-
Notifications
You must be signed in to change notification settings - Fork 265
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
Ruby on Rails: Do not run rake assets:precompile
in build step if a Rails asset pipeline is not configured
#839
Ruby on Rails: Do not run rake assets:precompile
in build step if a Rails asset pipeline is not configured
#839
Conversation
sprockets is not installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Can you please add a rails api only test to examples/
and run it in the docker_run_tests
Added in 1e3bac2. The diff is a bit gruesome to review because of the example app. Here are the main changes: |
src/providers/ruby.rs
Outdated
fn uses_sprockets(&self, app: &App) -> Result<bool> { | ||
if app.includes_file("Gemfile") { | ||
let gemfile = app.read_file("Gemfile").unwrap_or_default(); | ||
return Ok(gemfile.contains("sprockets")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propshaft also requires an assets:precompile
step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thank you! Added in 291e19a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Hm, CI seems to be failing on an error unrelated to this changeset, which cancelled all existing running checks. The error is a
https://github.com/railwayapp/nixpacks/actions/runs/4516055630/jobs/7954572560?pr=839#step:6:376 |
Yeah seems GitHub is having a few issues. Reran and will see |
rake assets:precompile
in build step if sprockets is not installedrake assets:precompile
in build step if a Rails asset pipeline is not configured
This PR resolves #751 by tweaking the Rails build plan to only include
bundle exec rake assets:precompile
if sprockets is installed.Context
In Rails applications,
bundle exec rake assets:precompile
is only included when the sprockets (Rails' asset pipeline) gem is installed. If sprockets is not a dependency (a common setup for Rails API-only apps [0] because they have no assets), the nixpacks build will fail becauserake assets:precompile
is missing.[0] https://guides.rubyonrails.org/api_app.html
Checklist
(WIP -- I'd like to include a snapshot plan test in this PR. Gonna research how to do it.)added in 1e3bac2