| Class | Gem::Commands::BuildCommand |
| In: |
lib/rubygems/commands/build_command.rb
|
| Parent: | Gem::Command |
# File lib/rubygems/commands/build_command.rb, line 6 6: def initialize 7: super('build', 'Build a gem from a gemspec') 8: end
# File lib/rubygems/commands/build_command.rb, line 18
18: def execute
19: gemspec = get_one_gem_name
20:
21: if File.exist? gemspec
22: spec = load_gemspec gemspec
23:
24: if spec then
25: Gem::Builder.new(spec).build
26: else
27: alert_error "Error loading gemspec. Aborting."
28: terminate_interaction 1
29: end
30: else
31: alert_error "Gemspec file not found: #{gemspec}"
32: terminate_interaction 1
33: end
34: end
# File lib/rubygems/commands/build_command.rb, line 36
36: def load_gemspec filename
37: if yaml?(filename)
38: open(filename) do |f|
39: begin
40: Gem::Specification.from_yaml(f)
41: rescue Gem::EndOfYAMLException
42: nil
43: end
44: end
45: else
46: Gem::Specification.load(filename) # can return nil
47: end
48: end