From 5b63bcbf587e4c6a87e17f783afe4bcd625b0f7c Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Wed, 4 Mar 2015 22:04:11 +0100 Subject: [PATCH 1/9] gemspec should accept a glob option in its argument hash --- lib/bundler/dsl.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 9736525a4f7..5cb3be025a3 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -52,7 +52,8 @@ def gemspec(opts = nil) when 1 spec = Bundler.load_gemspec(gemspecs.first) raise InvalidOption, "There was an error loading the gemspec at #{gemspecs.first}." unless spec - gem spec.name, :path => path + opts ||= {} + gem spec.name, opts.merge(:path => path) group(development_group) do spec.development_dependencies.each do |dep| gem dep.name, *(dep.requirement.as_list + [:type => :development]) @@ -224,7 +225,7 @@ def normalize_hash(opts) end def valid_keys - @valid_keys ||= %w(group groups git path name branch ref tag require submodules platform platforms type source) + @valid_keys ||= %w(group groups git path glob name branch ref tag require submodules platform platforms type source) end def normalize_options(name, version, opts) From 3c5d325759f8272955cd45840887c95114f2064d Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Mon, 9 Mar 2015 12:44:33 +0100 Subject: [PATCH 2/9] add development_group to valid_keys --- lib/bundler/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 5cb3be025a3..f612c651cda 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -225,7 +225,7 @@ def normalize_hash(opts) end def valid_keys - @valid_keys ||= %w(group groups git path glob name branch ref tag require submodules platform platforms type source) + @valid_keys ||= %w(branch git glob group development_group groups name path platform platforms ref require source submodules tag type) end def normalize_options(name, version, opts) From c254f3c86a513fa5fd064bc69def47abf7e08a0b Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Mon, 9 Mar 2015 13:21:05 +0100 Subject: [PATCH 3/9] document the new :glob option to gemspec --- man/gemfile.5.ronn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn index 876c927380a..63c27030245 100644 --- a/man/gemfile.5.ronn +++ b/man/gemfile.5.ronn @@ -453,10 +453,10 @@ files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths. -The `gemspec` method supports optional `:path`, `:name`, and `:development_group` -options, which control where bundler looks for the `.gemspec`, what named -`.gemspec` it uses (if more than one is present), and which group development -dependencies are included in. +The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group` +options, which control where bundler looks for the `.gemspec`, the glob it uses to look +for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses +(if more than one is present), and which group development dependencies are included in. ## SOURCE PRIORITY From 1c7d862c423018a2a0a17dc9d42bcf538ab9f759 Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Mon, 9 Mar 2015 13:47:07 +0100 Subject: [PATCH 4/9] fix spaces --- man/gemfile.5.ronn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn index 63c27030245..1340b59a271 100644 --- a/man/gemfile.5.ronn +++ b/man/gemfile.5.ronn @@ -454,8 +454,8 @@ need not manipulate the load path manually or require project files via relative paths. The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group` -options, which control where bundler looks for the `.gemspec`, the glob it uses to look -for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses +options, which control where bundler looks for the `.gemspec`, the glob it uses to look +for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses (if more than one is present), and which group development dependencies are included in. ## SOURCE PRIORITY From 4502d8ad088275481d230d0b824f3e69f5f99057 Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Thu, 12 Mar 2015 15:04:43 +0100 Subject: [PATCH 5/9] Revert "add development_group to valid_keys" This reverts commit 3c5d325759f8272955cd45840887c95114f2064d. --- lib/bundler/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index f612c651cda..5cb3be025a3 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -225,7 +225,7 @@ def normalize_hash(opts) end def valid_keys - @valid_keys ||= %w(branch git glob group development_group groups name path platform platforms ref require source submodules tag type) + @valid_keys ||= %w(group groups git path glob name branch ref tag require submodules platform platforms type source) end def normalize_options(name, version, opts) From 93aa1ac7ce1aaba85c35ca980c07a006556c7c36 Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Thu, 12 Mar 2015 15:08:11 +0100 Subject: [PATCH 6/9] pass glob explicitly --- lib/bundler/dsl.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 5cb3be025a3..b90342e0fdd 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -42,6 +42,7 @@ def eval_gemfile(gemfile, contents = nil) def gemspec(opts = nil) path = opts && opts[:path] || '.' + glob = opts && opts[:glob] #|| nil name = opts && opts[:name] || '{,*}' development_group = opts && opts[:development_group] || :development expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname) @@ -52,8 +53,7 @@ def gemspec(opts = nil) when 1 spec = Bundler.load_gemspec(gemspecs.first) raise InvalidOption, "There was an error loading the gemspec at #{gemspecs.first}." unless spec - opts ||= {} - gem spec.name, opts.merge(:path => path) + gem spec.name, path: path, glob: glob group(development_group) do spec.development_dependencies.each do |dep| gem dep.name, *(dep.requirement.as_list + [:type => :development]) From ed36b25c90e608dd78e5a0386c4106047e5076f9 Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Thu, 12 Mar 2015 15:18:25 +0100 Subject: [PATCH 7/9] use old hash syntax --- lib/bundler/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index b90342e0fdd..8229e0d6bdc 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -53,7 +53,7 @@ def gemspec(opts = nil) when 1 spec = Bundler.load_gemspec(gemspecs.first) raise InvalidOption, "There was an error loading the gemspec at #{gemspecs.first}." unless spec - gem spec.name, path: path, glob: glob + gem spec.name, :path => path, :glob => glob group(development_group) do spec.development_dependencies.each do |dep| gem dep.name, *(dep.requirement.as_list + [:type => :development]) From e2beec61a80c5c0c42ecffbeec9b5d7e7cc0f8ae Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Thu, 12 Mar 2015 19:11:13 +0100 Subject: [PATCH 8/9] remove comment --- lib/bundler/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 8229e0d6bdc..bb891cc42ff 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -42,7 +42,7 @@ def eval_gemfile(gemfile, contents = nil) def gemspec(opts = nil) path = opts && opts[:path] || '.' - glob = opts && opts[:glob] #|| nil + glob = opts && opts[:glob] name = opts && opts[:name] || '{,*}' development_group = opts && opts[:development_group] || :development expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname) From 228b4492fe1efe09299a9bfba74530fa6dacbf9f Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Fri, 13 Mar 2015 09:42:12 +0100 Subject: [PATCH 9/9] I'm a noob who's committing a space Because I don't know how else to make travis-ci retry my pull request, which it errored out on. --- lib/bundler/dsl.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index bb891cc42ff..ab388b6071b 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -329,4 +329,5 @@ def check_primary_source_safety(source) end end + end