add option for output file, update readme
This commit is contained in:
parent
db1c125e7e
commit
20095c571d
26
README.md
26
README.md
|
@ -6,32 +6,34 @@ Github Changelog Generator
|
||||||
This script automatically generate change-log from your tags and merged pull-requests.
|
This script automatically generate change-log from your tags and merged pull-requests.
|
||||||
|
|
||||||
## Installation:
|
## Installation:
|
||||||
`gem install github_changelog_generator`
|
gem install github_changelog_generator
|
||||||
|
|
||||||
## Usage:
|
## Usage
|
||||||
|
|
||||||
### Example usage:
|
### Example usage:
|
||||||
`github_changelog_generator -u github-username -p github-project`
|
github_changelog_generator -u github-username -p github-project
|
||||||
|
|
||||||
In output you will get `[your_project]_CHANGELOG.md` file with *pretty Markdown-formatted* changelogs in your current directory.
|
In output you will get `CHANGELOG.md` file with *pretty Markdown-formatted* changelogs in your current directory.
|
||||||
|
|
||||||
### Params:
|
### Params:
|
||||||
github_changelog_generator -u user_name -p project_name [-t 16-digit-GitHubToken] [options]
|
See `github_changelog_generator --help` for detailed usage.
|
||||||
-u, --user [USER] your username on GitHub
|
|
||||||
-p, --project [PROJECT] name of project on GitHub
|
Usage: changelog_generator --user username --project project_name [options]
|
||||||
-t, --token [TOKEN] To make more than 50 requests this app required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications
|
-u, --user [USER] Username of the owner of target GitHub repo (required)
|
||||||
|
-p, --project [PROJECT] Name of project on GitHub (required)
|
||||||
|
-t, --token [TOKEN] To make more than 50 requests this script required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications
|
||||||
-h, --help Displays Help
|
-h, --help Displays Help
|
||||||
-v, --[no-]verbose Run verbosely
|
-v, --[no-]verbose Run verbosely
|
||||||
-l, --last-changes generate log between last 2 tags
|
-l, --last-changes Generate log between only last 2 tags
|
||||||
-f, --date-format [FORMAT] date format. default is %d/%m/%y
|
-f, --date-format [FORMAT] Date format. Default is %d/%m/%y
|
||||||
|
-o, --output [FORMAT] Output file. Default is CHANGELOG.md
|
||||||
|
|
||||||
## Real examples:
|
## Real examples:
|
||||||
### [This changelog](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md) was generated by
|
### [This changelog](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md) was generated by
|
||||||
`github_changelog_generator -u skywinder -p ActionSheetPicker-3.0`: [ActionSheetPicker-3.0/CHANGELOG.md](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md)
|
`github_changelog_generator -u skywinder -p ActionSheetPicker-3.0`: [ActionSheetPicker-3.0/CHANGELOG.md](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md)
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
Since GitHub allow to make only 50 requests without authentication it's recommended to run this scrip with key `-t [your 16 digit token]` that you can easily **[generate here](https://github.com/settings/applications)**.
|
Since GitHub allow to make only 50 requests without authentication it's recommended to run this scrip with key `-t [your 16 digit token]` that you can easily **[generate it here](https://github.com/settings/applications)**.
|
||||||
|
|
||||||
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': GET https://api.github.com/repos/skywinder/ActionSheetPicker-3.0/git/commits/89678f7d7f66873c858e6cb07bf697192aca6768: 403 API rate limit exceeded for 195.88.177.9. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) (Github::Error::Forbidden)
|
>! /Library/Ruby/Gems/2.0.0/gems/github_api-0.12.2/lib/github_api/response/raise_error.rb:14:in `on_complete': GET https://api.github.com/repos/skywinder/ActionSheetPicker-3.0/git/commits/89678f7d7f66873c858e6cb07bf697192aca6768: 403 API rate limit exceeded for 195.88.177.9. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) (Github::Error::Forbidden)
|
||||||
|
|
|
@ -88,7 +88,8 @@ class ChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
log += "\n\n*This file was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
|
log += "\n\n*This file was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
|
||||||
output_filename = "#{@options[:project]}_CHANGELOG.md"
|
|
||||||
|
output_filename = "#{@options[:output]}"
|
||||||
File.open(output_filename, 'w') { |file| file.write(log) }
|
File.open(output_filename, 'w') { |file| file.write(log) }
|
||||||
|
|
||||||
puts "Done! Generated log placed in #{output_filename}"
|
puts "Done! Generated log placed in #{output_filename}"
|
||||||
|
|
|
@ -3,17 +3,17 @@ require 'optparse'
|
||||||
|
|
||||||
class Parser
|
class Parser
|
||||||
def self.parse_options
|
def self.parse_options
|
||||||
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y'}
|
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md'}
|
||||||
|
|
||||||
parser = OptionParser.new { |opts|
|
parser = OptionParser.new { |opts|
|
||||||
opts.banner = 'Usage: changelog_generator -u user_name -p project_name [-t 16-digit-GitHubToken] [options]'
|
opts.banner = 'Usage: changelog_generator --user username --project project_name [options]'
|
||||||
opts.on('-u', '--user [USER]', 'your username on GitHub') do |last|
|
opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo (required)') do |last|
|
||||||
options[:user] = last
|
options[:user] = last
|
||||||
end
|
end
|
||||||
opts.on('-p', '--project [PROJECT]', 'name of project on GitHub') do |last|
|
opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub (required)') do |last|
|
||||||
options[:project] = last
|
options[:project] = last
|
||||||
end
|
end
|
||||||
opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests this app required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications') do |last|
|
opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests this script required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications') do |last|
|
||||||
options[:token] = last
|
options[:token] = last
|
||||||
end
|
end
|
||||||
opts.on('-h', '--help', 'Displays Help') do
|
opts.on('-h', '--help', 'Displays Help') do
|
||||||
|
@ -23,12 +23,15 @@ class Parser
|
||||||
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
||||||
options[:verbose] = v
|
options[:verbose] = v
|
||||||
end
|
end
|
||||||
opts.on('-l', '--last-changes', 'generate log between last 2 tags') do |last|
|
opts.on('-l', '--last-changes', 'Generate log between only last 2 tags') do |last|
|
||||||
options[:last] = last
|
options[:last] = last
|
||||||
end
|
end
|
||||||
opts.on('-f', '--date-format [FORMAT]', 'date format. default is %d/%m/%y') do |last|
|
opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %d/%m/%y') do |last|
|
||||||
options[:format] = last
|
options[:format] = last
|
||||||
end
|
end
|
||||||
|
opts.on('-o', '--output [FORMAT]', 'Output file. Default is CHANGELOG.md') do |last|
|
||||||
|
options[:output] = last
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.parse!
|
parser.parse!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user