Add option --require to load custom Ruby code (#574)
This commit is contained in:
@@ -6,6 +6,7 @@ module GitHubChangelogGenerator
|
||||
#
|
||||
# @return [String] Generated change log file
|
||||
def compound_changelog
|
||||
options.load_custom_ruby_files
|
||||
fetch_and_filter_tags
|
||||
fetch_issues_and_pr
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ module GitHubChangelogGenerator
|
||||
pulls
|
||||
release_branch
|
||||
release_url
|
||||
require
|
||||
simple_list
|
||||
since_tag
|
||||
ssl_ca_file
|
||||
@@ -69,6 +70,13 @@ module GitHubChangelogGenerator
|
||||
values
|
||||
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
|
||||
|
||||
def values
|
||||
|
||||
@@ -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|
|
||||
options[:ssl_ca_file] = ssl_ca_file
|
||||
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|
|
||||
options[:verbose] = v
|
||||
end
|
||||
@@ -226,7 +229,8 @@ module GitHubChangelogGenerator
|
||||
bug_prefix: "**Fixed bugs:**",
|
||||
enhancement_prefix: "**Implemented enhancements:**",
|
||||
breaking_prefix: "**Breaking changes:**",
|
||||
http_cache: true
|
||||
http_cache: true,
|
||||
require: []
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user