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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Compiler.



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

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.



13
14
15
# File 'lib/rubygems/compiler.rb', line 13

def options
  @options
end

#target_dirObject (readonly)

Returns the value of attribute target_dir.



13
14
15
# File 'lib/rubygems/compiler.rb', line 13

def target_dir
  @target_dir
end

Instance Method Details

#compileObject



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

def compile
  unpack

  build_extensions

  artifacts = collect_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