Skip to content

Add option --require to load custom Ruby code before starting #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Generator
#
# @return [String] Generated change log file
def compound_changelog
options.load_custom_ruby_files
fetch_and_filter_tags
fetch_issues_and_pr

Expand Down
8 changes: 8 additions & 0 deletions lib/github_changelog_generator/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Options < SimpleDelegator
pulls
release_branch
release_url
require
simple_list
since_tag
ssl_ca_file
Expand All @@ -69,6 +70,13 @@ def to_hash
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
Expand Down
6 changes: 5 additions & 1 deletion lib/github_changelog_generator/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def self.setup_parser(options)
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
Expand Down Expand Up @@ -226,7 +229,8 @@ def self.default_options
bug_prefix: "**Fixed bugs:**",
enhancement_prefix: "**Implemented enhancements:**",
breaking_prefix: "**Breaking changes:**",
http_cache: true
http_cache: true,
require: []
)
end
end
Expand Down
27 changes: 20 additions & 7 deletions man/git-generate-changelog.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.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"
\fBgit\-generate\-changelog\fR \- Generate changelog from github
Expand Down Expand Up @@ -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\'
.
.P
\-\-between\-tags x,y,z
.
.P
Change log will be filled only between specified tags
.
.P
\-\-exclude\-tags x,y,z
.
.P
Expand Down Expand Up @@ -264,6 +258,25 @@ Filename to use for cache\. Default is github\-changelog\-http\-cache in a tempo
.P
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
\-\-[no\-]verbose
.
Expand Down
11 changes: 10 additions & 1 deletion man/git-generate-changelog.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/git-generate-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ Automatically generate change log from your tags, issues, labels and pull reques

--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.
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

Expand Down