Merge pull request #338 from olleolleolle/feature/neutralize-man-page-generation

Man page copying: only copy .1
This commit is contained in:
Petr Korolev 2016-02-26 13:17:19 +02:00
commit 568db9e519
4 changed files with 32 additions and 8 deletions

View File

@ -3,6 +3,10 @@ source "https://rubygems.org"
gemspec
group :test do
gem "rake"
gem "bundler"
gem "rubocop"
gem "overcommit"
gem "coveralls", "~>0.8", require: false
gem "simplecov", "~>0.10", require: false
gem "codeclimate-test-reporter", "~>0.4"

View File

@ -1,7 +1,7 @@
PATH
remote: .
specs:
github_changelog_generator (1.11.2)
github_changelog_generator (1.11.3)
bundler (>= 1.7)
colorize (~> 0.7)
github_api (~> 0.12)
@ -98,9 +98,13 @@ PLATFORMS
ruby
DEPENDENCIES
bundler
codeclimate-test-reporter (~> 0.4)
coveralls (~> 0.8)
github_changelog_generator!
overcommit
rake
rubocop
simplecov (~> 0.10)
BUNDLED WITH

View File

@ -9,15 +9,31 @@ require "overcommit"
RuboCop::RakeTask.new
RSpec::Core::RakeTask.new(:rspec)
task :create_man do |_t|
os_prefix = "/usr/local"
man_prefix = Pathname("#{os_prefix}/share/man/man1")
man_pages = "man/git-*"
task :copy_man_page_to_manpath do |_t|
known_manpath_paths = %w(/etc/manpath.config /etc/manpaths)
manpath = known_manpath_paths.find do |f|
path = Pathname(f)
path.file? && path.readable?
end
return unless manpath
writable_man_path = Pathname(manpath).each_line.find do |line|
path = Pathname(line.chomp)
path.directory? && path.writable?
end
return unless writable_man_path
man_prefix = Pathname("#{writable_man_path.chomp}/man1")
man_pages = "man/git-*.1"
Pathname.glob(man_pages) do |path|
if path.exist? && man_prefix.exist? && man_prefix.writable?
FileUtils.cp(path, man_prefix + path.basename)
end
end
end
task checks: [:rubocop, :rspec]
task default: [:create_man]
task default: [:copy_man_page_to_manpath]

View File

@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.description = "Changelog generation has never been so easy. Fully automate changelog generation - this gem generate change log file based on tags, issues and merged pull requests from Github issue tracker."
spec.homepage = "https://github.com/skywinder/Github-Changelog-Generator"
spec.license = "MIT"
#spec.extensions = ["Rakefile"]
spec.extensions = ["Rakefile"]
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }