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

Use --quiet for bundle install #50185

Merged

Conversation

jonathanhefner
Copy link
Member

@jonathanhefner jonathanhefner commented Nov 27, 2023

When generating a new app, bundle install may be run multiple times due to various application templates. This can create a lot of noise in the output log, particularly with Bundler <= 2.4.16, which displays the full list of gems each time bundle install is run.

To reduce noise, this commit adds the --quiet flag to bundle install commands.

Before

$ rails new my_cool_app --dev
      create
      create  Gemfile
         run  bundle install
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Bundle complete! 1 Gemfile dependency, 58 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  rails new my_cool_app --dev
       exist
      remove  Gemfile
      remove  Gemfile.lock
      create  README.md
...
         run  bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
...
       rails  importmap:install
       apply  importmap-rails-1.2.3/lib/install/install.rb
...
         run  bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

       rails  turbo:install stimulus:install
       apply  turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
         run  bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
       apply  turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
  Enable redis in bundle
        gsub    Gemfile
         run    bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
  Switch development cable to use redis
        gsub    config/cable.yml
         run  bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
       apply  stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
         run  bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

After

$ rails new my_cool_app --dev
      create
      create  Gemfile
         run  bundle install --quiet
         run  rails new my_cool_app --dev
       exist
      remove  Gemfile
      remove  Gemfile.lock
      create  README.md
...
         run  bundle install --quiet
...
       rails  importmap:install
       apply  importmap-rails-1.2.3/lib/install/install.rb
...
         run  bundle install --quiet
       rails  turbo:install stimulus:install
       apply  turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
         run  bundle install --quiet
       apply  turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
  Enable redis in bundle
        gsub    Gemfile
         run    bundle install --quiet
  Switch development cable to use redis
        gsub    config/cable.yml
         run  bundle install --quiet
       apply  stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
         run  bundle install --quiet

Note that bundle install still displays any errors when using the --quiet flag:

$ bundle install --quiet
Could not find gem 'rails (= 9001.0)' in rubygems repository https://rubygems.org/ or installed locally.

The source contains the following gems matching 'rails':
  * rails-0.8.0
  ...
  * rails-7.1.2 

@rails-bot rails-bot bot added the railties label Nov 27, 2023
When generating a new app, `bundle install` may be run multiple times
due to various application templates.  This can create a lot of noise
in the output log, particularly with Bundler <= 2.4.16, which displays
the full list of gems each time `bundle install` is run.

To reduce noise, this commit adds the `--quiet` flag to `bundle install`
commands.

__Before__

  ```console
  $ rails new my_cool_app --dev
        create
        create  Gemfile
           run  bundle install
  Resolving dependencies...
  Fetching gem metadata from https://rubygems.org/..........
  Bundle complete! 1 Gemfile dependency, 58 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
           run  rails new my_cool_app --dev
         exist
        remove  Gemfile
        remove  Gemfile.lock
        create  README.md
  ...
           run  bundle install
  Fetching gem metadata from https://rubygems.org/..........
  Resolving dependencies...
  Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
  ...
         rails  importmap:install
         apply  importmap-rails-1.2.3/lib/install/install.rb
  ...
           run  bundle install
  Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.

         rails  turbo:install stimulus:install
         apply  turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
  ...
           run  bundle install
  Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
         apply  turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
    Enable redis in bundle
          gsub    Gemfile
           run    bundle install
  Fetching gem metadata from https://rubygems.org/..........
  Resolving dependencies...
  Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
    Switch development cable to use redis
          gsub    config/cable.yml
           run  bundle install
  Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
         apply  stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
  ...
           run  bundle install
  Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
  ```

__After__

  ```console
  $ rails new my_cool_app --dev
        create
        create  Gemfile
           run  bundle install --quiet
           run  rails new my_cool_app --dev
         exist
        remove  Gemfile
        remove  Gemfile.lock
        create  README.md
  ...
           run  bundle install --quiet
  ...
         rails  importmap:install
         apply  importmap-rails-1.2.3/lib/install/install.rb
  ...
           run  bundle install --quiet
         rails  turbo:install stimulus:install
         apply  turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
  ...
           run  bundle install --quiet
         apply  turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
    Enable redis in bundle
          gsub    Gemfile
           run    bundle install --quiet
    Switch development cable to use redis
          gsub    config/cable.yml
           run  bundle install --quiet
         apply  stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
  ...
           run  bundle install --quiet
  ```

Note that `bundle install` still displays any errors when using the
`--quiet` flag:

  ```console
  $ bundle install
  Could not find gem 'rails (= 9001.0)' in rubygems repository https://rubygems.org/ or installed locally.

  The source contains the following gems matching 'rails':
    * rails-0.8.0
    ...
    * rails-7.1.2
  ```
@jonathanhefner jonathanhefner force-pushed the app_generator-quiet-bundle-install branch from 4e20940 to 11f418f Compare November 27, 2023 19:13
@jonathanhefner jonathanhefner merged commit 3e7771c into rails:main Nov 27, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant