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.9.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Compiler.



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

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.



16
17
18
# File 'lib/rubygems/compiler.rb', line 16

def options
  @options
end

#target_dirObject (readonly)

Returns the value of attribute target_dir.



16
17
18
# File 'lib/rubygems/compiler.rb', line 16

def target_dir
  @target_dir
end

Instance Method Details

#compileObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rubygems/compiler.rb', line 24

def compile
  unpack

  build_extensions

  artifacts = collect_artifacts

  strip_artifacts artifacts

  if shared_dir = options[:include_shared_dir]
    shared_libs = collect_shared(shared_dir)

    artifacts.concat shared_libs
  end

  # 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