Class: Gem::Compiler

Inherits:
Object
  • Object
show all
Includes:
UserInteraction
Defined in:
lib/rubygems/compiler/version.rb,
lib/rubygems/compiler.rb

Defined Under Namespace

Classes: CompilerError

Constant Summary collapse

VERSION =
"0.5.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemfile, _options = {}) ⇒ Compiler

Returns a new instance of Compiler


20
21
22
23
24
# File 'lib/rubygems/compiler.rb', line 20

def initialize(gemfile, _options = {})
  @gemfile    = gemfile
  @output_dir = _options.delete(:output)
  @options    = _options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options


18
19
20
# File 'lib/rubygems/compiler.rb', line 18

def options
  @options
end

#target_dirObject (readonly)

Returns the value of attribute target_dir


18
19
20
# File 'lib/rubygems/compiler.rb', line 18

def target_dir
  @target_dir
end

Instance Method Details

#compileObject


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rubygems/compiler.rb', line 26

def compile
  unpack

  build_extensions

  artifacts = collect_artifacts

  # build a new gemspec from the original one
  gemspec = installer.spec.dup

  adjust_gemspec_files gemspec, artifacts

  # generate new gem and return new path to it
  repackage gemspec
ensure
  cleanup
end