Class: Gem::Installer::FakePackage

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ FakePackage

Returns a new instance of FakePackage.



110
111
112
# File 'lib/rubygems/installer.rb', line 110

def initialize(spec)
  @spec = spec
end

Instance Attribute Details

#specObject

Returns the value of attribute spec.



108
109
110
# File 'lib/rubygems/installer.rb', line 108

def spec
  @spec
end

Instance Method Details

#copy_to(path) ⇒ Object



125
126
# File 'lib/rubygems/installer.rb', line 125

def copy_to path
end

#extract_files(destination_dir, pattern = '*') ⇒ Object



114
115
116
117
118
119
120
121
122
123
# File 'lib/rubygems/installer.rb', line 114

def extract_files destination_dir, pattern = '*'
  FileUtils.mkdir_p destination_dir

  spec.files.each do |file|
    file = File.join destination_dir, file
    next if File.exist? file
    FileUtils.mkdir_p File.dirname(file)
    File.open file, 'w' do |fp| fp.puts "# #{file}" end
  end
end