-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
213 lines (183 loc) · 6.25 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# -*- ruby -*-
require File.expand_path("#{File.dirname(__FILE__)}/spec/helper/test_gem_home")
GemInstaller::TestGemHome.install_rubygems
begin
require 'hoe'
rescue LoadError => e
puts e
abort "ERROR: GemInstaller has build- and test-time dependencies
on Hoe and other libraries. Run the 'geminstaller'
executable from the root of the geminstaller source
tree, and GemInstaller will automatically install
these dependencies."
end
puts "Gem::RubyGemsVersion = #{Gem::RubyGemsVersion}"
require './lib/geminstaller.rb'
require './lib/geminstaller/hoe_extensions.rb'
IndependentHoe.plugin :seattlerb
IndependentHoe.spec 'geminstaller' do |p|
developer 'Chad Woolley', '[email protected]'
p.rubyforge_name = 'geminstaller'
p.version = GemInstaller.version
p.summary = "See http://geminstaller.rubyforge.org"
clean_globs << 'coverage'
clean_globs << 'website/out'
clean_globs << 'website/output'
clean_globs << '**/webgen.cache'
p.extra_deps = []
end
def run_smoketest(path_to_smoketest)
cmd = "#{Hoe::RUBY_FLAGS} #{path_to_smoketest} #{Hoe::FILTER}"
result = send :ruby, cmd
raise "#{path_to_smoketest} Smoketest failed" unless result == 0 || result == true
end
desc "Run all metrics"
task :metrics do
Rake::Task[:coverage].invoke
Rake::Task[:audit].invoke
end
task :coverage do
rm_rf "coverage"
rm_rf "website/out/code/coverage"
sh "mkdir -p website/out/code"
sh "rcov -o website/out/code/coverage test_suites/test_all.rb"
end
task :coverage_no_fail do
begin
Rake::Task[:coverage].invoke
rescue
end
end
desc "Diff the manifest"
task :diff_manifest => :clean do
f = "Manifest.tmp"
require 'find'
files = []
Find.find '.' do |path|
next unless File.file? path
next if path =~ /\.svn|tmp$|CVS/
next if path =~ /\.git|\.gitmodules/
next if path =~ /dummyrepo/
next if path =~ /\.iml|\.ipr|\.iws|\.kpf|\.tmproj|\.project/
next if path =~ /\.idea/
next if path =~ /tmtags/
next if path =~ /\.\/nbproject/
next if path =~ /\.\/spec/
next if path =~ /\.\/test_suites/
next if path =~ /\.\/pkg/
next if path =~ /\.\/out/
next if path =~ /\.\/website\/out/
next if path =~ /\.DS_Store/
next if path =~ /\.rvmrc/
next if path =~ /Gemfile/
files << path[2..-1]
end
files = files.sort.join "\n"
File.open f, 'w' do |fp| fp.puts files end
system "diff -du Manifest.txt #{f}"
rm f
end
desc "Update the manifest"
task :update_manifest do
system('rake diff_manifest | patch -p0 Manifest.txt')
end
desc "Run Webgen to generate website"
task :webgen do
# rm_rf "website/out"
rm_rf "website/webgen.cache"
# Use webgen/RedCloth versions from GemInstaller config
# require 'geminstaller'
# GemInstaller.autogem
# ARGV.clear
# ARGV.concat(['-d','website'])
# load 'webgen'
sh 'webgen -d website'
end
desc "Move ri docs to website"
task :website_rdocs => :docs do
rm_rf "website/out/code/rdoc"
sh "mkdir -p website/out/code/"
mv "doc", "website/out/code/rdoc"
end
desc "Generate website, including rdoc and coverage"
task :website => [:webgen, :website_rdocs, :coverage] do
end
desc 'Publish website to RubyForge'
task :publish_website => [:clean, :website, :upload_website] do
end
desc 'Publish website to RubyForge even if test coverage run rails'
task :publish_website_no_fail => [:clean, :webgen, :website_rdocs, :coverage_no_fail, :upload_website] do
end
desc 'Upload website (should already be clean and generated)'
task :upload_website do
host = "[email protected]"
remote_dir = "/var/www/gforge-projects/geminstaller"
local_dir = 'website/out'
sh %{rsync -av --delete --exclude=statsvn #{local_dir}/ #{host}:#{remote_dir}}
end
desc 'Run All Smoketests'
task :all_smoketest => [:git_submodule_update, :clean] do
run_smoketest 'test_suites/test_all_smoketests.rb'
end
desc 'Run Install Smoketest'
task :install_smoketest => [:git_submodule_update, :clean] do
run_smoketest 'spec/smoketest/install_smoketest.rb'
end
desc 'Run AutoGem Smoketest'
task :autogem_smoketest => [:git_submodule_update, :clean] do
run_smoketest 'spec/smoketest/autogem_smoketest.rb'
end
desc 'Run Rails Smoketest'
task :rails_smoketest => [:git_submodule_update, :clean] do
run_smoketest 'spec/smoketest/rails_smoketest.rb'
end
desc 'Run Debug Smoketest'
task :debug_smoketest => [:git_submodule_update, :clean] do
run_smoketest 'spec/smoketest/debug_smoketest.rb'
end
desc 'CruiseControl.rb default task'
task :cruise => [:geminstaller, :git_submodule_commit_and_push] do
Rake::Task[:default].invoke
end
desc 'Run GemInstaller to install development dependencies'
task :geminstaller do
system('geminstaller') || raise("'geminstaller' command failed")
end
desc 'Git submodules init and update'
task :git_submodule_update do
if File.exist?(File.dirname(__FILE__) + "/.git")
# NOTE: If you remove a submodule, you must do 'git rm --cached [path to deleted submodule]' or else you will get warnings
sh "git submodule init"
sh "git submodule update"
end
end
# TODO: make these use submodule foreach option
desc 'Git submodules init, update, and pull'
task :git_submodule_pull => [:git_submodule_update] do
if File.exist?(File.dirname(__FILE__) + "/.git")
sh "cd dummyrepo && git pull origin master && git status; cd .."
sh "cd spec/fixture/rubygems_dist/rubygems-trunk/ && git pull origin master && git status; cd ../../../../"
end
end
# TODO: make these use submodule foreach option
desc 'Git submodules init, update, pull, commit, and push - warning - does a commit and push to remote repo'
task :git_submodule_commit_and_push => [:git_submodule_pull] do
if File.exist?(File.dirname(__FILE__) + "/.git") && git_repo_writeable?
puts "Updating, committing, and pushing git submodule updates..."
git_commit_submodule_commit('dummyrepo')
git_commit_submodule_commit('spec/fixture/rubygems_dist/rubygems-trunk')
sh "git push"
end
end
def git_commit_submodule_commit(submodule_path)
sh "git commit #{submodule_path} -m 'update #{submodule_path} submodule'" do |ok, res|
if !ok and res.exitstatus != 1
puts "pattern not found (status = #{res.exitstatus})"
raise "git #{submodule_path} submodule commit failed"
end
end
end
def git_repo_writeable?
`git config --get-regexp remote\..+\.url` =~ /git@/
end
# vim: syntax=Ruby