forked from ELLIOTTCABLE/stringray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
93 lines (78 loc) · 3.05 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
require 'stringray'
require 'extlib/string' # String#/, because I'm a lazy fuck.
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
begin
require 'echoe'
namespace :echoe do
Echoe.new('StringRay', StringRay::VERSION) do |g|
g.name = 'stringray'
g.author = ['elliottcable']
g.email = ['StringRay@elliottcable.com']
g.summary = 'Combining many of the benefits of Arrays and Strings, StringRay allows you to treat a String as an Array of words in many cases.'
g.url = 'http://github.com/elliottcable/stringray'
g.dependencies = []
g.manifest_name = '.manifest'
g.ignore_pattern = ['.git', 'meta', 'stringray.gemspec']
end
desc 'tests packaged files to ensure they are all present'
task :verify => :package do
# An error message will be displayed if files are missing
if system %(ruby -e "require 'rubygems'; require 'pkg/merb_strokedb-#{StringRay::VERSION}/lib/stringray'")
puts "\nThe library files are present"
end
end
task :copy_gemspec => [:package] do
pkg = Dir['pkg/*'].select {|dir| File.directory? dir}.last
mv File.join(pkg, pkg.gsub(/^pkg\//,'').gsub(/\-\d+$/,'.gemspec')), './'
end
desc 'builds a gemspec as GitHub wants it'
task :gemspec => [:package, :copy_gemspec, :clobber_package]
# desc 'Run specs, clean tree, update manifest, run coverage, and install gem!'
desc 'Clean tree, update manifest, and install gem!'
task :magic => [:clean, :manifest, :install]
end
task :manifest => [:'echoe:manifest']
rescue LoadError => boom
puts "You are missing a dependency required for meta-operations on this gem."
puts "#{boom.to_s.capitalize}."
ensure
task :default # No effect # Invisible
# Runs specs, generates rcov, and opens rcov in your browser.
namespace :rcov do
Spec::Rake::SpecTask.new(:run) do |t|
t.spec_opts = ["--format", "specdoc", "--colour"]
t.spec_files = Dir['spec/**/*_spec.rb'].sort
t.libs = ['lib']
t.rcov = true
t.rcov_dir = 'meta' / 'coverage'
end
Spec::Rake::SpecTask.new(:plain) do |t|
t.spec_opts = ["--format", "specdoc"]
t.spec_files = Dir['spec/**/*_spec.rb'].sort
t.libs = ['lib']
t.rcov = true
t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '^lib']
t.rcov_dir = 'meta' / 'coverage'
end
RCov::VerifyTask.new(:verify) do |t|
t.threshold = 100
t.index_html = 'meta' / 'coverage' / 'index.html'
end
task :open do
system 'open ' + 'meta' / 'coverage' / 'index.html' if PLATFORM['darwin']
end
end
namespace :git do
task :status do
`git status`
end
end
desc 'Check everything over before commiting'
task :aok => [:'echoe:manifest', :'rcov:run', :'rcov:verify', :'rcov:ratio', :'rcov:open', :'git:status']
# desc 'Task run during continuous integration' # Invisible
task :cruise => [:'rcov:plain', :'rcov:verify', :'rcov:ratio']
end