Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 201 lines (159 sloc) 5.539 kB
60c031d @sferik Use the new `bundle gem` defaults
sferik authored
1 # -*- encoding: utf-8 -*-
67859e4 Moving in thor
Carlhuda authored
2 $:.unshift File.expand_path("../lib", __FILE__)
434b2aa @indirect use the easier gem tasks
indirect authored
3 require 'bundler/gem_tasks'
67859e4 Moving in thor
Carlhuda authored
4
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
5 def safe_task(&block)
6 yield
7 true
8 rescue
9 false
10 end
11
1ce02b4 @indirect always have the spec:deps task available
indirect authored
12 namespace :spec do
13 desc "Ensure spec dependencies are installed"
14 task :deps do
15 sh "gem list ronn | (grep 'ronn' 1> /dev/null) || gem install ronn --no-ri --no-rdoc"
f87201b @indirect Check for RSpec 2.x not 2.0.x
indirect authored
16 sh "gem list rspec | (grep 'rspec (2.' 1> /dev/null) || gem install rspec --no-ri --no-rdoc"
1ce02b4 @indirect always have the spec:deps task available
indirect authored
17 end
18 end
19
67859e4 Moving in thor
Carlhuda authored
20 begin
1ce02b4 @indirect always have the spec:deps task available
indirect authored
21 # running the specs needs both rspec and ronn
870ad85 @wycats Get Bundler tests running on RSpec 2
wycats authored
22 require 'rspec/core/rake_task'
1ce02b4 @indirect always have the spec:deps task available
indirect authored
23 require 'ronn'
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
24
67859e4 Moving in thor
Carlhuda authored
25 desc "Run specs"
870ad85 @wycats Get Bundler tests running on RSpec 2
wycats authored
26 RSpec::Core::RakeTask.new do |t|
e4adbf7 @carllerche Update Rakefile for rspec 2 beta22
carllerche authored
27 t.rspec_opts = %w(-fs --color)
28 t.ruby_opts = %w(-w)
67859e4 Moving in thor
Carlhuda authored
29 end
2c82b5e @indirect Better names for manpage tasks
indirect authored
30 task :spec => "man:build"
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
31
32 namespace :spec do
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
33 task :clean do
34 rm_rf 'tmp'
35 end
36
ba80464 @indirect real-world spec for index search cache bug
indirect authored
37 desc "Run the real-world spec suite (reequires internet)"
38 task :realworld => ["set_realworld", "spec"]
39
40 task :set_realworld do
41 ENV['BUNDLER_REALWORLD_TESTS'] = '1'
42 end
43
74ee162 @indirect Minor rakefile organization
indirect authored
44 desc "Run the spec suite with the sudo tests"
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
45 task :sudo => ["set_sudo", "spec", "clean_sudo"]
74ee162 @indirect Minor rakefile organization
indirect authored
46
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
47 task :set_sudo do
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
48 ENV['BUNDLER_SUDO_TESTS'] = '1'
49 end
50
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
51 task :clean_sudo do
52 puts "Cleaning up sudo test files..."
53 system "sudo rm -rf #{File.expand_path('../tmp/sudo_gem_home', __FILE__)}"
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
54 end
55
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
56 namespace :rubygems do
c78d29f @indirect update rubygems versions
indirect authored
57 # Rubygems specs by version
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
58 rubyopt = ENV["RUBYOPT"]
ce83b23 @indirect rubygems is up to 1.8.10 now
indirect authored
59 %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.10).each do |rg|
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
60 desc "Run specs with Rubygems #{rg}"
61 RSpec::Core::RakeTask.new(rg) do |t|
62 t.rspec_opts = %w(-fs --color)
63 t.ruby_opts = %w(-w)
64 end
65
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
66 # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
67 namespace rg do
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
68 task :sudo => ["set_sudo", rg, "clean_sudo"]
8a66d1f @indirect run realworld specs on travis
indirect authored
69 task :realworld => ["set_realworld", rg]
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
70 end
71
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
72 task "clone_rubygems_#{rg}" do
3d724d6 @indirect Update Rubygems test versions
indirect authored
73 unless File.directory?("tmp/rubygems")
74 system("git clone git://github.com/rubygems/rubygems.git tmp/rubygems")
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
75 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
76 hash = nil
77
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
78 Dir.chdir("tmp/rubygems") do
6f49167 @indirect In further git genius, update tags before checking them out
indirect authored
79 system("git remote update")
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
80 system("git checkout #{rg}")
81 system("git pull origin master") if rg == "master"
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
82 hash = `git rev-parse HEAD`.strip
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
83 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
84
85 puts "Running bundler specs against rubygems '#{rg}' at #{hash}"
3d724d6 @indirect Update Rubygems test versions
indirect authored
86 ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
87 end
88
ef42a1f @indirect make sure manpages get built before rubygems specs
indirect authored
89 task rg => ["clone_rubygems_#{rg}", "man:build"]
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
90 task "rubygems:all" => rg
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
91 end
5f4a8f3 Phase 1 of rubygems/bundler reintegration
Evan Phoenix authored
92
93 desc "Run specs under a Rubygems checkout (set RG=path)"
94 RSpec::Core::RakeTask.new("co") do |t|
95 t.rspec_opts = %w(-fs --color)
96 t.ruby_opts = %w(-w)
97 end
98
99 task "setup_co" do
100 ENV["RUBYOPT"] = "-I#{File.expand_path ENV['RG']} #{rubyopt}"
101 end
102
103 task "co" => "setup_co"
104 task "rubygems:all" => "co"
715f150 Make bundler work with RG 1.3.5, 1.3.6 and trunk and create a spec ta…
Carlhuda authored
105 end
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
106
992c2a4 @indirect argh how did that happen
indirect authored
107 desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
8a66d1f @indirect run realworld specs on travis
indirect authored
108 task :travis do
992c2a4 @indirect argh how did that happen
indirect authored
109 rg = ENV['RGV'] || 'master'
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
110
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
111 puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
112 specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke }
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
113
f8fdf6d @joshk we need to reenable more than one rake task
joshk authored
114 Rake::Task["spec:rubygems:#{rg}"].reenable
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
115
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
116 puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
117 sudos = safe_task { Rake::Task["spec:rubygems:#{rg}:sudo"].invoke }
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
118
8a66d1f @indirect run realworld specs on travis
indirect authored
119 Rake::Task["spec:rubygems:#{rg}"].reenable
120
121 puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n"
122 realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
123
124 unless specs && sudos && realworld
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
125 fail "Bundler tests failed, please review the log for more information"
126 end
f419c42 @indirect and the travis task should be inside the spec namespace
indirect authored
127 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
128 end
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
129
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
130 namespace :man do
131 directory "lib/bundler/man"
132
133 Dir["man/*.ronn"].each do |ronn|
134 basename = File.basename(ronn, ".ronn")
135 roff = "lib/bundler/man/#{basename}"
136
137 file roff => ["lib/bundler/man", ronn] do
138 sh "ronn --roff --pipe #{ronn} > #{roff}"
139 end
140
141 file "#{roff}.txt" => roff do
142 sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
143 end
144
145 task :build_all_pages => "#{roff}.txt"
146 end
147
148 desc "Build the man pages"
149 task :build => "man:build_all_pages"
150
151 desc "Clean up from the built man pages"
152 task :clean do
153 rm_rf "lib/bundler/man"
154 end
155 end
156
1ce02b4 @indirect always have the spec:deps task available
indirect authored
157 begin
158 require 'ci/reporter/rake/rspec'
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
159
1ce02b4 @indirect always have the spec:deps task available
indirect authored
160 namespace :ci do
161 desc "Run specs with Hudson output"
162 RSpec::Core::RakeTask.new(:spec)
163 task :spec => ["ci:setup:rspec", "man:build"]
164 end
adbe01d @indirect rake spec:deps to install ronn and rspec 2.0
indirect authored
165
1ce02b4 @indirect always have the spec:deps task available
indirect authored
166 rescue LoadError
167 namespace :ci do
168 task :spec do
169 abort "Run `rake ci:deps` to be able to run the CI specs"
170 end
171
172 desc "Install CI dependencies"
173 task :deps do
174 sh "gem list ci_reporter | (grep 'ci_reporter' 1> /dev/null) || gem install ci_reporter --no-ri --no-rdoc"
175 end
176 task :deps => "spec:deps"
9e492c6 @indirect rake ci:spec now outputs JUnit XML for Hudson
indirect authored
177 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
178 end
9e492c6 @indirect rake ci:spec now outputs JUnit XML for Hudson
indirect authored
179
1ce02b4 @indirect always have the spec:deps task available
indirect authored
180 rescue LoadError
181 task :spec do
182 abort "Run `rake spec:deps` to be able to run the specs"
183 end
715f150 Make bundler work with RG 1.3.5, 1.3.6 and trunk and create a spec ta…
Carlhuda authored
184 end
185
1012be8 @spastorino Add Rake task to allow building vendor dir
spastorino authored
186 namespace :vendor do
187 desc "Build the vendor dir"
188 task :build => :clean do
189 sh "git clone git://github.com/wycats/thor.git lib/bundler/vendor/tmp"
190 sh "mv lib/bundler/vendor/tmp/lib/* lib/bundler/vendor/"
191 rm_rf "lib/bundler/vendor/tmp"
192 end
193
194 desc "Clean the vendor dir"
195 task :clean do
196 rm_rf "lib/bundler/vendor"
197 end
198 end
199
e4adbf7 @carllerche Update Rakefile for rspec 2 beta22
carllerche authored
200 task :default => :spec
Something went wrong with that request. Please try again.