mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rubygems master targeted RubyGems 3.1.0.
1172320540
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
59a6215af6
commit
3dc6efbe9c
18 changed files with 105 additions and 78 deletions
|
@ -18,6 +18,10 @@ class Gem::Commands::BuildCommand < Gem::Command
|
|||
add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
|
||||
options[:output] = value
|
||||
end
|
||||
|
||||
add_option '-C PATH', '', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
|
||||
options[:build_path] = value
|
||||
end
|
||||
end
|
||||
|
||||
def arguments # :nodoc:
|
||||
|
@ -60,25 +64,36 @@ Gems can be saved to a specified filename with the output option:
|
|||
end
|
||||
|
||||
if File.exist? gemspec
|
||||
Dir.chdir(File.dirname(gemspec)) do
|
||||
spec = Gem::Specification.load File.basename(gemspec)
|
||||
spec = Gem::Specification.load(gemspec)
|
||||
|
||||
if spec
|
||||
Gem::Package.build(
|
||||
spec,
|
||||
options[:force],
|
||||
options[:strict],
|
||||
options[:output]
|
||||
)
|
||||
else
|
||||
alert_error "Error loading gemspec. Aborting."
|
||||
terminate_interaction 1
|
||||
if options[:build_path]
|
||||
Dir.chdir(File.dirname(gemspec)) do
|
||||
spec = Gem::Specification.load File.basename(gemspec)
|
||||
build_package(spec)
|
||||
end
|
||||
else
|
||||
build_package(spec)
|
||||
end
|
||||
|
||||
else
|
||||
alert_error "Gemspec file not found: #{gemspec}"
|
||||
terminate_interaction 1
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_package(spec)
|
||||
if spec
|
||||
Gem::Package.build(
|
||||
spec,
|
||||
options[:force],
|
||||
options[:strict],
|
||||
options[:output]
|
||||
)
|
||||
else
|
||||
alert_error "Error loading gemspec. Aborting."
|
||||
terminate_interaction 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue