Class: Gem::Builder

Inherits:
Object
  • Object
show all
Includes:
UserInteraction
Defined in:
lib/rubygems/builder.rb

Overview

The Builder class processes RubyGem specification files to produce a .gem file.

Instance Method Summary collapse

Methods included from UserInteraction

#alert, #alert_error, #alert_warning, #ask, #ask_for_password, #ask_yes_no, #choose_from_list, #say, #terminate_interaction

Methods included from DefaultUserInteraction

ui, #ui, ui=, #ui=, use_ui, #use_ui

Constructor Details

#initialize(spec) ⇒ Builder

Constructs a builder instance for the provided specification

spec
Gem::Specification

The specification instance



27
28
29
# File 'lib/rubygems/builder.rb', line 27

def initialize(spec)
  @spec = spec
end

Instance Method Details

#build(skip_validation = false) ⇒ Object

Builds the gem from the specification. Returns the name of the file written.



35
36
37
38
39
40
41
42
# File 'lib/rubygems/builder.rb', line 35

def build(skip_validation=false)
  @spec.mark_version
  @spec.validate unless skip_validation
  @signer = sign
  write_package
  say success if Gem.configuration.verbose
  File.basename @spec.cache_file
end

#successObject



44
45
46
47
48
49
50
51
# File 'lib/rubygems/builder.rb', line 44

def success
  <<-EOM
Successfully built RubyGem
Name: #{@spec.name}
Version: #{@spec.version}
File: #{File.basename @spec.cache_file}
EOM
end