summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--lib/bundler/cli.rb19
-rw-r--r--lib/bundler/rubygems_integration.rb1
-rw-r--r--spec/bundler/cli_spec.rb15
-rw-r--r--spec/bundler/yaml_serializer_spec.rb1
5 files changed, 33 insertions, 9 deletions
diff --git a/README.md b/README.md
index 3f8fd13c52..649b777129 100644
--- a/README.md
+++ b/README.md
@@ -12,13 +12,15 @@ It does this by managing the gems that the application depends on. Given a list
### Installation and usage
-To install:
+To install (or update to the latest version):
```
gem install bundler
```
-Bundler is most commonly used to manage your application's dependencies. To use it for this:
+To install a prerelease version (if one is available), run `gem install bundler --pre`. To uninstall Bundler, run `gem uninstall bundler`.
+
+Bundler is most commonly used to manage your application's dependencies. For example, these commands will allow you to use Bundler to manage the `rspec` gem for your application:
```
bundle init
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index cd4391279a..a1ad3055ca 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -6,6 +6,9 @@ require "bundler/vendored_thor"
module Bundler
class CLI < Thor
AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
+ PARSEABLE_COMMANDS = %w[
+ check config help exec platform show version
+ ].freeze
def self.start(*)
super
@@ -13,12 +16,14 @@ module Bundler
Bundler.ui = UI::Shell.new
raise e
ensure
- warn_on_outdated_bundler
Bundler::SharedHelpers.print_major_deprecations!
end
def self.dispatch(*)
- super {|i| i.send(:print_command) }
+ super do |i|
+ i.send(:print_command)
+ i.send(:warn_on_outdated_bundler)
+ end
end
def initialize(*args)
@@ -641,7 +646,7 @@ module Bundler
_, _, config = @_initializer
current_command = config[:current_command]
command_name = current_command.name
- return if %w[exec version check platform show help].include?(command_name)
+ return if PARSEABLE_COMMANDS.include?(command_name)
command = ["bundle", command_name] + args
options_to_print = options.dup
options_to_print.delete_if do |k, v|
@@ -653,9 +658,14 @@ module Bundler
Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
end
- def self.warn_on_outdated_bundler
+ def warn_on_outdated_bundler
return if Bundler.settings[:disable_version_check]
+ _, _, config = @_initializer
+ current_command = config[:current_command]
+ command_name = current_command.name
+ return if PARSEABLE_COMMANDS.include?(command_name)
+
latest = Fetcher::CompactIndex.
new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
send(:compact_index_client).
@@ -672,6 +682,5 @@ module Bundler
rescue
nil
end
- private_class_method :warn_on_outdated_bundler
end
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 1ac040dd83..38374ae0b6 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -830,6 +830,7 @@ module Bundler
def use_gemdeps(gemfile)
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
+ require "bundler/gemdeps"
runtime = Bundler.setup
Bundler.ui = nil
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 2ef2eb3412..5283027ca0 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -57,8 +57,9 @@ RSpec.describe "bundle executable" do
context "with --verbose" do
it "prints the running command" do
- bundle! "config", :verbose => true
- expect(last_command.stdout).to start_with("Running `bundle config --verbose` with bundler #{Bundler::VERSION}")
+ gemfile ""
+ bundle! "info bundler", :verbose => true
+ expect(last_command.stdout).to start_with("Running `bundle info bundler --no-color --verbose` with bundler #{Bundler::VERSION}")
end
it "doesn't print defaults" do
@@ -120,6 +121,16 @@ To update, run `gem install bundler`
include_examples "no warning"
end
+ context "running a parseable command" do
+ it "prints no warning" do
+ bundle! "config --parseable foo"
+ expect(last_command.stdboth).to eq ""
+
+ bundle "platform --ruby"
+ expect(last_command.stdboth).to eq "Could not locate Gemfile"
+ end
+ end
+
context "and is a pre-release" do
let(:latest_version) { "2.0.0.pre.4" }
it "prints the version warning" do
diff --git a/spec/bundler/yaml_serializer_spec.rb b/spec/bundler/yaml_serializer_spec.rb
index 2970fb44ec..1241c74bbf 100644
--- a/spec/bundler/yaml_serializer_spec.rb
+++ b/spec/bundler/yaml_serializer_spec.rb
@@ -167,6 +167,7 @@ RSpec.describe Bundler::YAMLSerializer do
"What did the sea say to the sand?",
"Nothing, it simply waved.",
],
+ "array with empty string" => [""],
},
"sales" => {
"item" => "A Parachute",