-
Notifications
You must be signed in to change notification settings - Fork 74
/
Rakefile
108 lines (75 loc) · 1.75 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
#
# bundle exec rake xxx
#
require 'rake'
require 'rake/clean'
require 'rdoc/task'
#
# clean
CLEAN.include('pkg', 'rdoc', 'ruote_work', 'ruote_data')
#
# test
task :test do
sh 'ruby -I. test/unit/test.rb'
sh 'ruby -I. test/functional/test.rb'
end
task :default => [ :test ]
#
# gem
GEMSPEC_FILE = Dir['*.gemspec'].first
GEMSPEC = eval(File.read(GEMSPEC_FILE))
GEMSPEC.validate
desc %{
builds the gem and places it in pkg/
}
task :build do
sh "gem build #{GEMSPEC_FILE}"
sh "mkdir pkg" rescue nil
sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
end
desc %{
builds the gem and pushes it to rubygems.org
}
task :push => :build do
sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
end
#
# rdoc
#
# make sure to have rdoc 2.5.x to run that
Rake::RDocTask.new do |rd|
rd.main = 'README.rdoc'
rd.rdoc_dir = 'rdoc'
rd.rdoc_files.include(
'README.rdoc', 'CHANGELOG.txt', 'CREDITS.txt', 'lib/**/*.rb')
rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
end
#
# upload_rdoc
desc %{
upload the rdoc to rubyforge
}
task :upload_rdoc => [ :clean, :rdoc ] do
account = '[email protected]'
webdir = '/var/www/gforge-projects/ruote'
sh "rsync -azv -e ssh rdoc #{account}:#{webdir}/"
end
#
# leverage rdoc.info instead
desc %{
attempt at detecting test methods with the same name
}
task :doublons do
lines = `grep -r " def test_" test/ | sort`.split("\n")
lines.inject(nil) do |previous, line|
puts line if line == previous
line
end
lines = `grep -r "TestCase" test/`.split("\n")
lines = lines.collect { |line| [ line, line.split(/\.rb:/).last ] }
lines = lines.sort_by { |line, klass| klass }
lines.inject(nil) do |previous, (line, klass)|
puts klass if line == previous
line
end
end