Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 213 lines (170 sloc) 5.834 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
527aadb @joshk Updated the travis rake task to capture individual rake task failures…
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
74ee162 @indirect Minor rakefile organization
indirect authored
37 desc "Run the spec suite with the sudo tests"
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
38 task :sudo => ["set_sudo", "spec", "clean_sudo"]
74ee162 @indirect Minor rakefile organization
indirect authored
39
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
40 task :set_sudo do
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
41 ENV['BUNDLER_SUDO_TESTS'] = '1'
42 end
43
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
44 task :clean_sudo do
45 puts "Cleaning up sudo test files..."
46 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
47 end
48
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
49 namespace :rubygems do
c78d29f @indirect update rubygems versions
indirect authored
50 # Rubygems specs by version
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
51 rubyopt = ENV["RUBYOPT"]
ce83b23 @indirect rubygems is up to 1.8.10 now
indirect authored
52 %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
53 desc "Run specs with Rubygems #{rg}"
54 RSpec::Core::RakeTask.new(rg) do |t|
55 t.rspec_opts = %w(-fs --color)
56 t.ruby_opts = %w(-w)
57 end
58
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
59 # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
60 namespace rg do
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
61 task :sudo => ["set_sudo", rg, "clean_sudo"]
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
62 end
63
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
64 task "clone_rubygems_#{rg}" do
3d724d6 @indirect Update Rubygems test versions
indirect authored
65 unless File.directory?("tmp/rubygems")
66 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
67 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
68 hash = nil
69
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
70 Dir.chdir("tmp/rubygems") do
6f49167 @indirect In further git genius, update tags before checking them out
indirect authored
71 system("git remote update")
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
72 system("git checkout #{rg}")
73 system("git pull origin master") if rg == "master"
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
74 hash = `git rev-parse HEAD`.strip
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
75 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
76
77 puts "Running bundler specs against rubygems '#{rg}' at #{hash}"
3d724d6 @indirect Update Rubygems test versions
indirect authored
78 ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
79 end
80
e22fc71 @joshk we need to build the man pages before running the tests
joshk authored
81 task rg => ["clone_rubygems_#{rg}", "man:build"]
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
82 task "rubygems:all" => rg
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
83 end
5f4a8f3 Phase 1 of rubygems/bundler reintegration
Evan Phoenix authored
84
85 desc "Run specs under a Rubygems checkout (set RG=path)"
86 RSpec::Core::RakeTask.new("co") do |t|
87 t.rspec_opts = %w(-fs --color)
88 t.ruby_opts = %w(-w)
89 end
90
91 task "setup_co" do
92 ENV["RUBYOPT"] = "-I#{File.expand_path ENV['RG']} #{rubyopt}"
93 end
94
95 task "co" => "setup_co"
96 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
97 end
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
98
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
99 namespace :ruby do
100 # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
101 task "ensure_rvm" do
102 raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
103 end
715f150 Make bundler work with RG 1.3.5, 1.3.6 and trunk and create a spec ta…
Carlhuda authored
104
c78d29f @indirect update rubygems versions
indirect authored
105 %w(1.8.6-p420 1.8.7-p334 1.9.2-p180).each do |ruby|
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
106 ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
107
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
108 desc "Run specs on Ruby #{ruby}"
109 RSpec::Core::RakeTask.new(ruby) do |t|
110 t.rspec_opts = %w(-fs --color)
111 t.ruby_opts = %w(-w)
112 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
113
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
114 task "ensure_ruby_#{ruby}" do
115 raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
116 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
117
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
118 task "ensure_ruby_#{ruby}" => "ensure_rvm"
119 task ruby => "ensure_ruby_#{ruby}"
120 task "ruby:all" => ruby
121 end
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
122 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
123
992c2a4 @indirect argh how did that happen
indirect authored
124 desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
f419c42 @indirect and the travis task should be inside the spec namespace
indirect authored
125 task "travis" do
992c2a4 @indirect argh how did that happen
indirect authored
126 rg = ENV['RGV'] || 'master'
527aadb @joshk Updated the travis rake task to capture individual rake task failures…
joshk authored
127
992c2a4 @indirect argh how did that happen
indirect authored
128 puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
527aadb @joshk Updated the travis rake task to capture individual rake task failures…
joshk authored
129 specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke }
130
131 Rake::Task["spec:rubygems:#{rg}"].reenable
132
133 puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
134 sudos = safe_task { Rake::Task["spec:rubygems:#{rg}:sudo"].invoke }
135
136 unless specs && sudos
137 fail "Bundler tests failed, please review the log for more information"
138 end
f419c42 @indirect and the travis task should be inside the spec namespace
indirect authored
139 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
140 end
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
141
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
142 namespace :man do
143 directory "lib/bundler/man"
144
145 Dir["man/*.ronn"].each do |ronn|
146 basename = File.basename(ronn, ".ronn")
147 roff = "lib/bundler/man/#{basename}"
148
149 file roff => ["lib/bundler/man", ronn] do
150 sh "ronn --roff --pipe #{ronn} > #{roff}"
151 end
152
153 file "#{roff}.txt" => roff do
154 sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
155 end
156
157 task :build_all_pages => "#{roff}.txt"
158 end
159
160 desc "Build the man pages"
161 task :build => "man:build_all_pages"
162
163 desc "Clean up from the built man pages"
164 task :clean do
165 rm_rf "lib/bundler/man"
166 end
167 end
168
1ce02b4 @indirect always have the spec:deps task available
indirect authored
169 begin
170 require 'ci/reporter/rake/rspec'
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
171
1ce02b4 @indirect always have the spec:deps task available
indirect authored
172 namespace :ci do
173 desc "Run specs with Hudson output"
174 RSpec::Core::RakeTask.new(:spec)
175 task :spec => ["ci:setup:rspec", "man:build"]
176 end
adbe01d @indirect rake spec:deps to install ronn and rspec 2.0
indirect authored
177
1ce02b4 @indirect always have the spec:deps task available
indirect authored
178 rescue LoadError
179 namespace :ci do
180 task :spec do
181 abort "Run `rake ci:deps` to be able to run the CI specs"
182 end
183
184 desc "Install CI dependencies"
185 task :deps do
186 sh "gem list ci_reporter | (grep 'ci_reporter' 1> /dev/null) || gem install ci_reporter --no-ri --no-rdoc"
187 end
188 task :deps => "spec:deps"
9e492c6 @indirect rake ci:spec now outputs JUnit XML for Hudson
indirect authored
189 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
190 end
9e492c6 @indirect rake ci:spec now outputs JUnit XML for Hudson
indirect authored
191
1ce02b4 @indirect always have the spec:deps task available
indirect authored
192 rescue LoadError
193 task :spec do
194 abort "Run `rake spec:deps` to be able to run the specs"
195 end
715f150 Make bundler work with RG 1.3.5, 1.3.6 and trunk and create a spec ta…
Carlhuda authored
196 end
197
1012be8 @spastorino Add Rake task to allow building vendor dir
spastorino authored
198 namespace :vendor do
199 desc "Build the vendor dir"
200 task :build => :clean do
201 sh "git clone git://github.com/wycats/thor.git lib/bundler/vendor/tmp"
202 sh "mv lib/bundler/vendor/tmp/lib/* lib/bundler/vendor/"
203 rm_rf "lib/bundler/vendor/tmp"
204 end
205
206 desc "Clean the vendor dir"
207 task :clean do
208 rm_rf "lib/bundler/vendor"
209 end
210 end
211
e4adbf7 @carllerche Update Rakefile for rspec 2 beta22
carllerche authored
212 task :default => :spec
Something went wrong with that request. Please try again.