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

[close #800] Don't add a default "worker" process if they don't have that task #810

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Master

* Do not add the `jobs:work` command if an app does not have that rake task available (https:/heroku/heroku-buildpack-ruby/pull/810)

## v193 (9/14/2018)

* Fix link (https:/heroku/heroku-buildpack-ruby/pull/811)
Expand Down
10 changes: 5 additions & 5 deletions lib/language_pack/rails2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def default_process_types
"bundle exec thin start -e $RAILS_ENV -p $PORT" :
"bundle exec ruby script/server -p $PORT"

super.merge({
"web" => web_process,
"worker" => "bundle exec rake jobs:work",
"console" => "bundle exec script/console"
})
process_types = super
process_types["web"] = web_process
process_types["worker"] = "bundle exec rake jobs:work" if rake.task("jobs:work").is_defined?
process_types["console"] = "bundle exec script/console"
process_types
end
end

Expand Down
22 changes: 20 additions & 2 deletions spec/hatchet/rails5_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@
describe "Rails 5" do
it "works" do
Hatchet::Runner.new("rails5").deploy do |app, heroku|
expect(app.run("rails -v")).to match("")

# Test BUNDLE_DISABLE_VERSION_CHECK works
expect(app.output).not_to include("The latest bundler is")

# Test worker task only appears if the app has that rake task
worker_task = worker_task_for_app(app)
expect(worker_task).to be_nil

run!(%Q{echo "task 'jobs:work' do ; end" >> Rakefile})
app.commit!

app.deploy do
worker_task = worker_task_for_app(app)
expect(worker_task["command"]).to eq("bundle exec rake jobs:work")
end
end
end

def worker_task_for_app(app)
app
.api_rate_limit.call
.formation
.list(app.name)
.detect { |h| h["type"] == "worker" }
end

describe "active storage" do
it "non-local storage warnings" do
Hatchet::Runner.new("active_storage_non_local").deploy do |app, heroku|
Expand Down