Compare commits

..

51 Commits
1.2.3 ... 1.2.7

Author SHA1 Message Date
Petr Korolev
99d20bd8a9 Merge branch 'release/1.2.7' 2015-01-26 17:00:48 +02:00
Petr Korolev
f0e713d6ef Update gemspec to version 1.2.7 2015-01-26 17:00:45 +02:00
sue445
8dc50cf483 Add option: --compare-link 2015-01-26 17:00:36 +02:00
sue445
90c455ada4 regenerate CHANGELOG 2015-01-26 17:00:36 +02:00
sue445
088824aa05 Refactorings
* tweak indent
* rename variable name (tag_xxx -> newer_tag_xxx)
2015-01-26 17:00:36 +02:00
sue445
96977c8384 Add compare link between older version and newer version 2015-01-26 17:00:36 +02:00
Petr Korolev
1940974c4c Merge pull request #46 from sue445/feature/compare_link
Add compare link between older version and newer version
2015-01-26 16:58:34 +02:00
sue445
1fced7278e Add option: --compare-link 2015-01-26 21:30:27 +09:00
sue445
eb9bd59f26 regenerate CHANGELOG 2015-01-24 21:48:02 +09:00
sue445
41f43932e0 Refactorings
* tweak indent
* rename variable name (tag_xxx -> newer_tag_xxx)
2015-01-24 21:46:13 +09:00
sue445
4ba7bbcc90 Add compare link between older version and newer version 2015-01-24 21:44:12 +09:00
Petr Korolev
8505d340af Merge branch 'hotfix/update-changelog' into develop 2015-01-21 19:19:48 +01:00
Petr Korolev
f3c05bd01c Merge branch 'hotfix/update-changelog' 2015-01-21 19:19:48 +01:00
Petr Korolev
4bcf49175b Update changelog for version 1.2.6 2015-01-21 19:19:48 +01:00
Petr Korolev
6c28db6d4a Merge branch 'release/1.2.6' into develop 2015-01-21 19:19:24 +01:00
Petr Korolev
6f8aee6a4b Merge branch 'release/1.2.6' 2015-01-21 19:19:24 +01:00
Petr Korolev
3e3cc15592 Update gemspec to version 1.2.6 2015-01-21 19:19:23 +01:00
Petr Korolev
d5edb1f606 Update README.md 2015-01-21 19:19:18 +01:00
Petr Korolev
e6d0c3d791 Update README.md 2015-01-21 19:19:18 +01:00
sugamasao
c1d28d486f fix link tag format
Remove Extra Space.
2015-01-21 19:19:18 +01:00
Petr Korolev
fa713af816 Update README.md 2015-01-21 19:17:57 +01:00
Petr Korolev
17f7127de1 Update README.md 2015-01-21 19:14:31 +01:00
Petr Korolev
e1a264e2c9 Merge pull request #45 from sugamasao/fix/link-tag-format
fix link tag format
2015-01-21 19:13:13 +01:00
sugamasao
e4b79e75ca fix link tag format
Remove Extra Space.
2015-01-17 10:28:31 +09:00
Petr Korolev
c7a767451d Merge branch 'hotfix/update-changelog' into develop 2015-01-15 23:35:17 +01:00
Petr Korolev
01f44b8311 Merge branch 'hotfix/update-changelog' 2015-01-15 23:35:17 +01:00
Petr Korolev
c0015a2c22 Update changelog for version 1.2.5 2015-01-15 23:35:17 +01:00
Petr Korolev
49cb6589f7 Merge branch 'release/1.2.5' into develop 2015-01-15 23:34:48 +01:00
Petr Korolev
e139f839c9 Merge branch 'release/1.2.5' 2015-01-15 23:34:47 +01:00
Petr Korolev
a7a75a181e Update gemspec to version 1.2.5 2015-01-15 23:34:47 +01:00
Petr Korolev
6efa421816 Merge branch 'develop' 2015-01-15 23:30:00 +01:00
Petr Korolev
e8d59fe66a Merge branch 'master' into develop 2015-01-15 23:27:13 +01:00
Petr Korolev
6b5cf5ab2e Merge pull request #42 from glenlovett/enterprise_github
support enterprise github via command line options
2015-01-15 23:16:54 +01:00
Petr Korolev
de6763aa3a Merge pull request #43 from schwing/prettyprint
PrettyPrint class is included using lowercase 'pp'
2015-01-15 23:15:50 +01:00
John Schwinghammer
5f019482d2 PrettyPrint class is included using lowercase 'pp' 2015-01-14 13:56:44 -06:00
Petr Korolev
6da115c4b0 Fix #32 2014-12-22 15:51:45 +02:00
Petr Korolev
657ce0e838 add ability to disable milestones filtering 2014-12-22 15:41:20 +02:00
Petr Korolev
5304e4faf8 fix #22 2014-12-22 15:31:49 +02:00
Petr Korolev
e6bb728355 remove issues with other milstones 2014-12-22 15:14:01 +02:00
Petr Korolev
135c48a494 Merge branch 'glenlovett-enterprise_github' into develop 2014-12-22 14:27:40 +02:00
Lovett, Glen
6bad92e899 support enterprise github via command line options 2014-12-19 16:55:42 -05:00
Petr Korolev
ad4c20d8d8 Merge branch 'hotfix/update-changelog' 2014-12-16 17:53:18 +02:00
Petr Korolev
a5d9766aef Merge branch 'hotfix/update-changelog' into develop 2014-12-16 17:53:18 +02:00
Petr Korolev
a0cfaa66a2 Update changelog for version 1.2.4 2014-12-16 17:53:16 +02:00
Petr Korolev
d16f4f7cb5 Merge branch 'release/1.2.4' 2014-12-16 17:52:49 +02:00
Petr Korolev
1d6d6ab400 Merge branch 'release/1.2.4' into develop 2014-12-16 17:52:49 +02:00
Petr Korolev
5b07fc9614 Update gemspec to version 1.2.4 2014-12-16 17:52:47 +02:00
Petr Korolev
3437fbf278 fx 2014-12-16 17:43:24 +02:00
Petr Korolev
ba4db0e5f4 Merge branch 'hotfix/update-changelog' 2014-12-16 17:42:11 +02:00
Petr Korolev
abac1013f1 fx 2014-12-16 17:41:20 +02:00
Petr Korolev
28247edc7f Merge branch 'release/1.2.3' into develop 2014-12-16 17:25:12 +02:00
6 changed files with 159 additions and 43 deletions

