Rakefile in pdfmult-1.3.2 vs Rakefile in pdfmult-1.4.0

- old
+ new

@@ -1,72 +1,68 @@ -# rakefile for the pdfmult script. -# -# Copyright (C) 2011-2013 Marcus Stollsteimer +# frozen_string_literal: true -require 'rake/testtask' +require "rake/testtask" -require './lib/pdfmult' +require "./lib/pdfmult" PROGNAME = Pdfmult::PROGNAME HOMEPAGE = Pdfmult::HOMEPAGE TAGLINE = Pdfmult::TAGLINE -BINDIR = '/usr/local/bin' -MANDIR = '/usr/local/man/man1' +BINDIR = "/usr/local/bin" +MANDIR = "/usr/local/man/man1" -HELP2MAN = 'help2man' -SED = 'sed' +HELP2MAN = "help2man" +SED = "sed" -BINARY = 'lib/pdfmult.rb' -BINARYNAME = 'pdfmult' # install using this name -MANPAGE = 'man/pdfmult.1' -H2MFILE = 'pdfmult.h2m' +BINARY = "lib/pdfmult.rb" +BINARYNAME = "pdfmult" # install using this name +MANPAGE = "man/pdfmult.1" +H2MFILE = "pdfmult.h2m" def gemspec_file - 'pdfmult.gemspec' + "pdfmult.gemspec" end -task :default => [:test] +task default: [:test] Rake::TestTask.new do |t| - t.pattern = 'test/**/test_*.rb' - t.ruby_opts << '-rubygems' + t.pattern = "test/**/test_*.rb" t.verbose = true t.warning = true end -desc 'Install binary and man page' -task :install => [BINARY, MANPAGE] do +desc "Install binary and man page" +task install: [BINARY, MANPAGE] do mkdir_p BINDIR install(BINARY, "#{BINDIR}/#{BINARYNAME}") mkdir_p MANDIR - install(MANPAGE, MANDIR, :mode => 0644) + install(MANPAGE, MANDIR, mode: 0o644) end -desc 'Uninstall binary and man page' +desc "Uninstall binary and man page" task :uninstall do rm "#{BINDIR}/#{BINARYNAME}" manfile = File.basename(MANPAGE) rm "#{MANDIR}/#{manfile}" end -desc 'Create man page' -task :man => [MANPAGE] +desc "Create man page" +task man: [MANPAGE] file MANPAGE => [BINARY, H2MFILE] do sh "#{HELP2MAN} --no-info --name='#{TAGLINE}' --include=#{H2MFILE} -o #{MANPAGE} ./#{BINARY}" - sh "#{SED} -i '/\.PP/{N;s/\.PP\\nOptions/.SH OPTIONS/}' #{MANPAGE}" sh "#{SED} -i 's/^License GPL/.br\\nLicense GPL/;s/There is NO WARRANTY/.br\\nThere is NO WARRANTY/' #{MANPAGE}" sh "#{SED} -i 's!%HOMEPAGE%!#{HOMEPAGE}!g' #{MANPAGE}" sh "#{SED} -i 's!%PROGNAME%!#{PROGNAME}!g' #{MANPAGE}" end -desc 'Build gem' -task :build => [MANPAGE] do +desc "Build gem" +task build: [MANPAGE] do sh "gem build #{gemspec_file}" end