Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76df82fe0b | ||
|
|
12734dbbe1 | ||
|
|
d33dcced8f | ||
|
|
4a9f6fdd43 | ||
|
|
32f14e685b | ||
|
|
85d5352e6e | ||
|
|
637de14699 | ||
|
|
925f6fd3f0 | ||
|
|
568db9e519 | ||
|
|
9b7273f009 | ||
|
|
08cacdc5ec | ||
|
|
159173d86a | ||
|
|
c111488376 | ||
|
|
5bc90a32ae | ||
|
|
772e403e40 | ||
|
|
fe2162030b | ||
|
|
ee86b35068 | ||
|
|
93e29e8e81 | ||
|
|
5bff64de19 | ||
|
|
780ebdf0eb | ||
|
|
c5837ad9f0 | ||
|
|
17a1b23059 | ||
|
|
7205a060b3 | ||
|
|
471fe6f312 | ||
|
|
40df2c7dac | ||
|
|
aa87c803ca | ||
|
|
6962b5e7b2 | ||
|
|
407bf86e57 | ||
|
|
cff1e8c5ed | ||
|
|
8e9ff4cb8a | ||
|
|
3e045e3b42 | ||
|
|
0bfd702d21 | ||
|
|
c762f82917 | ||
|
|
b510b2c3fb | ||
|
|
f45dc26aba | ||
|
|
78361faaa9 | ||
|
|
5898dd4eb9 | ||
|
|
6706b10311 | ||
|
|
827afcda02 | ||
|
|
94c52a17e2 | ||
|
|
4af3d1cb06 | ||
|
|
b5df8e1e76 | ||
|
|
2f179649b9 | ||
|
|
9a217e3468 | ||
|
|
035e160f5e | ||
|
|
60517bffe9 | ||
|
|
5b192f9e43 | ||
|
|
32ab582797 | ||
|
|
4e6906dccf | ||
|
|
179f110b8a | ||
|
|
06585b1c69 | ||
|
|
89d1b5393d | ||
|
|
87b9962a8d | ||
|
|
4ceb065cae | ||
|
|
cf55352620 | ||
|
|
540251ab60 | ||
|
|
74f93460bc | ||
|
|
b8f7dbaa2e | ||
|
|
74655cce06 | ||
|
|
e27a471fc8 |
45
CHANGELOG.md
45
CHANGELOG.md
@@ -1,12 +1,53 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## [1.10.3](https://github.com/skywinder/github-changelog-generator/tree/1.10.3) (2016-02-23)
|
## [1.11.3](https://github.com/skywinder/github-changelog-generator/tree/1.11.3) (2016-02-25)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.2...1.10.3)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.2...1.11.3)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Cannot install gem [\#335](https://github.com/skywinder/github-changelog-generator/issues/335)
|
||||||
|
|
||||||
|
## [1.11.2](https://github.com/skywinder/github-changelog-generator/tree/1.11.2) (2016-02-25)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.1...1.11.2)
|
||||||
|
|
||||||
**Fixed bugs:**
|
**Fixed bugs:**
|
||||||
|
|
||||||
- Getting an error on install [\#329](https://github.com/skywinder/github-changelog-generator/issues/329)
|
- Getting an error on install [\#329](https://github.com/skywinder/github-changelog-generator/issues/329)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Fix installation by not running the specs - which have dependencies [\#337](https://github.com/skywinder/github-changelog-generator/pull/337) ([skywinder](https://github.com/skywinder))
|
||||||
|
|
||||||
|
## [1.11.1](https://github.com/skywinder/github-changelog-generator/tree/1.11.1) (2016-02-25)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.0...1.11.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add rubocop and rspec as runtime dependencies [\#336](https://github.com/skywinder/github-changelog-generator/pull/336) ([jkeiser](https://github.com/jkeiser))
|
||||||
|
- \[Refactor\] ParserFile class use Pathname [\#334](https://github.com/skywinder/github-changelog-generator/pull/334) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
- \[Refactor\] Generator\#exclude\_issues\_by\_labels simpler, tested [\#332](https://github.com/skywinder/github-changelog-generator/pull/332) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
|
||||||
|
## [1.11.0](https://github.com/skywinder/github-changelog-generator/tree/1.11.0) (2016-02-24)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.5...1.11.0)
|
||||||
|
|
||||||
|
## [1.10.5](https://github.com/skywinder/github-changelog-generator/tree/1.10.5) (2016-02-24)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.4...1.10.5)
|
||||||
|
|
||||||
|
## [1.10.4](https://github.com/skywinder/github-changelog-generator/tree/1.10.4) (2016-02-24)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.3...1.10.4)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Rake and Bundler as runtime deps [\#333](https://github.com/skywinder/github-changelog-generator/pull/333) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Test case for \#327 [\#331](https://github.com/skywinder/github-changelog-generator/pull/331) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
- Fix crash installing on systems without overcommit [\#330](https://github.com/skywinder/github-changelog-generator/pull/330) ([jkeiser](https://github.com/jkeiser))
|
||||||
|
|
||||||
|
## [1.10.3](https://github.com/skywinder/github-changelog-generator/tree/1.10.3) (2016-02-23)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.2...1.10.3)
|
||||||
|
|
||||||
## [1.10.2](https://github.com/skywinder/github-changelog-generator/tree/1.10.2) (2016-02-23)
|
## [1.10.2](https://github.com/skywinder/github-changelog-generator/tree/1.10.2) (2016-02-23)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.11.0...1.10.2)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.11.0...1.10.2)
|
||||||
|
|
||||||
|
|||||||
6
Gemfile
6
Gemfile
@@ -3,8 +3,10 @@ source "https://rubygems.org"
|
|||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem "rspec", "~>3.2"
|
gem "rake"
|
||||||
gem "rubocop", "~>0.31"
|
gem "bundler"
|
||||||
|
gem "rubocop"
|
||||||
|
gem "overcommit"
|
||||||
gem "coveralls", "~>0.8", require: false
|
gem "coveralls", "~>0.8", require: false
|
||||||
gem "simplecov", "~>0.10", require: false
|
gem "simplecov", "~>0.10", require: false
|
||||||
gem "codeclimate-test-reporter", "~>0.4"
|
gem "codeclimate-test-reporter", "~>0.4"
|
||||||
|
|||||||
16
Gemfile.lock
16
Gemfile.lock
@@ -1,12 +1,14 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
github_changelog_generator (1.10.3)
|
github_changelog_generator (1.11.3)
|
||||||
bundler (~> 1.7)
|
bundler (>= 1.7)
|
||||||
colorize (~> 0.7)
|
colorize (~> 0.7)
|
||||||
github_api (~> 0.12)
|
github_api (~> 0.12)
|
||||||
overcommit (~> 0.31)
|
overcommit (>= 0.31)
|
||||||
rake (~> 10.0)
|
rake (>= 10.0)
|
||||||
|
rspec (>= 3.2)
|
||||||
|
rubocop (>= 0.31)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
@@ -96,11 +98,13 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
bundler
|
||||||
codeclimate-test-reporter (~> 0.4)
|
codeclimate-test-reporter (~> 0.4)
|
||||||
coveralls (~> 0.8)
|
coveralls (~> 0.8)
|
||||||
github_changelog_generator!
|
github_changelog_generator!
|
||||||
rspec (~> 3.2)
|
overcommit
|
||||||
rubocop (~> 0.31)
|
rake
|
||||||
|
rubocop
|
||||||
simplecov (~> 0.10)
|
simplecov (~> 0.10)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
|||||||
28
Rakefile
28
Rakefile
@@ -9,15 +9,31 @@ require "overcommit"
|
|||||||
RuboCop::RakeTask.new
|
RuboCop::RakeTask.new
|
||||||
RSpec::Core::RakeTask.new(:rspec)
|
RSpec::Core::RakeTask.new(:rspec)
|
||||||
|
|
||||||
task :create_man do |_t|
|
task :copy_man_page_to_manpath do |_t|
|
||||||
os_prefix = "/usr/local"
|
known_manpath_paths = %w(/etc/manpath.config /etc/manpaths)
|
||||||
man_prefix = Pathname("#{os_prefix}/share/man/man1")
|
manpath = known_manpath_paths.find do |f|
|
||||||
man_pages = "man/git-*"
|
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|
|
Pathname.glob(man_pages) do |path|
|
||||||
FileUtils.cp(path, man_prefix + path.basename)
|
if path.exist? && man_prefix.exist? && man_prefix.writable?
|
||||||
|
FileUtils.cp(path, man_prefix + path.basename)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task checks: [:rubocop, :rspec]
|
task checks: [:rubocop, :rspec]
|
||||||
task default: [:checks, :create_man]
|
task default: [:copy_man_page_to_manpath]
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ Gem::Specification.new do |spec|
|
|||||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||||
spec.require_paths = ["lib"]
|
spec.require_paths = ["lib"]
|
||||||
|
|
||||||
spec.add_runtime_dependency "rake", "~> 10.0"
|
spec.add_runtime_dependency "rake", ">= 10.0"
|
||||||
spec.add_runtime_dependency "bundler", "~> 1.7"
|
spec.add_runtime_dependency "bundler", ">= 1.7"
|
||||||
spec.add_runtime_dependency("github_api", ["~> 0.12"])
|
spec.add_runtime_dependency("github_api", ["~> 0.12"])
|
||||||
spec.add_runtime_dependency("colorize", ["~> 0.7"])
|
spec.add_runtime_dependency("colorize", ["~> 0.7"])
|
||||||
spec.add_runtime_dependency("overcommit", "~>0.31")
|
spec.add_runtime_dependency("overcommit", ">= 0.31")
|
||||||
|
spec.add_runtime_dependency("rubocop", ">= 0.31")
|
||||||
|
spec.add_runtime_dependency("rspec", ">= 3.2")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ module GitHubChangelogGenerator
|
|||||||
# @param [Array] issues
|
# @param [Array] issues
|
||||||
# @return [Array] filtered array
|
# @return [Array] filtered array
|
||||||
def exclude_issues_by_labels(issues)
|
def exclude_issues_by_labels(issues)
|
||||||
unless @options[:exclude_labels].nil?
|
return issues if !@options[:exclude_labels] || @options[:exclude_labels].empty?
|
||||||
issues = issues.select do |issue|
|
|
||||||
var = issue.labels.map(&:name) & @options[:exclude_labels]
|
issues.reject do |issue|
|
||||||
!var.any?
|
labels = issue.labels.map(&:name)
|
||||||
end
|
(labels & @options[:exclude_labels]).any?
|
||||||
end
|
end
|
||||||
issues
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Array] filtered issues accourding milestone
|
# @return [Array] filtered issues accourding milestone
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
|
require "pathname"
|
||||||
|
|
||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
ParserError = Class.new(StandardError)
|
ParserError = Class.new(StandardError)
|
||||||
|
|
||||||
class ParserFile
|
class ParserFile
|
||||||
|
FILENAME = ".github_changelog_generator"
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@options = options
|
@options = options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Destructively change @options using data in configured options file.
|
||||||
def parse!
|
def parse!
|
||||||
return unless File.exist?(file)
|
file.each_line { |line| parse_line!(line) } if file.exist?
|
||||||
|
|
||||||
File.readlines(file).each { |line| parse_line!(line) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def file
|
def file
|
||||||
@file ||= File.expand_path(@options[:params_file] || ".github_changelog_generator")
|
@file ||= Pathname(File.expand_path(@options[:params_file] || FILENAME))
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_line!(line)
|
def parse_line!(line)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
VERSION = "1.10.4"
|
VERSION = "1.11.4"
|
||||||
end
|
end
|
||||||
|
|||||||
28
spec/unit/generator/generator_processor_spec.rb
Normal file
28
spec/unit/generator/generator_processor_spec.rb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
module GitHubChangelogGenerator
|
||||||
|
describe Generator do
|
||||||
|
context "#exclude_issues_by_labels" do
|
||||||
|
let(:label) { double("the-bad-label", name: "BAD") }
|
||||||
|
let(:issue) { double("the-issue-to-be-excluded", labels: [label]) }
|
||||||
|
let(:good_label) { double("a-good-label", name: "GOOD") }
|
||||||
|
let(:good_issue) { double("an-issue-to-be-kept", labels: [good_label]) }
|
||||||
|
let(:issues) { [issue, good_issue] }
|
||||||
|
subject(:generator) { described_class.new(exclude_labels: %w(BAD BOO)) }
|
||||||
|
|
||||||
|
it "removes issues with labels in the exclude_label list" do
|
||||||
|
result = generator.exclude_issues_by_labels(issues)
|
||||||
|
|
||||||
|
expect(result).to include(good_issue)
|
||||||
|
expect(result).not_to include(issue)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with no option given" do
|
||||||
|
subject(:generator) { described_class.new }
|
||||||
|
it "passes everything through when no option given" do
|
||||||
|
result = generator.exclude_issues_by_labels(issues)
|
||||||
|
|
||||||
|
expect(result).to eq(issues)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user