github_changelog_generator 1.2.2 → 1.2.3

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: 8155f1e7ea3677c3d367f637a07fb6de0cea418d
4
- data.tar.gz: 4e2f2af6c503c0900dab6b473f03aaecaa23fa4a
3
+ metadata.gz: 561ac7c4d92ba4ccd6d3b4e111e2efb32990f784
4
+ data.tar.gz: 228ce29ec844a324bf9b430dd3d35b2a23674952
5
5
  SHA512:
6
- metadata.gz: 17d13e3e44f54241ced0f06c58b2f5fbfa24235a3e5c104c218157c15b063edabd84a39b096e6714a5cef539e733882170866364754d251d21fd570a211dacc6
7
- data.tar.gz: fb0c0aa4a2173ad2b6137626270b25d2fe91821099b6f0f60fdd494ac58e627e54f27970afc9946b128eb0cb0e442b79e35a410235f43707a7d43a93a4f39790
6
+ metadata.gz: 7d71b8cadc18bca549584c8aab88fb1c7ca34a4dd8b80b80b599d6dcf5d35ad76beaf7438ccc3113262947dcfbebb9d689a620b6b2218571857b525ae0bfe389
7
+ data.tar.gz: 0fc781c6800ac6fd7d7c2791893b6ca44655aca8962a15807ef21732b8a7598a01f552f4b20dddcf7b8969a3577833e59ea51978ab2a8294214c139f870484c8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
4
+ #### 10/12/14
5
+ - *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))
6
+
3
7
  ## [1.2.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.1)
4
8
  #### 22/11/14
