github_changelog_generator 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2f745ceb3b89e317b0fc6f59a50ee366269e81d
4
- data.tar.gz: 0eefaea73139a411da78b4104a8ccb931bcb2722
3
+ metadata.gz: 9c0659681c970003ea76fe78d4aa73f8468d184e
4
+ data.tar.gz: 8f0c8f99a306701c9cc880f4f0359ffb8cc3fbcc
5
5
  SHA512:
6
- metadata.gz: df561e334b31cc9d201175f8300ae1e65222a4ce0cde830f162926cf00bf5d0ee6f5436712c8d73c6508e6fef1aff7af36485fb2f310e1d0c2573f01b53971e3
7
- data.tar.gz: 402cae152bc6dbcb2f8b2eeab5e716ba9aa4e112d77d4974ed494c042f61752c11c12b247cb1753b8b42c9f3697ef44ddb5c85dafd8c1641a49dc26607c279d3
6
+ metadata.gz: 6b231574c906b9f0de7401ac91acdfe67a753781adf2567cdce9875cc8fc1298461fc94136b0c48968f41c78f79b2fac67f783d50e4a0e94184a804e00496b68
7
+ data.tar.gz: 394a7084167dcc2537d9b77075fe209514549b2e81db8d576805eb2a89914f2edd5c0ad6b5ca14b448560f56f54250c478269a049721fd73cc65969a6f841b15
data/.gitignore CHANGED
@@ -1 +0,0 @@
1
- /lib/CHANGELOG.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.7](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.7)
4
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.6...1.2.7)
5
+ #### 26/01/15
6
+ - *Merged pull-request:* Add compare link between older version and newer version [\#46](https://github.com/skywinder/Github-Changelog-Generator/pull/46) ([sue445](https://github.com/sue445))
7
+
3
8
  ## [1.2.6](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.6)
4
9
  [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.5...1.2.6)
5
10
  #### 21/01/15
@@ -23,17 +28,17 @@
23
28
 
24
29
  - *Merged pull-request:* Implement async fetching [\#39](https://github.com/skywinder/Github-Changelog-Generator/pull/39) ([skywinder](https://github.com/skywinder))
25
30
 
31
+ - *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
32
+
33
+ ## [1.2.3](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
34
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.2...1.2.3)
35
+ #### 16/12/14
26
36
  - *Implemented enhancement:* Add ability to run with one parameter instead -u -p [\#38](https://github.com/skywinder/Github-Changelog-Generator/issues/38)
27
37
 
28
38
  - *Implemented enhancement:* Detailed output [\#33](https://github.com/skywinder/Github-Changelog-Generator/issues/33)
29
39
 
30
40
  - *Fixed bug:* Docs lacking or basic behavior not as advertised [\#30](https://github.com/skywinder/Github-Changelog-Generator/issues/30)
31
41
 
32
- - *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
33
-
34
- ## [1.2.3](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
35
- [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.2...1.2.3)
36
- #### 16/12/14
37
42
  ## [1.2.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
38
43
  [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.1...1.2.2)
39
44
  #### 10/12/14
@@ -96,11 +101,11 @@
96
101
  ## [1.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1)
97
102
  [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.0.0...1.0.1)
98
103
  #### 10/11/14
99
- - *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8) ([skywinder](https://github.com/skywinder))
100
-
101
104
  ## [1.0.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.0)
102
105
  [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.1.0...1.0.0)
103
106
  #### 07/11/14
107
+ - *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8) ([skywinder](https://github.com/skywinder))
108
+
104
109
  - *Merged pull-request:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7) ([skywinder](https://github.com/skywinder))
105
110
 
106
111
  - *Merged pull-request:* Fix parsing date of pull request [\#3](https://github.com/skywinder/Github-Changelog-Generator/pull/3) ([skywinder](https://github.com/skywinder))
data/README.md CHANGED
@@ -6,14 +6,52 @@ GitHub Changelog Generator
6
6
 
7
7
  Changelog generation has never been so easy.
8
8
 
9
- This script automatically generate change-log from your tags and merged pull-requests.
9
+ **Fully automate changelog generation** - This script automatically generate change-log from your tags, issues and merged pull-requests from your project's **Github issue tracker**.
10
10
 
11
11
  ## Installation:
12
- You're almost done!
13
12
 
14
13
  [sudo] gem install github_changelog_generator
15
14
 
16
- ## Usage
15
+ ## Output example:
16
+
17
+ - Look at **[CHANGELOG.md](https://github.com/skywinder/Github-Changelog-Generator/blob/master/CHANGELOG.md)** for this project
18
+ - [ActionSheetPicker-3.0/CHANGELOG.md](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md) was generated by command:
19
+
20
+ github_changelog_generator -u skywinder -p ActionSheetPicker-3.0
21
+
22
+ - In general it looks like this:
23
+
24
+ > ## [1.3.10](https://github.com/skywinder/ActionSheetPicker-3.0/tree/1.3.10)
25
+ > #### 09/01/15
26
+ > - *Merged pull-request:* add header file to public [\#115](https://github.com/skywinder/ActionSheetPicker-3.0/pull/115)
27
+ > ([skywinder](https://github.com/skywinder))
28
+ >
29
+ > - *Merged pull-request:* Fix bad interaction with Git submodules.
30
+ > [\#112](https://github.com/skywinder/ActionSheetPicker-3.0/pull/112)
31
+ > ([JimDabell](https://github.com/JimDabell))
32
+ >
33
+ > - *Implemented enhancement:* Should have minimum/maximum date property exposed
34
+ > [\#97](https://github.com/skywinder/ActionSheetPicker-3.0/issues/97)
35
+ >
36
+ > ## [1.3.9](https://github.com/skywinder/ActionSheetPicker-3.0/tree/1.3.9)
37
+ > #### 11/12/14
38
+ > - *Closed issue:* Bad interaction with submodules [\#111](https://github.com/skywinder/ActionSheetPicker-3.0/issues/111)
39
+ >
40
+ > - *Closed issue:* No "cancel" button [\#122](https://github.com/skywinder/ActionSheetPicker-3.0/issues/122)
41
+
42
+
43
+ ###Features and advantages of this project as compared to other:
44
+ - Custom date format supported
45
+ - Automatically split issues by type:
46
+ - **Issues** (closed issues w/o any labels)
47
+ - **Merged pull-requests** (all merged pull-requests)
48
+ - **Bug-fixes** (by label `bug` in issue)
49
+ - **Enhancements** (by label `enhancement` in issue)
50
+ - Excluding "questions" from changelog (issues marked as `question` labels)
51
+ - Ability to manually specify in which version issue was fixed (in case, when closed date is not match) by setting `milestone` of issue the same name as tag of required version
52
+ - Ability to exclude some issues from changelog (by labels)
53
+
54
+ ## Usage:
17
55
  **It's really simple**:
18
56
 
19
57
  - If your **git remote** `origin` refer to your GitHub repo, then just go to your project folder and run:
@@ -66,22 +104,16 @@ So, if you got error like this:
66
104
 
67
105
  It's time to create this token or wait for 1 hour before GitHub reset the counter for your IP.
68
106
 
69
- ## Examples:
70
-
71
- - Look at **[CHANGELOG.md](https://github.com/skywinder/Github-Changelog-Generator/blob/master/CHANGELOG.md)** for **this** project
72
- - [ActionSheetPicker-3.0/CHANGELOG.md](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md) was generated by command:
73
-
74
- github_changelog_generator -u skywinder -p ActionSheetPicker-3.0
75
-
76
-
77
107
  ## Projects using this library
78
108
  [Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator)
79
109
 
80
- *If you are using `github_changelog_generator` for generation chamgelog in your project or know of project that uses it, please add it to [this] (https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) list.*
110
+ *If you are using `github_changelog_generator` for generation changelog in your project or know of project that uses it, please add it to [this] (https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) list.*
81
111
 
82
112
  ## Am I missed some essential feature?
83
113
 
84
- **Nothing is impossible!** Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together!
114
+ **Nothing is impossible!**
115
+
116
+ Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together!
85
117
 
86
118
  *Bug reports, feature requests, patches, well-wishes are always welcome!*
87
119
 
@@ -97,7 +129,3 @@ It's time to create this token or wait for 1 hour before GitHub reset the counte
97
129
  ## License
98
130
 
99
131
  Github Changelog Generator is released under the [MIT License](http://www.opensource.org/licenses/MIT).
100
-
101
-
102
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/skywinder/github-changelog-generator/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
103
-
data/lib/CHANGELOG.md ADDED
@@ -0,0 +1,133 @@
1
+ # Changelog
2
+
3
+ ## [1.2.7](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.7)
4
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.6...1.2.7)
5
+ #### 26/01/15
6
+ - *Merged pull-request:* Add compare link between older version and newer version [\#46](https://github.com/skywinder/Github-Changelog-Generator/pull/46) ([sue445](https://github.com/sue445))
7
+
8
+ ## [1.2.6](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.6)
9
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.5...1.2.6)
10
+ #### 21/01/15
11
+ - *Merged pull-request:* fix link tag format [\#45](https://github.com/skywinder/Github-Changelog-Generator/pull/45) ([sugamasao](https://github.com/sugamasao))
12
+
13
+ ## [1.2.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.5)
14
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.4...1.2.5)
15
+ #### 15/01/15
16
+ - *Merged pull-request:* PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/Github-Changelog-Generator/pull/43) ([schwing](https://github.com/schwing))
17
+
18
+ - *Merged pull-request:* support enterprise github via command line options [\#42](https://github.com/skywinder/Github-Changelog-Generator/pull/42) ([glenlovett](https://github.com/glenlovett))
19
+
20
+ - *Implemented enhancement:* Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22)
21
+
22
+ - *Fixed bug:* Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32)
23
+
24
+ ## [1.2.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.4)
25
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.3...1.2.4)
26
+ #### 16/12/14
27
+ - *Merged pull-request:* Fix crash when user is NULL [\#40](https://github.com/skywinder/Github-Changelog-Generator/pull/40) ([skywinder](https://github.com/skywinder))
28
+
29
+ - *Merged pull-request:* Implement async fetching [\#39](https://github.com/skywinder/Github-Changelog-Generator/pull/39) ([skywinder](https://github.com/skywinder))
30
+
31
+ - *Implemented enhancement:* Add ability to run with one parameter instead -u -p [\#38](https://github.com/skywinder/Github-Changelog-Generator/issues/38)
32
+
33
+ - *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
34
+
35
+ ## [1.2.3](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
36
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.2...1.2.3)
37
+ #### 16/12/14
38
+ - *Implemented enhancement:* Detailed output [\#33](https://github.com/skywinder/Github-Changelog-Generator/issues/33)
39
+
40
+ - *Fixed bug:* Docs lacking or basic behavior not as advertised [\#30](https://github.com/skywinder/Github-Changelog-Generator/issues/30)
41
+
42
+ ## [1.2.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
43
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.1...1.2.2)
44
+ #### 10/12/14
45
+ - *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))
46
+
47
+ - *Fixed bug:* Encapsulate \[ \> \* \_ \ \] signs in issues names [\#34](https://github.com/skywinder/Github-Changelog-Generator/issues/34)
48
+
49
+ ## [1.2.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.1)
50
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.0...1.2.1)
51
+ #### 22/11/14
52
+ - *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))
53
+
54
+ - *Merged pull-request:* Disable default --filter-pull-requests option. [\#28](https://github.com/skywinder/Github-Changelog-Generator/pull/28) ([skywinder](https://github.com/skywinder))
55
+
56
+ - *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
57
+
58
+ ## [1.2.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.0)
59
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.4...1.2.0)
60
+ #### 19/11/14
61
+ - *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))
62
+
63
+ - *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))
64
+
65
+ - *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))
66
+
67
+ - *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))
68
+
69
+ ## [1.1.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.4)
70
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.2...1.1.4)
71
+ #### 18/11/14
72
+ - *Merged pull-request:* Sort tags by date [\#23](https://github.com/skywinder/Github-Changelog-Generator/pull/23) ([skywinder](https://github.com/skywinder))
73
+
74
+ - *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)
75
+
76
+ ## [1.1.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.2)
77
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.1...1.1.2)
78
+ #### 12/11/14
79
+ - *Merged pull-request:* Fix bug with dot signs in project name [\#18](https://github.com/skywinder/Github-Changelog-Generator/pull/18) ([skywinder](https://github.com/skywinder))
80
+
81
+ - *Merged pull-request:* Fix bug with dot signs in user name [\#17](https://github.com/skywinder/Github-Changelog-Generator/pull/17) ([skywinder](https://github.com/skywinder))
82
+
83
+ ## [1.1.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.1)
84
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.0...1.1.1)
85
+ #### 10/11/14
86
+ - *Merged pull-request:* Remove duplicates of issues and pull-requests with same number [\#15](https://github.com/skywinder/Github-Changelog-Generator/pull/15) ([skywinder](https://github.com/skywinder))
87
+
88
+ - *Merged pull-request:* Sort issues by tags [\#14](https://github.com/skywinder/Github-Changelog-Generator/pull/14) ([skywinder](https://github.com/skywinder))
89
+
90
+ - *Merged pull-request:* Add ability to add or exclude issues without any labels [\#13](https://github.com/skywinder/Github-Changelog-Generator/pull/13) ([skywinder](https://github.com/skywinder))
91
+
92
+ ## [1.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.0)
93
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.0.1...1.1.0)
94
+ #### 10/11/14
95
+ - *Implemented enhancement:* Detect username and project form origin [\#11](https://github.com/skywinder/Github-Changelog-Generator/issues/11)
96
+
97
+ - *Fixed bug:* Markdown formating in the last line wrong [\#9](https://github.com/skywinder/Github-Changelog-Generator/issues/9)
98
+
99
+ - *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12)
100
+
101
+ ## [1.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1)
102
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.0.0...1.0.1)
103
+ #### 10/11/14
104
+ ## [1.0.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.0)
105
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.1.0...1.0.0)
106
+ #### 07/11/14
107
+ - *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8) ([skywinder](https://github.com/skywinder))
108
+
109
+ - *Merged pull-request:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7) ([skywinder](https://github.com/skywinder))
110
+
111
+ - *Merged pull-request:* Fix parsing date of pull request [\#3](https://github.com/skywinder/Github-Changelog-Generator/pull/3) ([skywinder](https://github.com/skywinder))
112
+
113
+ - *Implemented enhancement:* Implement option to specify output filename [\#4](https://github.com/skywinder/Github-Changelog-Generator/issues/4)
114
+
115
+ - *Implemented enhancement:* Add support for fixed issues and implemented enchanments. [\#6](https://github.com/skywinder/Github-Changelog-Generator/issues/6)
116
+
117
+ - *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5)
118
+
119
+ ## [0.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/0.1.0)
120
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.0.2...0.1.0)
121
+ #### 07/11/14
122
+ - *Merged pull-request:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2) ([skywinder](https://github.com/skywinder))
123
+
124
+ - *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))
125
+
126
+ ## [0.0.2](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2)
127
+ [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.0.1...0.0.2)
128
+ #### 06/11/14
129
+ ## [0.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.1)
130
+ #### 06/11/14
131
+
132
+
133
+ \* *This changelog was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -38,9 +38,11 @@ module GitHubChangelogGenerator
38
38
  @generator = Generator.new(@options)
39
39
 
40
40
  @all_tags = self.get_all_tags
41
- @pull_requests = self.get_all_closed_pull_requests
41
+ @pull_requests = self.get_filtered_pull_requests
42
42
  if @options[:issues]
43
43
  @issues = self.get_all_issues
44
+ fetch_event_for_issues(@issues)
45
+ detect_actual_closed_dates
44
46
  else
45
47
  @issues = []
46
48
  end
@@ -48,6 +50,43 @@ module GitHubChangelogGenerator
48
50
  @tag_times_hash = {}
49
51
  end
50
52
 
53
+ def detect_actual_closed_dates
54
+
55
+ if @options[:verbose]
56
+ print "Fetching close commit date for issues...\r"
57
+ end
58
+
59
+ threads = []
60
+ @issues.each{|issue|
61
+ threads << Thread.new {
62
+ find_closed_date_by_commit(issue)
63
+ }
64
+ }
65
+ threads.each { |thr| thr.join }
66
+
67
+ if @options[:verbose]
68
+ puts 'Fetching close commit date for issues: Done!'
69
+ end
70
+ end
71
+
72
+ def find_closed_date_by_commit(issue)
73
+ unless issue['events'].nil?
74
+ # reverse! - to find latest closed event. (event goes in date order)
75
+ issue['events'].reverse!.each{|event|
76
+ if event[:event].eql? 'closed'
77
+ if event[:commit_id].nil?
78
+ issue[:actual_date] = issue[:closed_at]
79
+ else
80
+ commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
81
+ issue[:actual_date] = commit[:author][:date]
82
+ end
83
+ break
84
+ end
85
+ }
86
+ end
87
+ #TODO: assert issues, that remain without 'actual_date' hash for some reason.
88
+ end
89
+
51
90
  def print_json(json)
52
91
  puts JSON.pretty_generate(json)
53
92
  end
@@ -57,29 +96,33 @@ module GitHubChangelogGenerator
57
96
  %x[#{exec_cmd}]
58
97
  end
59
98
 
60
-
61
99
  def get_all_closed_pull_requests
62
-
63
100
  if @options[:verbose]
64
101
  print "Fetching pull requests...\r"
65
102
  end
66
-
67
103
  response = @github.pull_requests.list @options[:user], @options[:project], :state => 'closed'
68
104
 
69
105
  pull_requests = []
70
106
  page_i = 0
71
107
  response.each_page do |page|
72
108
  page_i += PER_PAGE_NUMBER
73
- print "Fetching pull requests... #{page_i}\r"
109
+ count_pages = response.count_pages
110
+ print "Fetching pull requests... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
74
111
  pull_requests.concat(page)
75
112
  end
76
-
77
- print "\r"
113
+ print " \r"
78
114
 
79
115
  if @options[:verbose]
80
- puts "Received closed pull requests: #{pull_requests.count}"
116
+ puts "Received pull requests: #{pull_requests.count}"
81
117
  end
82
118
 
119
+ pull_requests
120
+ end
121
+
122
+ def get_filtered_pull_requests
123
+
124
+ pull_requests = self.get_all_closed_pull_requests
125
+
83
126
  unless @options[:pull_request_labels].nil?
84
127
 
85
128
  if @options[:verbose]
@@ -87,10 +130,11 @@ module GitHubChangelogGenerator
87
130
  end
88
131
 
89
132
  filtered_pull_requests = pull_requests.select { |pull_request|
90
- #We need issue to fetch labels
133
+ #fetch this issue to get labels array
91
134
  issue = @github.issues.get @options[:user], @options[:project], pull_request.number
135
+
92
136
  #compare is there any labels from @options[:labels] array
93
- select_no_label = !issue.labels.map { |label| label.name }.any?
137
+ issue_without_labels = !issue.labels.map { |label| label.name }.any?
94
138
 
95
139
  if @options[:verbose]
96
140
  puts "Filter request \##{issue.number}."
@@ -102,7 +146,7 @@ module GitHubChangelogGenerator
102
146
  select_by_label = false
103
147
  end
104
148
 
105
- select_by_label | select_no_label
149
+ select_by_label | issue_without_labels
106
150
  }
107
151
 
108
152
  if @options[:verbose]
@@ -115,9 +159,6 @@ module GitHubChangelogGenerator
115
159
  end
116
160
 
117
161
  def compund_changelog
118
- if @options[:verbose]
119
- puts 'Generating changelog:'
120
- end
121
162
 
122
163
  log = "# Changelog\n\n"
123
164
 
@@ -159,10 +200,15 @@ module GitHubChangelogGenerator
159
200
  def generate_log_for_all_tags
160
201
  log = ''
161
202
 
203
+ if @options[:verbose]
204
+ puts "Fetching tags dates.."
205
+ end
206
+
162
207
  # Async fetching tags:
163
208
  threads = []
164
209
  @all_tags.each { |tag|
165
- threads << Thread.new { self.get_time_of_tag(tag) }
210
+ # explicit set @tag_times_hash to write data safety.
211
+ threads << Thread.new { self.get_time_of_tag(tag, @tag_times_hash) }
166
212
  }
167
213
  threads.each { |thr| thr.join }
168
214
 
@@ -199,12 +245,13 @@ module GitHubChangelogGenerator
199
245
 
200
246
  tags = []
201
247
  page_i = 0
248
+ count_pages = response.count_pages
202
249
  response.each_page do |page|
203
250
  page_i += PER_PAGE_NUMBER
204
- print "Fetching tags... #{page_i}\r"
251
+ print "Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
205
252
  tags.concat(page)
206
253
  end
207
- print "\r"
254
+ print " \r"
208
255
  if @options[:verbose]
209
256
  puts "Found #{tags.count} tags"
210
257
  end
@@ -239,17 +286,10 @@ module GitHubChangelogGenerator
239
286
  newer_tag_time = self.get_time_of_tag(newer_tag)
240
287
  newer_tag_name = newer_tag['name']
241
288
 
242
- if older_tag.nil?
243
- older_tag_name = nil
244
- filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time)
245
- filtered_issues = delete_by_time(@issues, :closed_at, newer_tag_time)
246
- else
247
- older_tag_time = self.get_time_of_tag(older_tag)
248
- older_tag_name = older_tag['name']
249
- filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time, older_tag_time)
250
- filtered_issues = delete_by_time(@issues, :closed_at, newer_tag_time, older_tag_time)
251
- end
289
+ filtered_pull_requests = delete_by_time(@pull_requests, :merged_at, newer_tag_time, older_tag)
290
+ filtered_issues = delete_by_time(@issues, :actual_date, newer_tag_time, older_tag)
252
291
 
292
+ older_tag_name = older_tag.nil? ? nil : older_tag['name']
253
293
 
254
294
  if @options[:filter_issues_by_milestone]
255
295
  #delete excess irrelevant issues (according milestones)
@@ -291,7 +331,10 @@ module GitHubChangelogGenerator
291
331
 
292
332
  end
293
333
 
294
- def delete_by_time(array, hash_key, newer_tag_time, older_tag_time = nil)
334
+ def delete_by_time(array, hash_key, newer_tag_time, older_tag = nil)
335
+
336
+ older_tag_time = self.get_time_of_tag(older_tag)
337
+
295
338
  array.select { |req|
296
339
  if req[hash_key]
297
340
  t = Time.parse(req[hash_key]).utc
@@ -395,16 +438,19 @@ module GitHubChangelogGenerator
395
438
  log
396
439
  end
397
440
 
398
- def get_time_of_tag(prev_tag)
441
+ def get_time_of_tag(tag_name, tag_times_hash = @tag_times_hash)
442
+
443
+ if tag_name.nil?
444
+ return nil
445
+ end
399
446
 
400
- if @tag_times_hash[prev_tag['name']]
401
- return @tag_times_hash[prev_tag['name']]
447
+ if tag_times_hash[tag_name['name']]
448
+ return @tag_times_hash[tag_name['name']]
402
449
  end
403
450
 
404
- github_git_data_commits_get = @github.git_data.commits.get @options[:user], @options[:project], prev_tag['commit']['sha']
451
+ github_git_data_commits_get = @github.git_data.commits.get @options[:user], @options[:project], tag_name['commit']['sha']
405
452
  time_string = github_git_data_commits_get['committer']['date']
406
- Time.parse(time_string)
407
- @tag_times_hash[prev_tag['name']] = Time.parse(time_string)
453
+ @tag_times_hash[tag_name['name']] = Time.parse(time_string)
408
454
  end
409
455
 
410
456
  def get_all_issues
@@ -417,33 +463,30 @@ module GitHubChangelogGenerator
417
463
 
418
464
  issues = []
419
465
  page_i = 0
466
+ count_pages = response.count_pages
420
467
  response.each_page do |page|
421
468
  page_i += PER_PAGE_NUMBER
422
- print "Fetching closed issues... #{page_i}\r"
469
+ print "Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
423
470
  issues.concat(page)
424
471
  end
425
472
 
426
- print "\r"
473
+ print " \r"
474
+
475
+ if @options[:verbose]
476
+ puts "Received issues: #{issues.count}"
477
+ end
427
478
 
428
479
  # remove pull request from issues:
429
480
  issues.select! { |x|
430
481
  x.pull_request == nil
431
482
  }
432
483
 
433
- if @options[:verbose]
434
- puts "Received closed issues: #{issues.count}"
435
- end
436
-
437
-
438
- if @options[:verbose]
439
- puts "Filtering issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}"
440
- end
441
-
442
484
  filtered_issues = issues.select { |issue|
443
485
  #compare is there any labels from @options[:labels] array
444
486
  (issue.labels.map { |label| label.name } & @options[:labels]).any?
445
487
  }
446
488
 
489
+
447
490
  if @options[:add_issues_wo_labels]
448
491
  issues_wo_labels = issues.select {
449
492
  # add issues without any labels
@@ -452,14 +495,39 @@ module GitHubChangelogGenerator
452
495
  filtered_issues.concat(issues_wo_labels)
453
496
  end
454
497
 
498
+
455
499
  if @options[:verbose]
456
- puts "Filtered issues: #{filtered_issues.count}"
500
+ puts "Filtered issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}: #{filtered_issues.count}"
457
501
  end
458
502
 
459
503
  filtered_issues
460
504
 
461
505
  end
462
506
 
507
+ def fetch_event_for_issues(filtered_issues)
508
+ if @options[:verbose]
509
+ print "Fetching events for issues: 0/#{filtered_issues.count}\r"
510
+ end
511
+
512
+ # Async fetching events:
513
+ threads = []
514
+
515
+ i = 0
516
+ filtered_issues.each { |issue|
517
+ threads << Thread.new {
518
+ obj = @github.issues.events.list user: @options[:user], repo: @options[:project], issue_number: issue['number']
519
+ issue[:events] = obj.body
520
+ print "Fetching events for issues: #{i+1}/#{filtered_issues.count}\r"
521
+ i +=1
522
+ }
523
+ }
524
+ threads.each { |thr| thr.join }
525
+
526
+ if @options[:verbose]
527
+ puts "Fetching events for issues: Done!"
528
+ end
529
+ end
530
+
463
531
  end
464
532
 
465
533
  if __FILE__ == $0
@@ -31,13 +31,13 @@ module GitHubChangelogGenerator
31
31
  opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
32
32
  options[:issues] = v
33
33
  end
34
- opts.on('--[no-]issues-without-labels', 'Include closed issues without any labels to changelog. Default is true') do |v|
34
+ opts.on('--[no-]issues-wo-labels', 'Include closed issues without any labels to changelog. Default is true') do |v|
35
35
  options[:add_issues_wo_labels] = v
36
36
  end
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|
40
+ opts.on('--[no-]filter-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
41
41
  options[:filter_issues_by_milestone] = last
42
42
  end
43
43
  opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
@@ -72,15 +72,23 @@ module GitHubChangelogGenerator
72
72
 
73
73
  if ARGV[0] && !ARGV[1]
74
74
  github_site = options[:github_site] ? options[:github_site] : 'github.com'
75
- # this match should parse https://github.com/skywinder/Github-Changelog-Generator and skywinder/Github-Changelog-Generator to user and name
75
+ # this match should parse strings such "https://github.com/skywinder/Github-Changelog-Generator" or "skywinder/Github-Changelog-Generator" to user and name
76
76
  match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0])
77
77
 
78
- if match[2].nil?
78
+ begin
79
+ param = match[2].nil?
80
+ rescue
81
+ puts "Can't detect user and name from first parameter: '#{ARGV[0]}' -> exit'"
82
+ exit
83
+ end
84
+ if param
79
85
  exit
80
86
  else
81
87
  options[:user] = match[1]
82
88
  options[:project]= match[2]
83
89
  end
90
+
91
+
84
92
  end
85
93
 
86
94
  if !options[:user] && !options[:project]
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = '1.2.7'
2
+ VERSION = '1.2.8'
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.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,7 @@ files:
83
83
  - bin/github_changelog_generator
84
84
  - bump_gemfile.rb
85
85
  - github_changelog_generator.gemspec
86
+ - lib/CHANGELOG.md
86
87
  - lib/github_changelog_generator.rb
87
88
  - lib/github_changelog_generator/generator.rb
88
89
  - lib/github_changelog_generator/parser.rb
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.4.4
111
+ rubygems_version: 2.4.3
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Script, that automatically generate change-log from your tags and pull-requests.