summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-03-11 02:14:33 -0700
committerAndre Arko <andre@arko.net>2015-03-11 02:14:33 -0700
commitca746cb0a923e3543ce645b6a6981a25771deb71 (patch)
tree328c52aa35b4aff33e4480fe9060f71619c57aa8
parent07d17d90804fc409a8d6bfedfb810fba5678dbcb (diff)
parent85719633f39a33c04e303cb5f9341881e20e6d8f (diff)
downloadbundler-ca746cb0a923e3543ce645b6a6981a25771deb71.tar.gz
Merge tag 'v1.8.5'
Version 1.8.5 Conflicts: lib/bundler/templates/newgem/newgem.gemspec.tt lib/bundler/version.rb
-rw-r--r--CHANGELOG.md25
-rw-r--r--lib/bundler/cli/gem.rb23
-rw-r--r--lib/bundler/definition.rb11
-rw-r--r--lib/bundler/lockfile_parser.rb2
-rw-r--r--lib/bundler/settings.rb15
-rw-r--r--lib/bundler/source.rb7
-rw-r--r--lib/bundler/source/local_rubygems.rb16
-rw-r--r--lib/bundler/source/rubygems.rb13
-rw-r--r--lib/bundler/source_list.rb5
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt10
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--man/bundle-package.ronn7
-rw-r--r--spec/bundler/settings_spec.rb6
-rw-r--r--spec/bundler/source_list_spec.rb2
-rw-r--r--spec/commands/newgem_spec.rb52
-rw-r--r--spec/install/gems/sources_spec.rb20
16 files changed, 154 insertions, 62 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88bd610d7e..6882b120b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,36 @@
+## 1.8.5 (2015-03-11)
+
+Bugfixes:
+
+ - remove MIT license from gemspec when removing license file (@indirect)
+ - respect 'no' immediately as well as saving it in `gem` config (@kirs)
+
+## 1.8.4 (2015-03-05)
+
+Bugfixes:
+
+ - document --all-platforms option (#3449, @moeffju)
+ - find gems from all sources on exec after install (#3450, @TimMoore)
+
+## 1.8.3 (2015-02-24)
+
+Bugfixes:
+
+ - handle boolean values for gem settings (@EduardoBautista)
+ - stop always looking for updated `path` gems (#3414, #3417, #3429, @TimMoore)
+
## 1.8.2 (2015-02-14)
Bugfixes:
- - allow config settings for gems with 'http' in the name again (#3398, @tmoore)
+ - allow config settings for gems with 'http' in the name again (#3398, @TimMoore)
## 1.8.1 (2015-02-13)
Bugfixes:
- synchronize building git gem native extensions (#3385, @antifuchs & @indirect)
- - set gemspec bindir correctly (#3392, @tmoore)
+ - set gemspec bindir correctly (#3392, @TimMoore)
- request lockfile deletion when it is malformed (#3396, @indirect)
- explain problem when mirror config is missing (#3386, @indirect)
- explain problem when caching causes permission error (#3390, @indirect)
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index ea15b3b4f5..02ed7108f1 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -26,7 +26,7 @@ module Bundler
git_user_name = `git config user.name`.chomp
git_user_email = `git config user.email`.chomp
- opts = {
+ config = {
:name => name,
:underscored_name => underscored_name,
:namespaced_path => namespaced_path,
@@ -69,6 +69,7 @@ module Bundler
"for free as long as they admit you created it. You can read more about the MIT license " \
"at choosealicense.com/licenses/mit."
)
+ config[:mit] = true
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
end
@@ -101,7 +102,7 @@ module Bundler
end
templates.each do |src, dst|
- thor.template("newgem/#{src}", target.join(dst), opts)
+ thor.template("newgem/#{src}", target.join(dst), config)
end
Bundler.ui.info "Initializing git repo in #{target}"
@@ -120,17 +121,15 @@ module Bundler
end
def ask_and_set(key, header, message)
- result = options[key]
- if !Bundler.settings.all.include?("gem.#{key}")
- if result.nil?
- Bundler.ui.confirm header
- result = Bundler.ui.ask("#{message} y/(n):") == "y"
- end
+ choice = options[key] || Bundler.settings["gem.#{key}"]
- Bundler.settings.set_global("gem.#{key}", result)
+ if choice.nil?
+ Bundler.ui.confirm header
+ choice = (Bundler.ui.ask("#{message} y/(n):") =~ /y|yes/)
+ Bundler.settings.set_global("gem.#{key}", choice)
end
- result || Bundler.settings["gem.#{key}"]
+ choice
end
def validate_ext_name
@@ -145,6 +144,7 @@ module Bundler
def ask_and_set_test_framework
test_framework = options[:test] || Bundler.settings["gem.test"]
+
if test_framework.nil?
Bundler.ui.confirm "Do you want to generate tests with your gem?"
result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \
@@ -152,7 +152,7 @@ module Bundler
if result =~ /rspec|minitest/
test_framework = result
else
- test_framework = "false"
+ test_framework = false
end
end
@@ -160,7 +160,6 @@ module Bundler
Bundler.settings.set_global("gem.test", test_framework)
end
- return if test_framework == "false"
test_framework
end
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 59f8a69d77..4c15866577 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -406,11 +406,18 @@ module Bundler
if locked
unlocking = @locked_specs.any? do |locked_spec|
- locked_spec.source != locked
+ locked_spec.source.class == locked.class && locked_spec.source != locked
end
end
- !locked || unlocking || source.specs != locked.specs
+ !locked || unlocking || dependencies_for_source_changed?(locked) || source.specs != locked.specs
+ end
+
+ def dependencies_for_source_changed?(source)
+ deps_for_source = @dependencies.select { |s| s.source == source }
+ locked_deps_for_source = @locked_deps.select { |s| s.source == source }
+
+ deps_for_source != locked_deps_for_source
end
# Get all locals and override their matching sources.
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 1ced10ac33..7030508988 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -29,7 +29,7 @@ module Bundler
@state = :source
@specs = {}
- @rubygems_aggregate = Source::LocalRubygems.new
+ @rubygems_aggregate = Source::Rubygems.new
if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
raise LockfileError, "Your Gemfile.lock contains merge conflicts.\n" \
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 30df4df4bc..a29e7104c7 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -10,10 +10,15 @@ module Bundler
@global_config = load_config(global_config_file)
end
- def [](key)
- the_key = key_for(key)
- value = (@local_config[the_key] || ENV[the_key] || @global_config[the_key])
- is_bool(key) ? to_bool(value) : value
+ def [](name)
+ key = key_for(name)
+ value = (@local_config[key] || ENV[key] || @global_config[key])
+
+ if !value.nil? && is_bool(name)
+ to_bool(value)
+ else
+ value
+ end
end
def []=(key, value)
@@ -141,7 +146,7 @@ module Bundler
end
def to_bool(value)
- !(value.nil? || value == '' || value =~ /^(false|f|no|n|0)$/i)
+ !(value.nil? || value == '' || value =~ /^(false|f|no|n|0)$/i || value == false)
end
def set_key(key, value, hash, file)
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index ace319d613..d1fd35a31e 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -1,9 +1,8 @@
module Bundler
class Source
- autoload :Rubygems, 'bundler/source/rubygems'
- autoload :LocalRubygems, 'bundler/source/local_rubygems'
- autoload :Path, 'bundler/source/path'
- autoload :Git, 'bundler/source/git'
+ autoload :Rubygems, 'bundler/source/rubygems'
+ autoload :Path, 'bundler/source/path'
+ autoload :Git, 'bundler/source/git'
def self.mirror_for(uri)
uri = URI(uri.to_s) unless uri.is_a?(URI)
diff --git a/lib/bundler/source/local_rubygems.rb b/lib/bundler/source/local_rubygems.rb
deleted file mode 100644
index 40f072f387..0000000000
--- a/lib/bundler/source/local_rubygems.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Bundler
- class Source
- class LocalRubygems < Rubygems
-
- def specs
- @specs ||= begin
- idx = super
- idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
- idx.use(installed_specs, :override_dupes)
- idx
- end
- end
-
- end
- end
-end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 751777dc4a..b29d1ad0e9 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -68,10 +68,15 @@ module Bundler
alias_method :name, :to_s
def specs
- # remote_specs usually generates a way larger Index than the other
- # sources, and large_idx.use small_idx is way faster than
- # small_idx.use large_idx.
- @specs ||= @allow_remote ? remote_specs.dup : Index.new
+ @specs ||= begin
+ # remote_specs usually generates a way larger Index than the other
+ # sources, and large_idx.use small_idx is way faster than
+ # small_idx.use large_idx.
+ idx = @allow_remote ? remote_specs.dup : Index.new
+ idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
+ idx.use(installed_specs, :override_dupes)
+ idx
+ end
end
def install(spec)
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 4329749e5a..49efbf7a8e 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -6,7 +6,7 @@ module Bundler
def initialize
@path_sources = []
@git_sources = []
- @rubygems_aggregate = Source::LocalRubygems.new
+ @rubygems_aggregate = Source::Rubygems.new
@rubygems_sources = []
end
@@ -57,7 +57,8 @@ module Bundler
end
end
- replacement_rubygems = replacement_sources.detect { |s| s.is_a?(Source::LocalRubygems) }
+ replacement_rubygems =
+ replacement_sources.detect { |s| s.is_a?(Source::Rubygems) }
@rubygems_aggregate = replacement_rubygems if replacement_rubygems
# Return true if there were changes
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index a982e661a5..4749a9a70e 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -9,14 +9,12 @@ Gem::Specification.new do |spec|
spec.authors = [<%=config[:author].inspect%>]
spec.email = [<%=config[:email].inspect%>]
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
- end
-
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
+<%- if config[:mit] -%>
spec.license = "MIT"
+<%- end -%>
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
@@ -26,6 +24,10 @@ Gem::Specification.new do |spec|
spec.extensions = ["ext/<%=config[:underscored_name]%>/extconf.rb"]
<%- end -%>
+ if spec.respond_to?(:metadata)
+ spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
+ end
+
spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>"
spec.add_development_dependency "rake", "~> 10.0"
<%- if config[:ext] -%>
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 73d9219cbb..be60a8ba99 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -2,5 +2,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.9.0.dev" unless defined?(::Bundler::VERSION)
+ VERSION = "1.9.0.pre" unless defined?(::Bundler::VERSION)
end
diff --git a/man/bundle-package.ronn b/man/bundle-package.ronn
index 610f820487..8a6b439cd5 100644
--- a/man/bundle-package.ronn
+++ b/man/bundle-package.ronn
@@ -17,6 +17,13 @@ Since Bundler 1.2, the `bundle package` command can also package `:git` and
`:path` dependencies besides .gem files. This needs to be explicitly enabled
via the `--all` option. Once used, the `--all` option will be remembered.
+## SUPPORT FOR MULTIPLE PLATFORMS
+
+When using gems that have different packages for different platforms, Bundler
+1.8 and newer support caching of gems for other platforms in `vendor/cache`.
+This needs to be enabled via the `--all-platforms` option. This setting will be
+remembered in your local bundler configuration.
+
## REMOTE FETCHING
By default, if you simply run [bundle install(1)][bundle-install] after running
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index 0faaa3f51c..56ee87da6e 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -43,5 +43,11 @@ describe Bundler::Settings do
settings["local.httpsmarty"] = home("httpsmarty")
expect(settings.all).to include("local.httpsmarty")
end
+
+ it "reads older keys without trailing slashes" do
+ settings["mirror.https://rubygems.org"] = "http://rubygems-mirror.org"
+ expect(settings.gem_mirrors).to eq(URI("https://rubygems.org/") => URI("http://rubygems-mirror.org/"))
+ end
+
end
end
diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb
index b3e188636d..f5a8575ae8 100644
--- a/spec/bundler/source_list_spec.rb
+++ b/spec/bundler/source_list_spec.rb
@@ -91,7 +91,7 @@ describe Bundler::SourceList do
end
it "returns the aggregate rubygems source" do
- expect(@returned_source).to be_instance_of(Bundler::Source::LocalRubygems)
+ expect(@returned_source).to be_instance_of(Bundler::Source::Rubygems)
end
it "adds the provided remote to the beginning of the aggregate source" do
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index f775f81b84..c8c5bf5917 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -1,6 +1,7 @@
require "spec_helper"
describe "bundle gem" do
+
def reset!
super
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
@@ -154,10 +155,6 @@ describe "bundle gem" do
to match("delete to allow pushes to any server")
end
- it "sets gemspec license to MIT by default" do
- expect(generated_gem.gemspec.license).to eq("MIT")
- end
-
it "requires the version file" do
expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/require "test_gem\/version"/)
end
@@ -332,6 +329,9 @@ describe "bundle gem" do
expect(bundled_app("test-gem/Rakefile")).to exist
expect(bundled_app("test-gem/lib/test/gem.rb")).to exist
expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist
+
+ skel = Bundler::GemHelper.new(bundled_app(gem_name).to_s)
+ expect(skel.gemspec.license).to eq("MIT")
end
end
@@ -402,10 +402,6 @@ describe "bundle gem" do
to match("delete to allow pushes to any server")
end
- it "sets gemspec license to MIT by default" do
- expect(generated_gem.gemspec.license).to eq("MIT")
- end
-
it "requires the version file" do
expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/require "test\/gem\/version"/)
end
@@ -581,4 +577,44 @@ describe "bundle gem" do
end
end
end
+
+ context "on first run" do
+ before do
+ in_app_root
+ end
+
+ it "asks about test framework" do
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__COC" => "false"
+
+ bundle "gem foobar" do |input|
+ input.puts "rspec"
+ end
+
+ expect(bundled_app("foobar/spec/spec_helper.rb")).to exist
+ end
+
+ it "asks about MIT license" do
+ global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
+
+ bundle :config
+
+ bundle "gem foobar" do |input|
+ input.puts "yes"
+ end
+
+ expect(bundled_app("foobar/LICENSE.txt")).to exist
+ end
+
+ it "asks about CoC" do
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false"
+
+
+ bundle "gem foobar" do |input|
+ input.puts "yes"
+ end
+
+ expect(bundled_app("foobar/CODE_OF_CONDUCT.md")).to exist
+ end
+ end
+
end
diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb
index 45a742a87f..cca00a914d 100644
--- a/spec/install/gems/sources_spec.rb
+++ b/spec/install/gems/sources_spec.rb
@@ -281,6 +281,26 @@ describe "bundle install with gems on multiple sources" do
should_be_installed("rack 0.9.1")
end
end
+
+ context "with a path gem in the same Gemfile" do
+ before do
+ build_lib "foo"
+
+ gemfile <<-G
+ gem "rack", :source => "file://#{gem_repo1}"
+ gem "foo", :path => "#{lib_path('foo-1.0')}"
+ G
+ end
+
+ it "does not unlock the non-path gem after install" do
+ bundle :install
+
+ bundle %{exec ruby -e 'puts "OK"'}
+
+ expect(out).to include("OK")
+ expect(exitstatus).to eq(0) if exitstatus
+ end
+ end
end
context "when an older version of the same gem also ships with Ruby" do