5
9
  - *Merged pull-request:* Issues for last tag not in list [\#29](https://github.com/skywinder/Github-Changelog-Generator/pull/29) ([skywinder](https://github.com/skywinder))
@@ -8,11 +12,11 @@
8
12
 
9
13
  ## [1.2.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.0)
10
14
  #### 19/11/14
11
- - *Merged pull-request:* Add filter for pull-requests labels. (option --filter-pull-requests) [\#27](https://github.com/skywinder/Github-Changelog-Generator/pull/27) ([skywinder](https://github.com/skywinder))
15
+ - *Merged pull-request:* Add filter for pull-requests labels. \(option --filter-pull-requests\) [\#27](https://github.com/skywinder/Github-Changelog-Generator/pull/27) ([skywinder](https://github.com/skywinder))
12
16
 
13
- - *Merged pull-request:* Test Pull-Request [\#26](https://github.com/skywinder/Github-Changelog-Generator/pull/26) ([skywinder](https://github.com/skywinder))
17
+ - *Merged pull-request:* Test Pull-Request SHOULD NOT APPEAR IN LOG! [\#26](https://github.com/skywinder/Github-Changelog-Generator/pull/26) ([skywinder](https://github.com/skywinder))
14
18
 
15
- - *Merged pull-request:* Add ability to insert authors of pull-requests (--[no-]author option) [\#25](https://github.com/skywinder/Github-Changelog-Generator/pull/25) ([skywinder](https://github.com/skywinder))
19
+ - *Merged pull-request:* Add ability to insert authors of pull-requests \(--\[no-\]author option\) [\#25](https://github.com/skywinder/Github-Changelog-Generator/pull/25) ([skywinder](https://github.com/skywinder))
16
20
 
17
21
  - *Merged pull-request:* Don't receive issues in case of --no-isses flag specied [\#24](https://github.com/skywinder/Github-Changelog-Generator/pull/24) ([skywinder](https://github.com/skywinder))
18
22
 
@@ -20,7 +24,7 @@
20
24
  #### 18/11/14
21
25
  - *Merged pull-request:* Sort tags by date [\#23](https://github.com/skywinder/Github-Changelog-Generator/pull/23) ([skywinder](https://github.com/skywinder))
22
26
 
23
- - *Implemented enhancement:* Implement ability to retrieve GitHub token from ENV variable (to not put it to script directly) [\#19](https://github.com/skywinder/Github-Changelog-Generator/issues/19)
27
+ - *Implemented enhancement:* Implement ability to retrieve GitHub token from ENV variable \(to not put it to script directly\) [\#19](https://github.com/skywinder/Github-Changelog-Generator/issues/19)
24
28
 
25
29
  - *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
26
30
 
@@ -66,7 +70,7 @@
66
70
  #### 07/11/14
67
71
  - *Merged pull-request:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2) ([skywinder](https://github.com/skywinder))
68
72
 
69
- - *Merged pull-request:* Add option (-o --output) to specify name of the output file. [\#1](https://github.com/skywinder/Github-Changelog-Generator/pull/1) ([skywinder](https://github.com/skywinder))
73
+ - *Merged pull-request:* Add option \(-o --output\) to specify name of the output file. [\#1](https://github.com/skywinder/Github-Changelog-Generator/pull/1) ([skywinder](https://github.com/skywinder))
70
74
 
71
75
  ## [0.0.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2)
72
76
  #### 06/11/14
data/Gemfile.lock CHANGED
@@ -2,7 +2,7 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.6)
5
- colorize (0.7.3)
5
+ colorize (0.7.4)
6
6
  descendants_tracker (0.0.4)
7
7
  thread_safe (~> 0.3, >= 0.3.1)
8
8
  faraday (0.9.0)
@@ -15,13 +15,13 @@ GEM
15
15
  multi_json (>= 1.7.5, < 2.0)
16
16
  nokogiri (~> 1.6.3)
17
17
  oauth2
18
- hashie (3.3.1)
19
- jwt (1.0.0)
18
+ hashie (3.3.2)
19
+ jwt (1.2.0)
20
20
  mini_portile (0.6.1)
21
21
  multi_json (1.10.1)
22
22
  multi_xml (0.5.5)
23
23
  multipart-post (2.0.0)
24
- nokogiri (1.6.4)
24
+ nokogiri (1.6.5)
25
25
  mini_portile (~> 0.6.0)
26
26
  oauth2 (1.0.0)
27
27
  faraday (>= 0.8, < 0.10)
@@ -3,6 +3,8 @@
3
3
  require 'github_api'
4
4
  require 'json'
5
5
  require 'colorize'
6
+ require 'benchmark'
7
+
6
8
  require_relative 'github_changelog_generator/parser'
7
9
  require_relative 'github_changelog_generator/generator'
8
10
  require_relative 'github_changelog_generator/version'
@@ -12,6 +14,8 @@ module GitHubChangelogGenerator
12
14
 
13
15
  attr_accessor :options, :all_tags, :github
14
16
 
17
+ PER_PAGE_NUMBER = 30
18
+
15
19
  def initialize
16
20
 
17
21
  @options = Parser.parse_options
@@ -25,9 +29,10 @@ module GitHubChangelogGenerator
25
29
  github_token
26
30
 
27
31
  if @github_token.nil?
28
- @github = Github.new
32
+ @github = Github.new per_page: PER_PAGE_NUMBER
29
33
  else
30
- @github = Github.new oauth_token: @github_token
34
+ @github = Github.new oauth_token: @github_token,
35
+ per_page: PER_PAGE_NUMBER
31
36
  end
32
37
 
33
38
  @generator = Generator.new(@options)
@@ -56,18 +61,23 @@ module GitHubChangelogGenerator
56
61
  def get_all_closed_pull_requests
57
62
 
58
63
  if @options[:verbose]
59
- puts 'Fetching pull requests..'
64
+ print "Fetching pull requests...\r"
60
65
  end
61
66
 
62
67
  response = @github.pull_requests.list @options[:user], @options[:project], :state => 'closed'
63
68
 
64
69
  pull_requests = []
70
+ page_i = 0
65
71
  response.each_page do |page|
72
+ page_i += PER_PAGE_NUMBER
73
+ print "Fetching pull requests... #{page_i}\r"
66
74
  pull_requests.concat(page)
67
75
  end
68
76
 
77
+ print "\r"
78
+
69
79
  if @options[:verbose]
70
- puts "Received all closed pull requests: #{pull_requests.count}"
80
+ puts "Received closed pull requests: #{pull_requests.count}"
71
81
  end
72
82
 
73
83
  unless @options[:pull_request_labels].nil?
@@ -148,8 +158,13 @@ module GitHubChangelogGenerator
148
158
 
149
159
  def generate_log_for_all_tags
150
160
  log = ''
151
- @all_tags.each { |tag| self.get_time_of_tag(tag) }
152
161
 
162
+ # Async fetching tags:
163
+ threads = []
164
+ @all_tags.each { |tag|
165
+ threads << Thread.new { self.get_time_of_tag(tag) }
166
+ }
167
+ threads.each { |thr| thr.join }
153
168
 
154
169
  if @options[:verbose]
155
170
  puts "Sorting tags.."
@@ -177,16 +192,19 @@ module GitHubChangelogGenerator
177
192
  def get_all_tags
178
193
 
179
194
  if @options[:verbose]
180
- puts 'Fetching all tags..'
195
+ print "Fetching tags...\r"
181
196
  end
182
197
 
183
198
  response = @github.repos.tags @options[:user], @options[:project]
184
199
 
185
200
  tags = []
201
+ page_i = 0
186
202
  response.each_page do |page|
203
+ page_i += PER_PAGE_NUMBER
204
+ print "Fetching tags... #{page_i}\r"
187
205
  tags.concat(page)
188
206
  end
189
-
207
+ print "\r"
190
208
  if @options[:verbose]
191
209
  puts "Found #{tags.count} tags"
192
210
  end
@@ -329,10 +347,6 @@ module GitHubChangelogGenerator
329
347
  return @tag_times_hash[prev_tag['name']]
330
348
  end
331
349
 
332
- if @options[:verbose]
333
- puts "Getting time for tag #{prev_tag['name']}"
334
- end
335
-
336
350
  github_git_data_commits_get = @github.git_data.commits.get @options[:user], @options[:project], prev_tag['commit']['sha']
337
351
  time_string = github_git_data_commits_get['committer']['date']
338
352
  Time.parse(time_string)
@@ -341,13 +355,22 @@ module GitHubChangelogGenerator
341
355
 
342
356
  def get_all_issues
343
357
 
358
+ if @options[:verbose]
359
+ print "Fetching closed issues...\r"
360
+ end
361
+
344
362
  response = @github.issues.list user: @options[:user], repo: @options[:project], state: 'closed', filter: 'all', labels: nil
345
363
 
346
364
  issues = []
365
+ page_i = 0
347
366
  response.each_page do |page|
367
+ page_i += PER_PAGE_NUMBER
368
+ print "Fetching closed issues... #{page_i}\r"
348
369
  issues.concat(page)
349
370
  end
350
371
 
372
+ print "\r"
373
+
351
374
  # remove pull request from issues:
352
375
  issues.select! { |x|
353
376
  x.pull_request == nil
@@ -357,6 +380,11 @@ module GitHubChangelogGenerator
357
380
  puts "Received closed issues: #{issues.count}"
358
381
  end
359
382
 
383
+
384
+ if @options[:verbose]
385
+ puts "Filtering issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}"
386
+ end
387
+
360
388
  filtered_issues = issues.select { |issue|
361
389
  #compare is there any labels from @options[:labels] array
362
390
  (issue.labels.map { |label| label.name } & @options[:labels]).any?
@@ -371,7 +399,7 @@ module GitHubChangelogGenerator
371
399
  end
372
400
 
373
401
  if @options[:verbose]
374
- puts "Filter issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}: #{filtered_issues.count} issues"
402
+ puts "Filtered issues: #{filtered_issues.count}"
375
403
  end
376
404
 
377
405
  filtered_issues
@@ -10,7 +10,11 @@ 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
- merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
13
+ if !pull_request.user.nil?
14
+ merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
15
+ else
16
+ merge += " ({Null user})\n\n"
17
+ end
14
18
  else
15
19
  merge += "\n\n"
16
20
  end
@@ -58,15 +58,21 @@ module GitHubChangelogGenerator
58
58
 
59
59
  parser.parse!
60
60
 
61
- #udefined case with 1 parameter:
62
61
  if ARGV[0] && !ARGV[1]
63
- puts parser.banner
64
- exit
62
+ # 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])
64
+
65
+ if match[2].nil?
66
+ exit
67
+ else
68
+ options[:user] = match[1]
69
+ options[:project]= match[2]
70
+ end
65
71
  end
66
72
 
67
73
  if !options[:user] && !options[:project]
68
74
  remote = `git remote -vv`.split("\n")
69
- match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)\.git.*/.match(remote[0])
75
+ match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)(?:\.git)?.*/.match(remote[0])
70
76
 
71
77
  if match && match[1] && match[2]
72
78
  puts "Detected user:#{match[1]}, project:#{match[2]}"
@@ -83,7 +89,6 @@ module GitHubChangelogGenerator
83
89
  if ARGV[1]
84
90
  options[:tag1] = ARGV[0]
85
91
  options[:tag2] = ARGV[1]
86
-
87
92
  end
88
93
 
89
94
  options
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = '1.2.2'
2
+ VERSION = '1.2.3'
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.2
4
+ version: 1.2.3
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-10 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler