sysexits 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.md +15 -0
- data/README.md +81 -18
- data/Rakefile +61 -339
- data/lib/sysexits.rb +2 -2
- data/spec/sysexits_spec.rb +2 -2
- metadata +114 -52
- metadata.gz.sig +0 -0
- data/ChangeLog +0 -0
- data/rake/191_compat.rb +0 -26
- data/rake/dependencies.rb +0 -76
- data/rake/documentation.rb +0 -123
- data/rake/helpers.rb +0 -502
- data/rake/hg.rb +0 -287
- data/rake/manual.rb +0 -787
- data/rake/packaging.rb +0 -129
- data/rake/publishing.rb +0 -348
- data/rake/style.rb +0 -62
- data/rake/svn.rb +0 -668
- data/rake/testing.rb +0 -151
- data/rake/verifytask.rb +0 -64
data/rake/testing.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Rake tasklib for testing tasks
|
3
|
-
|
4
|
-
#
|
5
|
-
# Authors:
|
6
|
-
# * Michael Granger <ged@FaerieMUD.org>
|
7
|
-
#
|
8
|
-
|
9
|
-
unless defined?( COVERAGE_MINIMUM )
|
10
|
-
if ENV['COVVERAGE_MINIMUM']
|
11
|
-
COVERAGE_MINIMUM = Float( ENV['COVERAGE_MINIMUM'] )
|
12
|
-
else
|
13
|
-
COVERAGE_MINIMUM = 85.0
|
14
|
-
end
|
15
|
-
end
|
16
|
-
SPEC_FILES = [] unless defined?( SPEC_FILES )
|
17
|
-
TEST_FILES = [] unless defined?( TEST_FILES )
|
18
|
-
|
19
|
-
COMMON_RSPEC_OPTS = [] unless defined?( COMMON_RSPEC_OPTS )
|
20
|
-
|
21
|
-
COVERAGE_TARGETDIR = BASEDIR + 'coverage' unless defined?( COVERAGE_TARGETDIR )
|
22
|
-
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib' unless
|
23
|
-
defined?( RCOV_EXCLUDES )
|
24
|
-
|
25
|
-
|
26
|
-
desc "Run all defined tests"
|
27
|
-
task :test do
|
28
|
-
unless SPEC_FILES.empty?
|
29
|
-
log "Running specs"
|
30
|
-
Rake::Task['spec:quiet'].invoke
|
31
|
-
end
|
32
|
-
|
33
|
-
unless TEST_FILES.empty?
|
34
|
-
log "Running unit tests"
|
35
|
-
Rake::Task[:unittests].invoke
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
### RSpec specifications
|
41
|
-
begin
|
42
|
-
gem 'rspec', '>= 2.0.0'
|
43
|
-
|
44
|
-
require 'rspec'
|
45
|
-
require 'rspec/core/rake_task'
|
46
|
-
|
47
|
-
### Task: spec
|
48
|
-
desc "Run specs"
|
49
|
-
task :spec => 'spec:doc'
|
50
|
-
|
51
|
-
namespace :spec do
|
52
|
-
desc "Run rspec every time there's a change to one of the files"
|
53
|
-
task :autotest do
|
54
|
-
require 'autotest'
|
55
|
-
Autotest.add_discovery { "rspec2" }
|
56
|
-
Autotest.run
|
57
|
-
end
|
58
|
-
|
59
|
-
desc "Generate regular color 'doc' spec output"
|
60
|
-
RSpec::Core::RakeTask.new( :doc ) do |task|
|
61
|
-
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p', '-c']
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "Generate spec output with profiling"
|
65
|
-
RSpec::Core::RakeTask.new( :profile ) do |task|
|
66
|
-
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p', '-p']
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "Generate quiet non-colored plain-text output"
|
70
|
-
RSpec::Core::RakeTask.new( :quiet ) do |task|
|
71
|
-
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p']
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "Generate HTML output"
|
75
|
-
RSpec::Core::RakeTask.new( :html ) do |task|
|
76
|
-
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'h']
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
### Task: coverage (via RCov)
|
83
|
-
desc "Build test coverage reports"
|
84
|
-
RSpec::Core::RakeTask.new( :coverage ) do |task|
|
85
|
-
task.ruby_opts = [ "-I#{LIBDIR}" ]
|
86
|
-
task.rspec_opts = ['-f', 'p', '-b']
|
87
|
-
task.rcov_opts = RCOV_OPTS
|
88
|
-
task.rcov = true
|
89
|
-
end
|
90
|
-
|
91
|
-
### Task: rcov
|
92
|
-
task :rcov => :coverage
|
93
|
-
|
94
|
-
### Other coverage tasks
|
95
|
-
namespace :coverage do
|
96
|
-
desc "Generate a detailed text coverage report"
|
97
|
-
RSpec::Core::RakeTask.new( :text ) do |task|
|
98
|
-
task.rcov_opts = RCOV_OPTS + ['--text-report']
|
99
|
-
task.rcov = true
|
100
|
-
end
|
101
|
-
|
102
|
-
desc "Show differences in coverage from last run"
|
103
|
-
RSpec::Core::RakeTask.new( :diff ) do |task|
|
104
|
-
task.rspec_opts = ['-f', 'p', '-b']
|
105
|
-
task.rcov_opts = RCOV_OPTS - ['--save'] + ['--text-coverage-diff']
|
106
|
-
task.rcov = true
|
107
|
-
end
|
108
|
-
|
109
|
-
desc "Run RCov in 'spec-only' mode to check coverage from specs"
|
110
|
-
RSpec::Core::RakeTask.new( :speconly ) do |task|
|
111
|
-
task.rcov_opts = ['--exclude', RCOV_EXCLUDES, '--text-report', '--save']
|
112
|
-
task.rcov = true
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
CLOBBER.include( COVERAGE_TARGETDIR )
|
117
|
-
rescue LoadError => err
|
118
|
-
task :no_rspec do
|
119
|
-
$stderr.puts "Specification tasks not defined: %s" % [ err.message ]
|
120
|
-
end
|
121
|
-
|
122
|
-
task :spec => :no_rspec
|
123
|
-
namespace :spec do
|
124
|
-
task :autotest => :no_rspec
|
125
|
-
task :doc => :no_rspec
|
126
|
-
task :profile => :no_rspec
|
127
|
-
task :quiet => :no_rspec
|
128
|
-
task :html => :no_rspec
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
### Test::Unit tests
|
134
|
-
begin
|
135
|
-
require 'rake/testtask'
|
136
|
-
|
137
|
-
Rake::TestTask.new( :unittests ) do |task|
|
138
|
-
task.libs += [LIBDIR]
|
139
|
-
task.test_files = TEST_FILES
|
140
|
-
task.verbose = true
|
141
|
-
end
|
142
|
-
|
143
|
-
rescue LoadError => err
|
144
|
-
task :no_test do
|
145
|
-
$stderr.puts "Test tasks not defined: %s" % [ err.message ]
|
146
|
-
end
|
147
|
-
|
148
|
-
task :unittests => :no_rspec
|
149
|
-
end
|
150
|
-
|
151
|
-
|
data/rake/verifytask.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
### S U B V E R S I O N T A S K S A N D H E L P E R S
|
3
|
-
#####################################################################
|
4
|
-
|
5
|
-
require 'rake/tasklib'
|
6
|
-
|
7
|
-
#
|
8
|
-
# Work around the inexplicable behaviour of the original RDoc::VerifyTask, which
|
9
|
-
# errors if your coverage isn't *exactly* the threshold.
|
10
|
-
#
|
11
|
-
|
12
|
-
# A task that can verify that the RCov coverage doesn't
|
13
|
-
# drop below a certain threshold. It should be run after
|
14
|
-
# running Spec::Rake::SpecTask.
|
15
|
-
class VerifyTask < Rake::TaskLib
|
16
|
-
|
17
|
-
COVERAGE_PERCENTAGE_PATTERN =
|
18
|
-
%r{<tt class='coverage_code'>(\d+\.\d+)%</tt>}
|
19
|
-
|
20
|
-
# Name of the task. Defaults to :verify_rcov
|
21
|
-
attr_accessor :name
|
22
|
-
|
23
|
-
# Path to the index.html file generated by RCov, which
|
24
|
-
# is the file containing the total coverage.
|
25
|
-
# Defaults to 'coverage/index.html'
|
26
|
-
attr_accessor :index_html
|
27
|
-
|
28
|
-
# Whether or not to output details. Defaults to true.
|
29
|
-
attr_accessor :verbose
|
30
|
-
|
31
|
-
# The threshold value (in percent) for coverage. If the
|
32
|
-
# actual coverage is not equal to this value, the task will raise an
|
33
|
-
# exception.
|
34
|
-
attr_accessor :threshold
|
35
|
-
|
36
|
-
def initialize( name=:verify )
|
37
|
-
@name = name
|
38
|
-
@index_html = 'coverage/index.html'
|
39
|
-
@verbose = true
|
40
|
-
yield self if block_given?
|
41
|
-
raise "Threshold must be set" if @threshold.nil?
|
42
|
-
define
|
43
|
-
end
|
44
|
-
|
45
|
-
def define
|
46
|
-
desc "Verify that rcov coverage is at least #{threshold}%"
|
47
|
-
|
48
|
-
task @name do
|
49
|
-
total_coverage = nil
|
50
|
-
if match = File.read( index_html ).match( COVERAGE_PERCENTAGE_PATTERN )
|
51
|
-
total_coverage = Float( match[1] )
|
52
|
-
else
|
53
|
-
raise "Couldn't find the coverage percentage in #{index_html}"
|
54
|
-
end
|
55
|
-
|
56
|
-
puts "Coverage: #{total_coverage}% (threshold: #{threshold}%)" if verbose
|
57
|
-
if total_coverage < threshold
|
58
|
-
raise "Coverage must be at least #{threshold}% but was #{total_coverage}%"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# vim: set nosta noet ts=4 sw=4:
|