Sha256: 17ccda648dc5753ab67590737598f63d01070ba82206d37a72e16088993919f7

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require 'rubygems/dependency_installer'

module Bundler
  class Installer < Environment
    def self.install(root, definition, options = {})
      installer = new(root, definition)
      installer.run(options)
      installer
    end

    def run(options)
      if dependencies.empty?
        Bundler.ui.warn "The Gemfile specifies no dependencies"
        return
      end

      # Since we are installing, we can resolve the definition
      # using remote specs
      options["local"] ?
        @definition.resolve_with_cache! :
        @definition.resolve_remotely!

      # Ensure that BUNDLE_PATH exists
      FileUtils.mkdir_p(Bundler.bundle_path)

      # Must install gems in the order that the resolver provides
      # as dependencies might actually affect the installation of
      # the gem.
      specs.each do |spec|
        spec.source.fetch(spec) if spec.source.respond_to?(:fetch)

        # unless requested_specs.include?(spec)
        #   Bundler.ui.debug "  * Not in requested group; skipping."
        #   next
        # end

        spec.source.install(spec)
        Bundler.ui.info ""
        generate_bundler_executable_stubs(spec)
        FileUtils.rm_rf(Bundler.tmp)
      end

      lock
    end

  private

    def generate_bundler_executable_stubs(spec)
      spec.executables.each do |executable|
        next if executable == "bundle"
        File.open "#{Bundler.bin_path}/#{executable}", 'w', 0755 do |f|
          f.puts File.read(File.expand_path('../templates/Executable', __FILE__))
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-1.0.0.beta.2 lib/bundler/installer.rb