Compare commits

..

44 Commits
1.8.3 ... 1.9.0

Author SHA1 Message Date
Petr Korolev
8f61c7fc7e Merge branch 'release/1.9.0' 2015-09-17 11:59:33 +03:00
Petr Korolev
d79e70b267 Update gemspec to version 1.9.0 2015-09-17 11:59:30 +03:00
Dlani Mendes
ba7c565374 Rspec and README 2015-09-17 11:59:02 +03:00
Petr Korolev
31b4294ed6 rubocop autofix 2015-09-17 11:59:02 +03:00
Petr Korolev
55a1c6933c add build status 2015-09-17 11:59:01 +03:00
Petr Korolev
125960a3a3 run bundle install --no-deploymeng 2015-09-17 11:59:01 +03:00
Petr Korolev
9feecf98b8 update travis 2015-09-17 11:59:01 +03:00
Petr Korolev
4b88f02f97 remove trailing spaces 2015-09-17 11:59:01 +03:00
Olle Jonsson
eccecd6875 Feature: exclude_tags using regular expression 2015-09-17 11:59:01 +03:00
Dlani Mendes
0862e54f42 Auto parse options from file .github_changelog_generator 2015-09-17 11:59:01 +03:00
Petr Korolev
1c578fec91 rm build status 2015-09-17 11:59:01 +03:00
Petr Korolev
29c33fec60 Merge pull request #278 from dlanileonardo/master
Auto parse options from file .github_changelog_generator
2015-09-17 11:58:29 +03:00
Dlani Mendes
6c71cf439a Rspec and README 2015-09-16 16:19:40 -03:00
Petr Korolev
2d7f6bf174 rubocop autofix 2015-09-16 14:50:21 +03:00
Petr Korolev
1e4a3db0a2 Merge pull request #281 from olleolleolle/feature/rake-specs
Feature: exclude_tags using regular expression
2015-09-16 12:14:19 +03:00
Petr Korolev
b0fc03f38c add build status 2015-09-16 10:58:24 +03:00
Petr Korolev
a2658f9af9 run bundle install --no-deploymeng 2015-09-16 10:22:07 +03:00
Petr Korolev
48a49a67ec update travis 2015-09-16 10:09:27 +03:00
Petr Korolev
93b69a511f remove trailing spaces 2015-09-16 09:28:43 +03:00
Olle Jonsson
ef97e7f950 Feature: exclude_tags using regular expression 2015-09-15 21:34:54 +02:00
Dlani Mendes
fbd8207ff4 Auto parse options from file .github_changelog_generator 2015-09-15 13:58:23 -03:00
Petr Korolev
ff4e5612af rm build status 2015-09-15 09:07:46 +03:00
Petr Korolev
6bace8a582 Merge branch 'hotfix/update-changelog' into develop 2015-09-15 09:06:55 +03:00
Petr Korolev
a6b0d0cb83 Merge branch 'hotfix/update-changelog' 2015-09-15 09:06:54 +03:00
Petr Korolev
91176e9174 Update changelog for version 1.8.5 2015-09-15 09:06:52 +03:00
Petr Korolev
494c8afff0 Merge branch 'release/1.8.5' into develop 2015-09-15 09:06:03 +03:00
Petr Korolev
d14694a6d6 Merge branch 'release/1.8.5' 2015-09-15 09:06:03 +03:00
Petr Korolev
aa64fa131c Update gemspec to version 1.8.5 2015-09-15 09:06:00 +03:00
Petr Korolev
fe0eab1c90 Merge pull request #279 from olleolleolle/feature/negative-options
Rake task: Be able to set false value in config
2015-09-15 09:04:25 +03:00
Olle Jonsson
14d7c29808 Rake task: Be able to set false value in config 2015-09-15 00:35:07 +02:00
Petr Korolev
1bf758480f Merge branch 'master' into develop 2015-09-01 09:16:55 +03:00
Petr Korolev
12ea21c00b Merge pull request #275 from skywinder/fix-274
This PRi will fix #274.
2015-09-01 09:16:34 +03:00
Petr Korolev
6411ba6b81 Merge branch 'hotfix/update-changelog' into develop 2015-09-01 09:14:28 +03:00
Petr Korolev
302eb9c66f Merge branch 'hotfix/update-changelog' 2015-09-01 09:14:27 +03:00
Petr Korolev
4bd88a3fcb Update changelog for version 1.8.4 2015-09-01 09:14:25 +03:00
Petr Korolev
61b026a60c Merge branch 'release/1.8.4' into develop 2015-09-01 09:13:40 +03:00
Petr Korolev
72f993fab5 Merge branch 'release/1.8.4' 2015-09-01 09:13:40 +03:00
Petr Korolev
0a7c4886ec Update gemspec to version 1.8.4 2015-09-01 09:13:37 +03:00
Petr Korolev
b902897a22 This commit will fix #274. 2015-09-01 09:13:27 +03:00
Petr Korolev
0df2687b93 This commit will fix #274. 2015-09-01 09:11:52 +03:00
Petr Korolev
60ddebbe1a Merge branch 'hotfix/update-changelog' 2015-08-31 15:42:22 +03:00
Petr Korolev
e91b8cc535 Merge branch 'hotfix/update-changelog' into develop 2015-08-31 15:42:22 +03:00
Petr Korolev
f718a82af1 Update changelog for version 1.8.3 2015-08-31 15:42:20 +03:00
Petr Korolev
606f193ff6 Merge branch 'release/1.8.3' into develop 2015-08-31 15:41:28 +03:00
16 changed files with 196 additions and 110 deletions

View File

@@ -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:

View File

@@ -1,5 +1,26 @@
# 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)
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.2...1.8.3)
**Merged pull requests:**
- Do not alter pull\_requests while iterating on it [\#271](https://github.com/skywinder/github-changelog-generator/pull/271) ([raphink](https://github.com/raphink))
## [1.8.2](https://github.com/skywinder/github-changelog-generator/tree/1.8.2) (2015-08-26) ## [1.8.2](https://github.com/skywinder/github-changelog-generator/tree/1.8.2) (2015-08-26)
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.1...1.8.2) [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.1...1.8.2)
@@ -7,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)
@@ -241,16 +266,13 @@
**Implemented enhancements:** **Implemented enhancements:**
- Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/github-changelog-generator/issues/22) - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/github-changelog-generator/issues/22)
- support enterprise github via command line options [\#42](https://github.com/skywinder/github-changelog-generator/pull/42) ([glenlovett](https://github.com/glenlovett))
**Fixed bugs:** **Fixed bugs:**
- Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/github-changelog-generator/issues/32) - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/github-changelog-generator/issues/32)
- PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/github-changelog-generator/pull/43) ([schwing](https://github.com/schwing)) - PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/github-changelog-generator/pull/43) ([schwing](https://github.com/schwing))
**Merged pull requests:**
- support enterprise github via command line options [\#42](https://github.com/skywinder/github-changelog-generator/pull/42) ([glenlovett](https://github.com/glenlovett))
## [1.2.4](https://github.com/skywinder/github-changelog-generator/tree/1.2.4) (2014-12-16) ## [1.2.4](https://github.com/skywinder/github-changelog-generator/tree/1.2.4) (2014-12-16)
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.2.3...1.2.4) [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.2.3...1.2.4)

View File

@@ -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)

View File

@@ -1,5 +1,5 @@
[![Gem Version](https://badge.fury.io/rb/github_changelog_generator.svg)](http://badge.fury.io/rb/github_changelog_generator) [![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) [![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) [![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) [![Code Climate](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/gpa.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator)
@@ -20,7 +20,7 @@ GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg)
- [Contributing](#contributing) - [Contributing](#contributing)
- [License](#license) - [License](#license)
### Changelog generation has never been so easy: ### 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. **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.
@@ -48,26 +48,26 @@ Because software tools are for people. If you dont care, why are you contribu
- In general it looks like this: - In general it looks like this:
> ## [1.2.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.5) (2015-01-15) > ## [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) > [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.4...1.2.5)
> >
> **Implemented enhancements:** > **Implemented enhancements:**
> >
> - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22) > - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22)
> >
> **Fixed bugs:** > **Fixed bugs:**
> >
> - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32) > - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32)
> >
> **Merged pull requests:** > **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)) > - 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)) > - support enterprise github via command line options [\#42](https://github.com/skywinder/Github-Changelog-Generator/pull/42) ([glenlovett](https://github.com/glenlovett))
## Usage ## 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: - If your **git remote** `origin` refers to your GitHub repo, then just go to your project folder and run:
@@ -76,7 +76,7 @@ Because software tools are for people. If you dont care, why are you contribu
- or from anywhere: - or from anywhere:
- `github_changelog_generator -u github_username -p github_project` - `github_changelog_generator -u github_username -p github_project`
- `github_changelog_generator github_username/github_project` - `github_changelog_generator github_username/github_project`
As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog. As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog.
### Params ### Params
@@ -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)
@@ -92,9 +102,9 @@ Since GitHub allows you to make only 50 requests without authentication it's rec
And: And:
- Run with key `-t [your-40-digit-token]` - Run with key `-t [your-40-digit-token]`
- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your 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 : 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" export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token"
@@ -139,10 +149,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: - Merged pull requests (all `merged` pull-requests) :twisted_rightwards_arrows:
- Bug fixes (by label `bug` in issue) :beetle: - Bug fixes (by label `bug` in issue) :beetle:
- Enhancements (by label `enhancement` in issue) :star2: - 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: - 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)* (*look `github_changelog_generator --help` for details)*
@@ -153,7 +163,7 @@ Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Ch
### Projects using this library ### 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. 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.
@@ -161,9 +171,9 @@ If you've used this project in a live app, please let me know! Nothing makes me
## Am I missing some essential feature? ## 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: - *Bug reports, feature requests, patches, well-wishes are always welcome* :heavy_exclamation_mark:

View File

@@ -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"

View File

@@ -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

View File

@@ -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?
@@ -22,15 +24,20 @@ module GitHubChangelogGenerator
exit exit
end end
print_options(options)
options
end
# @param [Hash] options to display
def self.print_options(options)
if options[:verbose] if options[:verbose]
Helper.log.info "Performing task with options:" Helper.log.info "Performing task with options:"
options_to_display = options options_to_display = options.clone
options_to_display[:token] = options_to_display[:token].nil? ? nil : "hidden value" options_to_display[:token] = options_to_display[:token].nil? ? nil : "hidden value"
pp options_to_display pp options_to_display
puts "" puts ""
end end
options
end end
# setup parsing options # setup parsing options

View 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

View File

@@ -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

View File

@@ -1,3 +1,3 @@
module GitHubChangelogGenerator module GitHubChangelogGenerator
VERSION = "1.8.3" VERSION = "1.9.0"
end end

View File

View File

@@ -0,0 +1,2 @@
unreleased_label: staging
unreleased: false

View File

@@ -0,0 +1,2 @@
unreleased_label=staging
unreleased=false

View File

@@ -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

View File

@@ -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

View 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