diff --git a/Rakefile b/Rakefile index 2b038c11271..2fcdbff8167 100644 --- a/Rakefile +++ b/Rakefile @@ -199,72 +199,73 @@ task :rubocop do end namespace :man do - ronn_dep = development_dependencies.find do |dep| - dep.name == "ronn" - end + if RUBY_ENGINE == "jruby" + task(:build) {} + else + ronn_dep = development_dependencies.find do |dep| + dep.name == "ronn" + end - ronn_requirement = ronn_dep.requirement.to_s + ronn_requirement = ronn_dep.requirement.to_s - begin - gem "ronn", ronn_requirement + begin + gem "ronn", ronn_requirement - require "ronn" - rescue LoadError - task(:require) { abort "We couln't activate ronn (#{ronn_requirement}). Try `gem install ronn:'#{ronn_requirement}'` to be able to release!" } - task(:build) { abort "We couln't activate ronn (#{ronn_requirement}). Try `gem install ronn:'#{ronn_requirement}'` to be able to build the help pages" } - else - directory "man" + require "ronn" + rescue LoadError + task(:build) { abort "We couln't activate ronn (#{ronn_requirement}). Try `gem install ronn:'#{ronn_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 = [] + 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)] + index << [ronn, File.basename(roff)] - file roff => ["man", ronn] do - sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}" - end - - file "#{roff}.txt" => roff do - sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt" - end + file roff => ["man", ronn] do + sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}" + end - task :build_all_pages => "#{roff}.txt" - end + file "#{roff}.txt" => roff do + sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt" + end - file "index.txt" do - index.map! do |(ronn, roff)| - [File.read(ronn).split(" ").first, roff] + task :build_all_pages => "#{roff}.txt" 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" + + 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" + task :build_all_pages => "index.txt" - task :clean do - leftovers = Dir["man/*"].reject do |f| - File.extname(f) == ".ronn" + task :clean do + leftovers = Dir["man/*"].reject do |f| + File.extname(f) == ".ronn" + end + rm leftovers if leftovers.any? end - rm leftovers if leftovers.any? - end - desc "Build the man pages" - task :build => ["man:clean", "man:build_all_pages"] + desc "Build the man pages" + task :build => ["man:clean", "man:build_all_pages"] - desc "Remove all built man pages" - task :clobber do - rm_rf "lib/bundler/man" + desc "Remove all built man pages" + task :clobber do + rm_rf "lib/bundler/man" + end end - - task(:require) {} end end diff --git a/task/release.rake b/task/release.rake index f22d1296cc6..29fdc1dcb38 100644 --- a/task/release.rake +++ b/task/release.rake @@ -4,7 +4,7 @@ require "bundler/gem_tasks" task :build => ["build_metadata", "man:build", "generate_files"] do Rake::Task["build_metadata:clean"].tap(&:reenable).real_invoke end -task :release => ["man:require", "man:build", "release:verify_files", "release:verify_github", "build_metadata"] +task :release => ["man:build", "release:verify_files", "release:verify_github", "build_metadata"] namespace :release do task :verify_files do