Merge branch 'develop'
This commit is contained in:
commit
aac04726ba
8
.travis.yml
Normal file
8
.travis.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
language: ruby
|
||||||
|
before_install:
|
||||||
|
- gem update --system
|
||||||
|
- gem --version
|
||||||
|
rvm:
|
||||||
|
- 2.1.0
|
||||||
|
gemfile:
|
||||||
|
- Gemfile
|
3
Gemfile
3
Gemfile
|
@ -1,3 +1,4 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
gem 'github_api'
|
gem 'github_api'
|
||||||
gem 'colorize'
|
gem 'colorize'
|
||||||
|
gem 'rake'
|
||||||
|
|
|
@ -30,6 +30,7 @@ GEM
|
||||||
multi_xml (~> 0.5)
|
multi_xml (~> 0.5)
|
||||||
rack (~> 1.2)
|
rack (~> 1.2)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
|
rake (10.4.2)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
@ -38,3 +39,4 @@ PLATFORMS
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
colorize
|
colorize
|
||||||
github_api
|
github_api
|
||||||
|
rake
|
||||||
|
|
|
@ -2,7 +2,7 @@ GitHub Changelog Generator
|
||||||
==================
|
==================
|
||||||
|
|
||||||
[![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)
|
||||||
|
[![Build Status](https://travis-ci.org/skywinder/Github-Changelog-Generator.svg?branch=master)](https://travis-ci.org/skywinder/Github-Changelog-Generator)
|
||||||
Changelog generation has never been so easy.
|
Changelog generation has never been so easy.
|
||||||
|
|
||||||
This script automatically generate change-log from your tags and merged pull-requests.
|
This script automatically generate change-log from your tags and merged pull-requests.
|
||||||
|
|
9
Rakefile
Normal file
9
Rakefile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require "rake/testtask"
|
||||||
|
|
||||||
|
task :default => [:test]
|
||||||
|
|
||||||
|
Rake::TestTask.new do |t|
|
||||||
|
t.verbose = true
|
||||||
|
t.libs.push("demo", "test")
|
||||||
|
t.pattern = "test/**/*_test.rb"
|
||||||
|
end
|
|
@ -111,7 +111,6 @@ module GitHubChangelogGenerator
|
||||||
if @options[:last]
|
if @options[:last]
|
||||||
log += self.generate_log_between_tags(self.all_tags[0], self.all_tags[1])
|
log += self.generate_log_between_tags(self.all_tags[0], self.all_tags[1])
|
||||||
elsif @options[:tag1] and @options[:tag2]
|
elsif @options[:tag1] and @options[:tag2]
|
||||||
|
|
||||||
tag1 = @options[:tag1]
|
tag1 = @options[:tag1]
|
||||||
tag2 = @options[:tag2]
|
tag2 = @options[:tag2]
|
||||||
tags_strings = []
|
tags_strings = []
|
||||||
|
@ -159,11 +158,11 @@ module GitHubChangelogGenerator
|
||||||
puts "Generating log.."
|
puts "Generating log.."
|
||||||
end
|
end
|
||||||
|
|
||||||
for index in 1 ... self.all_tags.size
|
(1 ... self.all_tags.size).each { |index|
|
||||||
log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1])
|
log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1])
|
||||||
end
|
}
|
||||||
|
|
||||||
log += self.generate_log_before_tag(self.all_tags.last)
|
log += generate_log_between_tags(nil, self.all_tags.last)
|
||||||
|
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
@ -216,14 +215,14 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
if older_tag.nil?
|
if older_tag.nil?
|
||||||
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time)
|
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time)
|
||||||
issues = delete_by_time(@issues, :closed_at, newer_tag_time)
|
filtered_issues = delete_by_time(@issues, :closed_at, newer_tag_time)
|
||||||
else
|
else
|
||||||
older_tag_time = self.get_time_of_tag(older_tag)
|
older_tag_time = self.get_time_of_tag(older_tag)
|
||||||
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time, older_tag_time)
|
filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time, older_tag_time)
|
||||||
issues = delete_by_time(@issues, :closed_at, newer_tag_time, older_tag_time)
|
filtered_issues = delete_by_time(@issues, :closed_at, newer_tag_time, older_tag_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.create_log(filtered_pull_requests, issues, newer_tag_name, newer_tag_time)
|
self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ module GitHubChangelogGenerator
|
||||||
tag_in_range_new = t <= newer_tag_time
|
tag_in_range_new = t <= newer_tag_time
|
||||||
|
|
||||||
tag_in_range = (tag_in_range_old) && (tag_in_range_new)
|
tag_in_range = (tag_in_range_old) && (tag_in_range_new)
|
||||||
|
|
||||||
tag_in_range
|
tag_in_range
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -249,15 +248,15 @@ module GitHubChangelogGenerator
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_log_before_tag(tag)
|
# @param [Array] pull_requests
|
||||||
generate_log_between_tags(nil, tag)
|
# @param [Array] issues
|
||||||
end
|
# @param [String] tag_name
|
||||||
|
# @param [String] tag_time
|
||||||
|
# @return [String]
|
||||||
def create_log(pull_requests, issues, tag_name, tag_time)
|
def create_log(pull_requests, issues, tag_name, tag_time)
|
||||||
|
|
||||||
# Generate tag name and link
|
# Generate tag name and link
|
||||||
trimmed_tag = tag_name.tr('v', '')
|
log = "## [#{tag_name}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
|
||||||
log = "## [#{trimmed_tag}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
|
|
||||||
|
|
||||||
#Generate date string:
|
#Generate date string:
|
||||||
time_string = tag_time.strftime @options[:format]
|
time_string = tag_time.strftime @options[:format]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user