From 53df784ec37a548df1df6511bd9f0809029159e4 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Tue, 5 Jan 2016 21:38:52 +0100 Subject: [PATCH 1/3] Parser: avoid Ruby exit - made the method take three arguments - specs all note these three --- lib/github_changelog_generator/parser.rb | 11 +++-------- spec/unit/parser_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 7918c3a..2f16d9b 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -217,7 +217,7 @@ module GitHubChangelogGenerator # # @param [String] output of git remote command # @return [Array] user and project - def self.user_project_from_option(arg0, arg1, github_site = nil) + def self.user_project_from_option(arg0, arg1, github_site) user = nil project = nil github_site ||= "github.com" @@ -230,10 +230,10 @@ module GitHubChangelogGenerator param = match[2].nil? rescue puts "Can't detect user and name from first parameter: '#{arg0}' -> exit'" - exit + return end if param - exit + return else user = match[1] project = match[2] @@ -276,9 +276,4 @@ module GitHubChangelogGenerator [user, project] end end - - if __FILE__ == $PROGRAM_NAME - remote = "invalid reference to project" - p user_project_from_option(ARGV[0], ARGV[1], remote) - end end diff --git a/spec/unit/parser_spec.rb b/spec/unit/parser_spec.rb index 3f792c1..6e2fe9d 100644 --- a/spec/unit/parser_spec.rb +++ b/spec/unit/parser_spec.rb @@ -28,16 +28,16 @@ describe GitHubChangelogGenerator::Parser do end describe ".user_project_from_option" do context "when option is invalid" do - it("should exit") { expect { GitHubChangelogGenerator::Parser.user_project_from_option("blah", nil) }.to raise_error(SystemExit) } + it("should return nil") { expect(GitHubChangelogGenerator::Parser.user_project_from_option("blah", nil, nil)).to be_nil } end context "when option is valid" do - subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", nil) } + subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", nil, nil) } it { is_expected.to be_a(Array) } it { is_expected.to match_array(["skywinder", "ActionSheetPicker-3.0"]) } end context "when option nil" do - subject { GitHubChangelogGenerator::Parser.user_project_from_option(nil, nil) } + subject { GitHubChangelogGenerator::Parser.user_project_from_option(nil, nil, nil) } it { is_expected.to be_a(Array) } it { is_expected.to match_array([nil, nil]) } end From 0cc7065efc614f5bf2854cf713178c222b51b730 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Tue, 5 Jan 2016 21:59:39 +0100 Subject: [PATCH 2/3] linting --- github_changelog_generator.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_changelog_generator.gemspec b/github_changelog_generator.gemspec index 6f4c59d..fd6249d 100644 --- a/github_changelog_generator.gemspec +++ b/github_changelog_generator.gemspec @@ -9,14 +9,14 @@ Gem::Specification.new do |spec| spec.version = GitHubChangelogGenerator::VERSION spec.default_executable = "github_changelog_generator" - spec.required_ruby_version = ">= 1.9.3" + spec.required_ruby_version = ">= 1.9.3" spec.authors = ["Petr Korolev"] spec.email = "sky4winder+github_changelog_generator@gmail.com" spec.date = `date +"%Y-%m-%d"`.strip! spec.summary = "Script, that automatically generate changelog from your tags, issues, labels and pull requests." spec.description = "Changelog generation has never been so easy. Fully automate changelog generation - this gem generate change log file based on tags, issues and merged pull requests from Github issue tracker." spec.homepage = "https://github.com/skywinder/Github-Changelog-Generator" - spec.license = "MIT" + spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } From e745a89ac1b5a503e71a15b1f14500d8db456e94 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 6 Jan 2016 09:15:30 +0200 Subject: [PATCH 3/3] Update changelog for version 1.10.1 --- CHANGELOG.md | 7 +++++++ Gemfile.lock | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ad2da1..1c47ccf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## [1.10.1](https://github.com/skywinder/github-changelog-generator/tree/1.10.1) (2016-01-06) +[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.10.0...1.10.1) + +**Fixed bugs:** + +- Parser: avoid Ruby exit, to make Rake tasks work [\#315](https://github.com/skywinder/github-changelog-generator/pull/315) ([olleolleolle](https://github.com/olleolleolle)) + ## [1.10.0](https://github.com/skywinder/github-changelog-generator/tree/1.10.0) (2016-01-05) [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.9.0...1.10.0) diff --git a/Gemfile.lock b/Gemfile.lock index 5e1ed49..91835f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - github_changelog_generator (1.10.0) + github_changelog_generator (1.10.1) colorize (~> 0.7) github_api (~> 0.12)