54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/corundum/gemcutter.rb', line 54
def define
in_namespace do
task :uninstall do |t|
when_writing("Uninstalling #{gem_name}") do
require "rubygems/commands/uninstall_command"
uninstall = get_command Gem::Commands::UninstallCommand
uninstall.options[:args] = [gem_path]
uninstall.execute
end
end
task :install => [gem_path] do |t|
when_writing("Installing #{gem_path}") do
require "rubygems/commands/install_command"
install = get_command Gem::Commands::InstallCommand
install.options[:args] = [gem_path]
install.execute
end
end
task :reinstall => [:uninstall, :install]
task :dependencies_available do
checker = Gem::SpecFetcher.new
gemspec.runtime_dependencies.each do |dep|
fulfilling = checker.find_matching(dep,false,false,false)
if fulfilling.empty?
fail "Dependency #{dep} is unfulfilled remotely"
else
puts "Remotely fulfilled: #{dep}" if verbose
end
end
end
task :is_unpushed do
checker = Gem::SpecFetcher.new
dep = Gem::Dependency.new(gemspec.name, "= #{gemspec.version}")
fulfilling = checker.find_matching(dep,false,false,false)
unless fulfilling.empty?
p fulfilling
fail "Gem #{gemspec.full_name} is already pushed"
end
end
desc 'Push a gem up to Gemcutter'
task :push => [:dependencies_available, :is_unpushed] do
require "rubygems/commands/push_command"
push = get_command(Gem::Commands::PushCommand)
push.options[:args] = [gem_path]
push.execute
end
task :push => build_finished_path
end
task :release => in_namespace(:push)
task :preflight => in_namespace(:dependencies_available, :is_unpushed)
end
|