aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-04-15 19:46:14 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-04 23:53:37 -0500
commit388febddd67945ed09cf5fcd30d1b9bfed2bda50 (patch)
tree0976400c34a6f5678b8ed2a2f6c30800939a3582 /lib/bundler
parent667d4e4487bde5196bb326a7c03531e65de85cf6 (diff)
downloadbundler-388febddd67945ed09cf5fcd30d1b9bfed2bda50.tar.gz
gemspec allow conflicts
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/dsl.rb14
-rw-r--r--lib/bundler/index.rb1
-rw-r--r--lib/bundler/resolver.rb2
-rw-r--r--lib/bundler/source.rb5
-rw-r--r--lib/bundler/source/gemspec.rb13
-rw-r--r--lib/bundler/source/path.rb4
-rw-r--r--lib/bundler/source_list.rb6
7 files changed, 34 insertions, 11 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 2c68a7b8..dc482a69 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -67,16 +67,16 @@ module Bundler
"#{file}. Make sure you can build the gem, then try again"
end
+ @gemspecs << spec
+
gem_platforms = Bundler::Dependency::REVERSE_PLATFORM_MAP[Bundler::GemHelpers.generic_local_platform]
- gem spec.name, :path => path, :glob => glob, :platforms => gem_platforms
+ gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
group(development_group) do
spec.development_dependencies.each do |dep|
- gem dep.name, *(dep.requirement.as_list + [:type => :development])
+ gem dep.name, *(dep.requirement.as_list + [:type => :development, :platforms => gem_platforms])
end
end
-
- @gemspecs << gemspecs.first
when 0
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
else
@@ -149,7 +149,11 @@ module Bundler
end
def path(path, options = {}, &blk)
- source_options = normalize_hash(options).merge("path" => Pathname.new(path), "root_path" => gemfile_root)
+ source_options = normalize_hash(options).merge(
+ "path" => Pathname.new(path),
+ "root_path" => gemfile_root,
+ "gemspec" => gemspecs.find {|g| g.name == options["name"] }
+ )
source = @sources.add_path_source(source_options)
with_source(source, &blk)
end
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 5c490342..a03c11d9 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -156,6 +156,7 @@ module Bundler
@cache[base || false][dependency] ||= begin
specs = specs_by_name(dependency.name) + (base || [])
found = specs.select do |spec|
+ next true if spec.source.is_a?(Source::Gemspec)
if base # allow all platforms when searching from a lockfile
dependency.matches_spec?(spec)
else
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 48f0d468..8c183ba8 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -293,7 +293,7 @@ module Bundler
end
def requirement_satisfied_by?(requirement, activated, spec)
- requirement.matches_spec?(spec)
+ requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
end
def sort_dependencies(dependencies, activated, conflicts)
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index eee4ade4..afa7d918 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -1,9 +1,10 @@
# frozen_string_literal: true
module Bundler
class Source
- autoload :Rubygems, "bundler/source/rubygems"
- autoload :Path, "bundler/source/path"
+ autoload :Gemspec, "bundler/source/gemspec"
autoload :Git, "bundler/source/git"
+ autoload :Path, "bundler/source/path"
+ autoload :Rubygems, "bundler/source/rubygems"
attr_accessor :dependency_names
diff --git a/lib/bundler/source/gemspec.rb b/lib/bundler/source/gemspec.rb
new file mode 100644
index 00000000..37e9a439
--- /dev/null
+++ b/lib/bundler/source/gemspec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+module Bundler
+ class Source
+ class Gemspec < Path
+ attr_reader :gemspec
+
+ def initialize(options)
+ super
+ @gemspec = options["gemspec"]
+ end
+ end
+ end
+end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 3ec1e78b..569cea00 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -60,8 +60,8 @@ module Bundler
end
def eql?(other)
- other.instance_of?(Path) &&
- expanded_path == expand(other.path) &&
+ return unless other.class == Path || other.class == Gemspec
+ expanded_path == expand(other.path) &&
version == other.version
end
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index dc62c892..418834b2 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -12,7 +12,11 @@ module Bundler
end
def add_path_source(options = {})
- add_source_to_list Source::Path.new(options), path_sources
+ if options['gemspec']
+ add_source_to_list Source::Gemspec.new(options), path_sources
+ else
+ add_source_to_list Source::Path.new(options), path_sources
+ end
end
def add_git_source(options = {})