summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-24 15:35:29 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-07-24 15:41:47 -0500
commit94a7392a02c3e3c3cd8e0b641c4446f38b24c95a (patch)
tree02009906d249969e56273b4bfdbad950757e03dd
parent2a138ed736b2210a21588db44b567dbdea6f7a18 (diff)
downloadbundler-94a7392a02c3e3c3cd8e0b641c4446f38b24c95a.tar.gz
Add a source.rb file by default in the specs to track the source for a gem
-rw-r--r--spec/support/builders.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 2491f87b77..3c10cba757 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -373,12 +373,14 @@ module Spec
end
return unless block_given?
@_build_path = "#{path}/gems"
+ @_build_repo = File.basename(path)
yield
with_gem_path_as Path.base_system_gems do
Dir.chdir(path) { gem_command :generate_index }
end
ensure
@_build_path = nil
+ @_build_repo = nil
end
def build_index(&block)
@@ -435,6 +437,7 @@ module Spec
spec = nil
options[:path] ||= @_build_path
+ options[:source] ||= @_build_repo
Array(versions).each do |version|
spec = builder.new(self, name, version)
@@ -584,7 +587,12 @@ module Spec
@files["#{name}.gemspec"] = @spec.to_ruby
end
- @files = _default_files.merge(@files) unless options[:no_default]
+ unless options[:no_default]
+ gem_source = options[:source] || "path@#{path}"
+ @files = _default_files.
+ merge("lib/#{name}/source.rb" => "#{Builders.constantize(name)}_SOURCE = #{gem_source.to_s.dump}").
+ merge(@files)
+ end
@spec.authors = ["no one"]
@@ -609,7 +617,8 @@ module Spec
class GitBuilder < LibBuilder
def _build(options)
path = options[:path] || _default_path
- super(options.merge(:path => path))
+ source = options[:source] || "git@#{path}"
+ super(options.merge(:path => path, :source => source))
Dir.chdir(path) do
`git init`
`git add *`