C0 code coverage information
Generated on Wed Oct 07 08:34:05 -0700 2009 with rcov 0.8.2.1
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.
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with this
3 # work for additional information regarding copyright ownership. The ASF
4 # licenses this file to you under the Apache License, Version 2.0 (the
5 # "License"); you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations under
14 # the License.
15
16
17 require 'buildr/packaging/package'
18 require 'buildr/packaging/archive'
19 gem 'rubyforge' ; autoload :RubyForge, 'rubyforge'
20 Gem.autoload :Package, 'rubygems/package'
21
22
23 module Buildr
24
25 class PackageGemTask < ArchiveTask
26
27 def initialize(*args)
28 super
29 @spec = Gem::Specification.new
30 prepare do
31 include(changelog) if changelog
32 end
33 end
34
35 attr_accessor :changelog
36
37 def spec
38 yield @spec if block_given?
39 @spec
40 end
41
42 def install
43 Util::Gems.command 'install', name
44 end
45
46 def uninstall
47 Util::Gems.command 'uninstall', spec.name, '-v', spec.version.to_s
48 end
49
50 def upload
51 rubyforge = RubyForge.new
52 rubyforge.login
53 rubyforge.userconfig.merge!('release_changes'=>changelog.to_s, 'preformatted'=>true) if changelog
54 rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version, package(:gem).to_s
55 end
56
57 private
58
59 def create_from(file_map)
60 spec.mark_version
61 spec.validate
62 Gem::Package.open(name, 'w', nil) do |pkg|
63 pkg.metadata = spec.to_yaml
64 file_map.each do |path, content|
65 next if content.nil? || File.directory?(content.to_s)
66 pkg.add_file_simple(path, File.stat(name).mode & 0777, File.size(content.to_s)) do |os|
67 File.open(content.to_s, "rb") do |file|
68 os.write file.read(4096) until file.eof?
69 end
70 end
71 end
72 end
73 end
74
75 end
76
77
78 module PackageAsGem #:nodoc:
79
80 def package_as_gem(file_name) #:nodoc:
81 PackageGemTask.define_task(file_name).tap do |gem|
82 %w{ lib test doc }.each do |dir|
83 gem.include :from=>_(dir), :path=>dir if File.directory?(_(dir))
84 end
85 gem.spec do |spec|
86 spec.name = id
87 spec.version = version
88 spec.summary = full_comment
89 spec.has_rdoc = true
90 spec.rdoc_options << '--title' << comment
91 spec.require_path = 'lib'
92 end
93 end
94 end
95
96 end
97
98 class Project
99 include PackageAsGem
100 end
101
102 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.2.1.