From 919ac76706c18235f1ad6439331bd50850dd7681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 11 Feb 2020 11:11:16 +0100 Subject: Remove unneeded line --- spec/support/builders.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 467a9f2ccd..a62f0e07a4 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -463,7 +463,6 @@ module Spec Array(versions).each do |version| spec = builder.new(self, name, version) - spec.authors = ["no one"] if !spec.authors || spec.authors.empty? yield spec if block_given? spec._build(options) end -- cgit v1.2.1 From 2fa9f85b43aa0110037520052c801e01e4b5b35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 11 Feb 2020 11:59:56 +0100 Subject: Remove another unnecessary line --- spec/support/builders.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/builders.rb b/spec/support/builders.rb index a62f0e07a4..8ad3651f97 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -750,8 +750,6 @@ module Spec Dir.chdir(lib_path) do FileUtils.mkdir_p(destination) - @spec.authors = ["that guy"] if !@spec.authors || @spec.authors.empty? - Bundler.rubygems.build(@spec, opts[:skip_validation]) end gem_path = File.expand_path("#{@spec.full_name}.gem", lib_path) -- cgit v1.2.1 From 0cc261d0b1c2c819ea63d4eb0e352abf33dac56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 11 Feb 2020 12:01:20 +0100 Subject: Remove unused alias --- spec/support/path.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/path.rb b/spec/support/path.rb index 25206c9832..fe79a03c47 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -86,8 +86,6 @@ module Spec root.join(*path) end - alias_method :bundled_app1, :bundled_app - def bundled_app2(*path) root = tmp.join("bundled_app2") FileUtils.mkdir_p(root) -- cgit v1.2.1 From 5bfbcb278720548ac78f2f6574372e75cb153a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 11 Feb 2020 12:32:59 +0100 Subject: Remove a couple more folder switches from specs --- spec/support/builders.rb | 35 ++++++++++++++++++++++------------- 1 file 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 -- cgit v1.2.1 From 1e9e4cbab0715d77059fa0b3aac9a940f1d60873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 11 Feb 2020 12:54:20 +0100 Subject: Move method only used once inline --- spec/support/path.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spec/support/path.rb b/spec/support/path.rb index fe79a03c47..bfa4865abd 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -170,8 +170,8 @@ module Spec def with_root_gemspec if ruby_core? root_gemspec = root.join("bundler.gemspec") - # `in_repo_root` for Dir.glob in gemspec - spec = in_repo_root { Gem::Specification.load(gemspec.to_s) } + # Dir.chdir for Dir.glob in gemspec + spec = Dir.chdir(root) { Gem::Specification.load(gemspec.to_s) } spec.bindir = "libexec" File.open(root_gemspec.to_s, "w") {|f| f.write spec.to_ruby } yield(root_gemspec) @@ -192,10 +192,6 @@ module Spec end end - def in_repo_root - Dir.chdir(root) { yield } - end - extend self private -- cgit v1.2.1