summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-05-17 08:59:19 +1000
committerColby Swandale <colby@taplaboratories.com>2017-05-17 08:59:19 +1000
commitdc39cb2cd115fd124493b8ab04a21a4ece5d1cf9 (patch)
tree48dead57045982563212ff371e584b1c3127c737
parent0be134195bcb1b79b598def4333e36d7eac9b35e (diff)
parent52e01785a50ceba97c7ea850e103a2647a0d4ff6 (diff)
downloadbundler-dc39cb2cd115fd124493b8ab04a21a4ece5d1cf9.tar.gz
Merge remote-tracking branch 'origin/master' into colby/stderr-feature
* origin/master: Avoid Rack 1.6.7 in specs for now Avoid re-building manpages each spec run [Travis] Use RubyGems 2.6.12 Ensure that manpages are always built when running specs [Rakefile] Generate man/index in man:build
-rw-r--r--Rakefile23
-rw-r--r--man/index.txt15
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/manpages.rb13
-rw-r--r--spec/support/rubygems_ext.rb4
5 files changed, 37 insertions, 19 deletions
diff --git a/Rakefile b/Rakefile
index d9ffc70059..5e6f421fae 100644
--- a/Rakefile
+++ b/Rakefile
@@ -70,7 +70,7 @@ namespace :spec do
sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
# Install the gems with a consistent version of RubyGems
- sh "gem update --system 2.6.11"
+ sh "gem update --system 2.6.12"
$LOAD_PATH.unshift("./spec")
require "support/rubygems_ext"
@@ -240,12 +240,15 @@ begin
namespace :man do
directory "man"
+ index = []
sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") }
sources.map do |basename|
ronn = "man/#{basename}.ronn"
- manual_section = ".1" unless basename =~ /.*(\d+)\Z/
+ manual_section = ".1" unless basename =~ /\.(\d+)\Z/
roff = "man/#{basename}#{manual_section}"
+ index << [ronn, File.basename(roff)]
+
file roff => ["man", ronn] do
sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}"
end
@@ -257,9 +260,23 @@ begin
task :build_all_pages => "#{roff}.txt"
end
+ file "index.txt" do
+ index.map! do |(ronn, roff)|
+ [File.read(ronn).split(" ").first, roff]
+ end
+ index = index.sort_by(&:first)
+ justification = index.map {|(n, _f)| n.length }.max + 4
+ File.open("man/index.txt", "w") do |f|
+ index.each do |name, filename|
+ f << name.ljust(justification) << filename << "\n"
+ end
+ end
+ end
+ task :build_all_pages => "index.txt"
+
task :clean do
leftovers = Dir["man/*"].reject do |f|
- File.extname(f) == ".ronn" || f == "man/index.txt"
+ File.extname(f) == ".ronn"
end
rm leftovers if leftovers.any?
end
diff --git a/man/index.txt b/man/index.txt
deleted file mode 100644
index e3b38c46db..0000000000
--- a/man/index.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Gemfile(5) gemfile.5
-bundle-install bundle-install.1
-bundle-update bundle-update.1
-bundle-package bundle-package.1
-bundle-exec bundle-exec.1
-bundle-config bundle-config.1
-bundle-platform bundle-platform.1
-bundle-gem bundle-gem.1
-bundle-clean bundle-clean.1
-bundle-check bundle-check.1
-bundle-init bundle-init.1
-bundle-inject bundle-inject.1
-bundle-open bundle-open.1
-bundle-show bundle-show.1
-bundle-viz bundle-viz.1
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 297d81f531..0a6b696fe7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -40,6 +40,7 @@ end
$debug = false
+Spec::Manpages.setup
Spec::Rubygems.setup
FileUtils.rm_rf(Spec::Path.gem_repo1)
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.root}/spec/support/hax.rb"
diff --git a/spec/support/manpages.rb b/spec/support/manpages.rb
new file mode 100644
index 0000000000..f6a4a4ab51
--- /dev/null
+++ b/spec/support/manpages.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+module Spec
+ module Manpages
+ def self.setup
+ man_path = Spec::Path.root.join("man")
+ return if man_path.children(false).select {|file| file.extname == ".ronn" }.all? do |man|
+ Dir[man_path.join("#{man.to_s[0..-6]}*.txt").to_s].any?
+ end
+
+ system(Spec::Path.root.join("bin", "rake").to_s, "man:build") || raise("Failed building man pages")
+ end
+ end
+end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 88886c3f1f..cfc481ef83 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -8,7 +8,9 @@ module Spec
deps = {
# rack 2.x requires Ruby version >= 2.2.2.
# artifice doesn't support rack 2.x now.
- "rack" => "< 2",
+ # TODO: revert to `< 2` once https://github.com/rack/rack/issues/1168 is
+ # addressed
+ "rack" => "1.6.6",
"artifice" => "~> 0.6.0",
"compact_index" => "~> 0.11.0",
"sinatra" => "~> 1.4.7",