From 925f6fd3f0b0e2601d9d41adb0f6911d4c912e7c Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 19:14:44 +0100 Subject: [PATCH 1/7] Man page copying: only copy .1 - check if possible first --- Rakefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 6e525a6..6922c31 100644 --- a/Rakefile +++ b/Rakefile @@ -12,10 +12,12 @@ 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-*" + man_pages = "man/git-*.1" Pathname.glob(man_pages) do |path| - FileUtils.cp(path, man_prefix + path.basename) + if path.exist? && man_prefix.exist? + FileUtils.cp(path, man_prefix + path.basename) + end end end From 637de146994910eeecc5e03961a2a7a14e6df162 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 19:22:34 +0100 Subject: [PATCH 2/7] Check if man path is writable before writing --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 6922c31..3d33796 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,7 @@ task :create_man do |_t| man_pages = "man/git-*.1" Pathname.glob(man_pages) do |path| - if path.exist? && man_prefix.exist? + if path.exist? && man_prefix.exist? && man_prefix.writable? FileUtils.cp(path, man_prefix + path.basename) end end From 85d5352e6e6cddf0c24d1124423ea7d8e7fd6da6 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 19:56:25 +0100 Subject: [PATCH 3/7] Look in /etc/manpaths for writable paths --- Rakefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 3d33796..4a8e9a8 100644 --- a/Rakefile +++ b/Rakefile @@ -10,8 +10,14 @@ 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") + 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") man_pages = "man/git-*.1" Pathname.glob(man_pages) do |path| From 32f14e685bfa4f28bada5cb3401128a6cf03e516 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 20:13:32 +0100 Subject: [PATCH 4/7] Rake task: Try finding a writable manpath - OS X, Ubuntu manpath files checked --- Rakefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 4a8e9a8..90a7c1c 100644 --- a/Rakefile +++ b/Rakefile @@ -9,11 +9,19 @@ require "overcommit" RuboCop::RakeTask.new RSpec::Core::RakeTask.new(:rspec) -task :create_man do |_t| - writable_man_path = Pathname('/etc/manpaths').each_line.find do |line| +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 rescue nil + end return unless writable_man_path @@ -28,4 +36,4 @@ task :create_man do |_t| end task checks: [:rubocop, :rspec] -task default: [:create_man] +task default: [:copy_man_page_to_manpath] From 4a9f6fdd43a5996471be51c6b306ad5a2860b8e4 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 20:26:03 +0100 Subject: [PATCH 5/7] Gemfile now with test deps, too --- Gemfile | 4 ++++ Gemfile.lock | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0724b52..093f773 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index f3502b0..e2fa964 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 From d33dcced8f1a5c7975dc5a5731a1226b3d092ce9 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 20:29:01 +0100 Subject: [PATCH 6/7] Rake task: enable the default task again --- github_changelog_generator.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_changelog_generator.gemspec b/github_changelog_generator.gemspec index a7922b4..a8ad97a 100644 --- a/github_changelog_generator.gemspec +++ b/github_changelog_generator.gemspec @@ -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) } From 12734dbbe1ea6d282ab8eae8a79c69a830d82264 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Fri, 26 Feb 2016 13:18:11 +0200 Subject: [PATCH 7/7] Update gemspec to version 1.11.4 --- lib/github_changelog_generator/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/version.rb b/lib/github_changelog_generator/version.rb index 88f6ab9..81cddae 100644 --- a/lib/github_changelog_generator/version.rb +++ b/lib/github_changelog_generator/version.rb @@ -1,3 +1,3 @@ module GitHubChangelogGenerator - VERSION = "1.11.3" + VERSION = "1.11.4" end