summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-02-11 12:32:59 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2020-02-11 12:32:59 +0100
commit5bfbcb278720548ac78f2f6574372e75cb153a24 (patch)
treee805022926a1f5613b677fd84304a246d764804c
parent0cc261d0b1c2c819ea63d4eb0e352abf33dac56e (diff)
downloadbundler-5bfbcb278720548ac78f2f6574372e75cb153a24.tar.gz
Remove a couple more folder switches from specs
-rw-r--r--spec/support/builders.rb35
1 files changed, 22 insertions, 13 deletions
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 8ad3651f97..3f07591307 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -615,15 +615,6 @@ module Spec
def @spec.validate(*); end
end
- case options[:gemspec]
- when false
- # do nothing
- when :yaml
- @files["#{name}.gemspec"] = @spec.to_yaml
- else
- @files["#{name}.gemspec"] = @spec.to_ruby
- end
-
unless options[:no_default]
gem_source = options[:source] || "path@#{path}"
@files = _default_files.
@@ -632,13 +623,24 @@ module Spec
end
@spec.authors = ["no one"]
+ @spec.files = @files.keys
+
+ case options[:gemspec]
+ when false
+ # do nothing
+ when :yaml
+ @spec.files << "#{name}.gemspec"
+ @files["#{name}.gemspec"] = @spec.to_yaml
+ else
+ @spec.files << "#{name}.gemspec"
+ @files["#{name}.gemspec"] = @spec.to_ruby
+ end
@files.each do |file, source|
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)
File.open(file, "w") {|f| f.puts source }
end
- @spec.files = @files.keys
path
end
@@ -747,11 +749,18 @@ module Spec
def _build(opts)
lib_path = super(opts.merge(:path => @context.tmp(".tmp/#{@spec.full_name}"), :no_default => opts[:no_default]))
destination = opts[:path] || _default_path
- Dir.chdir(lib_path) do
- FileUtils.mkdir_p(destination)
+ FileUtils.mkdir_p(lib_path.join(destination))
- Bundler.rubygems.build(@spec, opts[:skip_validation])
+ if opts[:gemspec] == :yaml || opts[:gemspec] == false
+ Dir.chdir(lib_path) do
+ Bundler.rubygems.build(@spec, opts[:skip_validation])
+ end
+ elsif opts[:skip_validation]
+ @context.gem_command "build --force #{@spec.name}", :dir => lib_path
+ else
+ @context.gem_command! "build #{@spec.name}", :dir => lib_path
end
+
gem_path = File.expand_path("#{@spec.full_name}.gem", lib_path)
if opts[:to_system]
@context.system_gems gem_path, :keep_path => true