diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
commit | d22130922e7842226d38d59680e4bbb48a28a5f0 (patch) | |
tree | 39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/commands/build_command.rb | |
parent | 4752539e3f3e563d559732c52424206bd6f12dbd (diff) |
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/build_command.rb')
-rw-r--r-- | lib/rubygems/commands/build_command.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 5aac489459..cdae367365 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -23,32 +23,34 @@ class Gem::Commands::BuildCommand < Gem::Command def execute gemspec = get_one_gem_name - if File.exist?(gemspec) - specs = load_gemspecs(gemspec) - specs.each do |spec| + + if File.exist? gemspec + spec = load_gemspec gemspec + + if spec then Gem::Builder.new(spec).build + else + alert_error "Error loading gemspec. Aborting." + terminate_interaction 1 end else alert_error "Gemspec file not found: #{gemspec}" + terminate_interaction 1 end end - def load_gemspecs(filename) + def load_gemspec filename if yaml?(filename) - result = [] open(filename) do |f| begin - while not f.eof? and spec = Gem::Specification.from_yaml(f) - result << spec - end + Gem::Specification.from_yaml(f) rescue Gem::EndOfYAMLException - # OK + nil end end else - result = [Gem::Specification.load(filename)] + Gem::Specification.load(filename) # can return nil end - result end def yaml?(filename) |