changelog_jira 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +233 -0
  3. data/Rakefile +39 -0
  4. data/bin/git-generate-changelog +4 -0
  5. data/bin/github_changelog_generator +4 -0
  6. data/lib/CHANGELOG.md +58 -0
  7. data/lib/github_changelog_generator.rb +41 -0
  8. data/lib/github_changelog_generator/fetcher.rb +221 -0
  9. data/lib/github_changelog_generator/generator/generator.rb +143 -0
  10. data/lib/github_changelog_generator/generator/generator_fetcher.rb +83 -0
  11. data/lib/github_changelog_generator/generator/generator_generation.rb +190 -0
  12. data/lib/github_changelog_generator/generator/generator_processor.rb +193 -0
  13. data/lib/github_changelog_generator/generator/generator_tags.rb +184 -0
  14. data/lib/github_changelog_generator/helper.rb +37 -0
  15. data/lib/github_changelog_generator/parser.rb +285 -0
  16. data/lib/github_changelog_generator/parser_file.rb +103 -0
  17. data/lib/github_changelog_generator/reader.rb +84 -0
  18. data/lib/github_changelog_generator/task.rb +67 -0
  19. data/lib/github_changelog_generator/version.rb +3 -0
  20. data/man/git-generate-changelog.1 +252 -0
  21. data/man/git-generate-changelog.html +262 -0
  22. data/man/git-generate-changelog.md +179 -0
  23. data/spec/files/angular.js.md +9395 -0
  24. data/spec/files/bundler.md +1911 -0
  25. data/spec/files/github-changelog-generator.md +305 -0
  26. data/spec/install-gem-in-bundler.gemfile +3 -0
  27. data/spec/spec_helper.rb +55 -0
  28. data/spec/unit/fetcher_spec.rb +59 -0
  29. data/spec/unit/generator/generator_processor_spec.rb +28 -0
  30. data/spec/unit/generator/generator_tags_spec.rb +243 -0
  31. data/spec/unit/parse_file_spec.rb +73 -0
  32. data/spec/unit/parser_spec.rb +60 -0
  33. data/spec/unit/reader_spec.rb +113 -0
  34. metadata +190 -0
