Deps plugin for hoe.
check_extra_deps |
Install missing dependencies. |
deps:email |
Print a contact list for gems dependent on this gem |
deps:fetch |
Fetch all the dependent gems of this gem into tarballs |
deps:list |
List all the dependent gems of this gem |
The main rubygems repository.
Define tasks for plugin.
# File lib/hoe/deps.rb, line 23 def define_deps_tasks namespace :deps do desc "List all the dependent gems of this gem" task :list do deps_list_task end desc "Print a contact list for gems dependent on this gem" task :email do deps_email_task end desc "Fetch all the dependent gems of this gem into tarballs" task :fetch do deps_fetch_task end end desc 'Install missing dependencies.' task :check_extra_deps do check_extra_deps_task end desc 'Install missing plugins.' task :install_plugins do install_missing_plugins end end
Return all the dependencies on the named rubygem.
# File lib/hoe/deps.rb, line 216 def dependent_upon name get_latest_gems.find_all { |gem| gem.dependencies.any? { |dep| dep.name == name } } end
Return a hash of the latest rubygems keyed by name.
# File lib/hoe/deps.rb, line 187 def get_gems_by_name @@by_name ||= Hash[*get_latest_gems.map { |gem| [gem.name, gem, gem.full_name, gem] }.flatten] end
Return the latest rubygems.
# File lib/hoe/deps.rb, line 180 def get_latest_gems @@cache ||= Hash[*get_source_index.flatten].values end
Return the rubygems source index.
# File lib/hoe/deps.rb, line 147 def get_source_index @@index ||= nil return @@index if @@index dump = unless File.exist? '.source_index' then warn "Fetching full index and caching. This can take a while." url = GEMURL + "Marshal.#{Gem.marshal_version}.Z" dump = Gem::RemoteFetcher.fetcher.fetch_path url dump = Gem.inflate dump warn "stripping index to latest gems" ary = Marshal.load dump h = {} Hash[ary].values.sort.each { |spec| h[spec.name] = spec } ary = h.map { |k,v| [v.full_name, v] } dump = Marshal.dump ary open '.source_index', 'wb' do |io| io.write dump end dump else open '.source_index', 'rb' do |io| io.read end end @@index = Marshal.load dump end
Installs plugins that aren’t currently installed
# File lib/hoe/deps.rb, line 196 def install_missing_plugins plugins = Hoe.bad_plugins version = '>= 0' plugins.each do |name| dash_name = name.to_s.gsub '_', '-' next if have_gem?("hoe-#{name}") or have_gem?(name) or have_gem?(dash_name) install_gem("hoe-#{name}", version, false) or install_gem(name, version, false) or install_gem(dash_name, version, false) or warn "could not install gem for #{name} plugin" end end
Generated with the Darkfish Rdoc Generator 2.