github_changelog_generator 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5baba2054c1d760b300ab11776f9d18e91500a0
4
- data.tar.gz: 4083db4ad487e4809cc3aadc9b071daaa5aed822
3
+ metadata.gz: 202f122f1d16c0c0ffb31c835611647ea0090a66
4
+ data.tar.gz: eff1192c30c02b2b72bc2f22449510ed2c6c0bf2
5
5
  SHA512:
6
- metadata.gz: 2581324624bdb0a1311ccd6f71f0580445cde465777044180f901279591c4f25031a94d982891a185b7adcf5e7a0d00b90d299476f754e3ac302475369875388
7
- data.tar.gz: cdbad548c27826c616d8186d9c9c4aeae017d009ff504c911e0a5447917a8aa46100847843450a280342790c468088ff5b406df4a91b1f35158caa688701a4c7
6
+ metadata.gz: eb81c3164e100a0cf9c073c08ceb14d1b8e33d27b4ece4e693f8d7b60681c3b78c561d91b37c35c8003711a2d76cf200e28dd6ad9f7444eed00ab4221614a869
7
+ data.tar.gz: 6e153f5835447b3fd689ac157789bef00b2e2686b4cc8b320709da71c1fac7b68522b65cb010e91fbd0cdc88186289f2fa0646af27cfefa5aaf2fc585f25bce9
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.4] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.4)
4
+ #### 16/12/14
5
+ - *Merged pull-request:* Fix crash when user is NULL [\#40](https://github.com/skywinder/Github-Changelog-Generator/pull/40) ([skywinder](https://github.com/skywinder))
6
+
7
+ - *Merged pull-request:* Implement async fetching [\#39](https://github.com/skywinder/Github-Changelog-Generator/pull/39) ([skywinder](https://github.com/skywinder))
8
+
9
+ - *Implemented enhancement:* Add ability to run with one parameter instead -u -p [\#38](https://github.com/skywinder/Github-Changelog-Generator/issues/38)
10
+
11
+ - *Implemented enhancement:* Detailed output [\#33](https://github.com/skywinder/Github-Changelog-Generator/issues/33)
12
+
13
+ - *Fixed bug:* Docs lacking or basic behavior not as advertised [\#30](https://github.com/skywinder/Github-Changelog-Generator/issues/30)
14
+
15
+ ## [1.2.3] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
16
+ #### 16/12/14
17
+ - *Fixed bug:* Encapsulate \[ \> \* \_ \ \] signs in issues names [\#34](https://github.com/skywinder/Github-Changelog-Generator/issues/34)
18
+
3
19
  ## [1.2.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
4
20
  #### 10/12/14
5
21
  - *Merged pull-request:* Add a Bitdeli Badge to README [\#36](https://github.com/skywinder/Github-Changelog-Generator/pull/36) ([bitdeli-chef](https://github.com/bitdeli-chef))
@@ -28,12 +28,12 @@ module GitHubChangelogGenerator
28
28
 
29
29
  github_token
30
30
 
31
- if @github_token.nil?
32
- @github = Github.new per_page: PER_PAGE_NUMBER
33
- else
34
- @github = Github.new oauth_token: @github_token,
35
- per_page: PER_PAGE_NUMBER
36
- end
31
+ github_options = {per_page: PER_PAGE_NUMBER}
32
+ github_options[:oauth_token] = @github_token unless @github_token.nil?
33
+ github_options[:endpoint] = options[:github_endpoint] unless options[:github_endpoint].nil?
34
+ github_options[:site] = options[:github_endpoint] unless options[:github_site].nil?
35
+
36
+ @github = Github.new github_options
37
37
 
38
38
  @generator = Generator.new(@options)
39
39
 
@@ -231,6 +231,11 @@ module GitHubChangelogGenerator
231
231
 
232
232
  def generate_log_between_tags(older_tag, newer_tag)
233
233
 
234
+ if newer_tag.nil?
235
+ puts "Can't find tag -> terminate"
236
+ exit 1
237
+ end
238
+
234
239
  newer_tag_time = self.get_time_of_tag(newer_tag)
235
240
  newer_tag_name = newer_tag['name']
236
241
 
@@ -243,6 +248,43 @@ module GitHubChangelogGenerator
243
248
  filtered_issues = delete_by_time(@issues, :closed_at, newer_tag_time, older_tag_time)
244
249
  end
245
250
 
251
+
252
+ if @options[:filter_issues_by_milestone]
253
+ #delete excess irrelevant issues (according milestones)
254
+ filtered_issues.select! { |issue|
255
+ if issue.milestone.nil?
256
+ true
257
+ else
258
+ #check, that this milestone in tag list:
259
+ milestone_is_tag = @all_tags.find { |tag|
260
+ tag.name == issue.milestone.title
261
+ }
262
+ milestone_is_tag.nil?
263
+ end
264
+
265
+ }
266
+
267
+ #add missed issues (according milestones)
268
+ issues_to_add = @issues.select { |issue|
269
+ if issue.milestone.nil?
270
+ false
271
+ else
272
+ #check, that this milestone in tag list:
273
+ milestone_is_tag = @all_tags.find { |tag|
274
+ tag.name == issue.milestone.title
275
+ }
276
+
277
+ if milestone_is_tag.nil?
278
+ false
279
+ else
280
+ issue.milestone.title == newer_tag_name
281
+ end
282
+ end
283
+ }
284
+
285
+ filtered_issues |= issues_to_add
286
+ end
287
+
246
288
  self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time)
247
289
 
248
290
  end
@@ -276,8 +318,10 @@ module GitHubChangelogGenerator
276
318
  # @return [String]
277
319
  def create_log(pull_requests, issues, tag_name, tag_time)
278
320
 
321
+ github_site = options[:github_site] || 'https://github.com'
322
+
279
323
  # Generate tag name and link
280
- log = "## [#{tag_name}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
324
+ log = "## [#{tag_name}] (#{github_site}/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n"
281
325
 
282
326
  #Generate date string:
283
327
  time_string = tag_time.strftime @options[:format]
@@ -10,10 +10,10 @@ module GitHubChangelogGenerator
10
10
 
11
11
  merge = "#{@options[:merge_prefix]}#{encapsulated_title} [\\##{pull_request[:number]}](#{pull_request.html_url})"
12
12
  if @options[:author]
13
- if !pull_request.user.nil?
14
- merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
15
- else
13
+ if pull_request.user.nil?
16
14
  merge += " ({Null user})\n\n"
15
+ else
16
+ merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
17
17
  end
18
18
  else
19
19
  merge += "\n\n"
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
- require 'PP'
3
+ require 'pp'
4
4
  require_relative 'version'
5
5
 
6
6
  module GitHubChangelogGenerator
7
7
  class Parser
8
8
  def self.parse_options
9
- options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil}
9
+ options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true}
10
10
 
11
11
  parser = OptionParser.new { |opts|
12
12
  opts.banner = 'Usage: changelog_generator [options]'
@@ -37,6 +37,9 @@ module GitHubChangelogGenerator
37
37
  opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
38
38
  options[:pulls] = v
39
39
  end
40
+ opts.on('--[no-]filter-issues-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
41
+ options[:filter_issues_by_milestone] = last
42
+ end
40
43
  opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
41
44
  options[:last] = author
42
45
  end
@@ -46,6 +49,12 @@ module GitHubChangelogGenerator
46
49
  opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list|
47
50
  options[:pull_request_labels] = list
48
51
  end
52
+ opts.on('--github-site [URL]', 'The Enterprise Github site on which your project is hosted.') do |last|
53
+ options[:github_site] = last
54
+ end
55
+ opts.on('--github-api [URL]', 'The enterprise endpoint to use for your Github API.') do |last|
56
+ options[:github_endpoint] = last
57
+ end
49
58
  opts.on('-v', '--version', 'Print version number') do |v|
50
59
  puts "Version: #{GitHubChangelogGenerator::VERSION}"
51
60
  exit
@@ -59,8 +68,9 @@ module GitHubChangelogGenerator
59
68
  parser.parse!
60
69
 
61
70
  if ARGV[0] && !ARGV[1]
71
+ github_site = options[:github_site] ? options[:github_site] : 'github.com'
62
72
  # this match should parse https://github.com/skywinder/Github-Changelog-Generator and skywinder/Github-Changelog-Generator to user and name
63
- match = /(?:.+github\.com\/)?(.+)\/(.+)/.match(ARGV[0])
73
+ match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0])
64
74
 
65
75
  if match[2].nil?
66
76
  exit
@@ -94,4 +104,4 @@ module GitHubChangelogGenerator
94
104
  options
95
105
  end
96
106
  end
97
- end
107
+ end
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = '1.2.4'
2
+ VERSION = '1.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_changelog_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.4.4
110
+ rubygems_version: 2.4.3
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Script, that automatically generate change-log from your tags and pull-requests.