View File

@@ -1,16 +1,57 @@
# Changelog # Changelog
## [1.2.6](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.6)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.5...1.2.6)
#### 21/01/15
- *Merged pull-request:* fix link tag format [\#45](https://github.com/skywinder/Github-Changelog-Generator/pull/45) ([sugamasao](https://github.com/sugamasao))
## [1.2.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.5)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.4...1.2.5)
#### 15/01/15
- *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))
- *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))
- *Implemented enhancement:* Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22)
- *Fixed bug:* Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32)
## [1.2.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.4)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.3...1.2.4)
#### 16/12/14
- *Merged pull-request:* Fix crash when user is NULL [\#40](https://github.com/skywinder/Github-Changelog-Generator/pull/40) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Implement async fetching [\#39](https://github.com/skywinder/Github-Changelog-Generator/pull/39) ([skywinder](https://github.com/skywinder))
- *Implemented enhancement:* Add ability to run with one parameter instead -u -p [\#38](https://github.com/skywinder/Github-Changelog-Generator/issues/38)
- *Implemented enhancement:* Detailed output [\#33](https://github.com/skywinder/Github-Changelog-Generator/issues/33)
- *Fixed bug:* Docs lacking or basic behavior not as advertised [\#30](https://github.com/skywinder/Github-Changelog-Generator/issues/30)
- *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
## [1.2.3](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.2...1.2.3)
#### 16/12/14
## [1.2.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2) ## [1.2.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.1...1.2.2)
#### 10/12/14 #### 10/12/14
- *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)) - *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))
- *Fixed bug:* Encapsulate \[ \> \* \_ \ \] signs in issues names [\#34](https://github.com/skywinder/Github-Changelog-Generator/issues/34)
## [1.2.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.1) ## [1.2.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.1)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.0...1.2.1)
#### 22/11/14 #### 22/11/14
- *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)) - *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))
- *Merged pull-request:* Disable default --filter-pull-requests option. [\#28](https://github.com/skywinder/Github-Changelog-Generator/pull/28) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Disable default --filter-pull-requests option. [\#28](https://github.com/skywinder/Github-Changelog-Generator/pull/28) ([skywinder](https://github.com/skywinder))
- *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
## [1.2.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.0) ## [1.2.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.0)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.4...1.2.0)
#### 19/11/14 #### 19/11/14
- *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)) - *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))
@@ -21,20 +62,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)) - *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))
## [1.1.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.4) ## [1.1.4](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.4)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.2...1.1.4)
#### 18/11/14 #### 18/11/14
- *Merged pull-request:* Sort tags by date [\#23](https://github.com/skywinder/Github-Changelog-Generator/pull/23) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Sort tags by date [\#23](https://github.com/skywinder/Github-Changelog-Generator/pull/23) ([skywinder](https://github.com/skywinder))
- *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) - *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)
- *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
## [1.1.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.2) ## [1.1.2](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.2)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.1...1.1.2)
#### 12/11/14 #### 12/11/14
- *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)) - *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))
- *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)) - *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))
## [1.1.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.1) ## [1.1.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.1)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.1.0...1.1.1)
#### 10/11/14 #### 10/11/14
- *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)) - *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))
@@ -43,6 +85,7 @@
- *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)) - *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))
## [1.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.0) ## [1.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.0)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.0.1...1.1.0)
#### 10/11/14 #### 10/11/14
- *Implemented enhancement:* Detect username and project form origin [\#11](https://github.com/skywinder/Github-Changelog-Generator/issues/11) - *Implemented enhancement:* Detect username and project form origin [\#11](https://github.com/skywinder/Github-Changelog-Generator/issues/11)
@@ -51,10 +94,12 @@
- *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12) - *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12)
## [1.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1) ## [1.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.0.0...1.0.1)
#### 10/11/14 #### 10/11/14
- *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8) ([skywinder](https://github.com/skywinder))
## [1.0.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.0) ## [1.0.0](https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.0)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.1.0...1.0.0)
#### 07/11/14 #### 07/11/14
- *Merged pull-request:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7) ([skywinder](https://github.com/skywinder))
@@ -67,12 +112,14 @@
- *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5) - *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5)
## [0.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/0.1.0) ## [0.1.0](https://github.com/skywinder/Github-Changelog-Generator/tree/0.1.0)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.0.2...0.1.0)
#### 07/11/14 #### 07/11/14
- *Merged pull-request:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2) ([skywinder](https://github.com/skywinder)) - *Merged pull-request:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2) ([skywinder](https://github.com/skywinder))
- *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)) - *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))
## [0.0.2](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2) ## [0.0.2](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2)
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/0.0.1...0.0.2)
#### 06/11/14 #### 06/11/14
## [0.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.1) ## [0.0.1](https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.1)
#### 06/11/14 #### 06/11/14

