Merge branch 'hotfix/fix-travis' into develop
This commit is contained in:
commit
2456db0847
|
@ -2,3 +2,7 @@ inherit_from: .rubocop_todo.yml
|
||||||
|
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
#http://viget.com/extend/just-use-double-quoted-ruby-strings
|
||||||
|
#Style/StringLiterals:
|
||||||
|
# EnforcedStyle: double_quotes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# This configuration was generated by `rubocop --auto-gen-config`
|
# This configuration was generated by `rubocop --auto-gen-config`
|
||||||
# on 2015-03-26 22:36:26 +0200 using RuboCop version 0.29.1.
|
# on 2015-03-27 03:03:45 +0200 using RuboCop version 0.29.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
|
@ -16,26 +16,16 @@ Metrics/BlockNesting:
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Max: 483
|
Max: 471
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 18
|
Max: 18
|
||||||
|
|
||||||
# Offense count: 81
|
# Offense count: 27
|
||||||
# Configuration parameters: AllowURI, URISchemes.
|
|
||||||
Metrics/LineLength:
|
|
||||||
Max: 213
|
|
||||||
|
|
||||||
# Offense count: 26
|
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 145
|
Max: 147
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: CountKeywordArgs.
|
|
||||||
Metrics/ParameterLists:
|
|
||||||
Max: 6
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
|
@ -75,7 +65,7 @@ Style/GlobalVars:
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 18
|
# Offense count: 17
|
||||||
# Configuration parameters: MaxLineLength.
|
# Configuration parameters: MaxLineLength.
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -85,11 +75,6 @@ Style/IfUnlessModifier:
|
||||||
Style/Next:
|
Style/Next:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
|
||||||
Style/PredicateName:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Configuration parameters: MaxSlashes.
|
# Configuration parameters: MaxSlashes.
|
||||||
Style/RegexpLiteral:
|
Style/RegexpLiteral:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
[![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)
|
[![Build Status](https://travis-ci.org/skywinder/github-changelog-generator.svg?branch=master)](https://travis-ci.org/skywinder/github-changelog-generator)
|
||||||
|
[![Coverage Status](http://img.shields.io/coveralls/skywinder/github-changelog-generator/master.svg)](https://coveralls.io/r/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)
|
||||||
|
[![Inline docs](http://inch-ci.org/github/skywinder/github-changelog-generator.svg)](http://inch-ci.org/github/skywinder/github-changelog-generator)
|
||||||
|
|
||||||
GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg)
|
GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg)
|
||||||
==================
|
==================
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /usr/bin/env ruby
|
#! /usr/bin/env ruby
|
||||||
|
|
||||||
require_relative '../lib/github_changelog_generator'
|
require_relative '../lib/github_changelog_generator'
|
||||||
GitHubChangelogGenerator::ChangelogGenerator.new.compund_changelog
|
GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog
|
||||||
|
|
|
@ -15,8 +15,8 @@ module GitHubChangelogGenerator
|
||||||
attr_accessor :options, :all_tags, :github
|
attr_accessor :options, :all_tags, :github
|
||||||
|
|
||||||
PER_PAGE_NUMBER = 30
|
PER_PAGE_NUMBER = 30
|
||||||
GH_RATE_LIMIT_EXCEEDED_MSG = 'Warning: GitHub API rate limit exceed (5000 per hour), change log may not ' \
|
GH_RATE_LIMIT_EXCEEDED_MSG = 'Warning: GitHub API rate limit (5000 per hour) exceeded, change log may be ' \
|
||||||
'contain some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument'
|
'missing some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument.'
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@options = Parser.parse_options
|
@options = Parser.parse_options
|
||||||
|
@ -95,7 +95,7 @@ module GitHubChangelogGenerator
|
||||||
commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
|
commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
|
||||||
issue[:actual_date] = commit[:author][:date]
|
issue[:actual_date] = commit[:author][:date]
|
||||||
rescue
|
rescue
|
||||||
puts "Warning: can't fetch commit #{event[:commit_id]} probably it referenced from another repo.".yellow
|
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo.".yellow
|
||||||
issue[:actual_date] = issue[:closed_at]
|
issue[:actual_date] = issue[:closed_at]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -139,7 +139,7 @@ module GitHubChangelogGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
puts 'Fetching merged dates... Done!'
|
puts 'Fetching merged dates: Done!'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
unless @options[:include_labels].nil?
|
unless @options[:include_labels].nil?
|
||||||
filtered_pull_requests = @pull_requests.select { |issue|
|
filtered_pull_requests = @pull_requests.select { |issue|
|
||||||
# add all labels from @options[:incluse_labels] array
|
# add all labels from @options[:include_labels] array
|
||||||
(issue.labels.map(&:name) & @options[:include_labels]).any?
|
(issue.labels.map(&:name) & @options[:include_labels]).any?
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -176,7 +176,7 @@ module GitHubChangelogGenerator
|
||||||
filtered_pull_requests
|
filtered_pull_requests
|
||||||
end
|
end
|
||||||
|
|
||||||
def compund_changelog
|
def compound_changelog
|
||||||
log = "# Change Log\n\n"
|
log = "# Change Log\n\n"
|
||||||
|
|
||||||
if @options[:unreleased_only]
|
if @options[:unreleased_only]
|
||||||
|
@ -218,13 +218,13 @@ module GitHubChangelogGenerator
|
||||||
fetch_tags_dates
|
fetch_tags_dates
|
||||||
|
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
puts 'Sorting tags..'
|
puts 'Sorting tags...'
|
||||||
end
|
end
|
||||||
|
|
||||||
@all_tags.sort_by! { |x| get_time_of_tag(x) }.reverse!
|
@all_tags.sort_by! { |x| get_time_of_tag(x) }.reverse!
|
||||||
|
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
puts 'Generating log..'
|
puts 'Generating log...'
|
||||||
end
|
end
|
||||||
|
|
||||||
log = ''
|
log = ''
|
||||||
|
@ -248,7 +248,7 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
def fetch_tags_dates
|
def fetch_tags_dates
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
print "Fetching tags dates..\r"
|
print "Fetching tag dates...\r"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Async fetching tags:
|
# Async fetching tags:
|
||||||
|
@ -275,12 +275,6 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_megred(number)
|
|
||||||
@github.pull_requests.merged? @options[:user], @options[:project], number
|
|
||||||
rescue
|
|
||||||
puts GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_all_tags
|
def get_all_tags
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
print "Fetching tags...\r"
|
print "Fetching tags...\r"
|
||||||
|
@ -298,12 +292,11 @@ module GitHubChangelogGenerator
|
||||||
tags.concat(page)
|
tags.concat(page)
|
||||||
end
|
end
|
||||||
print " \r"
|
print " \r"
|
||||||
if @options[:verbose]
|
|
||||||
puts "Found #{tags.count} tags"
|
|
||||||
end
|
|
||||||
|
|
||||||
if tags.count == 0
|
if tags.count == 0
|
||||||
puts "Warning: Can't find any tags in repo. Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
puts "Warning: Can't find any tags in repo. Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
|
elsif @options[:verbose]
|
||||||
|
puts "Found #{tags.count} tags"
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue
|
rescue
|
||||||
|
@ -318,7 +311,7 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
unless env_var
|
unless env_var
|
||||||
puts 'Warning: No token provided (-t option) and variable $CHANGELOG_GITHUB_TOKEN was not found.'.yellow
|
puts 'Warning: No token provided (-t option) and variable $CHANGELOG_GITHUB_TOKEN was not found.'.yellow
|
||||||
puts 'This script can make only 50 requests to GitHub API per hour without token!'.yellow
|
puts 'This script can make only 50 requests per hour to GitHub API without a token!'.yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
@github_token ||= env_var
|
@github_token ||= env_var
|
||||||
|
@ -417,23 +410,14 @@ module GitHubChangelogGenerator
|
||||||
# @param [String] older_tag_name
|
# @param [String] older_tag_name
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def create_log(pull_requests, issues, newer_tag, older_tag_name = nil)
|
def create_log(pull_requests, issues, newer_tag, older_tag_name = nil)
|
||||||
newer_tag_time = newer_tag.nil? ? nil : get_time_of_tag(newer_tag)
|
newer_tag_time = newer_tag.nil? ? Time.new : get_time_of_tag(newer_tag)
|
||||||
newer_tag_name = newer_tag.nil? ? nil : newer_tag['name']
|
newer_tag_name = newer_tag.nil? ? @options[:unreleased_label] : newer_tag['name']
|
||||||
|
newer_tag_link = newer_tag.nil? ? 'HEAD' : newer_tag_name
|
||||||
|
|
||||||
github_site = options[:github_site] || 'https://github.com'
|
github_site = options[:github_site] || 'https://github.com'
|
||||||
project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}"
|
project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}"
|
||||||
|
|
||||||
if newer_tag.nil?
|
log = generate_header(newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url)
|
||||||
newer_tag_name = @options[:unreleased_label]
|
|
||||||
newer_tag_link = 'HEAD'
|
|
||||||
newer_tag_time = Time.new
|
|
||||||
else
|
|
||||||
newer_tag_link = newer_tag_name
|
|
||||||
end
|
|
||||||
|
|
||||||
log = ''
|
|
||||||
|
|
||||||
log += generate_header(log, newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url)
|
|
||||||
|
|
||||||
if @options[:issues]
|
if @options[:issues]
|
||||||
# Generate issues:
|
# Generate issues:
|
||||||
|
@ -488,9 +472,11 @@ module GitHubChangelogGenerator
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_header(log, newer_tag_name, newer_tag_name2, newer_tag_time, older_tag_name, project_url)
|
def generate_header(newer_tag_name, newer_tag_name2, newer_tag_time, older_tag_name, project_url)
|
||||||
|
log = ''
|
||||||
|
|
||||||
# Generate date string:
|
# Generate date string:
|
||||||
time_string = newer_tag_time.strftime @options[:format]
|
time_string = newer_tag_time.strftime @options[:dateformat]
|
||||||
|
|
||||||
# Generate tag name and link
|
# Generate tag name and link
|
||||||
if newer_tag_name.equal? @options[:unreleased_label]
|
if newer_tag_name.equal? @options[:unreleased_label]
|
||||||
|
@ -532,7 +518,7 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
unless @options[:include_labels].nil?
|
unless @options[:include_labels].nil?
|
||||||
filtered_issues = issues.select { |issue|
|
filtered_issues = issues.select { |issue|
|
||||||
# add all labels from @options[:incluse_labels] array
|
# add all labels from @options[:include_labels] array
|
||||||
(issue.labels.map(&:name) & @options[:include_labels]).any?
|
(issue.labels.map(&:name) & @options[:include_labels]).any?
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -635,6 +621,6 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
if __FILE__ == $PROGRAM_NAME
|
if __FILE__ == $PROGRAM_NAME
|
||||||
GitHubChangelogGenerator::ChangelogGenerator.new.compund_changelog
|
GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,24 +9,27 @@ module GitHubChangelogGenerator
|
||||||
options = {
|
options = {
|
||||||
tag1: nil,
|
tag1: nil,
|
||||||
tag2: nil,
|
tag2: nil,
|
||||||
format: '%Y-%m-%d',
|
dateformat: '%Y-%m-%d',
|
||||||
output: 'CHANGELOG.md',
|
output: 'CHANGELOG.md',
|
||||||
exclude_labels: %w(duplicate question invalid wontfix),
|
|
||||||
pulls: true,
|
|
||||||
issues: true,
|
issues: true,
|
||||||
verbose: true,
|
|
||||||
add_issues_wo_labels: true,
|
add_issues_wo_labels: true,
|
||||||
add_pr_wo_labels: true,
|
add_pr_wo_labels: true,
|
||||||
|
pulls: true,
|
||||||
|
filter_issues_by_milestone: true,
|
||||||
|
author: true,
|
||||||
|
unreleased: true,
|
||||||
|
unreleased_label: 'Unreleased',
|
||||||
|
compare_link: true,
|
||||||
|
include_labels: %w(bug enhancement),
|
||||||
|
exclude_labels: %w(duplicate question invalid wontfix),
|
||||||
|
max_issues: nil,
|
||||||
|
simple_list: false,
|
||||||
|
verbose: true,
|
||||||
|
|
||||||
merge_prefix: '**Merged pull requests:**',
|
merge_prefix: '**Merged pull requests:**',
|
||||||
issue_prefix: '**Closed issues:**',
|
issue_prefix: '**Closed issues:**',
|
||||||
bug_prefix: '**Fixed bugs:**',
|
bug_prefix: '**Fixed bugs:**',
|
||||||
enhancement_prefix: '**Implemented enhancements:**',
|
enhancement_prefix: '**Implemented enhancements:**',
|
||||||
author: true,
|
|
||||||
filter_issues_by_milestone: true,
|
|
||||||
max_issues: nil,
|
|
||||||
compare_link: true,
|
|
||||||
unreleased: true,
|
|
||||||
unreleased_label: 'Unreleased',
|
|
||||||
branch: 'origin'
|
branch: 'origin'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,25 +41,25 @@ module GitHubChangelogGenerator
|
||||||
opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub') do |last|
|
opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub') do |last|
|
||||||
options[:project] = last
|
options[:project] = last
|
||||||
end
|
end
|
||||||
opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests per hour your GitHub token required. You can generate it here: https://github.com/settings/tokens/new') do |last|
|
opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests per hour your GitHub token is required. You can generate it at: https://github.com/settings/tokens/new') do |last|
|
||||||
options[:token] = last
|
options[:token] = last
|
||||||
end
|
end
|
||||||
opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %d/%m/%y') do |last|
|
opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %Y-%m-%d') do |last|
|
||||||
options[:format] = last
|
options[:dateformat] = last
|
||||||
end
|
end
|
||||||
opts.on('-o', '--output [NAME]', 'Output file. Default is CHANGELOG.md') do |last|
|
opts.on('-o', '--output [NAME]', 'Output file. Default is CHANGELOG.md') do |last|
|
||||||
options[:output] = last
|
options[:output] = last
|
||||||
end
|
end
|
||||||
opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
|
opts.on('--[no-]issues', 'Include closed issues in changelog. Default is true') do |v|
|
||||||
options[:issues] = v
|
options[:issues] = v
|
||||||
end
|
end
|
||||||
opts.on('--[no-]issues-wo-labels', 'Include closed issues without labels to changelog. Default is true') do |v|
|
opts.on('--[no-]issues-wo-labels', 'Include closed issues without labels in changelog. Default is true') do |v|
|
||||||
options[:add_issues_wo_labels] = v
|
options[:add_issues_wo_labels] = v
|
||||||
end
|
end
|
||||||
opts.on('--[no-]pr-wo-labels', 'Include pull requests without labels to changelog. Default is true') do |v|
|
opts.on('--[no-]pr-wo-labels', 'Include pull requests without labels in changelog. Default is true') do |v|
|
||||||
options[:add_pr_wo_labels] = v
|
options[:add_pr_wo_labels] = v
|
||||||
end
|
end
|
||||||
opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
|
opts.on('--[no-]pull-requests', 'Include pull-requests in changelog. Default is true') do |v|
|
||||||
options[:pulls] = v
|
options[:pulls] = v
|
||||||
end
|
end
|
||||||
opts.on('--[no-]filter-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
|
opts.on('--[no-]filter-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
|
||||||
|
@ -77,10 +80,10 @@ module GitHubChangelogGenerator
|
||||||
opts.on('--[no-]compare-link', 'Include compare link (Full Changelog) between older version and newer version. Default is true') do |v|
|
opts.on('--[no-]compare-link', 'Include compare link (Full Changelog) between older version and newer version. Default is true') do |v|
|
||||||
options[:compare_link] = v
|
options[:compare_link] = v
|
||||||
end
|
end
|
||||||
opts.on('--include-labels x,y,z', Array, 'Issues only with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
|
opts.on('--include-labels x,y,z', Array, 'Only issues with the specified labels will be included in the changelog. Default is \'bug,enhancement\'') do |list|
|
||||||
options[:include_labels] = list
|
options[:include_labels] = list
|
||||||
end
|
end
|
||||||
opts.on('--exclude-labels x,y,z', Array, 'Issues with that labels will be always excluded from changelog. Default is \'duplicate,question,invalid,wontfix\'') do |list|
|
opts.on('--exclude-labels x,y,z', Array, 'Issues with the specified labels will be always excluded from changelog. Default is \'duplicate,question,invalid,wontfix\'') do |list|
|
||||||
options[:exclude_labels] = list
|
options[:exclude_labels] = list
|
||||||
end
|
end
|
||||||
opts.on('--max-issues [NUMBER]', Integer, 'Max number of issues to fetch from GitHub. Default is unlimited') do |max|
|
opts.on('--max-issues [NUMBER]', Integer, 'Max number of issues to fetch from GitHub. Default is unlimited') do |max|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user