Rake Gemcutter C0 Coverage Information - RCov

lib/rake/rubygems.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/rake/rubygems.rb 109 93
83.49%
80.65%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 require 'rake'
2 require 'rake/tasklib'
3 
4 
5 module Gem::Commands
6   autoload "PushCommand", "rubygems/commands/push_command"
7   autoload "InstallCommand", "rubygems/commands/install_command"
8   autoload "UninstallCommand", "rubygems/commands/uninstall_command"
9 end
10 
11 module Rake::Gemcutter
12   class Tasks < ::Rake::TaskLib
13     def initialize(gem_spec)
14       @gem_spec = gem_spec
15       setup_fields
16       yield self if block_given?
17       finalize_fields
18       define
19     end
20 
21     def setup_fields
22       @gem_path = nil
23       @package_dir = "pkg"
24     end
25     attr_accessor :gem_path, :package_dir
26 
27     def finalize_fields
28       if @gem_name.nil?
29         @gem_name = @gem_spec.full_name
30       end
31 
32       if @gem_path.nil? and not @package_dir.nil?
33         @gem_path = File::join(@package_dir, @gem_spec.file_name)
34       end
35     end
36 
37     module CommandTweaks
38       def setup_args(args = nil)
39         args ||= []
40         handle_options(args)
41       end
42 
43       def gem_list=(list)
44         @gems = list
45       end
46 
47       def get_all_gem_names
48         return @gems if defined?(@gems)
49         super
50       end
51 
52       def get_one_gem_name
53         return @gems.first if defined?(@gems)
54         super
55       end
56     end
57 
58     def get_command(klass, args=nil)
59       cmd = klass.new
60       cmd.extend(CommandTweaks)
61       cmd.setup_args(args)
62       cmd
63     end
64 
65     def define
66       namespace :gem do
67         desc "Uninstall the gem" 
68         task :uninstall do |t|
69           when_writing("Uninstalling #{@gem_name}") do
70             uninstall = get_command Gem::Commands::UninstallCommand
71             uninstall.gem_list = [@gem_path]
72             uninstall.execute
73           end
74         end
75 
76         desc "Install the gem locally"
77         task :install => [@gem_path] do |t|
78           when_writing("Installing #{@gem_path}") do
79             install = get_command Gem::Commands::InstallCommand
80             install.get_list = [@gem_path]
81             install.execute
82           end
83         end
84 
85         desc "Force a reinstall of the gem"
86         task :reinstall => [:uninstall, :install]
87 
88         task :dependencies_available do
89           checker = Gem::SpecFetcher.new
90           @gem_spec.runtime_dependencies.each do |dep|
91             fulfilling = checker.fetch(dep,false,false,false)
92             if fulfilling.empty?
93               fail "Dependency #{dep} is unfulfilled remotely"
94             else
95               puts "Remotely fulfilled: #{dep}"
96             end
97           end
98         end
99 
100         desc 'Push a gem up to Gemcutter'
101         task :push => [:dependencies_available] do
102           push = get_command(Gem::Commands::PushCommand)
103           push.gem_list = [@gem_path]
104           push.execute
105         end
106       end
107     end
108   end
109 end

Generated on Wed Apr 20 19:43:30 -0700 2011 with rcov 0.9.8