Merge branch 'travis-update' into develop

This commit is contained in:
Petr Korolev 2014-12-03 11:37:39 +02:00
commit e038c7e680
5 changed files with 34 additions and 15 deletions

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: ruby
before_install:
- gem update --system
- gem --version
rvm:
- 2.1.0
gemfile:
- Gemfile

View File

@ -1,3 +1,4 @@
source 'https://rubygems.org'
gem 'github_api'
gem 'colorize'
gem 'colorize'
gem 'rake'

View File

@ -30,6 +30,7 @@ GEM
multi_xml (~> 0.5)
rack (~> 1.2)
rack (1.5.2)
rake (10.4.2)
thread_safe (0.3.4)
PLATFORMS
@ -38,3 +39,4 @@ PLATFORMS
DEPENDENCIES
colorize
github_api
rake

9
Rakefile Normal file
View 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

View File

@ -111,7 +111,6 @@ module GitHubChangelogGenerator
if @options[:last]
log += self.generate_log_between_tags(self.all_tags[0], self.all_tags[1])
elsif @options[:tag1] and @options[:tag2]
tag1 = @options[:tag1]
tag2 = @options[:tag2]
tags_strings = []
@ -159,11 +158,11 @@ module GitHubChangelogGenerator
puts "Generating log.."
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])
end
}
log += self.generate_log_before_tag(self.all_tags.last)
log += generate_log_between_tags(nil, self.all_tags.last)
log
end
@ -216,14 +215,14 @@ module GitHubChangelogGenerator
if older_tag.nil?
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
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)
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
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
@ -241,7 +240,7 @@ module GitHubChangelogGenerator
tag_in_range_new = t <= newer_tag_time
tag_in_range = (tag_in_range_old) && (tag_in_range_new)
tag_in_range
else
false
@ -249,15 +248,15 @@ module GitHubChangelogGenerator
}
end
def generate_log_before_tag(tag)
generate_log_between_tags(nil, tag)
end
# @param [Array] pull_requests
# @param [Array] issues
# @param [String] tag_name
# @param [String] tag_time
# @return [String]
def create_log(pull_requests, issues, tag_name, tag_time)
# Generate tag name and link
trimmed_tag = tag_name.tr('v', '')
log = "## [#{trimmed_tag}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
log = "## [#{tag_name}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
#Generate date string:
time_string = tag_time.strftime @options[:format]