aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md7
-rw-r--r--lib/bundler/current_ruby.rb6
-rw-r--r--lib/bundler/definition.rb17
-rw-r--r--lib/bundler/installer/parallel_installer.rb4
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--man/bundle-check.ronn26
-rw-r--r--man/bundle-clean.ronn18
-rw-r--r--man/bundle-init.ronn18
-rw-r--r--man/bundle-inject.ronn22
-rw-r--r--man/bundle-open.ronn19
-rw-r--r--man/bundle-show.ronn20
-rw-r--r--man/bundle-viz.ronn30
-rw-r--r--man/gemfile.5.ronn84
-rw-r--r--man/index.txt7
-rw-r--r--spec/commands/help_spec.rb4
-rw-r--r--spec/install/deploy_spec.rb13
-rw-r--r--spec/install/gemfile/gemspec_spec.rb31
-rw-r--r--spec/runtime/platform_spec.rb16
18 files changed, 264 insertions, 80 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb7d0785..a7adef9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 1.14.2 (2017-01-22)
+
+Bugfixes:
+
+ - fix using `force_ruby_platform` on windows (#5344, @segiddins)
+ - fix an incorrect version conflict error when using `gemspec` on multiple platforms (#5340, @segiddins)
+
## 1.14.1 (2017-01-21)
Bugfixes:
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index 145518ba..cca40100 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -58,15 +58,15 @@ module Bundler
end
def mswin64?
- Bundler::WINDOWS && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
+ Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
end
def mingw?
- Bundler::WINDOWS && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
+ Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
end
def x64_mingw?
- Bundler::WINDOWS && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
+ Bundler::WINDOWS && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
end
(KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 1c0b0de6..1e13794a 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -104,7 +104,9 @@ module Bundler
add_current_platform unless Bundler.settings[:frozen]
+ converge_gemspec_sources
@path_changes = converge_paths
+ @source_changes = converge_sources
unless @unlock[:lock_shared_dependencies]
eager_unlock = expand_dependencies(@unlock[:gems])
@@ -113,7 +115,6 @@ module Bundler
@gem_version_promoter = create_gem_version_promoter
- @source_changes = converge_sources
@dependency_changes = converge_dependencies
@local_changes = converge_locals
@@ -627,15 +628,20 @@ module Bundler
gemspec_source || source
end
- def converge_sources
- changes = false
-
+ def converge_gemspec_sources
@locked_sources.map! do |source|
converge_path_source_to_gemspec_source(source)
end
@locked_specs.each do |spec|
spec.source &&= converge_path_source_to_gemspec_source(spec.source)
end
+ @locked_deps.each do |dep|
+ dep.source &&= converge_path_source_to_gemspec_source(dep.source)
+ end
+ end
+
+ def converge_sources
+ changes = false
# Get the Rubygems sources from the Gemfile.lock
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
@@ -685,7 +691,8 @@ module Bundler
dep.platforms.concat(@platforms.map {|p| Dependency::REVERSE_PLATFORM_MAP[p] }.flatten(1)).uniq!
end
end
- Set.new(@dependencies) != Set.new(@locked_deps)
+ dependency_without_type = proc {|d| Gem::Dependency.new(d.name, *d.requirement.as_list) }
+ Set.new(@dependencies.map(&dependency_without_type)) != Set.new(@locked_deps.map(&dependency_without_type))
end
# Remove elements from the locked specs that are expired. This will most
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index 70939cee..b1a997f3 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -67,6 +67,10 @@ module Bundler
def all_dependencies
@spec.dependencies
end
+
+ def to_s
+ "#<#{self.class} #{@spec.full_name} (#{state})>"
+ end
end
def self.call(*args)
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index ebd878e0..4bbb17c9 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -7,5 +7,5 @@ module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
- VERSION = "1.14.1" unless defined?(::Bundler::VERSION)
+ VERSION = "1.14.2" unless defined?(::Bundler::VERSION)
end
diff --git a/man/bundle-check.ronn b/man/bundle-check.ronn
new file mode 100644
index 00000000..b299da42
--- /dev/null
+++ b/man/bundle-check.ronn
@@ -0,0 +1,26 @@
+bundle-check(1) -- Verifies if dependencies are satisfied by installed gems
+===========================================================================
+
+## SYNOPSIS
+
+`bundle check` [--dry-run]
+ [--gemfile=FILE]
+ [--path=PATH]
+
+## DESCRIPTION
+
+`check` searches the local machine for each of the gems requested in the
+Gemfile. If all gems are found, Bundler prints a success message and exits with
+a status of 0.
+
+If not, the first missing gem is listed and Bundler exits status 1.
+
+## OPTIONS
+
+* `--dry-run`:
+ Locks the `Gemfile(5)` before running the command.
+* `--gemfile`:
+ Use the specified gemfile instead of the `Gemfile(5)`
+* `--path`:
+ Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).
+ Bundler will remember this value for future installs on this machine.
diff --git a/man/bundle-clean.ronn b/man/bundle-clean.ronn
new file mode 100644
index 00000000..de239917
--- /dev/null
+++ b/man/bundle-clean.ronn
@@ -0,0 +1,18 @@
+bundle-clean(1) -- Cleans up unused gems in your bundler directory
+==================================================================
+
+## SYNOPSIS
+
+`bundle clean` [--dry-run] [--force]
+
+## DESCRIPTION
+
+This command will remove all unused gems in your bundler directory. This is
+useful when you have made many changes to your gem dependencies.
+
+## OPTIONS
+
+* `--dry-run`:
+ Print the changes, but do not clean the unused gems.
+* `--force`:
+ Force a clean even if `--path` is not set.
diff --git a/man/bundle-init.ronn b/man/bundle-init.ronn
new file mode 100644
index 00000000..e5dfd420
--- /dev/null
+++ b/man/bundle-init.ronn
@@ -0,0 +1,18 @@
+bundle-init(1) -- Generates a Gemfile into the current working directory
+========================================================================
+
+## SYNOPSIS
+
+`bundle init` [--gemspec=FILE]
+
+## DESCRIPTION
+
+Init generates a default `Gemfile(5)` in the current working directory. When
+adding a `Gemfile(5)` to a gem with a gemspec, the `--gemspec` option will
+automatically add each dependency listed in the gemspec file to the newly
+created `Gemfile(5)`.
+
+## OPTIONS
+
+* `--gemspec`:
+ Use the specified .gemspec to create the `Gemfile(5)`
diff --git a/man/bundle-inject.ronn b/man/bundle-inject.ronn
new file mode 100644
index 00000000..02f5dd8b
--- /dev/null
+++ b/man/bundle-inject.ronn
@@ -0,0 +1,22 @@
+bundle-inject(1) -- Add named gem(s) with version requirements to Gemfile
+=========================================================================
+
+## SYNOPSIS
+
+`bundle inject` [GEM] [VERSION]
+
+## DESCRIPTION
+
+Adds the named gem(s) with their version requirements to the resolved
+`Gemfile(5)`.
+
+This command will add the gem to both your `Gemfile(5)` and Gemfile.lock if it
+isn't listed yet.
+
+Example:
+
+ bundle install
+ bundle inject 'rack' '> 0'
+
+This will inject the 'rack' gem with a version greater than 0 in your
+`Gemfile(5)` and Gemfile.lock
diff --git a/man/bundle-open.ronn b/man/bundle-open.ronn
new file mode 100644
index 00000000..497beac9
--- /dev/null
+++ b/man/bundle-open.ronn
@@ -0,0 +1,19 @@
+bundle-open(1) -- Opens the source directory for a gem in your bundle
+=====================================================================
+
+## SYNOPSIS
+
+`bundle open` [GEM]
+
+## DESCRIPTION
+
+Opens the source directory of the provided GEM in your editor.
+
+For this to work the `EDITOR` or `BUNDLER_EDITOR` environment variable has to
+be set.
+
+Example:
+
+ bundle open 'rack'
+
+Will open the source directory for the 'rack' gem in your bundle.
diff --git a/man/bundle-show.ronn b/man/bundle-show.ronn
new file mode 100644
index 00000000..714b6067
--- /dev/null
+++ b/man/bundle-show.ronn
@@ -0,0 +1,20 @@
+bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem
+=========================================================================
+
+## SYNOPSIS
+
+`bundle show` [GEM]
+ [--paths]
+
+## DESCRIPTION
+
+Without the [GEM] option, `show` will print a list of the names and versions of
+all gems that are required by your `Gemfile(5)`.
+
+Calling show with [GEM] will list the exact location of that gem on your
+machine.
+
+## OPTIONS
+
+* `--paths`:
+ List the paths of all gems that are required by your `Gemfile(5)`.
diff --git a/man/bundle-viz.ronn b/man/bundle-viz.ronn
new file mode 100644
index 00000000..865bbf6e
--- /dev/null
+++ b/man/bundle-viz.ronn
@@ -0,0 +1,30 @@
+bundle-viz(1) -- Generates a visual dependency graph for your Gemfile
+=====================================================================
+
+## SYNOPSIS
+
+`bundle viz` [--file=FILE]
+ [--format=FORMAT]
+ [--requirements]
+ [--version]
+ [--without=GROUP GROUP]
+
+## DESCRIPTION
+
+`viz` generates a PNG file of the current `Gemfile(5)` as a dependency graph.
+`viz` requires the ruby-graphviz gem (and its dependencies).
+
+The associated gems must also be installed via `bundle install(1)`.
+
+## OPTIONS
+
+* `--file`:
+ The name to use for the generated file. See `--format` option
+* `--format`:
+ This is output format option. Supported format is png, jpg, svg, dot ...
+* `--requirements`:
+ Set to show the version of each required dependency.
+* `--version`:
+ Set to show each gem version.
+* `--without`:
+ Exclude gems that are part of the specified named group.
diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn
index 08a3ded4..fe8d37ee 100644
--- a/man/gemfile.5.ronn
+++ b/man/gemfile.5.ronn
@@ -173,78 +173,38 @@ There are a number of `Gemfile` platforms:
* `ruby`:
C Ruby (MRI) or Rubinius, but `NOT` Windows
- * `ruby_18`:
- _ruby_ `AND` version 1.8
- * `ruby_19`:
- _ruby_ `AND` version 1.9
- * `ruby_20`:
- _ruby_ `AND` version 2.0
- * `ruby_21`:
- _ruby_ `AND` version 2.1
- * `ruby_22`:
- _ruby_ `AND` version 2.2
- * `ruby_23`:
- _ruby_ `AND` version 2.3
- * `ruby_24`:
- _ruby_ `AND` version 2.4
- * `ruby_25`:
- _ruby_ `AND` version 2.5
* `mri`:
Same as _ruby_, but not Rubinius
- * `mri_18`:
- _mri_ `AND` version 1.8
- * `mri_19`:
- _mri_ `AND` version 1.9
- * `mri_20`:
- _mri_ `AND` version 2.0
- * `mri_21`:
- _mri_ `AND` version 2.1
- * `mri_22`:
- _mri_ `AND` version 2.2
- * `mri_23`:
- _mri_ `AND` version 2.3
- * `mri_24`:
- _mri_ `AND` version 2.4
- * `mri_25`:
- _mri_ `AND` version 2.5
+ * `mingw`:
+ Windows 32 bit 'mingw32' platform (aka RubyInstaller)
+ * `x64_mingw`:
+ Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
* `rbx`:
Same as _ruby_, but only Rubinius (not MRI)
* `jruby`:
JRuby
* `mswin`:
Windows
+
+You can restrict further by platform and version for all platforms *except* for
+`rbx`, `jruby`, and `mswin`.
+
+To specify a version in addition to a platform, append the version number without
+the delimiter to the platform. For example, to specify that a gem should only be
+used on platforms with Ruby 2.3, use:
+
+ ruby_23
+
+The full list of platforms and supported versions includes:
+
+ * `ruby`:
+ 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
+ * `mri`:
+ 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
* `mingw`:
- Windows 32 bit 'mingw32' platform (aka RubyInstaller)
- * `mingw_18`:
- _mingw_ `AND` version 1.8
- * `mingw_19`:
- _mingw_ `AND` version 1.9
- * `mingw_20`:
- _mingw_ `AND` version 2.0
- * `mingw_21`:
- _mingw_ `AND` version 2.1
- * `mingw_22`:
- _mingw_ `AND` version 2.2
- * `mingw_23`:
- _mingw_ `AND` version 2.3
- * `mingw_24`:
- _mingw_ `AND` version 2.4
- * `mingw_25`:
- _mingw_ `AND` version 2.5
+ 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
* `x64_mingw`:
- Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
- * `x64_mingw_20`:
- _x64_mingw_ `AND` version 2.0
- * `x64_mingw_21`:
- _x64_mingw_ `AND` version 2.1
- * `x64_mingw_22`:
- _x64_mingw_ `AND` version 2.2
- * `x64_mingw_23`:
- _x64_mingw_ `AND` version 2.3
- * `x64_mingw_24`:
- _x64_mingw_ `AND` version 2.4
- * `x64_mingw_25`:
- _x64_mingw_ `AND` version 2.5
+ 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
As with groups, you can specify one or more platforms:
diff --git a/man/index.txt b/man/index.txt
index 9e46ceba..e3b38c46 100644
--- a/man/index.txt
+++ b/man/index.txt
@@ -6,3 +6,10 @@ bundle-exec bundle-exec.1
bundle-config bundle-config.1
bundle-platform bundle-platform.1
bundle-gem bundle-gem.1
+bundle-clean bundle-clean.1
+bundle-check bundle-check.1
+bundle-init bundle-init.1
+bundle-inject bundle-inject.1
+bundle-open bundle-open.1
+bundle-show bundle-show.1
+bundle-viz bundle-viz.1
diff --git a/spec/commands/help_spec.rb b/spec/commands/help_spec.rb
index 7789fe40..790d26fd 100644
--- a/spec/commands/help_spec.rb
+++ b/spec/commands/help_spec.rb
@@ -33,8 +33,8 @@ RSpec.describe "bundle help" do
end
it "still outputs the old help for commands that do not have man pages yet" do
- bundle "help check"
- expect(out).to include("Check searches the local machine")
+ bundle "help version"
+ expect(out).to include("Prints the bundler's version information")
end
it "looks for a binary and executes it with --help option if it's named bundler-<task>" do
diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb
index 1d97ceb4..1e54204e 100644
--- a/spec/install/deploy_spec.rb
+++ b/spec/install/deploy_spec.rb
@@ -267,22 +267,21 @@ RSpec.describe "install with --deployment or --frozen" do
context "with path in Gemfile and packed" do
it "works fine after bundle package and bundle install --local" do
build_lib "foo", :path => lib_path("foo")
- install_gemfile <<-G
- gem "foo", :path => "#{lib_path("foo")}"
+ install_gemfile! <<-G
+ gem "foo", :path => "#{lib_path("foo")}"
G
- bundle :install
+ bundle! :install
expect(the_bundle).to include_gems "foo 1.0"
- bundle "package --all"
+ bundle! "package --all"
expect(bundled_app("vendor/cache/foo")).to be_directory
- bundle "install --local"
+ bundle! "install --local"
expect(out).to include("Using foo 1.0 from source at")
expect(out).to include("vendor/cache/foo")
- expect(exitstatus).to eq(0) if exitstatus
simulate_new_machine
- bundle "install --deployment"
+ bundle! "install --deployment --verbose"
expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile")
expect(out).not_to include("You have added to the Gemfile")
expect(out).not_to include("You have deleted from the Gemfile")
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb
index 3ed4d116..4b8e4d6f 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -131,6 +131,37 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
+ it "should match a lockfile without needing to re-resolve" do
+ build_lib("foo", :path => tmp.join("foo")) do |s|
+ s.add_dependency "rack"
+ end
+
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+ gemspec :path => '#{tmp.join("foo")}'
+ G
+
+ bundle! "install", :verbose => true
+ expect(out).to include("Found no changes, using resolution from the lockfile")
+ end
+
+ it "should match a lockfile without needing to re-resolve with development dependencies" do
+ simulate_platform java
+
+ build_lib("foo", :path => tmp.join("foo")) do |s|
+ s.add_dependency "rack"
+ s.add_development_dependency "thin"
+ end
+
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+ gemspec :path => '#{tmp.join("foo")}'
+ G
+
+ bundle! "install", :verbose => true
+ expect(out).to include("Found no changes, using resolution from the lockfile")
+ end
+
it "should evaluate the gemspec in its directory" do
build_lib("foo", :path => tmp.join("foo"))
File.open(tmp.join("foo/foo.gemspec"), "w") do |s|
diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb
index be1005e8..4df934e7 100644
--- a/spec/runtime/platform_spec.rb
+++ b/spec/runtime/platform_spec.rb
@@ -104,4 +104,20 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
expect(the_bundle).to include_gems "nokogiri 1.4.2", "platform_specific 1.0 RUBY"
end
+
+ it "allows specifying only-ruby-platform on windows with dependency platforms" do
+ simulate_windows do
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+ gem "nokogiri", :platforms => [:mingw, :mswin, :x64_mingw, :jruby]
+ gem "platform_specific"
+ G
+
+ bundle! "config force_ruby_platform true"
+
+ bundle! "install"
+
+ expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
+ end
+ end
end