Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 344 lines (284 sloc) 10.52 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__)
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
3 require "shellwords"
4 require "benchmark"
88d49f2 @indirect simplify the certs manager
indirect authored
5
8c2b02a @indirect certificate manager namespacing and path expansion
indirect authored
6 RUBYGEMS_REPO = File.expand_path("tmp/rubygems")
d05497a @indirect check rspec version while running specs
indirect authored
7 BUNDLER_SPEC = Gem::Specification.load("bundler.gemspec")
f711a47 @indirect benchmark all the tasks. because we can.
indirect authored
8
ef47173 @indirect create task to test against rubygems 2 rc1
indirect authored
9 def safe_task(&block)
10 yield
11 true
12 rescue
13 false
14 end
15
f711a47 @indirect benchmark all the tasks. because we can.
indirect authored
16 # Benchmark task execution
17 module Rake
18 class Task
19 alias_method :real_invoke, :invoke
20
21 def invoke(*args)
22 time = Benchmark.measure(@name) do
23 real_invoke(*args)
24 end
25 puts "#{@name} ran for #{time}"
26 end
27 end
28 end
67859e4 Moving in thor
Carlhuda authored
29
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
30 def clean_files(files, regex, replacement = "")
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
31 files.each do |file|
32 contents = File.read(file)
33 contents.gsub!(regex, replacement)
14a7eb2 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
34 File.open(file, "w") {|f| f << contents }
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
35 end
36 end
37
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
38 namespace :molinillo do
39 task :namespace do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
40 files = Dir.glob("lib/bundler/vendor/molinillo*/**/*.rb")
41 clean_files(files, "Molinillo", "Bundler::Molinillo")
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
42 clean_files(files, /require (["'])molinillo/, 'require \1bundler/vendor/molinillo/lib/molinillo')
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
43 end
44
45 task :clean do
14a7eb2 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
46 files = Dir.glob("lib/bundler/vendor/molinillo*/*", File::FNM_DOTMATCH).reject {|f| %(. .. lib).include? f.split("/").last }
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
47 rm_r files
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
48 end
49
df8ca47 @esasse Fix Lint/UnusedBlockArgument
esasse authored
50 task :update, [:tag] => [] do |_, args|
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
51 tag = args[:tag]
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
52 Dir.chdir "lib/bundler/vendor" do
53 rm_rf "molinillo"
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
54 sh "curl -L https://github.com/CocoaPods/molinillo/archive/#{tag}.tar.gz | tar -xz"
55 sh "mv Molinillo-* molinillo"
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
56 end
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
57 Rake::Task["molinillo:namespace"].invoke
58 Rake::Task["molinillo:clean"].invoke
a43c560 @segiddins [Resolver] Start migration to Molinillo
segiddins authored
59 end
60 end
61
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
62 namespace :thor do
63 task :namespace do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
64 files = Dir.glob("lib/bundler/vendor/thor*/**/*.rb")
65 clean_files(files, "Thor", "Bundler::Thor")
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
66 clean_files(files, /require (["'])thor/, 'require \1bundler/vendor/thor/lib/thor')
67 clean_files(files, /(autoload\s+[:\w]+,\s+["'])(thor[\w\/]+["'])/, '\1bundler/vendor/thor/lib/\2')
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
68 end
69
70 task :clean do
14a7eb2 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
71 files = Dir.glob("lib/bundler/vendor/thor*/*", File::FNM_DOTMATCH).reject {|f| %(. .. lib).include? f.split("/").last }
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
72 rm_r files
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
73 end
74
df8ca47 @esasse Fix Lint/UnusedBlockArgument
esasse authored
75 task :update, [:tag] => [] do |_, args|
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
76 tag = args[:tag]
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
77 Dir.chdir "lib/bundler/vendor" do
78 rm_rf "thor"
aef35ac @segiddins [Vendor] Dont change the load path to require vendored gems
segiddins authored
79 sh "curl -L https://github.com/erikhuda/thor/archive/#{tag}.tar.gz | tar -xz"
80 sh "mv thor-* thor"
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
81 end
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
82 Rake::Task["thor:namespace"].invoke
83 Rake::Task["thor:clean"].invoke
6b2affe @segiddins [Thor] Namespaced the vendored version of Thor and update to the v0.1…
segiddins authored
84 end
85 end
86
1ce02b4 @indirect always have the spec:deps task available
indirect authored
87 namespace :spec do
88 desc "Ensure spec dependencies are installed"
89 task :deps do
d05497a @indirect check rspec version while running specs
indirect authored
90 deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d|
bd7e5a7 @indirect move the dev deps list into the gemspec
indirect authored
91 [d.name, d.requirement.to_s]
a7c960e @indirect sort deps by name before installing them
indirect authored
92 end]
2e12a0f @segiddins [Rakefile] Properly install RuboCop
segiddins authored
93 deps["rubocop"] ||= ">= 0.32.1" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
2e2be72 @indirect Ruby 1.8 is still a thing
indirect authored
94
95 # JRuby can't build ronn or rdiscount, so we skip that
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
96 if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
2e2be72 @indirect Ruby 1.8 is still a thing
indirect authored
97 deps.delete("ronn")
98 deps.delete("rdiscount")
99 end
bc9c7b5 @headius Avoid installing C exts on JRuby to allow running specs.
headius authored
100
0f8bc78 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
101 deps.sort_by {|name, _| name }.each do |name, version|
0ede196 @marutosi fix "rake spec:deps" fails on MinGW Ruby 2.0
marutosi authored
102 sh %{#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || } +
103 %{#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc}
2868f49 @indirect rdiscount 2.0 doesn't compile on 1.9.2
indirect authored
104 end
264ada4 @indirect install those gems inside spec:deps, yup yup
indirect authored
105
106 # Download and install gems used inside tests
107 $LOAD_PATH.unshift("./spec")
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
108 require "support/rubygems_ext"
264ada4 @indirect install those gems inside spec:deps, yup yup
indirect authored
109 Spec::Rubygems.setup
1ce02b4 @indirect always have the spec:deps task available
indirect authored
110 end
b6b5f80 @indirect move the travis deps task above the rspec load
indirect authored
111
112 namespace :travis do
113 task :deps do
114 # Give the travis user a name so that git won't fatally error
22a1acc @indirect oops, need older rubygems to work
indirect authored
115 system "sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd"
b6b5f80 @indirect move the travis deps task above the rspec load
indirect authored
116 # Strip secure_path so that RVM paths transmit through sudo -E
22a1acc @indirect oops, need older rubygems to work
indirect authored
117 system "sudo sed -i '/secure_path/d' /etc/sudoers"
e3e9f4a @aprescott Allow bundle viz to work with dependencies satisfied by prereleases.
aprescott authored
118 # Install groff so ronn can generate man/help pages
22a1acc @indirect oops, need older rubygems to work
indirect authored
119 sh "sudo apt-get install groff -y"
e3e9f4a @aprescott Allow bundle viz to work with dependencies satisfied by prereleases.
aprescott authored
120 # Install graphviz so that the viz specs can run
121 sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
122 if RUBY_VERSION < "1.9"
22a1acc @indirect oops, need older rubygems to work
indirect authored
123 # Downgrade Rubygems on 1.8 so Ronn can be required
124 # https://github.com/rubygems/rubygems/issues/784
4d62410 @indirect :grimacing: lets try a real version of rubygems
indirect authored
125 sh "gem update --system 2.1.11"
22a1acc @indirect oops, need older rubygems to work
indirect authored
126 else
769eabc @JuanitoFatas [ci skip] Fix a typo in Rakefile.
JuanitoFatas authored
127 # Downgrade Rubygems so RSpec 3 can be installed
22a1acc @indirect oops, need older rubygems to work
indirect authored
128 # https://github.com/rubygems/rubygems/issues/813
129 sh "gem update --system 2.2.0"
0671915 @indirect downgrade rubygems on 1.8
indirect authored
130 end
b6b5f80 @indirect move the travis deps task above the rspec load
indirect authored
131 # Install the other gem deps, etc.
132 Rake::Task["spec:deps"].invoke
133 end
134 end
1ce02b4 @indirect always have the spec:deps task available
indirect authored
135 end
136
67859e4 Moving in thor
Carlhuda authored
137 begin
0f8bc78 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
138 rspec = BUNDLER_SPEC.development_dependencies.find {|d| d.name == "rspec" }
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
139 gem "rspec", rspec.requirement.to_s
140 require "rspec/core/rake_task"
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
141
67859e4 Moving in thor
Carlhuda authored
142 desc "Run specs"
6485b24 @indirect move spec task options into options file
indirect authored
143 RSpec::Core::RakeTask.new
2c82b5e @indirect Better names for manpage tasks
indirect authored
144 task :spec => "man:build"
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
145
c06f276 @segiddins Setup RuboCop
segiddins authored
146 if RUBY_VERSION >= "1.9.3"
147 # can't go in the gemspec because of the ruby version requirement
148 gem "rubocop", ">= 0.32.1"
149 require "rubocop/rake_task"
150 RuboCop::RakeTask.new
151 end
152
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
153 namespace :spec do
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
154 task :clean do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
155 rm_rf "tmp"
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
156 end
157
4ef90b2 @sferik Fix typo in rake task description
sferik authored
158 desc "Run the real-world spec suite (requires internet)"
7f31d86 @esasse Use %w[] instead of %w()
esasse authored
159 task :realworld => %w[set_realworld spec]
ba80464 @indirect real-world spec for index search cache bug
indirect authored
160
161 task :set_realworld do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
162 ENV["BUNDLER_REALWORLD_TESTS"] = "1"
ba80464 @indirect real-world spec for index search cache bug
indirect authored
163 end
164
74ee162 @indirect Minor rakefile organization
indirect authored
165 desc "Run the spec suite with the sudo tests"
7f31d86 @esasse Use %w[] instead of %w()
esasse authored
166 task :sudo => %w[set_sudo spec clean_sudo]
74ee162 @indirect Minor rakefile organization
indirect authored
167
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
168 task :set_sudo do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
169 ENV["BUNDLER_SUDO_TESTS"] = "1"
6cc134c Add a task that runs the specs including sudo specs
Carl Lerche authored
170 end
171
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
172 task :clean_sudo do
173 puts "Cleaning up sudo test files..."
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
174 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
175 end
176
a32b020 @indirect fix travis and tasks to match
indirect authored
177 # Rubygems specs by version
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
178 namespace :rubygems do
179 rubyopt = ENV["RUBYOPT"]
a32b020 @indirect fix travis and tasks to match
indirect authored
180 # When editing this list, also edit .travis.yml!
516d548 @indirect and we need the rake tasks for travis, too
indirect authored
181 branches = %w(master)
d155010 @segiddins [Travis] Test against 2.4.8 now
segiddins authored
182 releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.3 v2.4.8)
4846d9e @indirect update rubygems versions being tested
indirect authored
183 (branches + releases).each do |rg|
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
184 desc "Run specs with Rubygems #{rg}"
185 RSpec::Core::RakeTask.new(rg) do |t|
b2ef0e4 @kiela Use documentation rspec formater
kiela authored
186 t.rspec_opts = %w(--format documentation --color)
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
187 t.ruby_opts = %w(-w)
188 end
189
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
190 # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
191 namespace rg do
805259c @indirect clean up sudo tmp files after any sudo tests run
indirect authored
192 task :sudo => ["set_sudo", rg, "clean_sudo"]
8a66d1f @indirect run realworld specs on travis
indirect authored
193 task :realworld => ["set_realworld", rg]
e8e5244 @indirect add sudo spec tasks for each rubygems version
indirect authored
194 end
195
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
196 task "clone_rubygems_#{rg}" do
62c9267 @indirect use RUBYGEMS_REPO everywhere
indirect authored
197 unless File.directory?(RUBYGEMS_REPO)
0ccb61c @indirect clone rubygems via https
indirect authored
198 system("git clone https://github.com/rubygems/rubygems.git tmp/rubygems")
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
199 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
200 hash = nil
201
88d49f2 @indirect simplify the certs manager
indirect authored
202 Dir.chdir(RUBYGEMS_REPO) do
6f49167 @indirect In further git genius, update tags before checking them out
indirect authored
203 system("git remote update")
82173b6 @indirect awesome. I broke the matrix build, too.
indirect authored
204 if rg == "master"
205 system("git checkout origin/master")
206 else
2bc1277 @indirect raise when Rubygems version doesn't exist
indirect authored
207 system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}")
82173b6 @indirect awesome. I broke the matrix build, too.
indirect authored
208 end
f2c4c35 @indirect add 2.0.0-preview2 to the build for now for clarity
indirect authored
209 hash = `git rev-parse HEAD`.chomp
91e89f6 @indirect In a total noob move, I pulled bundler master instead of rubygems master
indirect authored
210 end
f7f74f3 Report the git SHA1 to double check which rubygems was used
Evan Phoenix authored
211
f711a47 @indirect benchmark all the tasks. because we can.
indirect authored
212 puts "Checked out rubygems '#{rg}' at #{hash}"
3d724d6 @indirect Update Rubygems test versions
indirect authored
213 ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
214 puts "RUBYOPT=#{ENV["RUBYOPT"]}"
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
215 end
216
7024b3b @indirect run ronn before setting RUBYOPT for rg checkout
indirect authored
217 task rg => ["man:build", "clone_rubygems_#{rg}"]
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
218 task "rubygems:all" => rg
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
219 end
5f4a8f3 Phase 1 of rubygems/bundler reintegration
Evan Phoenix authored
220
221 desc "Run specs under a Rubygems checkout (set RG=path)"
222 RSpec::Core::RakeTask.new("co") do |t|
b2ef0e4 @kiela Use documentation rspec formater
kiela authored
223 t.rspec_opts = %w(--format documentation --color)
5f4a8f3 Phase 1 of rubygems/bundler reintegration
Evan Phoenix authored
224 t.ruby_opts = %w(-w)
225 end
226
227 task "setup_co" do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
228 rg = File.expand_path ENV["RG"]
c397a53 @indirect print path to rubygems checkout
indirect authored
229 puts "Running specs against Rubygems in #{rg}..."
230 ENV["RUBYOPT"] = "-I#{rg} #{rubyopt}"
5f4a8f3 Phase 1 of rubygems/bundler reintegration
Evan Phoenix authored
231 end
232
233 task "co" => "setup_co"
234 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
235 end
bd4dc9b Allow the Rake file to load and run when rspec is not installed
Carl Lerche authored
236
992c2a4 @indirect argh how did that happen
indirect authored
237 desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
8a66d1f @indirect run realworld specs on travis
indirect authored
238 task :travis do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
239 rg = ENV["RGV"] || raise("Rubygems version is required on Travis!")
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
240
4b24502 @indirect Fail fast if RuboCop task fails
indirect authored
241 if RUBY_VERSION > "1.9.3"
242 puts "\n\e[1;33m[Travis CI] Running bundler linter\e[m\n\n"
243 Rake::Task["rubocop"].invoke
244 end
cbe34f1 @TimMoore Run Rubocop before specs.
TimMoore authored
245
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
246 puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
247 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
248
f8fdf6d @joshk we need to reenable more than one rake task
joshk authored
249 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
250
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
251 puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
256f071 @indirect allow PATH through sudo on rails travis workers
indirect authored
252 sudos = system("sudo -E rake spec:rubygems:#{rg}:sudo")
253 # clean up by chowning the newly root-owned tmp directory back to the travis user
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
254 system("sudo chown -R #{ENV["USER"]} #{File.join(File.dirname(__FILE__), "tmp")}")
68bcd1e @joshk If you want to run a Rake task twice using invoke, you need to reenab…
joshk authored
255
8a66d1f @indirect run realworld specs on travis
indirect authored
256 Rake::Task["spec:rubygems:#{rg}"].reenable
257
258 puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n"
259 realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
260
4b24502 @indirect Fail fast if RuboCop task fails
indirect authored
261 { "specs" => specs, "sudo" => sudos, "realworld" => realworld }.each do |name, passed|
88f7f56 @indirect print results from each suite
indirect authored
262 if passed
263 puts "\e[0;32m[Travis CI] #{name} passed\e[m"
264 else
265 puts "\e[0;31m[Travis CI] #{name} failed\e[m"
266 end
267 end
268
8a66d1f @indirect run realworld specs on travis
indirect authored
269 unless specs && sudos && realworld
1bedb85 @esasse Fix Style/SignalException
esasse authored
270 raise "Spec run failed, please review the log for more information"
bcea40f @joshk We need to capturing rake errors and return false, and then fail the …
joshk authored
271 end
f419c42 @indirect and the travis task should be inside the spec namespace
indirect authored
272 end
0898d4e @indirect Spec tasks to run on 1.8.6, 1.8.7, and 1.9.2
indirect authored
273 end
0dd7343 @indirect Clean up the retarded Rakefile, use the Bundler gem helpers
indirect authored
274
2af8c75 @indirect fail man tasks without ronn
indirect authored
275 rescue LoadError
276 task :spec do
277 abort "Run `rake spec:deps` to be able to run the specs"
278 end
2e12a0f @segiddins [Rakefile] Properly install RuboCop
segiddins authored
279
280 task :rubocop do
281 abort "Run `rake spec:deps` to be able to run rubocop"
282 end
2af8c75 @indirect fail man tasks without ronn
indirect authored
283 end
284
285 begin
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
286 require "ronn"
2af8c75 @indirect fail man tasks without ronn
indirect authored
287
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
288 namespace :man do
289 directory "lib/bundler/man"
290
0f8bc78 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
291 sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") }
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
292 sources.map do |basename|
293 ronn = "man/#{basename}.ronn"
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
294 roff = "lib/bundler/man/#{basename}"
295
296 file roff => ["lib/bundler/man", ronn] do
8301888 @brixen Use the same ruby to run subprocesses as is running rake.
brixen authored
297 sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}"
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
298 end
299
300 file "#{roff}.txt" => roff do
301 sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
302 end
303
304 task :build_all_pages => "#{roff}.txt"
305 end
306
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
307 task :clean do
308 leftovers = Dir["lib/bundler/man/*"].reject do |f|
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
309 basename = File.basename(f).sub(/\.(txt|ronn)/, "")
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
310 sources.include?(basename)
311 end
312 rm leftovers if leftovers.any?
313 end
314
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
315 desc "Build the man pages"
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
316 task :build => ["man:clean", "man:build_all_pages"]
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
317
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
318 desc "Remove all built man pages"
319 task :clobber do
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
320 rm_rf "lib/bundler/man"
321 end
a9b4aa6 @indirect guard against missing ronn during release
indirect authored
322
14a7eb2 @indirect Fix Style/SpaceInsideBlockBraces
indirect authored
323 task(:require) {}
b88d8a9 @indirect allow rspec tasks even if ronn is missing
indirect authored
324 end
325
1ce02b4 @indirect always have the spec:deps task available
indirect authored
326 rescue LoadError
2af8c75 @indirect fail man tasks without ronn
indirect authored
327 namespace :man do
a9b4aa6 @indirect guard against missing ronn during release
indirect authored
328 task(:require) { abort "Install the ronn gem to be able to release!" }
329 task(:build) { warn "Install the ronn gem to build the help pages" }
1ce02b4 @indirect always have the spec:deps task available
indirect authored
330 end
715f150 Make bundler work with RG 1.3.5, 1.3.6 and trunk and create a spec ta…
Carlhuda authored
331 end
332
88d49f2 @indirect simplify the certs manager
indirect authored
333 desc "Update vendored SSL certs to match the certs vendored by Rubygems"
334 task :update_certs => "spec:rubygems:clone_rubygems_master" do
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
335 require "bundler/ssl_certs/certificate_manager"
8c2b02a @indirect certificate manager namespacing and path expansion
indirect authored
336 Bundler::SSLCerts::CertificateManager.update_from!(RUBYGEMS_REPO)
88d49f2 @indirect simplify the certs manager
indirect authored
337 end
338
a77ca27 @segiddins [RuboCop] Enable Style/StringLiterals
segiddins authored
339 require "bundler/gem_tasks"
3926f3f @indirect use Rake convention of clean/clobber for manpages
indirect authored
340 task :build => ["man:build"]
341 task :release => ["man:require", "man:build"]
2af8c75 @indirect fail man tasks without ronn
indirect authored
342
e4adbf7 @carllerche Update Rakefile for rspec 2 beta22
carllerche authored
343 task :default => :spec
Something went wrong with that request. Please try again.