@@ -0,0 +1,103 @@
1
+ require "pathname"
2
+
3
+ module GitHubChangelogGenerator
4
+ ParserError = Class.new(StandardError)
5
+
6
+ # ParserFile is a configuration file reader which sets options in the
7
+ # given Hash.
8
+ #
9
+ # In your project's root, you can put a file named
10
+ # <tt>.github_changelog_generator</tt> to override defaults.
11
+ #
12
+ # Example:
13
+ # header_label=# My Super Changelog
14
+ # ; Comments are allowed
15
+ # future-release=5.0.0
16
+ # # Ruby-style comments, too
17
+ # since-tag=1.0.0
18
+ #
19
+ # The configuration format is <tt>some-key=value</tt> or <tt>some_key=value</tt>.
20
+ #
21
+ class ParserFile
22
+ # @param options [Hash] options to be configured from file contents
23
+ # @param file [nil,IO] configuration file handle, defaults to opening `.github_changelog_generator`
24
+ def initialize(options, file = open_settings_file)
25
+ @options = options
26
+ @file = file
27
+ end
28
+
29
+ # Sets options using configuration file content
30
+ def parse!
31
+ return unless @file
32
+ @file.each_with_index { |line, i| parse_line!(line, i + 1) }
33
+ @file.close
34
+ end
35
+
36
+ private
37
+
38
+ FILENAME = ".github_changelog_generator"
39
+
40
+ def open_settings_file
41
+ path = Pathname(File.expand_path(FILENAME))
42
+ File.open(path) if path.exist?
43
+ end
44
+
45
+ def parse_line!(line, line_number)
46
+ return if non_configuration_line?(line)
47
+ option_name, value = extract_pair(line)
48
+ @options[option_key_for(option_name)] = convert_value(value, option_name)
49
+ rescue
50
+ raise ParserError, "Failed on line ##{line_number}: \"#{line.gsub(/[\n\r]+/, '')}\""
51
+ end
52
+
53
+ # Returns true if the line starts with a pound sign or a semi-colon.
54
+ def non_configuration_line?(line)
55
+ line =~ /^[\#;]/ || line =~ /^[\s]+$/
56
+ end
57
+
58
+ # Returns a the option name as a symbol and its string value sans newlines.
59
+ #
60
+ # @param line [String] unparsed line from config file
61
+ # @return [Array<Symbol, String>]
62
+ def extract_pair(line)
63
+ key, value = line.split("=", 2)
64
+ [key.sub("-", "_").to_sym, value.gsub(/[\n\r]+/, "")]
65
+ end
66
+
67
+ KNOWN_ARRAY_KEYS = [:exclude_labels, :include_labels, :bug_labels,
68
+ :enhancement_labels, :between_tags, :exclude_tags]
69
+ KNOWN_INTEGER_KEYS = [:max_issues]
70
+
71
+ def convert_value(value, option_name)
72
+ if KNOWN_ARRAY_KEYS.include?(option_name)
73
+ value.split(",")
74
+ elsif KNOWN_INTEGER_KEYS.include?(option_name)
75
+ value.to_i
76
+ elsif value =~ /^(true|t|yes|y|1)$/i
77
+ true
78
+ elsif value =~ /^(false|f|no|n|0)$/i
79
+ false
80
+ else
81
+ value
82
+ end
83
+ end
84
+
85
+ IRREGULAR_OPTIONS = {
86
+ bugs_label: :bug_prefix,
87
+ enhancement_label: :enhancement_prefix,
88
+ issues_label: :issue_prefix,
89
+ header_label: :header,
90
+ front_matter: :frontmatter,
91
+ pr_label: :merge_prefix,
92
+ issues_wo_labels: :add_issues_wo_labels,
93
+ pr_wo_labels: :add_pr_wo_labels,
94
+ pull_requests: :pulls,
95
+ filter_by_milestone: :filter_issues_by_milestone,
96
+ github_api: :github_endpoint
97
+ }
98
+
99
+ def option_key_for(option_name)
100
+ IRREGULAR_OPTIONS.fetch(option_name) { option_name }
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,84 @@
1
+ #
2
+ # Author:: Enrico Stahn <mail@enricostahn.com>
3
+ #
4
+ # Copyright 2014, Zanui, <engineering@zanui.com.au>
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module GitHubChangelogGenerator
20
+ # A Reader to read an existing ChangeLog file and return a structured object
21
+ #
22
+ # Example:
23
+ # reader = GitHubChangelogGenerator::Reader.new
24
+ # content = reader.read('./CHANGELOG.md')
25
+ class Reader
26
+ def initialize(options = {})
27
+ defaults = {
28
+ heading_level: "##",
29
+ heading_structures: [
30
+ /^## \[(?<version>.+?)\]\((?<url>.+?)\)( \((?<date>.+?)\))?$/,
31
+ /^## (?<version>.+?)( \((?<date>.+?)\))?$/
32
+ ]
33
+ }
34
+
35
+ @options = options.merge(defaults)
36
+
37
+ @heading_level = @options[:heading_level]
38
+ @heading_structures = @options[:heading_structures]
39
+ end
40
+
41
+ # Parse a single heading and return a Hash
42
+ #
43
+ # The following heading structures are currently valid:
44
+ # - ## [v1.0.2](https://github.com/zanui/chef-thumbor/tree/v1.0.1) (2015-03-24)
45
+ # - ## [v1.0.2](https://github.com/zanui/chef-thumbor/tree/v1.0.1)
46
+ # - ## v1.0.2 (2015-03-24)
47
+ # - ## v1.0.2
48
+ #
49
+ # @param [String] heading Heading from the ChangeLog File
50
+ # @return [Hash] Returns a structured Hash with version, url and date
51
+ def parse_heading(heading)
52
+ captures = { "version" => nil, "url" => nil, "date" => nil }
53
+
54
+ @heading_structures.each do |regexp|
55
+ matches = Regexp.new(regexp).match(heading)
56
+ if matches
57
+ captures.merge!(Hash[matches.names.zip(matches.captures)])
58
+ break
59
+ end
60
+ end
61
+
62
+ captures
63
+ end
64
+
65
+ # Parse the given ChangeLog data into a list of Hashes
66
+ #
67
+ # @param [String] data File data from the ChangeLog.md
68
+ # @return [Array<Hash>] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]
69
+ def parse(data)
70
+ sections = data.split(/^## .+?$/)
71
+ headings = data.scan(/^## .+?$/)
72
+
73
+ headings.each_with_index.map do |heading, index|
74
+ section = parse_heading(heading)
75
+ section["content"] = sections.at(index + 1)
76
+ section
77
+ end
78
+ end
79
+
80
+ def read(file_path)
81
+ parse File.read(file_path)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,67 @@
1
+ require "rake"
2
+ require "rake/tasklib"
3
+ require "github_changelog_generator"
4
+
5
+ module GitHubChangelogGenerator
6
+ class RakeTask < ::Rake::TaskLib
7
+ include ::Rake::DSL if defined?(::Rake::DSL)
8
+
9
+ OPTIONS = %w( user project token date_format output
10
+ bug_prefix enhancement_prefix issue_prefix
11
+ header merge_prefix issues
12
+ add_issues_wo_labels add_pr_wo_labels
13
+ pulls filter_issues_by_milestone author
14
+ unreleased_only unreleased unreleased_label
15
+ compare_link include_labels exclude_labels
16
+ bug_labels enhancement_labels
17
+ between_tags exclude_tags since_tag max_issues
18
+ github_site github_endpoint simple_list
19
+ future_release release_branch verbose release_url
20
+ base )
21
+
22
+ OPTIONS.each do |o|
23
+ attr_accessor o.to_sym
24
+ end
25
+
26
+ # Public: Initialise a new GitHubChangelogGenerator::RakeTask.
27
+ #
28
+ # Example
29
+ #
30
+ # GitHubChangelogGenerator::RakeTask.new
31
+ def initialize(*args, &task_block)
32
+ @name = args.shift || :changelog
33
+
34
+ define(args, &task_block)
35
+ end
36
+
37
+ def define(args, &task_block)
38
+ desc "Generate a Change log from GitHub"
39
+
40
+ yield(*[self, args].slice(0, task_block.arity)) if task_block
41
+
42
+ # clear any (auto-)pre-existing task
43
+ Rake::Task[@name].clear if Rake::Task.task_defined?(@name)
44
+
45
+ task @name do
46
+ # mimick parse_options
47
+ options = Parser.default_options
48
+
49
+ Parser.user_and_project_from_git(options)
50
+
51
+ OPTIONS.each do |o|
52
+ v = instance_variable_get("@#{o}")
53
+ options[o.to_sym] = v unless v.nil?
54
+ end
55
+
56
+ generator = Generator.new options
57
+
58
+ log = generator.compound_changelog
59
+
60
+ output_filename = (options[:output]).to_s
61
+ File.open(output_filename, "w") { |file| file.write(log) }
62
+ puts "Done!"
63
+ puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,3 @@
1
+ module GitHubChangelogGenerator
2
+ VERSION = "1.12.0"
3
+ end
@@ -0,0 +1,252 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "GIT\-GENERATE\-CHANGELOG" "1" "October 2015" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBgit\-generate\-changelog\fR \- Generate changelog from github
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBgit generate\-changelog\fR [\-h|\-\-help] [\-u|\-\-user] [\-p|\-\-project]
11
+ .
12
+ .SH "DESCRIPTION"
13
+ Automatically generate change log from your tags, issues, labels and pull requests on GitHub\.
14
+ .
15
+ .SH "OPTIONS"
16
+ \-u, \-\-user [USER]
17
+ .
18
+ .P
19
+ Username of the owner of target GitHub repo
20
+ .
21
+ .P
22
+ \-p, \-\-project [PROJECT]
23
+ .
24
+ .P
25
+ Name of project on GitHub
26
+ .
27
+ .P
28
+ \-t, \-\-token [TOKEN]
29
+ .
30
+ .P
31
+ To make more than 50 requests per hour your GitHub token is required\. You can generate it at: https://github\.com/settings/tokens/new
32
+ .
33
+ .P
34
+ \-f, \-\-date\-format [FORMAT]
35
+ .
36
+ .P
37
+ Date format\. Default is %Y\-%m\-%d
38
+ .
39
+ .P
40
+ \-o, \-\-output [NAME]
41
+ .
42
+ .P
43
+ Output file\. Default is CHANGELOG\.md
44
+ .
45
+ .P
46
+ \-b, \-\-base [NAME]
47
+ .
48
+ .P
49
+ Optional base file to append generated changes to\.
50
+ .
51
+ .P
52
+ \-\-bugs\-label [LABEL]
53
+ .
54
+ .P
55
+ Setup custom label for bug\-fixes section\. Default is "\fBFixed bugs:\fR
56
+ .
57
+ .P
58
+ \-\-enhancement\-label [LABEL]
59
+ .
60
+ .P
61
+ Setup custom label for enhancements section\. Default is "\fBImplemented enhancements:\fR"
62
+ .
63
+ .P
64
+ \-\-issues\-label [LABEL]
65
+ .
66
+ .P
67
+ Setup custom label for closed\-issues section\. Default is "\fBClosed issues:\fR"
68
+ .
69
+ .P
70
+ \-\-header\-label [LABEL]
71
+ .
72
+ .P
73
+ Setup custom header label\. Default is "# Change Log"
74
+ .
75
+ .P
76
+ \-\-pr\-label [LABEL]
77
+ .
78
+ .P
79
+ Setup custom label for pull requests section\. Default is "\fBMerged pull requests:\fR"
80
+ .
81
+ .P
82
+ \-\-[no\-]issues
83
+ .
84
+ .P
85
+ Include closed issues in changelog\. Default is true
86
+ .
87
+ .P
88
+ \-\-[no\-]issues\-wo\-labels
89
+ .
90
+ .P
91
+ Include closed issues without labels in changelog\. Default is true
92
+ .
93
+ .P
94
+ \-\-[no\-]pr\-wo\-labels
95
+ .
96
+ .P
97
+ Include pull requests without labels in changelog\. Default is true
98
+ .
99
+ .P
100
+ \-\-[no\-]pull\-requests
101
+ .
102
+ .P
103
+ Include pull\-requests in changelog\. Default is true
104
+ .
105
+ .P
106
+ \-\-[no\-]filter\-by\-milestone
107
+ .
108
+ .P
109
+ Use milestone to detect when issue was resolved\. Default is true
110
+ .
111
+ .P
112
+ \-\-[no\-]author
113
+ .
114
+ .P
115
+ Add author of pull\-request in the end\. Default is true
116
+ .
117
+ .P
118
+ \-\-unreleased\-only
119
+ .
120
+ .P
121
+ Generate log from unreleased closed issues only\.
122
+ .
123
+ .P
124
+ \-\-[no\-]unreleased
125
+ .
126
+ .P
127
+ Add to log unreleased closed issues\. Default is true
128
+ .
129
+ .P
130
+ \-\-unreleased\-label [label]
131
+ .
132
+ .P
133
+ Add to log unreleased closed issues\. Default is true
134
+ .
135
+ .P
136
+ \-\-[no\-]compare\-link
137
+ .
138
+ .P
139
+ Include compare link (Full Changelog) between older version and newer version\. Default is true
140
+ .
141
+ .P
142
+ \-\-include\-labels x,y,z
143
+ .
144
+ .P
145
+ Only issues with the specified labels will be included in the changelog\.
146
+ .
147
+ .P
148
+ \-\-exclude\-labels x,y,z
149
+ .
150
+ .P
151
+ Issues with the specified labels will be always excluded from changelog\. Default is \'duplicate,question,invalid,wontfix\'
152
+ .
153
+ .P
154
+ \-\-bug\-labels x,y,z
155
+ .
156
+ .P
157
+ Issues with the specified labels will be always added to "Fixed bugs" section\. Default is \'bug,Bug\'
158
+ .
159
+ .P
160
+ \-\-enhancement\-labels x,y,z
161
+ .
162
+ .P
163
+ Issues with the specified labels will be always added to "Implemented enhancements" section\. Default is \'enhancement,Enhancement\'
164
+ .
165
+ .P
166
+ \-\-between\-tags x,y,z
167
+ .
168
+ .P
169
+ Change log will be filled only between specified tags
170
+ .
171
+ .P
172
+ \-\-exclude\-tags x,y,z
173
+ .
174
+ .P
175
+ Change log will exclude specified tags
176
+ .
177
+ .P
178
+ \-\-since\-tag x
179
+ .
180
+ .P
181
+ Change log will start after specified tag
182
+ .
183
+ .P
184
+ \-\-due\-tag x
185
+ .
186
+ .P
187
+ Change log will end before specified tag
188
+ .
189
+ .P
190
+ \-\-max\-issues [NUMBER]
191
+ .
192
+ .P
193
+ Max number of issues to fetch from GitHub\. Default is unlimited
194
+ .
195
+ .P
196
+ \-\-release\-url [URL]
197
+ .
198
+ .P
199
+ The URL to point to for release links, in printf format (with the tag as variable)\.
200
+ .
201
+ .P
202
+ \-\-github\-site [URL]
203
+ .
204
+ .P
205
+ The Enterprise Github site on which your project is hosted\.
206
+ .
207
+ .P
208
+ \-\-github\-api [URL]
209
+ .
210
+ .P
211
+ The enterprise endpoint to use for your Github API\.
212
+ .
213
+ .P
214
+ \-\-simple\-list
215
+ .
216
+ .P
217
+ Create simple list from issues and pull requests\. Default is false\.
218
+ .
219
+ .P
220
+ \-\-future\-release [RELEASE\-VERSION]
221
+ .
222
+ .P
223
+ Put the unreleased changes in the specified release number\.
224
+ .
225
+ .P
226
+ \-\-[no\-]verbose
227
+ .
228
+ .P
229
+ Run verbosely\. Default is true
230
+ .
231
+ .P
232
+ \-v, \-\-version
233
+ .
234
+ .P
235
+ Print version number
236
+ .
237
+ .P
238
+ \-h, \-\-help
239
+ .
240
+ .P
241
+ Displays Help
242
+ .
243
+ .SH "EXAMPLES"
244
+ .
245
+ .SH "AUTHOR"
246
+ Written by Petr Korolev sky4winder@gmail\.com
247
+ .
248
+ .SH "REPORTING BUGS"
249
+ <\fIhttps://github\.com/skywinder/github\-changelog\-generator/issues\fR>
250
+ .
251
+ .SH "SEE ALSO"
252
+ <\fIhttps://github\.com/skywinder/github\-changelog\-generator/\fR>