TODO: Refactor this class
# File lib/bundler/source/rubygems.rb, line 48 def self.from_lock(options) s = new(options) Array(options["remote"]).each { |r| s.add_remote(r) } s end
# File lib/bundler/source/rubygems.rb, line 14 def initialize(options = {}) @options = options @remotes = (options["remotes"] || []).map { |r| normalize_uri(r) } @fetchers = {} @dependency_names = [] @allow_remote = false @allow_cached = false @caches = [ Bundler.app_cache ] + Bundler.rubygems.gem_path.map{|p| File.expand_path("#{p}/cache") } end
# File lib/bundler/source/rubygems.rb, line 124 def add_remote(source) @remotes << normalize_uri(source) end
# File lib/bundler/source/rubygems.rb, line 116 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/rubygems.rb, line 30 def cached! @allow_cached = true end
# File lib/bundler/source/rubygems.rb, line 38 def eql?(o) Rubygems === o end
# File lib/bundler/source/rubygems.rb, line 34 def hash Rubygems.hash end
# File lib/bundler/source/rubygems.rb, line 70 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) if Bundler.requires_sudo? install_path = Bundler.tmp bin_path = install_path.join("bin") else install_path = Bundler.rubygems.gem_dir bin_path = Bundler.system_bindir end installed_spec = nil Bundler.rubygems.preserve_paths do installed_spec = Bundler::GemInstaller.new(path, :install_dir => install_path.to_s, :bin_dir => bin_path.to_s, :ignore_dependencies => true, :wrappers => true, :env_shebang => true ).install end if spec.post_install_message Installer.post_install_messages[spec.name] = spec.post_install_message end # SUDO HAX if Bundler.requires_sudo? Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/gems" Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/specifications" Bundler.sudo "cp -R #{Bundler.tmp}/gems/#{spec.full_name} #{Bundler.rubygems.gem_dir}/gems/" Bundler.sudo "cp -R #{Bundler.tmp}/specifications/#{spec.full_name}.gemspec #{Bundler.rubygems.gem_dir}/specifications/" spec.executables.each do |exe| Bundler.mkdir_p Bundler.system_bindir Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.system_bindir}" end end installed_spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" end
# File lib/bundler/source/rubygems.rb, line 44 def options { "remotes" => @remotes.map { |r| r.to_s } } end
# File lib/bundler/source/rubygems.rb, line 26 def remote! @allow_remote = true end
# File lib/bundler/source/rubygems.rb, line 128 def replace_remotes(source) return false if source.remotes == @remotes @remotes = [] source.remotes.each do |r| add_remote r.to_s end true end
# File lib/bundler/source/rubygems.rb, line 66 def specs @specs ||= fetch_specs end
# File lib/bundler/source/rubygems.rb, line 54 def to_lock out = "GEM\n" out << remotes.map {|r| " remote: #{r}\n" }.join out << " specs:\n" end
# File lib/bundler/source/rubygems.rb, line 60 def to_s remote_names = self.remotes.map { |r| r.to_s }.join(', ') "rubygems repository #{remote_names}" end
Generated with the Darkfish Rdoc Generator 2.