Class: BundleHack::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_hack/sandbox.rb

Instance Method Summary collapse

Constructor Details

#initialize(gem_name, gemfile_path = nil) ⇒ Sandbox

Returns a new instance of Sandbox.



5
6
7
8
9
10
# File 'lib/bundle_hack/sandbox.rb', line 5

def initialize(gem_name, gemfile_path = nil)
  @gem_name = gem_name
  @gemfile_path = gemfile_path || Bundler.default_gemfile
  @gemfile_lock_path = lock_path(gemfile_path)
  @root_path = Pathname.new(File.dirname(@gemfile_path))
end

Instance Method Details

#buildObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/bundle_hack/sandbox.rb', line 12

def build
  parser = GemfileParser.new(File.open(@gemfile_path))
  gems = locate_gems(parser)
  ConfigWriter.new(@root_path).create_or_update
  GemfileWriter.new(@root_path, @gemfile_path, gems).create
  gems.each do |gem|
    GemCloner.new(gem, @root_path).clone
    GemspecCloner.new(gem, @root_path).clone
  end
end