diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-01-20 22:31:18 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-01-22 10:15:02 +0100 |
commit | ac881ed5dff994dd9f945243290be7582b303a3c (patch) | |
tree | 19f2175ee6d04d20110652d41854be070c9afda6 | |
parent | 12b786888e630a6141273d28b74ec4b2e075cc44 (diff) | |
download | bundler-ac881ed5dff994dd9f945243290be7582b303a3c.tar.gz |
Don't require automatiek and ronn by default
Only require and install them when any documentation or vendoring tasks are run.
-rw-r--r-- | Rakefile | 233 |
1 files changed, 109 insertions, 124 deletions
@@ -76,158 +76,143 @@ task :check_rvm_integration do end namespace :man do - if RUBY_ENGINE == "jruby" - task(:build) {} - else - begin - Spec::Rubygems.gem_require("ronn") - rescue Gem::LoadError => e - desc "Build the man pages" - task(:build) { abort "We couln't activate ronn (#{e.requirement}). Try `gem install ronn:'#{e.requirement}'` to be able to build the help pages" } - - desc "Verify man pages are in sync" - task(:check) { abort "We couln't activate ronn (#{e.requirement}). Try `gem install ronn:'#{e.requirement}'` to be able to build the help pages" } - else - 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/ - roff = "man/#{basename}#{manual_section}" - - index << [ronn, File.basename(roff)] - - file roff => ["man", ronn] do - sh "bin/ronn --roff --pipe --date #{Time.now.strftime("%Y-%m-%d")} #{ronn} > #{roff}" - end - - file "#{roff}.txt" => roff do - sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt" - end - - task :build_all_pages => "#{roff}.txt" - end + desc "Makes sure ronn is available" + task :require_ronn do + Spec::Rubygems.gem_require("ronn") + 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" - - desc "Remove all built man pages" - task :clean do - leftovers = Dir["man/*"].reject do |f| - File.extname(f) == ".ronn" - end - rm leftovers if leftovers.any? - end + 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/ + roff = "man/#{basename}#{manual_section}" + + index << [ronn, File.basename(roff)] + + file roff => [:require_ronn, "man", ronn] do + sh "bin/ronn --roff --pipe --date #{Time.now.strftime("%Y-%m-%d")} #{ronn} > #{roff}" + end + + file "#{roff}.txt" => roff do + sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt" + end + + task :build_all_pages => "#{roff}.txt" + end - desc "Build the man pages" - task :build => ["man:clean", "man:build_all_pages"] - - desc "Verify man pages are in sync" - task :check => :build do - sh("git diff --quiet --ignore-all-space man") do |outcome, _| - if outcome - puts - puts "Manpages are in sync!" - puts - else - sh("GIT_PAGER=cat git diff --ignore-all-space man") - - puts - puts "Man pages are out of sync. Above you can see the diff that got generated from rebuilding them. Please review and commit the results." - puts - - exit(1) - end - 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 -end + task :build_all_pages => "index.txt" -begin - Spec::Rubygems.gem_require("automatiek") -rescue Gem::LoadError => e - msg = "We couldn't activate automatiek (#{e.requirement}). Try `gem install automatiek:'#{e.requirement}'` to be able to vendor gems" + desc "Remove all built man pages" + task :clean do + leftovers = Dir["man/*"].reject do |f| + File.extname(f) == ".ronn" + end + rm leftovers if leftovers.any? + end - namespace :vendor do - desc "Vendor a specific version of molinillo" - task(:molinillo) { abort msg } + desc "Build the man pages" + task :build => ["man:clean", "man:build_all_pages"] - desc "Vendor a specific version of fileutils" - task(:fileutils) { abort msg } + desc "Verify man pages are in sync" + task :check => :build do + sh("git diff --quiet --ignore-all-space man") do |outcome, _| + if outcome + puts + puts "Manpages are in sync!" + puts + else + sh("GIT_PAGER=cat git diff --ignore-all-space man") - desc "Vendor a specific version of thor" - task(:thor) { abort msg } + puts + puts "Man pages are out of sync. Above you can see the diff that got generated from rebuilding them. Please review and commit the results." + puts - desc "Vendor a specific version of net-http-persistent" - task(:"net-http-persistent") { abort msg } + exit(1) + end + end end -else +end + +namespace :vendor do desc "Vendor a specific version of molinillo" - Automatiek::RakeTask.new("molinillo") do |lib| - lib.download = { :github => "https://github.com/CocoaPods/Molinillo" } - lib.namespace = "Molinillo" - lib.prefix = "Bundler" - lib.vendor_lib = "lib/bundler/vendor/molinillo" + task :molinillo, [:version] => [] do |_, args| + Spec::Rubygems.gem_require("automatiek") + + Automatiek::Gem.new("molinillo") do |lib| + lib.download = { :github => "https://github.com/CocoaPods/Molinillo" } + lib.namespace = "Molinillo" + lib.prefix = "Bundler" + lib.vendor_lib = "lib/bundler/vendor/molinillo" + end.vendor!(args[:version]) end # We currently cherry-pick changes to use `require_relative` internally # instead of regular `require`. They are already in thor's master branch but # still need to be released. desc "Vendor a specific version of thor" - Automatiek::RakeTask.new("thor") do |lib| - lib.download = { :github => "https://github.com/erikhuda/thor" } - lib.namespace = "Thor" - lib.prefix = "Bundler" - lib.vendor_lib = "lib/bundler/vendor/thor" + task :thor, [:version] => [] do |_, args| + Spec::Rubygems.gem_require("automatiek") + + Automatiek::Gem.new("thor") do |lib| + lib.download = { :github => "https://github.com/erikhuda/thor" } + lib.namespace = "Thor" + lib.prefix = "Bundler" + lib.vendor_lib = "lib/bundler/vendor/thor" + end.vendor!(args[:version]) end desc "Vendor a specific version of fileutils" - Automatiek::RakeTask.new("fileutils") do |lib| - lib.download = { :github => "https://github.com/ruby/fileutils" } - lib.namespace = "FileUtils" - lib.prefix = "Bundler" - lib.vendor_lib = "lib/bundler/vendor/fileutils" + task :fileutils, [:version] => [] do |_, args| + Automatiek::Gem.new("fileutils") do |lib| + lib.download = { :github => "https://github.com/ruby/fileutils" } + lib.namespace = "FileUtils" + lib.prefix = "Bundler" + lib.vendor_lib = "lib/bundler/vendor/fileutils" + end.vendor!(args[:version]) end # We currently cherry-pick changes to use `require_relative` internally # instead of regular `require`. They are pending review at # https://github.com/drbrain/net-http-persistent/pull/106 desc "Vendor a specific version of net-http-persistent" - Automatiek::RakeTask.new("net-http-persistent") do |lib| - lib.download = { :github => "https://github.com/drbrain/net-http-persistent" } - lib.namespace = "Net::HTTP::Persistent" - lib.prefix = "Bundler::Persistent" - lib.vendor_lib = "lib/bundler/vendor/net-http-persistent" - - lib.dependency("connection_pool") do |sublib| - sublib.version = "v2.2.2" - sublib.download = { :github => "https://github.com/mperham/connection_pool" } - sublib.namespace = "ConnectionPool" - sublib.prefix = "Bundler" - sublib.vendor_lib = "lib/bundler/vendor/connection_pool" - end + task :"net-http-persistent", [:version] => [] do |_, args| + Automatiek::Gem.new("net-http-persistent") do |lib| + lib.download = { :github => "https://github.com/drbrain/net-http-persistent" } + lib.namespace = "Net::HTTP::Persistent" + lib.prefix = "Bundler::Persistent" + lib.vendor_lib = "lib/bundler/vendor/net-http-persistent" + + lib.dependency("connection_pool") do |sublib| + sublib.version = "v2.2.2" + sublib.download = { :github => "https://github.com/mperham/connection_pool" } + sublib.namespace = "ConnectionPool" + sublib.prefix = "Bundler" + sublib.vendor_lib = "lib/bundler/vendor/connection_pool" + end - lib.dependency("uri") do |sublib| - sublib.version = "master" - sublib.download = { :github => "https://github.com/ruby/uri" } - sublib.namespace = "URI" - sublib.prefix = "Bundler" - sublib.vendor_lib = "lib/bundler/vendor/uri" - end + lib.dependency("uri") do |sublib| + sublib.version = "master" + sublib.download = { :github => "https://github.com/ruby/uri" } + sublib.namespace = "URI" + sublib.prefix = "Bundler" + sublib.vendor_lib = "lib/bundler/vendor/uri" + end + end.vendor!(args[:version]) end end |