Class: Bundler::Standalone

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

Instance Method Summary collapse

Constructor Details

#initialize(groups, definition) ⇒ Standalone

Returns a new instance of Standalone.



4
5
6
# File 'lib/bundler/installer/standalone.rb', line 4

def initialize(groups, definition)
  @specs = groups.empty? ? definition.requested_specs : definition.specs_for(groups.map(&:to_sym))
end

Instance Method Details

#generateObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bundler/installer/standalone.rb', line 8

def generate
  SharedHelpers.filesystem_access(bundler_path) do |p|
    FileUtils.mkdir_p(p)
  end
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
    file.puts "require 'rbconfig'"
    file.puts "# ruby 1.8.7 doesn't define RUBY_ENGINE"
    file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'"
    file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
    file.puts "path = File.expand_path('..', __FILE__)"
    paths.each do |path|
      file.puts %($:.unshift "\#{path}/#{path}")
    end
  end
end