Parent

Class Index [+]

Quicksearch

Gem::Commands::BuildCommand

Public Class Methods

new() click to toggle source
   # File lib/rubygems/commands/build_command.rb, line 6
6:   def initialize
7:     super('build', 'Build a gem from a gemspec')
8:   end

Public Instance Methods

execute() click to toggle source
    # 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
load_gemspec(filename) click to toggle source
    # 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
yaml?(filename) click to toggle source
    # File lib/rubygems/commands/build_command.rb, line 50
50:   def yaml?(filename)
51:     line = open(filename) { |f| line = f.gets }
52:     result = line =~ %{!ruby/object:Gem::Specification}
53:     result
54:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.