TODO: Refactor this class
# File lib/bundler/source.rb, line 130 def add_remote(source) @remotes << normalize_uri(source) end
# File lib/bundler/source.rb, line 122 def cache(spec) cached_path = cached_gem(spec) raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path return if File.dirname(cached_path) == Bundler.app_cache.to_s Bundler.ui.info " * #{File.basename(cached_path)}" FileUtils.cp(cached_path, Bundler.app_cache) end
# File lib/bundler/source.rb, line 33 def cached! @allow_cached = true end
# File lib/bundler/source.rb, line 41 def eql?(o) Rubygems === o end
# File lib/bundler/source.rb, line 73 def fetch(spec) spec, uri = @spec_fetch_map[spec.full_name] if spec path = download_gem_from_uri(spec, uri) s = Bundler.rubygems.spec_from_gem(path) spec.__swap__(s) end end
# File lib/bundler/source.rb, line 82 def install(spec) if installed_specs[spec].any? Bundler.ui.info "Using #{spec.name} (#{spec.version}) " return end Bundler.ui.info "Installing #{spec.name} (#{spec.version}) " path = cached_gem(spec) Bundler.rubygems.preserve_paths do install_path = Bundler.requires_sudo? ? Bundler.tmp : Bundler.rubygems.gem_dir options = { :install_dir => install_path, :ignore_dependencies => true, :wrappers => true, :env_shebang => true } options.merge!(:bin_dir => "#{install_path}/bin") unless spec.executables.nil? || spec.executables.empty? installer = Bundler::GemInstaller.new path, options installer.install end # SUDO HAX if Bundler.requires_sudo? sudo "mkdir -p #{Bundler.rubygems.gem_dir}/gems #{Bundler.rubygems.gem_dir}/specifications" sudo "cp -R #{Bundler.tmp}/gems/#{spec.full_name} #{Bundler.rubygems.gem_dir}/gems/" sudo "cp -R #{Bundler.tmp}/specifications/#{spec.full_name}.gemspec #{Bundler.rubygems.gem_dir}/specifications/" spec.executables.each do |exe| sudo "mkdir -p #{Bundler.rubygems.gem_bindir}" sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.rubygems.gem_bindir}" end end spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" end
# File lib/bundler/source.rb, line 134 def merge_remotes(source) @remotes = [] source.remotes.each do |r| add_remote r.to_s end end
# File lib/bundler/source.rb, line 47 def options { "remotes" => @remotes.map { |r| r.to_s } } end
# File lib/bundler/source.rb, line 29 def remote! @allow_remote = true end
# File lib/bundler/source.rb, line 69 def specs @specs ||= fetch_specs end
# File lib/bundler/source.rb, line 118 def sudo(str) Bundler.sudo(str) end
# File lib/bundler/source.rb, line 57 def to_lock out = "GEM\n" out << remotes.map {|r| " remote: #{r}\n" }.join out << " specs:\n" end
# File lib/bundler/source.rb, line 63 def to_s remote_names = self.remotes.map { |r| r.to_s }.join(', ') "rubygems repository #{remote_names}" end
# File lib/bundler/source.rb, line 51 def self.from_lock(options) s = new(options) Array(options["remote"]).each { |r| s.add_remote(r) } s end
# File lib/bundler/source.rb, line 15 def initialize(options = {}) @options = options @remotes = (options["remotes"] || []).map { |r| normalize_uri(r) } @allow_remote = false @allow_cached = false # Hardcode the paths for now @caches = [ Bundler.app_cache ] + Bundler.rubygems.gem_path.map do |x| File.expand_path("#{x}/cache") end @spec_fetch_map = {} end
Generated with the Darkfish Rdoc Generator 2.