2016-02-23 15:44:16 +00:00
|
|
|
require "bundler"
|
2015-10-02 21:14:19 +00:00
|
|
|
require "bundler/gem_tasks"
|
2015-04-02 09:05:26 +00:00
|
|
|
require "rubocop/rake_task"
|
|
|
|
require "rspec/core/rake_task"
|
2015-10-02 21:14:19 +00:00
|
|
|
require "pathname"
|
|
|
|
require "fileutils"
|
2016-02-23 10:38:27 +00:00
|
|
|
require "overcommit"
|
2014-12-03 09:30:26 +00:00
|
|
|
|
2015-03-26 13:33:56 +00:00
|
|
|
RuboCop::RakeTask.new
|
|
|
|
RSpec::Core::RakeTask.new(:rspec)
|
|
|
|
|
2015-10-02 21:14:19 +00:00
|
|
|
task :create_man do |_t|
|
2016-02-25 18:56:25 +00:00
|
|
|
writable_man_path = Pathname('/etc/manpaths').each_line.find do |line|
|
|
|
|
path = Pathname(line.chomp)
|
|
|
|
path.directory? && path.writable?
|
|
|
|
end rescue nil
|
|
|
|
|
|
|
|
return unless writable_man_path
|
|
|
|
|
|
|
|
man_prefix = Pathname("#{writable_man_path.chomp}/man1")
|
2016-02-25 18:14:44 +00:00
|
|
|
man_pages = "man/git-*.1"
|
2015-10-02 21:14:19 +00:00
|
|
|
|
|
|
|
Pathname.glob(man_pages) do |path|
|
2016-02-25 18:22:34 +00:00
|
|
|
if path.exist? && man_prefix.exist? && man_prefix.writable?
|
2016-02-25 18:14:44 +00:00
|
|
|
FileUtils.cp(path, man_prefix + path.basename)
|
|
|
|
end
|
2015-10-02 21:14:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
task checks: [:rubocop, :rspec]
|
2016-02-25 13:28:11 +00:00
|
|
|
task default: [:create_man]
|