forked from kputnam/stupidedi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
108 lines (94 loc) · 2.33 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
require "pathname"
abspath = Pathname.new(File.dirname(__FILE__)).expand_path
relpath = abspath.relative_path_from(Pathname.pwd)
begin
require "rubygems"
require "bundler/setup"
rescue LoadError
warn "couldn't load bundler:"
warn " #{$!}"
end
task :default => :spec
task :console do
exec *%w(irb -I lib -r stupidedi)
end
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new do |t|
t.verbose = false
t.pattern = "#{relpath}/spec/examples/**/*.example"
t.rspec_opts = %w(--color --format p)
t.rspec_opts << "-I#{abspath}/spec"
end
rescue LoadError => first
begin
require "spec/rake/spectask"
Spec::Rake::SpecTask.new do |t|
t.pattern = "#{relpath}/spec/examples/**/*.example"
t.spec_opts << "--color"
t.spec_opts << "--format p"
t.libs << "#{abspath}/spec"
end
rescue LoadError => second
task :spec do
warn "couldn't load rspec version 1 or 2:"
warn " #{first}"
warn " #{second}"
exit 1
end
end
end
begin
require "rcov"
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:rcov) do |t|
t.rcov = true
t.rcov_opts = "--exclude spec/,gems/,00401"
t.verbose = false
t.pattern = "#{relpath}/spec/examples/**/*.example"
t.rspec_opts = %w(--color --format p)
t.rspec_opts << "-I#{abspath}/spec"
end
rescue LoadError => first
begin
require "spec/rake/spectask"
Spec::Rake::SpecTask.new(:rcov) do |t|
t.rcov = true
t.rcov_opts = %w(--exclude spec/,gems/)
t.pattern = "#{relpath}/spec/examples/**/*.example"
t.spec_opts << "--color"
t.spec_opts << "--format=p"
t.libs << "#{abspath}/spec"
end
rescue LoadError => second
task :rcov do
warn "couldn't load rspec version 1 or 2:"
warn " #{first}"
warn " #{second}"
exit 1
end
end
end
rescue LoadError
task :rcov do
warn "couldn't load rcov:"
warn " #{$!}"
exit 1
end
end
begin
require "yard"
# Note options are loaded from .yardopts
YARD::Rake::YardocTask.new(:yard => :clobber_yard)
task :clobber_yard do
rm_rf "#{relpath}/doc/generated"
mkdir_p "#{relpath}/doc/generated/images"
end
rescue LoadError
task :yard do
warn "couldn't load yard:"
warn " #{$!}"
exit 1
end
end