Add option --require to load custom Ruby code (#574)

This commit is contained in:
Olle Jonsson 2017-10-14 21:00:56 +02:00 committed by GitHub
parent 79518161b8
commit ad0d972ed9
6 changed files with 49 additions and 10 deletions

View File

@ -6,6 +6,7 @@ module GitHubChangelogGenerator
# #
# @return [String] Generated change log file # @return [String] Generated change log file
def compound_changelog def compound_changelog
options.load_custom_ruby_files
fetch_and_filter_tags fetch_and_filter_tags
fetch_issues_and_pr fetch_issues_and_pr

View File

@ -43,6 +43,7 @@ module GitHubChangelogGenerator
pulls pulls
release_branch release_branch
release_url release_url
require
simple_list simple_list
since_tag since_tag
ssl_ca_file ssl_ca_file
@ -69,6 +70,13 @@ module GitHubChangelogGenerator
values values
end end
# Loads the configured Ruby files from the --require option.
#
# @return [void]
def load_custom_ruby_files
self[:require].each { |f| require f }
end
private private
def values def values

View File

@ -181,6 +181,9 @@ module GitHubChangelogGenerator
opts.on("--ssl-ca-file [PATH]", "Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.") do |ssl_ca_file| opts.on("--ssl-ca-file [PATH]", "Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.") do |ssl_ca_file|
options[:ssl_ca_file] = ssl_ca_file options[:ssl_ca_file] = ssl_ca_file
end end
opts.on("--require x,y,z", Array, "Path to Ruby file(s) to require.") do |paths|
options[:require] = paths
end
opts.on("--[no-]verbose", "Run verbosely. Default is true") do |v| opts.on("--[no-]verbose", "Run verbosely. Default is true") do |v|
options[:verbose] = v options[:verbose] = v
end end
@ -226,7 +229,8 @@ module GitHubChangelogGenerator
bug_prefix: "**Fixed bugs:**", bug_prefix: "**Fixed bugs:**",
enhancement_prefix: "**Implemented enhancements:**", enhancement_prefix: "**Implemented enhancements:**",
breaking_prefix: "**Breaking changes:**", breaking_prefix: "**Breaking changes:**",
http_cache: true http_cache: true,
require: []
) )
end end
end end

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GIT\-GENERATE\-CHANGELOG" "1" "December 2016" "" "" .TH "GIT\-GENERATE\-CHANGELOG" "1" "October 2017" "" ""
. .
.SH "NAME" .SH "NAME"
\fBgit\-generate\-changelog\fR \- Generate changelog from github \fBgit\-generate\-changelog\fR \- Generate changelog from github
@ -175,12 +175,6 @@ Issues with the specified labels will be always added to "Fixed bugs" section\.
Issues with the specified labels will be always added to "Implemented enhancements" section\. Default is \'enhancement,Enhancement\' Issues with the specified labels will be always added to "Implemented enhancements" section\. Default is \'enhancement,Enhancement\'
. .
.P .P
\-\-between\-tags x,y,z
.
.P
Change log will be filled only between specified tags
.
.P
\-\-exclude\-tags x,y,z \-\-exclude\-tags x,y,z
. .
.P .P
@ -264,6 +258,25 @@ Filename to use for cache\. Default is github\-changelog\-http\-cache in a tempo
.P .P
Filename to use for cache log\. Default is github\-changelog\-logger\.log in a temporary directory\. Filename to use for cache log\. Default is github\-changelog\-logger\.log in a temporary directory\.
. .
.IP "" 4
.
.nf
\-\-ssl\-ca\-file [PATH]
.
.fi
.
.IP "" 0
.
.P
Path to cacert\.pem file\. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert\.pem\. Respects SSL_CA_PATH\.
.
.P
\-\-require file1\.rb,file2\.rb
.
.P
Paths to Ruby file(s) to require before generating changelog\.
.
.P .P
\-\-[no\-]verbose \-\-[no\-]verbose
. .

View File

@ -248,6 +248,15 @@
<p> Filename to use for cache log. Default is github-changelog-logger.log in a temporary directory.</p> <p> Filename to use for cache log. Default is github-changelog-logger.log in a temporary directory.</p>
<pre><code>--ssl-ca-file [PATH]
</code></pre>
<p> Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.</p>
<p> --require file1.rb,file2.rb</p>
<p> Paths to Ruby file(s) to require before generating changelog.</p>
<p> --[no-]verbose</p> <p> --[no-]verbose</p>
<p> Run verbosely. Default is true</p> <p> Run verbosely. Default is true</p>
@ -277,7 +286,7 @@
<ol class='man-decor man-foot man foot'> <ol class='man-decor man-foot man foot'>
<li class='tl'></li> <li class='tl'></li>
<li class='tc'>December 2016</li> <li class='tc'>October 2017</li>
<li class='tr'>git-generate-changelog(1)</li> <li class='tr'>git-generate-changelog(1)</li>
</ol> </ol>

View File

@ -179,6 +179,10 @@ Automatically generate change log from your tags, issues, labels and pull reques
Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH. Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.
--require file1.rb,file2.rb
Paths to Ruby file(s) to require before generating changelog.
--[no-]verbose --[no-]verbose
Run verbosely. Default is true Run verbosely. Default is true