Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f61c7fc7e | ||
|
|
d79e70b267 | ||
|
|
ba7c565374 | ||
|
|
31b4294ed6 | ||
|
|
55a1c6933c | ||
|
|
125960a3a3 | ||
|
|
9feecf98b8 | ||
|
|
4b88f02f97 | ||
|
|
eccecd6875 | ||
|
|
0862e54f42 | ||
|
|
1c578fec91 | ||
|
|
29c33fec60 | ||
|
|
6c71cf439a | ||
|
|
2d7f6bf174 | ||
|
|
1e4a3db0a2 | ||
|
|
b0fc03f38c | ||
|
|
a2658f9af9 | ||
|
|
48a49a67ec | ||
|
|
93b69a511f | ||
|
|
ef97e7f950 | ||
|
|
fbd8207ff4 | ||
|
|
ff4e5612af | ||
|
|
6bace8a582 | ||
|
|
a6b0d0cb83 | ||
|
|
91176e9174 | ||
|
|
494c8afff0 | ||
|
|
d14694a6d6 | ||
|
|
aa64fa131c | ||
|
|
fe0eab1c90 | ||
|
|
14d7c29808 | ||
|
|
1bf758480f | ||
|
|
12ea21c00b | ||
|
|
6411ba6b81 | ||
|
|
302eb9c66f | ||
|
|
4bd88a3fcb | ||
|
|
61b026a60c | ||
|
|
0df2687b93 |
@@ -1,6 +1,5 @@
|
|||||||
sudo: false
|
|
||||||
cache: bundler
|
|
||||||
language: ruby
|
language: ruby
|
||||||
|
before_install: gem update --system
|
||||||
rvm:
|
rvm:
|
||||||
- 2.1.0
|
- 2.1.0
|
||||||
script:
|
script:
|
||||||
|
|||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,19 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [1.8.5](https://github.com/skywinder/github-changelog-generator/tree/1.8.5) (2015-09-15)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.4...1.8.5)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Rake task: Be able to set false value in config [\#279](https://github.com/skywinder/github-changelog-generator/pull/279) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
|
||||||
|
## [1.8.4](https://github.com/skywinder/github-changelog-generator/tree/1.8.4) (2015-09-01)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.3...1.8.4)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Sending OATH through -t fails [\#274](https://github.com/skywinder/github-changelog-generator/issues/274)
|
||||||
|
|
||||||
## [1.8.3](https://github.com/skywinder/github-changelog-generator/tree/1.8.3) (2015-08-31)
|
## [1.8.3](https://github.com/skywinder/github-changelog-generator/tree/1.8.3) (2015-08-31)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.2...1.8.3)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.2...1.8.3)
|
||||||
|
|
||||||
@@ -14,6 +28,10 @@
|
|||||||
|
|
||||||
- Output should not include security information [\#270](https://github.com/skywinder/github-changelog-generator/issues/270)
|
- Output should not include security information [\#270](https://github.com/skywinder/github-changelog-generator/issues/270)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- This PRi will fix \#274. [\#275](https://github.com/skywinder/github-changelog-generator/pull/275) ([skywinder](https://github.com/skywinder))
|
||||||
|
|
||||||
## [1.8.1](https://github.com/skywinder/github-changelog-generator/tree/1.8.1) (2015-08-25)
|
## [1.8.1](https://github.com/skywinder/github-changelog-generator/tree/1.8.1) (2015-08-25)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.0...1.8.1)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.0...1.8.1)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
github_changelog_generator (1.8.1)
|
github_changelog_generator (1.8.5)
|
||||||
colorize (~> 0.7)
|
colorize (~> 0.7)
|
||||||
github_api (~> 0.12)
|
github_api (~> 0.12)
|
||||||
|
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -84,6 +84,16 @@ Type `github_changelog_generator --help` for details.
|
|||||||
|
|
||||||
More detailed info about params you can find in Wiki page: [**Advanced change log generation examples**](https://github.com/skywinder/github-changelog-generator/wiki/Advanced-change-log-generation-examples)
|
More detailed info about params you can find in Wiki page: [**Advanced change log generation examples**](https://github.com/skywinder/github-changelog-generator/wiki/Advanced-change-log-generation-examples)
|
||||||
|
|
||||||
|
### Params File
|
||||||
|
You can put Params in a .github_changelog_generator file in Project Root to override default params:
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
unreleased=false
|
||||||
|
future-release=5.0.0
|
||||||
|
since-tag=1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
### GitHub token
|
### GitHub token
|
||||||
|
|
||||||
Since GitHub allows you to make only 50 requests without authentication it's recommended to run this script with a token (`-t, --token` option)
|
Since GitHub allows you to make only 50 requests without authentication it's recommended to run this script with a token (`-t, --token` option)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ require "benchmark"
|
|||||||
|
|
||||||
require_relative "github_changelog_generator/helper"
|
require_relative "github_changelog_generator/helper"
|
||||||
require_relative "github_changelog_generator/parser"
|
require_relative "github_changelog_generator/parser"
|
||||||
|
require_relative "github_changelog_generator/parser_file"
|
||||||
require_relative "github_changelog_generator/generator/generator"
|
require_relative "github_changelog_generator/generator/generator"
|
||||||
require_relative "github_changelog_generator/version"
|
require_relative "github_changelog_generator/version"
|
||||||
require_relative "github_changelog_generator/reader"
|
require_relative "github_changelog_generator/reader"
|
||||||
|
|||||||
@@ -131,16 +131,45 @@ module GitHubChangelogGenerator
|
|||||||
# @param [Array] all_tags all tags
|
# @param [Array] all_tags all tags
|
||||||
# @return [Array] filtered tags according :exclude_tags option
|
# @return [Array] filtered tags according :exclude_tags option
|
||||||
def filter_excluded_tags(all_tags)
|
def filter_excluded_tags(all_tags)
|
||||||
filtered_tags = all_tags
|
return all_tags unless @options[:exclude_tags]
|
||||||
if @options[:exclude_tags]
|
|
||||||
@options[:exclude_tags].each do |tag|
|
apply_exclude_tags(all_tags)
|
||||||
unless all_tags.map(&:name).include? tag
|
end
|
||||||
Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
|
|
||||||
end
|
private
|
||||||
end
|
|
||||||
filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag.name }
|
def apply_exclude_tags(all_tags)
|
||||||
|
if @options[:exclude_tags].is_a?(Regexp)
|
||||||
|
filter_tags_with_regex(all_tags)
|
||||||
|
else
|
||||||
|
filter_exact_tags(all_tags)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_tags_with_regex(all_tags)
|
||||||
|
warn_if_nonmatching_regex(all_tags)
|
||||||
|
all_tags.reject { |tag| @options[:exclude_tags] =~ tag.name }
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_exact_tags(all_tags)
|
||||||
|
@options[:exclude_tags].each do |tag|
|
||||||
|
warn_if_tag_not_found(all_tags, tag)
|
||||||
|
end
|
||||||
|
all_tags.reject { |tag| @options[:exclude_tags].include? tag.name }
|
||||||
|
end
|
||||||
|
|
||||||
|
def warn_if_nonmatching_regex(all_tags)
|
||||||
|
unless all_tags.map(&:name).any? { |t| @options[:exclude_tags] =~ t }
|
||||||
|
Helper.log.warn "Warning: unable to reject any tag, using regex "\
|
||||||
|
"#{@options[:exclude_tags].inspect} in --exclude-tags "\
|
||||||
|
"option."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def warn_if_tag_not_found(all_tags, tag)
|
||||||
|
unless all_tags.map(&:name).include? tag
|
||||||
|
Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
|
||||||
end
|
end
|
||||||
filtered_tags
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ module GitHubChangelogGenerator
|
|||||||
def self.parse_options
|
def self.parse_options
|
||||||
options = get_default_options
|
options = get_default_options
|
||||||
|
|
||||||
parser = setup_parser(options)
|
parser_file = ParserFile.new options
|
||||||
|
parser_file.parse!
|
||||||
|
|
||||||
|
parser = setup_parser(options)
|
||||||
parser.parse!
|
parser.parse!
|
||||||
|
|
||||||
if options[:user].nil? || options[:project].nil?
|
if options[:user].nil? || options[:project].nil?
|
||||||
|
|||||||
36
lib/github_changelog_generator/parser_file.rb
Normal file
36
lib/github_changelog_generator/parser_file.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
module GitHubChangelogGenerator
|
||||||
|
class ParserFile
|
||||||
|
def initialize(options)
|
||||||
|
@options = options
|
||||||
|
end
|
||||||
|
|
||||||
|
def file
|
||||||
|
File.expand_path(@options[:params_file] || ".github_changelog_generator")
|
||||||
|
end
|
||||||
|
|
||||||
|
def file?
|
||||||
|
File.exist?(file)
|
||||||
|
end
|
||||||
|
|
||||||
|
def file_open
|
||||||
|
File.open(file)
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse!
|
||||||
|
return unless file?
|
||||||
|
file_open.each do |line|
|
||||||
|
begin
|
||||||
|
key, value = line.split("=")
|
||||||
|
key_sym = key.sub("-", "_").to_sym
|
||||||
|
value = value.gsub(/[\n\r]+/, "")
|
||||||
|
value = true if value =~ (/^(true|t|yes|y|1)$/i)
|
||||||
|
value = false if value =~ (/^(false|f|no|n|0)$/i)
|
||||||
|
@options[key_sym] = value
|
||||||
|
rescue
|
||||||
|
raise "File #{file} is incorrect in line \"#{line.gsub(/[\n\r]+/, '')}\""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -51,7 +51,7 @@ module GitHubChangelogGenerator
|
|||||||
|
|
||||||
OPTIONS.each do |o|
|
OPTIONS.each do |o|
|
||||||
v = instance_variable_get("@#{o}")
|
v = instance_variable_get("@#{o}")
|
||||||
options[o.to_sym] = v if v
|
options[o.to_sym] = v unless v.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
generator = Generator.new options
|
generator = Generator.new options
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
VERSION = "1.8.4"
|
VERSION = "1.9.0"
|
||||||
end
|
end
|
||||||
|
|||||||
0
spec/files/github_changelog_params_empty
Normal file
0
spec/files/github_changelog_params_empty
Normal file
2
spec/files/github_changelog_params_incorrect
Normal file
2
spec/files/github_changelog_params_incorrect
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
unreleased_label: staging
|
||||||
|
unreleased: false
|
||||||
2
spec/files/github_changelog_params_override
Normal file
2
spec/files/github_changelog_params_override
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
unreleased_label=staging
|
||||||
|
unreleased=false
|
||||||
@@ -31,91 +31,25 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|||||||
SimpleCov.start
|
SimpleCov.start
|
||||||
|
|
||||||
require "github_changelog_generator"
|
require "github_changelog_generator"
|
||||||
|
require "github_changelog_generator/task"
|
||||||
|
|
||||||
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
||||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
||||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
||||||
# this file to always be loaded, without a need to explicitly require it in any
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Given that it is always loaded, you are encouraged to keep this file as
|
|
||||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
||||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
||||||
# individual file that may not need all of that loaded. Instead, consider making
|
|
||||||
# a separate helper file that requires the additional dependencies and performs
|
|
||||||
# the additional setup, and require it from the spec files that actually need
|
|
||||||
# it.
|
|
||||||
#
|
|
||||||
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
||||||
# users commonly want.
|
|
||||||
#
|
|
||||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# rspec-expectations config goes here. You can use an alternate
|
|
||||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
||||||
# assertions if you prefer.
|
|
||||||
config.expect_with :rspec do |expectations|
|
config.expect_with :rspec do |expectations|
|
||||||
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
||||||
# and `failure_message` of custom matchers include text for helper methods
|
|
||||||
# defined using `chain`, e.g.:
|
|
||||||
# be_bigger_than(2).and_smaller_than(4).description
|
|
||||||
# # => "be bigger than 2 and smaller than 4"
|
|
||||||
# ...rather than:
|
|
||||||
# # => "be bigger than 2"
|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# rspec-mocks config goes here. You can use an alternate test double
|
|
||||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
||||||
config.mock_with :rspec do |mocks|
|
config.mock_with :rspec do |mocks|
|
||||||
# Prevents you from mocking or stubbing a method that does not exist on
|
|
||||||
# a real object. This is generally recommended, and will default to
|
|
||||||
# `true` in RSpec 4.
|
|
||||||
mocks.verify_partial_doubles = true
|
mocks.verify_partial_doubles = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# These two settings work together to allow you to limit a spec run
|
|
||||||
# to individual examples or groups you care about by tagging them with
|
|
||||||
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
||||||
# get run.
|
|
||||||
config.filter_run :focus
|
config.filter_run :focus
|
||||||
config.run_all_when_everything_filtered = true
|
config.run_all_when_everything_filtered = true
|
||||||
|
|
||||||
# Limits the available syntax to the non-monkey patched syntax that is
|
|
||||||
# recommended. For more details, see:
|
|
||||||
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
||||||
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
||||||
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
|
||||||
# config.disable_monkey_patching!
|
|
||||||
|
|
||||||
# This setting enables warnings. It's recommended, but in some cases may
|
|
||||||
# be too noisy due to issues in dependencies.
|
|
||||||
config.warnings = true
|
config.warnings = true
|
||||||
|
|
||||||
# Many RSpec users commonly either run the entire suite or an individual
|
config.default_formatter = "doc" if config.files_to_run.one?
|
||||||
# file, and it's useful to allow more verbose output when running an
|
|
||||||
# individual spec file.
|
|
||||||
if config.files_to_run.one?
|
|
||||||
# Use the documentation formatter for detailed output,
|
|
||||||
# unless a formatter has already been configured
|
|
||||||
# (e.g. via a command-line flag).
|
|
||||||
config.default_formatter = "doc"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Print the 10 slowest examples and example groups at the
|
|
||||||
# end of the spec run, to help surface which specs are running
|
|
||||||
# particularly slow.
|
|
||||||
# config.profile_examples = 10
|
|
||||||
|
|
||||||
# Run specs in random order to surface order dependencies. If you find an
|
|
||||||
# order dependency and want to debug it, you can fix the order by providing
|
|
||||||
# the seed, which is printed after each run.
|
|
||||||
# --seed 1234
|
|
||||||
config.order = :random
|
config.order = :random
|
||||||
|
|
||||||
# Seed global randomization in this process using the `--seed` CLI option.
|
|
||||||
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
||||||
# test failures related to randomization by passing the same `--seed` value
|
|
||||||
# as the one that triggered the failure.
|
|
||||||
Kernel.srand config.seed
|
Kernel.srand config.seed
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -87,6 +87,18 @@ describe GitHubChangelogGenerator::Generator do
|
|||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with regex exclude_tags" do
|
||||||
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[23]/) }
|
||||||
|
it { is_expected.to be_a Array }
|
||||||
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with non-matching regex in exclude_tags" do
|
||||||
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[abc]/) }
|
||||||
|
it { is_expected.to be_a Array }
|
||||||
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#filter_since_tag" do
|
describe "#filter_since_tag" do
|
||||||
|
|||||||
32
spec/unit/parse_file_spec.rb
Normal file
32
spec/unit/parse_file_spec.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
describe GitHubChangelogGenerator::ParserFile do
|
||||||
|
describe ".github_changelog_generator" do
|
||||||
|
context "when no has file" do
|
||||||
|
let(:options) { {} }
|
||||||
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
||||||
|
subject { parse.parse! }
|
||||||
|
it { is_expected.to be_nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when file is empty" do
|
||||||
|
let(:options) { { params_file: "spec/files/github_changelog_params_empty" } }
|
||||||
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
||||||
|
subject { parse.parse! }
|
||||||
|
it { is_expected.to be_a(Hash) }
|
||||||
|
it { is_expected.to eq(options) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when file is incorrect" do
|
||||||
|
let(:options) { { params_file: "spec/files/github_changelog_params_incorrect" } }
|
||||||
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
||||||
|
it { expect { fail.raise! }.to raise_error RuntimeError }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when override default values" do
|
||||||
|
let(:options) { { params_file: "spec/files/github_changelog_params_override" }.merge(GitHubChangelogGenerator::Parser.get_default_options) }
|
||||||
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
||||||
|
subject { parse.parse! }
|
||||||
|
it { is_expected.to be_a(Hash) }
|
||||||
|
it { is_expected.to eq(options.merge(unreleased_label: "staging", unreleased: false)) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user