Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task assets:clean is executed without checking whether it exists #934

Closed
j15e opened this issue Nov 25, 2019 · 2 comments
Closed

Task assets:clean is executed without checking whether it exists #934

j15e opened this issue Nov 25, 2019 · 2 comments

Comments

@j15e
Copy link

j15e commented Nov 25, 2019

Context

Using Rails 6 without Sprocket, with Webpacker only.

What happen

This exception happen after assets compilation :

   Done in 5.16s.
   Asset precompilation completed (64.17s)
   Cleaning assets
   Running: rake assets:clean
   I, [2019-11-25T17:07:47.298404 #605]  INFO -- sentry: ** [Raven] Sending event 5db44a5151c44a8a8699a7ccaa2edf71 to Sentry
   rake aborted!
   Don't know how to build task 'assets:clean' (See the list of available tasks with `rake --tasks`)
   /tmp/build_400672b08b175a998e4d7f78b88ee830/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
   (See full trace by running task with --trace)

Why

The task assets:precompile is defined when using webpacker or sprocket, but the assets:clean is not defined when using only webpacker.

The rails buidpack check the assets:precompile exist before calling it :

precompile = rake.task("assets:precompile")
return true unless precompile.is_defined?

So I think a simple fix could be to check wether the assets:clean exist too before calling it :

puts "Cleaning assets"
rake.task("assets:clean").invoke(env: rake_env)

And /or check also for webpacker:clean task and invoke that one when required.

What do you think?

Other stuff I found :

@j15e j15e changed the title Task assets:clean is run without checking if it exist Task assets:clean is executed without checking whether it exists Nov 25, 2019
@SampsonCrowley
Copy link

SampsonCrowley commented Jun 11, 2020

this is a major issue, how is there not a single reply yet?

@schneems
Copy link
Contributor

this is a major issue, how is there not a single reply yet?

I missed the original issue when it came in. I can queue this up. It's an easy fix

schneems added a commit that referenced this issue Jun 11, 2020
If the `assets:clean` task does not exist, don't call it.
schneems added a commit that referenced this issue Jul 15, 2020
If the `assets:clean` task does not exist, don't call it.
krisrang added a commit to skyltmax/heroku-buildpack-ruby that referenced this issue Oct 2, 2020
* upstream/master:
  [changelog skip] Bring back rake task (heroku#1038)
  CNB: make the gems layer accessible to subsequent buildpacks heroku#1033  (heroku#1037)
  [close heroku#934] Skip rake task if it does not exist (heroku#1036)
  [changelog skip] Move unreleased changelogs (heroku#1035)
  v218 for Monday release (heroku#1034)
  [close heroku#1029] Remove default bin/rake binstub (heroku#1031)
  Document v217 release in master (heroku#1030)
  [close heroku#1027][changelog skip] Fix frozen string error (heroku#1028)
  Handle binary binstubs (heroku#1021)
  v216 release for monday (heroku#1023)
  Revert "Merge pull request heroku#1014 from heroku/schneems/fu-binstubs"
  [close heroku#990] Warn on bad shebang line
  [close heroku#818] Disable spring
  [changelog skip][close heroku#977] Recommend recent Ruby in warning
  [changelog skip][close heroku#977] Recommend recent Ruby in warning
  [close heroku#1001] Put Yarn first on the path
  Update HEREDOC to 2.5 syntax to support indenting
  Switch to using /usr/bin/env bash
  [changelog skip] Fix CNB tests
  Allow Nolockfile to get to compile phase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants