Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ea623fd81 | ||
|
|
6e61dfb378 | ||
|
|
3fee4fca75 | ||
|
|
9fc00f3dc3 | ||
|
|
132ecf255c | ||
|
|
238f779d38 | ||
|
|
0b88c3bd54 | ||
|
|
9c0f7c723f | ||
|
|
881ecc161c | ||
|
|
88cbcd22ed | ||
|
|
07081ccf46 | ||
|
|
a9b49927ee | ||
|
|
4a74bd0ba6 | ||
|
|
879668b605 | ||
|
|
92137ba0b2 | ||
|
|
b2a29d7279 | ||
|
|
52d14f4b0a | ||
|
|
4d4e8ef5a4 | ||
|
|
d4dfc99127 | ||
|
|
88b23ba790 | ||
|
|
d122e00a1a |
12
.codeclimate.yml
Normal file
12
.codeclimate.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
engines:
|
||||||
|
duplication:
|
||||||
|
enabled: true
|
||||||
|
config:
|
||||||
|
languages:
|
||||||
|
- ruby
|
||||||
|
rubocop:
|
||||||
|
enabled: true
|
||||||
|
ratings:
|
||||||
|
paths:
|
||||||
|
- "**.rb"
|
||||||
|
exclude_paths:
|
||||||
24
.travis.yml
24
.travis.yml
@@ -6,31 +6,25 @@ before_install:
|
|||||||
- gem install bundler
|
- gem install bundler
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- rvm: 2.2.2
|
- rvm: 2.2.6
|
||||||
install: true # This skips 'bundle install'
|
install: true # This skips 'bundle install'
|
||||||
script: gem build github_changelog_generator && gem install *.gem
|
script: gem build github_changelog_generator && gem install *.gem
|
||||||
- rvm: 2.2.2
|
- rvm: 2.2.6
|
||||||
install: true # This skips 'bundle install'
|
install: true # This skips 'bundle install'
|
||||||
script: gem build github_changelog_generator && bundle install
|
script: gem build github_changelog_generator && bundle install
|
||||||
gemfile: spec/install-gem-in-bundler.gemfile
|
gemfile: spec/install-gem-in-bundler.gemfile
|
||||||
- rvm: 2.1
|
- rvm: 2.1
|
||||||
gemfile: gemfiles/Gemfile.2_1
|
- rvm: 2.3.3
|
||||||
- rvm: 2.3.1
|
- rvm: 2.4.0
|
||||||
gemfile: gemfiles/Gemfile.2_3_1
|
- rvm: jruby-9.1.6.0
|
||||||
- rvm: 2.4.0-preview2
|
jdk: oraclejdk8
|
||||||
gemfile: gemfiles/Gemfile.2_4_0
|
env:
|
||||||
- rvm: jruby-9.1.5.0
|
- JRUBY_OPTS=--debug
|
||||||
|
- rvm: jruby-head
|
||||||
jdk: oraclejdk8
|
jdk: oraclejdk8
|
||||||
gemfile: gemfiles/Gemfile.jruby-9.1.5.0
|
|
||||||
env:
|
env:
|
||||||
- JRUBY_OPTS=--debug
|
- JRUBY_OPTS=--debug
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
recipients:
|
|
||||||
- sky4winder+githubchangeloggenerator@gmail.com
|
|
||||||
on_success: never
|
|
||||||
on_failure: change
|
|
||||||
addons:
|
addons:
|
||||||
code_climate:
|
code_climate:
|
||||||
repo_token:
|
repo_token:
|
||||||
|
|||||||
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,7 +1,30 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [v1.14.2](https://github.com/skywinder/github-changelog-generator/tree/v1.14.2) (2016-11-12)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.14.1...v1.14.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- We should add a git-generate-changelog command. [\#255](https://github.com/skywinder/github-changelog-generator/issues/255)
|
||||||
|
- OctoFetcher: Moved repositories fail explicitly [\#449](https://github.com/skywinder/github-changelog-generator/pull/449) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Error: can't convert Sawyer::Resource to Array when iterating over a 301 Moved Permanently [\#448](https://github.com/skywinder/github-changelog-generator/issues/448)
|
||||||
|
|
||||||
|
## [v1.14.1](https://github.com/skywinder/github-changelog-generator/tree/v1.14.1) (2016-11-06)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.14.0...v1.14.1)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- multi\_json is required but is listed as a test dependency [\#444](https://github.com/skywinder/github-changelog-generator/issues/444)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add multi\_json as a runtime dependency [\#445](https://github.com/skywinder/github-changelog-generator/pull/445) ([rnelson0](https://github.com/rnelson0))
|
||||||
|
|
||||||
## [v1.14.0](https://github.com/skywinder/github-changelog-generator/tree/v1.14.0) (2016-11-05)
|
## [v1.14.0](https://github.com/skywinder/github-changelog-generator/tree/v1.14.0) (2016-11-05)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.13.2...v1.14.0)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.13.2...v1.14.0)
|
||||||
|
|
||||||
**Implemented enhancements:**
|
**Implemented enhancements:**
|
||||||
|
|
||||||
@@ -37,11 +60,11 @@
|
|||||||
- Drop a stray Markdown file [\#426](https://github.com/skywinder/github-changelog-generator/pull/426) ([olleolleolle](https://github.com/olleolleolle))
|
- Drop a stray Markdown file [\#426](https://github.com/skywinder/github-changelog-generator/pull/426) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
- Travis: Add JRuby 9.1.5.0 to matrix [\#424](https://github.com/skywinder/github-changelog-generator/pull/424) ([olleolleolle](https://github.com/olleolleolle))
|
- Travis: Add JRuby 9.1.5.0 to matrix [\#424](https://github.com/skywinder/github-changelog-generator/pull/424) ([olleolleolle](https://github.com/olleolleolle))
|
||||||
|
|
||||||
## [1.13.2](https://github.com/skywinder/github-changelog-generator/tree/1.13.2) (2016-09-29)
|
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/v1.13.2...1.13.2)
|
|
||||||
|
|
||||||
## [v1.13.2](https://github.com/skywinder/github-changelog-generator/tree/v1.13.2) (2016-09-29)
|
## [v1.13.2](https://github.com/skywinder/github-changelog-generator/tree/v1.13.2) (2016-09-29)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.13.1...v1.13.2)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.13.2...v1.13.2)
|
||||||
|
|
||||||
|
## [1.13.2](https://github.com/skywinder/github-changelog-generator/tree/1.13.2) (2016-09-29)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.13.1...1.13.2)
|
||||||
|
|
||||||
**Implemented enhancements:**
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
|||||||
18
Gemfile
18
Gemfile
@@ -1,12 +1,14 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
ruby RUBY_VERSION
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem "rake"
|
|
||||||
gem "bundler"
|
gem "bundler"
|
||||||
gem "overcommit", ">= 0.31"
|
gem "overcommit", ">= 0.31"
|
||||||
|
gem "rake"
|
||||||
gem "rubocop", ">= 0.43"
|
gem "rubocop", ">= 0.43"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -15,16 +17,12 @@ group :development do
|
|||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem "vcr"
|
|
||||||
gem "multi_json"
|
|
||||||
gem "webmock"
|
|
||||||
gem "coveralls", "~>0.8", require: false
|
|
||||||
gem "simplecov", "~>0.10", require: false
|
|
||||||
gem "codeclimate-test-reporter", "~>0.4"
|
gem "codeclimate-test-reporter", "~>0.4"
|
||||||
if RUBY_VERSION > "2"
|
gem "coveralls", "~>0.8", require: false
|
||||||
gem "json", "~> 2.0", ">= 2.0.2"
|
|
||||||
else
|
|
||||||
gem "json"
|
gem "json"
|
||||||
end
|
gem "multi_json"
|
||||||
gem "rspec", "< 4"
|
gem "rspec", "< 4"
|
||||||
|
gem "simplecov", "~>0.10", require: false
|
||||||
|
gem "vcr"
|
||||||
|
gem "webmock"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ end
|
|||||||
|
|
||||||
All command line options can be passed to the `rake` task as `config` parameters. And since you're naming the `rake` task yourself, you can create as many as you want.
|
All command line options can be passed to the `rake` task as `config` parameters. And since you're naming the `rake` task yourself, you can create as many as you want.
|
||||||
|
|
||||||
|
You can look for params names from the [parser source code (#setup_parser)](https://github.com/skywinder/github-changelog-generator/blob/master/lib/github_changelog_generator/parser.rb). For example, to translate the bugs label to Portuguese, instead of setting `config.bugs_label`, you have to set `config.bug_prefix`, and so on.
|
||||||
|
|
||||||
## Features and advantages of this project
|
## Features and advantages of this project
|
||||||
- Generate canonical, neat change log file, followed by [basic change log guidelines](http://keepachangelog.com) :gem:
|
- Generate canonical, neat change log file, followed by [basic change log guidelines](http://keepachangelog.com) :gem:
|
||||||
- Optionally generate **Unreleased** changes (closed issues that have not released yet) :dizzy:
|
- Optionally generate **Unreleased** changes (closed issues that have not released yet) :dizzy:
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
eval_gemfile File.expand_path('../../Gemfile', __FILE__)
|
|
||||||
gem 'rack', '~> 1.6'
|
|
||||||
gem 'activesupport', '~> 4'
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
eval_gemfile File.expand_path('../../Gemfile', __FILE__)
|
|
||||||
gem 'rack', '>= 2'
|
|
||||||
gem 'activesupport', '>= 4'
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
eval_gemfile File.expand_path('../../Gemfile', __FILE__)
|
|
||||||
gem 'rack', '>= 2'
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
eval_gemfile File.expand_path('../../Gemfile', __FILE__)
|
|
||||||
gem 'rack', '>= 2'
|
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
spec.add_runtime_dependency "rake", ">= 10.0"
|
spec.add_runtime_dependency "rake", ">= 10.0"
|
||||||
spec.add_runtime_dependency "rainbow", ">= 2.1"
|
spec.add_runtime_dependency "rainbow", ">= 2.1"
|
||||||
spec.add_runtime_dependency("octokit", ["~> 4.0"])
|
spec.add_runtime_dependency("octokit", ["~> 4.6"])
|
||||||
spec.add_runtime_dependency("faraday-http-cache")
|
spec.add_runtime_dependency("faraday-http-cache")
|
||||||
spec.add_runtime_dependency("activesupport")
|
spec.add_runtime_dependency("activesupport")
|
||||||
spec.add_runtime_dependency("retriable", ["~> 2.1"])
|
spec.add_runtime_dependency("retriable", ["~> 2.1"])
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ module GitHubChangelogGenerator
|
|||||||
# @option options [Boolean] :http_cache Use ActiveSupport::Cache::FileStore to cache http requests
|
# @option options [Boolean] :http_cache Use ActiveSupport::Cache::FileStore to cache http requests
|
||||||
# @option options [Boolean] :cache_file If using http_cache, this is the cache file path
|
# @option options [Boolean] :cache_file If using http_cache, this is the cache file path
|
||||||
# @option options [Boolean] :cache_log If using http_cache, this is the cache log file path
|
# @option options [Boolean] :cache_log If using http_cache, this is the cache log file path
|
||||||
def initialize(options = {}) # rubocop:disable Metrics/CyclomaticComplexity
|
def initialize(options = {})
|
||||||
@options = options || {}
|
@options = options || {}
|
||||||
@user = @options[:user]
|
@user = @options[:user]
|
||||||
@project = @options[:project]
|
@project = @options[:project]
|
||||||
@@ -40,8 +40,7 @@ module GitHubChangelogGenerator
|
|||||||
@github_options[:access_token] = @github_token unless @github_token.nil?
|
@github_options[:access_token] = @github_token unless @github_token.nil?
|
||||||
@github_options[:api_endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil?
|
@github_options[:api_endpoint] = @options[:github_endpoint] unless @options[:github_endpoint].nil?
|
||||||
|
|
||||||
client_type = @options[:github_endpoint].nil? ? Octokit::Client : Octokit::EnterpriseAdminClient
|
@client = Octokit::Client.new(@github_options)
|
||||||
@client = client_type.new(@github_options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def init_cache
|
def init_cache
|
||||||
@@ -244,38 +243,49 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
MovedPermanentlyError = Class.new(RuntimeError)
|
||||||
|
|
||||||
# Iterates through all pages until there are no more :next pages to follow
|
# Iterates through all pages until there are no more :next pages to follow
|
||||||
# yields the result per page
|
# yields the result per page
|
||||||
#
|
#
|
||||||
# @param [Octokit::Client] client
|
# @param [Octokit::Client] client
|
||||||
# @param [String] method (eg. 'tags')
|
# @param [String] method (eg. 'tags')
|
||||||
|
#
|
||||||
|
# @yield [Sawyer::Resource] An OctoKit-provided response (which can be empty)
|
||||||
|
#
|
||||||
# @return [Integer] total number of pages
|
# @return [Integer] total number of pages
|
||||||
def iterate_pages(client, method, *args)
|
def iterate_pages(client, method, *args)
|
||||||
if args.size == 1 && args.first.is_a?(Hash)
|
request_opts = extract_request_args(args)
|
||||||
request_options = args.delete_at(0)
|
args.push(@request_options.merge(request_opts))
|
||||||
elsif args.size > 1 && args.last.is_a?(Hash)
|
|
||||||
request_options = args.delete_at(args.length - 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
args.push(@request_options.merge(request_options))
|
number_of_pages = 1
|
||||||
|
|
||||||
pages = 1
|
check_github_response { client.send(method, user_project, *args) }
|
||||||
|
|
||||||
check_github_response do
|
|
||||||
client.send(method, user_project, *args)
|
|
||||||
end
|
|
||||||
last_response = client.last_response
|
last_response = client.last_response
|
||||||
|
if last_response.status == 301
|
||||||
|
raise MovedPermanentlyError, last_response.data[:url]
|
||||||
|
end
|
||||||
|
|
||||||
yield last_response.data
|
yield(last_response.data)
|
||||||
|
|
||||||
until (next_one = last_response.rels[:next]).nil?
|
until (next_one = last_response.rels[:next]).nil?
|
||||||
pages += 1
|
number_of_pages += 1
|
||||||
|
|
||||||
last_response = check_github_response { next_one.get }
|
last_response = check_github_response { next_one.get }
|
||||||
yield last_response.data
|
yield(last_response.data)
|
||||||
end
|
end
|
||||||
|
|
||||||
pages
|
number_of_pages
|
||||||
|
end
|
||||||
|
|
||||||
|
def extract_request_args(args)
|
||||||
|
if args.size == 1 && args.first.is_a?(Hash)
|
||||||
|
args.delete_at(0)
|
||||||
|
elsif args.size > 1 && args.last.is_a?(Hash)
|
||||||
|
args.delete_at(args.length - 1)
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is wrapper with rescue block
|
# This is wrapper with rescue block
|
||||||
@@ -285,7 +295,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
|
|||||||
Retriable.retriable(retry_options) do
|
Retriable.retriable(retry_options) do
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
|
rescue MovedPermanentlyError => e
|
||||||
|
Helper.log.error("#{e.class}: #{e.message}")
|
||||||
|
sys_abort("The repository has moved, please update your configuration")
|
||||||
rescue Octokit::Forbidden => e
|
rescue Octokit::Forbidden => e
|
||||||
Helper.log.error("#{e.class}: #{e.message}")
|
Helper.log.error("#{e.class}: #{e.message}")
|
||||||
sys_abort("Exceeded retry limit")
|
sys_abort("Exceeded retry limit")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
VERSION = "1.14.1"
|
VERSION = "1.14.3"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user