Merge branch 'master' into develop
This commit is contained in:
commit
827afcda02
2
Gemfile
2
Gemfile
|
@ -3,8 +3,6 @@ source "https://rubygems.org"
|
|||
gemspec
|
||||
|
||||
group :test do
|
||||
gem "rspec", "~>3.2"
|
||||
gem "rubocop", "~>0.31"
|
||||
gem "coveralls", "~>0.8", require: false
|
||||
gem "simplecov", "~>0.10", require: false
|
||||
gem "codeclimate-test-reporter", "~>0.4"
|
||||
|
|
12
Gemfile.lock
12
Gemfile.lock
|
@ -1,12 +1,14 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
github_changelog_generator (1.10.3)
|
||||
bundler (~> 1.7)
|
||||
github_changelog_generator (1.10.4)
|
||||
bundler (>= 1.7)
|
||||
colorize (~> 0.7)
|
||||
github_api (~> 0.12)
|
||||
overcommit (~> 0.31)
|
||||
rake (~> 10.0)
|
||||
overcommit (>= 0.31)
|
||||
rake (>= 10.0)
|
||||
rspec (>= 3.2)
|
||||
rubocop (>= 0.31)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
|
@ -99,8 +101,6 @@ DEPENDENCIES
|
|||
codeclimate-test-reporter (~> 0.4)
|
||||
coveralls (~> 0.8)
|
||||
github_changelog_generator!
|
||||
rspec (~> 3.2)
|
||||
rubocop (~> 0.31)
|
||||
simplecov (~> 0.10)
|
||||
|
||||
BUNDLED WITH
|
||||
|
|
|
@ -24,9 +24,11 @@ Gem::Specification.new do |spec|
|
|||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_runtime_dependency "rake", "~> 10.0"
|
||||
spec.add_runtime_dependency "bundler", "~> 1.7"
|
||||
spec.add_runtime_dependency "rake", ">= 10.0"
|
||||
spec.add_runtime_dependency "bundler", ">= 1.7"
|
||||
spec.add_runtime_dependency("github_api", ["~> 0.12"])
|
||||
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
|
||||
|
|
|
@ -4,13 +4,12 @@ module GitHubChangelogGenerator
|
|||
# @param [Array] issues
|
||||
# @return [Array] filtered array
|
||||
def exclude_issues_by_labels(issues)
|
||||
unless @options[:exclude_labels].nil?
|
||||
issues = issues.select do |issue|
|
||||
var = issue.labels.map(&:name) & @options[:exclude_labels]
|
||||
!var.any?
|
||||
end
|
||||
return issues if !@options[:exclude_labels] || @options[:exclude_labels].empty?
|
||||
|
||||
issues.reject do |issue|
|
||||
labels = issue.labels.map(&:name)
|
||||
(labels & @options[:exclude_labels]).any?
|
||||
end
|
||||
issues
|
||||
end
|
||||
|
||||
# @return [Array] filtered issues accourding milestone
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
require 'pathname'
|
||||
|
||||
module GitHubChangelogGenerator
|
||||
ParserError = Class.new(StandardError)
|
||||
|
||||
class ParserFile
|
||||
FILENAME = ".github_changelog_generator"
|
||||
|
||||
def initialize(options)
|
||||
@options = options
|
||||
end
|
||||
|
||||
# Destructively change @options using data in configured options file.
|
||||
def parse!
|
||||
return unless File.exist?(file)
|
||||
|
||||
File.readlines(file).each { |line| parse_line!(line) }
|
||||
file.each_line { |line| parse_line!(line) } if file.exist?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def file
|
||||
@file ||= File.expand_path(@options[:params_file] || ".github_changelog_generator")
|
||||
@file ||= Pathname(File.expand_path(@options[:params_file] || FILENAME))
|
||||
end
|
||||
|
||||
def parse_line!(line)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module GitHubChangelogGenerator
|
||||
VERSION = "1.10.4"
|
||||
VERSION = "1.11.0"
|
||||
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
|
Loading…
Reference in New Issue
Block a user