From 1c578fec915a49a6b852c1b3d5f4fe8611083b5f Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Tue, 15 Sep 2015 09:07:46 +0300 Subject: [PATCH 01/10] rm build status --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ab30e2b..5acde66 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![Gem Version](https://badge.fury.io/rb/github_changelog_generator.svg)](http://badge.fury.io/rb/github_changelog_generator) [![Dependency Status](https://gemnasium.com/skywinder/github-changelog-generator.svg)](https://gemnasium.com/skywinder/github-changelog-generator) -[![Build Status](https://travis-ci.org/skywinder/github-changelog-generator.svg?branch=master)](https://travis-ci.org/skywinder/github-changelog-generator) [![Inline docs](http://inch-ci.org/github/skywinder/github-changelog-generator.svg)](http://inch-ci.org/github/skywinder/github-changelog-generator) [![Code Climate](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/gpa.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator) [![Test Coverage](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/coverage.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator) From 0862e54f4212305e8f969981d305c6a82f0f249c Mon Sep 17 00:00:00 2001 From: Dlani Mendes Date: Mon, 14 Sep 2015 01:02:52 -0300 Subject: [PATCH 02/10] Auto parse options from file .github_changelog_generator --- .gitignore | 1 + lib/github_changelog_generator.rb | 1 + lib/github_changelog_generator/parser.rb | 4 ++- lib/github_changelog_generator/parser_file.rb | 28 +++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lib/github_changelog_generator/parser_file.rb diff --git a/.gitignore b/.gitignore index e69de29..1377554 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 3b1e60f..31d86ae 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -7,6 +7,7 @@ require "benchmark" require_relative "github_changelog_generator/helper" 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/version" require_relative "github_changelog_generator/reader" diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index d1b36b7..06b5c26 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -10,9 +10,11 @@ module GitHubChangelogGenerator options = get_default_options parser = setup_parser(options) - parser.parse! + parser_file = ParseFile.new options + parser_file.parse! + if options[:user].nil? || options[:project].nil? detect_user_and_project(options, ARGV[0], ARGV[1]) end diff --git a/lib/github_changelog_generator/parser_file.rb b/lib/github_changelog_generator/parser_file.rb new file mode 100644 index 0000000..068fc0f --- /dev/null +++ b/lib/github_changelog_generator/parser_file.rb @@ -0,0 +1,28 @@ +module GitHubChangelogGenerator + class ParseFile + def initialize(options) + @options = options + end + + def file + File.expand_path(".github_changelog_generator") + end + + def has_file? + File.exists?(file) + end + + def file_open + File.open(file) + end + + def parse! + return false unless has_file? + file_open.each do |line| + key, value = line.split("=") + key_sym = key.sub('-', '_').to_sym + @options[key_sym] = value.gsub(/[\n\r]+/, '') + end + end + end +end From eccecd68751a2a1abf5da324e1789f22dca1c8b9 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Tue, 15 Sep 2015 21:34:54 +0200 Subject: [PATCH 03/10] Feature: exclude_tags using regular expression --- .../generator/generator_tags.rb | 47 ++++++++++--- spec/spec_helper.rb | 66 +------------------ spec/unit/generator/generator_tags_spec.rb | 12 ++++ 3 files changed, 51 insertions(+), 74 deletions(-) diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index db2579c..0966df1 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -131,16 +131,45 @@ module GitHubChangelogGenerator # @param [Array] all_tags all tags # @return [Array] filtered tags according :exclude_tags option def filter_excluded_tags(all_tags) - filtered_tags = all_tags - if @options[:exclude_tags] - @options[:exclude_tags].each do |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 = all_tags.reject { |tag| @options[:exclude_tags].include? tag.name } + return all_tags unless @options[:exclude_tags] + + apply_exclude_tags(all_tags) + end + + private + + 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 - filtered_tags end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5c4749d..bf88b97 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,91 +31,27 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov.start 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-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| - # 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 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| - # 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 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.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 - # Many RSpec users commonly either run the entire suite or an individual - # 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 - # 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 end diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index 932e673..a2a3dff 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -87,6 +87,18 @@ describe GitHubChangelogGenerator::Generator do it { is_expected.to be_a Array } it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) } 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 describe "#filter_since_tag" do From 4b88f02f978712b788723373e9e24c21072944c6 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 16 Sep 2015 09:28:43 +0300 Subject: [PATCH 04/10] remove trailing spaces --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5acde66..0cbfe93 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg) - [Contributing](#contributing) - [License](#license) - + ### Changelog generation has never been so easy: **Fully automate changelog generation** - This gem generates change log file based on **tags**, **issues** and merged **pull requests** (and splits them into separate lists according labels) from :octocat: GitHub Issue Tracker. @@ -47,26 +47,26 @@ Because software tools are for people. If you don’t care, why are you contribu - In general it looks like this: > ## [1.2.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.5) (2015-01-15) -> +> > [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.4...1.2.5) -> +> > **Implemented enhancements:** -> +> > - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22) -> +> > **Fixed bugs:** -> +> > - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32) -> +> > **Merged pull requests:** -> +> > - PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/Github-Changelog-Generator/pull/43) ([schwing](https://github.com/schwing)) -> +> > - support enterprise github via command line options [\#42](https://github.com/skywinder/Github-Changelog-Generator/pull/42) ([glenlovett](https://github.com/glenlovett)) ## Usage -**It's really simple**: +**It's really simple**: - If your **git remote** `origin` refers to your GitHub repo, then just go to your project folder and run: @@ -75,7 +75,7 @@ Because software tools are for people. If you don’t care, why are you contribu - or from anywhere: - `github_changelog_generator -u github_username -p github_project` - `github_changelog_generator github_username/github_project` - + As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog. ### Params @@ -91,9 +91,9 @@ Since GitHub allows you to make only 50 requests without authentication it's rec And: -- Run with key `-t [your-40-digit-token]` -- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token. - +- Run with key `-t [your-40-digit-token]` +- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token. + i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string : export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token" @@ -138,10 +138,10 @@ All command line options can be passed to the Rake task as `config` parameters. - Merged pull requests (all `merged` pull-requests) :twisted_rightwards_arrows: - Bug fixes (by label `bug` in issue) :beetle: - Enhancements (by label `enhancement` in issue) :star2: - - Issues (closed issues `w/o any labels`) :non-potable_water: + - Issues (closed issues `w/o any labels`) :non-potable_water: - You can manually set which labels should be included/excluded. :wrench: -- Apply a lot of other customisations, to fit changelog for your personal style :tophat: +- Apply a lot of other customisations, to fit changelog for your personal style :tophat: (*look `github_changelog_generator --help` for details)* @@ -152,7 +152,7 @@ Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Ch ### Projects using this library -[Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) +[Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) If you've used this project in a live app, please let me know! Nothing makes me happier than seeing someone else take my work and go wild with it. @@ -160,9 +160,9 @@ If you've used this project in a live app, please let me know! Nothing makes me ## Am I missing some essential feature? -- **Nothing is impossible!** +- **Nothing is impossible!** -- Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together! +- Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together! - *Bug reports, feature requests, patches, well-wishes are always welcome* :heavy_exclamation_mark: From 9feecf98b8cbfdd6216b6baac7cd118c3a939e64 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 16 Sep 2015 10:09:27 +0300 Subject: [PATCH 05/10] update travis --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fff1005..958237a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ -sudo: false -cache: bundler language: ruby +before_install: gem update --system rvm: - 2.1.0 script: From 125960a3a354d31ad7ba0cc3cd1b7fb93d2893d8 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 16 Sep 2015 10:22:07 +0300 Subject: [PATCH 06/10] run bundle install --no-deploymeng --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d956225..4e1d1aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - github_changelog_generator (1.8.1) + github_changelog_generator (1.8.5) colorize (~> 0.7) github_api (~> 0.12) From 55a1c6933cec3c5a9cc20cf6604e8d4233118706 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 16 Sep 2015 10:58:24 +0300 Subject: [PATCH 07/10] add build status --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cbfe93..e4f05e7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Gem Version](https://badge.fury.io/rb/github_changelog_generator.svg)](http://badge.fury.io/rb/github_changelog_generator) -[![Dependency Status](https://gemnasium.com/skywinder/github-changelog-generator.svg)](https://gemnasium.com/skywinder/github-changelog-generator) +[![Dependency Status](https://gemnasium.com/skywinder/github-changelog-generator.svg)](https://gemnasium.com/skywinder/github-changelog-generator) +[![Build Status](https://travis-ci.org/skywinder/github-changelog-generator.svg?branch=master)](https://travis-ci.org/skywinder/github-changelog-generator) [![Inline docs](http://inch-ci.org/github/skywinder/github-changelog-generator.svg)](http://inch-ci.org/github/skywinder/github-changelog-generator) [![Code Climate](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/gpa.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator) [![Test Coverage](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/coverage.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator) From 31b4294ed6c232df474f53055b6f52d7b86cf2c1 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 16 Sep 2015 14:50:21 +0300 Subject: [PATCH 08/10] rubocop autofix --- spec/spec_helper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bf88b97..e8fa625 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -47,9 +47,7 @@ RSpec.configure do |config| config.warnings = true - if config.files_to_run.one? - config.default_formatter = "doc" - end + config.default_formatter = "doc" if config.files_to_run.one? config.order = :random From ba7c5653748c9d69e9d482b6278bc4b3bbac6c08 Mon Sep 17 00:00:00 2001 From: Dlani Mendes Date: Tue, 15 Sep 2015 15:38:41 -0300 Subject: [PATCH 09/10] Rspec and README --- .gitignore | 1 - README.md | 10 ++++++ lib/github_changelog_generator/parser.rb | 6 ++-- lib/github_changelog_generator/parser_file.rb | 24 +++++++++----- spec/files/github_changelog_params_empty | 0 spec/files/github_changelog_params_incorrect | 2 ++ spec/files/github_changelog_params_override | 2 ++ spec/unit/parse_file_spec.rb | 32 +++++++++++++++++++ 8 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 spec/files/github_changelog_params_empty create mode 100644 spec/files/github_changelog_params_incorrect create mode 100644 spec/files/github_changelog_params_override create mode 100644 spec/unit/parse_file_spec.rb diff --git a/.gitignore b/.gitignore index 1377554..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -*.swp diff --git a/README.md b/README.md index e4f05e7..de5803f 100644 --- a/README.md +++ b/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) +### 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 Since GitHub allows you to make only 50 requests without authentication it's recommended to run this script with a token (`-t, --token` option) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 06b5c26..5001ad6 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -9,12 +9,12 @@ module GitHubChangelogGenerator def self.parse_options options = get_default_options + parser_file = ParserFile.new options + parser_file.parse! + parser = setup_parser(options) parser.parse! - parser_file = ParseFile.new options - parser_file.parse! - if options[:user].nil? || options[:project].nil? detect_user_and_project(options, ARGV[0], ARGV[1]) end diff --git a/lib/github_changelog_generator/parser_file.rb b/lib/github_changelog_generator/parser_file.rb index 068fc0f..74f3cd3 100644 --- a/lib/github_changelog_generator/parser_file.rb +++ b/lib/github_changelog_generator/parser_file.rb @@ -1,15 +1,15 @@ module GitHubChangelogGenerator - class ParseFile + class ParserFile def initialize(options) @options = options end def file - File.expand_path(".github_changelog_generator") + File.expand_path(@options[:params_file] || ".github_changelog_generator") end - def has_file? - File.exists?(file) + def file? + File.exist?(file) end def file_open @@ -17,12 +17,20 @@ module GitHubChangelogGenerator end def parse! - return false unless has_file? + return unless file? file_open.each do |line| - key, value = line.split("=") - key_sym = key.sub('-', '_').to_sym - @options[key_sym] = value.gsub(/[\n\r]+/, '') + 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 diff --git a/spec/files/github_changelog_params_empty b/spec/files/github_changelog_params_empty new file mode 100644 index 0000000..e69de29 diff --git a/spec/files/github_changelog_params_incorrect b/spec/files/github_changelog_params_incorrect new file mode 100644 index 0000000..35fa3d8 --- /dev/null +++ b/spec/files/github_changelog_params_incorrect @@ -0,0 +1,2 @@ +unreleased_label: staging +unreleased: false diff --git a/spec/files/github_changelog_params_override b/spec/files/github_changelog_params_override new file mode 100644 index 0000000..ff0a972 --- /dev/null +++ b/spec/files/github_changelog_params_override @@ -0,0 +1,2 @@ +unreleased_label=staging +unreleased=false diff --git a/spec/unit/parse_file_spec.rb b/spec/unit/parse_file_spec.rb new file mode 100644 index 0000000..55c743d --- /dev/null +++ b/spec/unit/parse_file_spec.rb @@ -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 From d79e70b267fbd1e32ad786e9f1ee244a89949b27 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Thu, 17 Sep 2015 11:59:30 +0300 Subject: [PATCH 10/10] Update gemspec to version 1.9.0 --- 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 2678bdd..88f2aae 100644 --- a/lib/github_changelog_generator/version.rb +++ b/lib/github_changelog_generator/version.rb @@ -1,3 +1,3 @@ module GitHubChangelogGenerator - VERSION = "1.8.5" + VERSION = "1.9.0" end