From 64ab51507aacc56bc8f97e201aa3d7ef852b4789 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 7 Sep 2026 12:02:06 +0000 Subject: [PATCH] Drop the Heroku generator's dead code and refresh its USAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `HerokuGenerator#app_paths` had no callers — neither the generator nor `package.json.erb` referenced it — so it described a shape of the configuration that nothing depended on. The Heroku generator's `USAGE` had drifted from what the generator does: it omitted the `yarn.lock` written for a Yarn project, and named `SKIP_EMBER` without saying what unsetting it accomplishes, leaving a reader to guess why the command is in the list at all. `ember:init` had no spec, so nothing caught a broken initializer template. Cover the file it writes. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_014rAfkAVGVifbaEoTVeT66u --- lib/generators/ember/heroku/USAGE | 13 ++++++++++- .../ember/heroku/heroku_generator.rb | 6 ----- .../ember/init/init_generator_spec.rb | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 spec/generators/ember/init/init_generator_spec.rb diff --git a/lib/generators/ember/heroku/USAGE b/lib/generators/ember/heroku/USAGE index 2c309fd8..c46954b5 100644 --- a/lib/generators/ember/heroku/USAGE +++ b/lib/generators/ember/heroku/USAGE @@ -1,11 +1,16 @@ Description: Configures a project for deploying to Heroku. - Once the generator is complete, execute the following: + Once the generator is complete, add the buildpacks the deploy needs: $ heroku buildpacks:clear $ heroku buildpacks:add --index 1 heroku/nodejs $ heroku buildpacks:add --index 2 heroku/ruby + + `SKIP_EMBER` skips the build wherever it is set. Unset it on the Heroku + application, so that `assets:precompile` compiles the EmberCLI + applications at deploy time: + $ heroku config:unset SKIP_EMBER Example: @@ -16,3 +21,9 @@ Example: This will create: package.json + + An application configured with `yarn` also creates: + yarn.lock + + Run the generator again whenever you add an EmberCLI application: the + generated `cacheDirectories` names each application's `node_modules`. diff --git a/lib/generators/ember/heroku/heroku_generator.rb b/lib/generators/ember/heroku/heroku_generator.rb index 522c3232..66ca551b 100644 --- a/lib/generators/ember/heroku/heroku_generator.rb +++ b/lib/generators/ember/heroku/heroku_generator.rb @@ -38,12 +38,6 @@ def project_root_cached_directories [Rails.root.join("node_modules")] end - def app_paths - EmberCli.apps.values.map do |app| - app.root_path.relative_path_from(Rails.root) - end - end - def apps EmberCli.apps.values end diff --git a/spec/generators/ember/init/init_generator_spec.rb b/spec/generators/ember/init/init_generator_spec.rb new file mode 100644 index 00000000..1377b5c8 --- /dev/null +++ b/spec/generators/ember/init/init_generator_spec.rb @@ -0,0 +1,23 @@ +require "generator_spec" +require "generators/ember/init/init_generator" + +describe EmberCli::InitGenerator, type: :generator do + destination Rails.root.join("tmp", "init_generator_test_output") + + it "generates an initializer that configures an application" do + prepare_destination + + run_generator + + expect(destination_root).to have_structure { + directory "config" do + directory "initializers" do + file "ember.rb" do + contains "EmberCli.configure" + contains "c.app :frontend" + end + end + end + } + end +end