class Bundler::Installer
def generate_standalone(groups)
def generate_standalone(groups) standalone_path = Bundler.settings[:path] bundler_path = File.join(standalone_path, "bundler") FileUtils.mkdir_p(bundler_path) paths = [] if groups.empty? specs = @definition.requested_specs else specs = @definition.specs_for groups.map { |g| g.to_sym } end specs.each do |spec| next if spec.name == "bundler" next if spec.require_paths.nil? # builtin gems spec.require_paths.each do |path| full_path = File.join(spec.full_gem_path, path) gem_path = Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)) paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG['ruby_version']}", '#{ruby_engine}/#{ruby_version}') end 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 File.expand_path("\#{path}/#{path}")} end end end