Skip to content

Commit

Permalink
Include chrome buildpack to app_json
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Hale <[email protected]>
  • Loading branch information
Gabrielmbl and mikehale committed Aug 15, 2024
1 parent 24d8b8e commit 138a7a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/generators/chromium/pdf/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ def create_pdf_job_templates
copy_file 'app/jobs/generate_pdf_job.rb'
copy_file 'config/initializers/good_job.rb'
end

def include_chrome_buildpack_in_app_json
say(<<~SAY, :yellow)
N.B. app.json changes are not applied to existing heroku apps.
In the case where your app already exists make sure to manually add the buildpack by running the command:
`heroku buildpacks:add heroku-community/chrome-for-testing`
SAY
copy_file 'app.json'
end
end
end
end
Expand Down
17 changes: 17 additions & 0 deletions lib/generators/chromium/pdf/install/templates/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"buildpacks": [
{
"url":"heroku-community/chrome-for-testing"
},
{
"url":"heroku/metrics"
},
{
"url": "heroku/nodejs"
},
{
"url": "heroku/ruby"
}
]
}

5 changes: 5 additions & 0 deletions test/generators/install_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ class InstallGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file 'config/initializers/good_job.rb'
end

test 'app.json is created' do
run_generator
assert_file 'app.json'
end
end

0 comments on commit 138a7a9

Please sign in to comment.