View File

@@ -16,15 +16,15 @@ You're almost done!
## Usage ## Usage
**It's really simple**: **It's really simple**:
- If your **git remote** `origin` refer to your GitHub repo, then just go to your project folder just run: - If your **git remote** `origin` refer to your GitHub repo, then just go to your project folder and run:
github_changelog_generator github_changelog_generator
- or from anywhere: - or from anywhere:
github_changelog_generator -u github-username -p github-project github_changelog_generator -u github_username -p github_project
As output you will get `CHANGELOG.md` file with *pretty Markdown-formatted* changelog. As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog.
### Params: ### Params:
Type `github_changelog_generator --help` for detailed usage. Type `github_changelog_generator --help` for detailed usage.
@@ -57,7 +57,9 @@ And:
- Run with key `-t [your-16-digit-token]` - Run with key `-t [your-16-digit-token]`
- Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token. - Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string `export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token"'` i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string :
export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token"
So, if you got error like this: So, if you got error like this:
>! /Library/Ruby/Gems/2.0.0/gems/github_api-0.12.2/lib/github_api/response/raise_error.rb:14:in `on_complete' >! /Library/Ruby/Gems/2.0.0/gems/github_api-0.12.2/lib/github_api/response/raise_error.rb:14:in `on_complete'

View File

@@ -28,12 +28,12 @@ module GitHubChangelogGenerator
github_token github_token
if @github_token.nil? github_options = {per_page: PER_PAGE_NUMBER}
@github = Github.new per_page: PER_PAGE_NUMBER github_options[:oauth_token] = @github_token unless @github_token.nil?
else github_options[:endpoint] = options[:github_endpoint] unless options[:github_endpoint].nil?
@github = Github.new oauth_token: @github_token, github_options[:site] = options[:github_endpoint] unless options[:github_site].nil?
per_page: PER_PAGE_NUMBER
end @github = Github.new github_options
@generator = Generator.new(@options) @generator = Generator.new(@options)
@@ -231,19 +231,63 @@ module GitHubChangelogGenerator
def generate_log_between_tags(older_tag, newer_tag) def generate_log_between_tags(older_tag, newer_tag)
if newer_tag.nil?
puts "Can't find tag -> terminate"
exit 1
end
newer_tag_time = self.get_time_of_tag(newer_tag) newer_tag_time = self.get_time_of_tag(newer_tag)
newer_tag_name = newer_tag['name'] newer_tag_name = newer_tag['name']
if older_tag.nil? if older_tag.nil?
older_tag_name = 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)
filtered_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)
older_tag_name = older_tag['name']
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)
filtered_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, filtered_issues, newer_tag_name, newer_tag_time)
if @options[:filter_issues_by_milestone]
#delete excess irrelevant issues (according milestones)
filtered_issues.select! { |issue|
if issue.milestone.nil?
true
else
#check, that this milestone in tag list:
milestone_is_tag = @all_tags.find { |tag|
tag.name == issue.milestone.title
}
milestone_is_tag.nil?
end
}
#add missed issues (according milestones)
issues_to_add = @issues.select { |issue|
if issue.milestone.nil?
false
else
#check, that this milestone in tag list:
milestone_is_tag = @all_tags.find { |tag|
tag.name == issue.milestone.title
}
if milestone_is_tag.nil?
false
else
issue.milestone.title == newer_tag_name
end
end
}
filtered_issues |= issues_to_add
end
self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time, older_tag_name)
end end
@@ -271,16 +315,26 @@ module GitHubChangelogGenerator
# @param [Array] pull_requests # @param [Array] pull_requests
# @param [Array] issues # @param [Array] issues
# @param [String] tag_name # @param [String] newer_tag_name
# @param [String] tag_time # @param [String] newer_tag_time
# @param [String] older_tag_name
# @return [String] # @return [String]
def create_log(pull_requests, issues, tag_name, tag_time) def create_log(pull_requests, issues, newer_tag_name, newer_tag_time, older_tag_name = nil)
github_site = options[:github_site] || 'https://github.com'
project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}"
# Generate tag name and link # Generate tag name and link
log = "## [#{tag_name}] (https://github.com/#{@options[:user]}/#{@options[:project]}/tree/#{tag_name})\n" log = "## [#{newer_tag_name}](#{project_url}/tree/#{newer_tag_name})\n"
if @options[:compare_link] && older_tag_name
# Generate compare link
log += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_name})\n"
end
#Generate date string: #Generate date string:
time_string = tag_time.strftime @options[:format] time_string = newer_tag_time.strftime @options[:format]
log += "#### #{time_string}\n" log += "#### #{time_string}\n"
if @options[:pulls] if @options[:pulls]

View File

@@ -10,10 +10,10 @@ module GitHubChangelogGenerator
merge = "#{@options[:merge_prefix]}#{encapsulated_title} [\\##{pull_request[:number]}](#{pull_request.html_url})" merge = "#{@options[:merge_prefix]}#{encapsulated_title} [\\##{pull_request[:number]}](#{pull_request.html_url})"
if @options[:author] if @options[:author]
if !pull_request.user.nil? if pull_request.user.nil?
merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
else
merge += " ({Null user})\n\n" merge += " ({Null user})\n\n"
else
merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
end end
else else
merge += "\n\n" merge += "\n\n"

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'optparse' require 'optparse'
require 'PP' require 'pp'
require_relative 'version' require_relative 'version'
module GitHubChangelogGenerator module GitHubChangelogGenerator
class Parser class Parser
def self.parse_options def self.parse_options
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} 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, :compare_link => true}
parser = OptionParser.new { |opts| parser = OptionParser.new { |opts|
opts.banner = 'Usage: changelog_generator [options]' opts.banner = 'Usage: changelog_generator [options]'
@@ -37,15 +37,27 @@ module GitHubChangelogGenerator
opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v| opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
options[:pulls] = v options[:pulls] = v
end end
opts.on('--[no-]filter-issues-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
options[:filter_issues_by_milestone] = last
end
opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author| opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
options[:last] = author options[:last] = author
end end
opts.on('--[no-]compare-link', 'Include compare link between older version and newer version. Default is true') do |v|
options[:compare_link] = v
end
opts.on('--labels x,y,z', Array, 'Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list| opts.on('--labels x,y,z', Array, 'Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
options[:labels] = list options[:labels] = list
end end
opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list| opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list|
options[:pull_request_labels] = list options[:pull_request_labels] = list
end end
opts.on('--github-site [URL]', 'The Enterprise Github site on which your project is hosted.') do |last|
options[:github_site] = last
end
opts.on('--github-api [URL]', 'The enterprise endpoint to use for your Github API.') do |last|
options[:github_endpoint] = last
end
opts.on('-v', '--version', 'Print version number') do |v| opts.on('-v', '--version', 'Print version number') do |v|
puts "Version: #{GitHubChangelogGenerator::VERSION}" puts "Version: #{GitHubChangelogGenerator::VERSION}"
exit exit
@@ -59,8 +71,9 @@ module GitHubChangelogGenerator
parser.parse! parser.parse!
if ARGV[0] && !ARGV[1] if ARGV[0] && !ARGV[1]
github_site = options[:github_site] ? options[:github_site] : 'github.com'
# this match should parse https://github.com/skywinder/Github-Changelog-Generator and skywinder/Github-Changelog-Generator to user and name # this match should parse https://github.com/skywinder/Github-Changelog-Generator and skywinder/Github-Changelog-Generator to user and name
match = /(?:.+github\.com\/)?(.+)\/(.+)/.match(ARGV[0]) match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0])
if match[2].nil? if match[2].nil?
exit exit
@@ -72,7 +85,7 @@ module GitHubChangelogGenerator
if !options[:user] && !options[:project] if !options[:user] && !options[:project]
remote = `git remote -vv`.split("\n") remote = `git remote -vv`.split("\n")
match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)(?:\.git)?.*/.match(remote[0]) match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)?(?:\.git).*/.match(remote[0])
if match && match[1] && match[2] if match && match[1] && match[2]
puts "Detected user:#{match[1]}, project:#{match[2]}" puts "Detected user:#{match[1]}, project:#{match[2]}"

View File

@@ -1,3 +1,3 @@
module GitHubChangelogGenerator module GitHubChangelogGenerator
VERSION = '1.2.3' VERSION = '1.2.7'
end end