diff options
Diffstat (limited to 'lib/rubygems/commands/build_command.rb')
-rw-r--r-- | lib/rubygems/commands/build_command.rb | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 36a6fe48f2..64563ed3db 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -1,5 +1,5 @@ require 'rubygems/command' -require 'rubygems/builder' +require 'rubygems/package' class Gem::Commands::BuildCommand < Gem::Command @@ -22,11 +22,11 @@ class Gem::Commands::BuildCommand < Gem::Command def execute gemspec = get_one_gem_name - if File.exist? gemspec - spec = load_gemspec gemspec + if File.exist? gemspec then + spec = Gem::Specification.load gemspec if spec then - Gem::Builder.new(spec).build options[:force] + Gem::Package.build spec, options[:force] else alert_error "Error loading gemspec. Aborting." terminate_interaction 1 @@ -37,23 +37,5 @@ class Gem::Commands::BuildCommand < Gem::Command end end - def load_gemspec filename - if yaml?(filename) - open(filename) do |f| - begin - Gem::Specification.from_yaml(f) - rescue Gem::EndOfYAMLException - nil - end - end - else - Gem::Specification.load(filename) # can return nil - end - end - - def yaml?(filename) - line = open(filename) { |f| line = f.gets } - result = line =~ %r{!ruby/object:Gem::Specification} - result - end end + |