changelog_formatter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +209 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +116 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/changelog_formatter.gemspec +29 -0
- data/lib/changelog_formatter.rb +52 -0
- data/lib/changelog_formatter/version.rb +5 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1652cca06b09e8d2c9a3a96511f53a0725016daf
|
4
|
+
data.tar.gz: afdb80d3b3575619317ae0f58ce9f5dfc2380e70
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 362cd392529242da60587c8ffce5ba2f7b418cb062e23e5be61211ad243893ae8767b870a029a3f3e582ff85b60580cbcf89cb0f841bb3892465ab06b2e2bc38
|
7
|
+
data.tar.gz: 8dedbf72ffd03faeb17fbef39a77d05459895a9428ec8297f353be0f836447ad24c2738311d92b7b8cb77a51ea30442875470a687c55db33e53d356413b8a8a9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
AllCops:
|
2
|
+
# Default formatter will be used if no -f/--format option is given.
|
3
|
+
DefaultFormatter: progress
|
4
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
5
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
6
|
+
# option.
|
7
|
+
DisplayCopNames: true
|
8
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
9
|
+
# behavior by overriding DisplayStyleGuide, or by giving the
|
10
|
+
# -S/--display-style-guide option.
|
11
|
+
DisplayStyleGuide: true
|
12
|
+
# Extra details are not displayed in offense messages by default. Change
|
13
|
+
# behavior by overriding ExtraDetails, or by giving the
|
14
|
+
# -E/--extra-details option.
|
15
|
+
ExtraDetails: true
|
16
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
17
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
18
|
+
# the --only-guide-cops option.
|
19
|
+
StyleGuideCopsOnly: false
|
20
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
21
|
+
# this behavior by overriding DisabledByDefault. When DisabledByDefault is
|
22
|
+
# true, all cops in the default configuration are disabled, and and only cops
|
23
|
+
# in user configuration are enabled. This makes cops opt-in instead of
|
24
|
+
# opt-out. Note that when DisabledByDefault is true, cops in user
|
25
|
+
# configuration will be enabled even if they don't set the Enabled parameter.
|
26
|
+
DisabledByDefault: true
|
27
|
+
# Enables the result cache if true. Can be overridden by the --cache command
|
28
|
+
# line option.
|
29
|
+
UseCache: true
|
30
|
+
# Threshold for how many files can be stored in the result cache before some
|
31
|
+
# of the files are automatically removed.
|
32
|
+
MaxFilesInCache: 20000
|
33
|
+
# The cache will be stored in "rubocop_cache" under this directory. The name
|
34
|
+
# "/tmp" is special and will be converted to the system temporary directory,
|
35
|
+
# which is "/tmp" on Unix-like systems, but could be something else on other
|
36
|
+
# systems.
|
37
|
+
CacheRootDirectory: /tmp
|
38
|
+
# The default cache root directory is /tmp, which on most systems is
|
39
|
+
# writable by any system user. This means that it is possible for a
|
40
|
+
# malicious user to anticipate the location of Rubocop's cache directory,
|
41
|
+
# and create a symlink in its place that could cause Rubocop to overwrite
|
42
|
+
# unintended files, or read malicious input. If you are certain that your
|
43
|
+
# cache location is secure from this kind of attack, and wish to use a
|
44
|
+
# symlinked cache location, set this value to "true".
|
45
|
+
# AllowSymlinksInCacheRootDirectory: false
|
46
|
+
# What version of the Ruby interpreter is the inspected code intended to
|
47
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
48
|
+
TargetRubyVersion: 1.9
|
49
|
+
Exclude:
|
50
|
+
- 'vendor/**/*'
|
51
|
+
- 'db/**/*'
|
52
|
+
- 'tmp/**/*'
|
53
|
+
- 'bin/**/*'
|
54
|
+
- 'spec/**/*'
|
55
|
+
- 'test/**/*'
|
56
|
+
- 'script/**/*'
|
57
|
+
- 'lib/templates/**/*'
|
58
|
+
- 'doc/**/*'
|
59
|
+
|
60
|
+
# Commonly used screens these days easily fit more than 80 characters.
|
61
|
+
Metrics/LineLength:
|
62
|
+
Max: 120
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
# Too short methods lead to extraction of single-use methods, which can make
|
66
|
+
# the code easier to read (by naming things), but can also clutter the class
|
67
|
+
Metrics/MethodLength:
|
68
|
+
Max: 20
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
|
72
|
+
Metrics/ClassLength:
|
73
|
+
Max: 1500
|
74
|
+
|
75
|
+
# Single quotes being faster is hardly measurable and only affects parse time.
|
76
|
+
# Enforcing double quotes reduces the times where you need to change them
|
77
|
+
# when introducing an interpolation. Use single quotes only if their semantics
|
78
|
+
# are needed.
|
79
|
+
Style/StringLiterals:
|
80
|
+
EnforcedStyle: double_quotes
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
# We do not need to support Ruby 1.9, so this is good to use.
|
84
|
+
Style/SymbolArray:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
# Most readable form.
|
88
|
+
Style/AlignHash:
|
89
|
+
EnforcedHashRocketStyle: table
|
90
|
+
EnforcedColonStyle: table
|
91
|
+
# Enabled: false
|
92
|
+
|
93
|
+
# Mixing the styles looks just silly.
|
94
|
+
Style/HashSyntax:
|
95
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
# has_key? and has_value? are far more readable than key? and value?
|
99
|
+
# Style/DeprecatedHashMethods:
|
100
|
+
# Enabled: false
|
101
|
+
|
102
|
+
# String#% is by far the least verbose and only object oriented variant.
|
103
|
+
Style/FormatString:
|
104
|
+
EnforcedStyle: percent
|
105
|
+
|
106
|
+
Style/CollectionMethods:
|
107
|
+
PreferredMethods:
|
108
|
+
# inject seems more common in the community.
|
109
|
+
reduce: "inject"
|
110
|
+
map: "collect"
|
111
|
+
# Enabled: false
|
112
|
+
|
113
|
+
|
114
|
+
# Either allow this style or don't. Marking it as safe with parenthesis
|
115
|
+
# is silly. Let's try to live without them for now.
|
116
|
+
Style/ParenthesesAroundCondition:
|
117
|
+
AllowSafeAssignment: false
|
118
|
+
Enabled: false
|
119
|
+
Lint/AssignmentInCondition:
|
120
|
+
AllowSafeAssignment: false
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
# A specialized exception class will take one or more arguments and construct the message from it.
|
124
|
+
# So both variants make sense.
|
125
|
+
# Style/RaiseArgs:
|
126
|
+
# Enabled: false
|
127
|
+
|
128
|
+
# Indenting the chained dots beneath each other is not supported by this cop,
|
129
|
+
# see https://github.com/bbatsov/rubocop/issues/1633
|
130
|
+
# Style/MultilineOperationIndentation:
|
131
|
+
# Enabled: false
|
132
|
+
|
133
|
+
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
|
134
|
+
# The argument that fail should be used to abort the program is wrong too,
|
135
|
+
# there's Kernel#abort for that.
|
136
|
+
Style/SignalException:
|
137
|
+
EnforcedStyle: only_raise
|
138
|
+
|
139
|
+
# Suppressing exceptions can be perfectly fine, and be it to avoid to
|
140
|
+
# explicitly type nil into the rescue since that's what you want to return,
|
141
|
+
# or suppressing LoadError for optional dependencies
|
142
|
+
Lint/HandleExceptions:
|
143
|
+
Enabled: false
|
144
|
+
|
145
|
+
Style/SpaceInsideBlockBraces:
|
146
|
+
# The space here provides no real gain in readability while consuming
|
147
|
+
# horizontal space that could be used for a better parameter name.
|
148
|
+
# Also {| differentiates better from a hash than { | does.
|
149
|
+
SpaceBeforeBlockParameters: false
|
150
|
+
# Enabled: false
|
151
|
+
|
152
|
+
# No trailing space differentiates better from the block:
|
153
|
+
# foo} means hash, foo } means block.
|
154
|
+
Style/SpaceInsideHashLiteralBraces:
|
155
|
+
EnforcedStyle: no_space
|
156
|
+
# Enabled: false
|
157
|
+
|
158
|
+
# { ... } for multi-line blocks is okay, follow Weirichs rule instead:
|
159
|
+
# https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
|
160
|
+
Style/BlockDelimiters:
|
161
|
+
Enabled: false
|
162
|
+
|
163
|
+
# do / end blocks should be used for side effects,
|
164
|
+
# methods that run a block for side effects and have
|
165
|
+
# a useful return value are rare, assign the return
|
166
|
+
# value to a local variable for those cases.
|
167
|
+
Style/MethodCalledOnDoEndBlock:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
# Enforcing the names of variables? To single letter ones? Just no.
|
171
|
+
Style/SingleLineBlockParams:
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
# Shadowing outer local variables with block parameters is often useful
|
175
|
+
# to not reinvent a new name for the same thing, it highlights the relation
|
176
|
+
# between the outer variable and the parameter. The cases where it's actually
|
177
|
+
# confusing are rare, and usually bad for other reasons already, for example
|
178
|
+
# because the method is too long.
|
179
|
+
Lint/ShadowingOuterLocalVariable:
|
180
|
+
Enabled: false
|
181
|
+
|
182
|
+
# Check with yard instead.
|
183
|
+
Style/Documentation:
|
184
|
+
Enabled: false
|
185
|
+
|
186
|
+
# This is just silly. Calling the argument `other` in all cases makes no sense.
|
187
|
+
Style/OpMethod:
|
188
|
+
Enabled: false
|
189
|
+
|
190
|
+
# There are valid cases, for example debugging Cucumber steps,
|
191
|
+
# also they'll fail CI anyway
|
192
|
+
Lint/Debugger:
|
193
|
+
Enabled: false
|
194
|
+
|
195
|
+
# Style preference
|
196
|
+
Style/MethodDefParentheses:
|
197
|
+
Enabled: false
|
198
|
+
|
199
|
+
Style/EmptyLinesAroundBlockBody:
|
200
|
+
EnforcedStyle: empty_lines
|
201
|
+
Enabled: false
|
202
|
+
|
203
|
+
Style/EmptyLinesAroundClassBody:
|
204
|
+
EnforcedStyle: empty_lines
|
205
|
+
# Enabled: false
|
206
|
+
|
207
|
+
Style/EmptyLinesAroundModuleBody:
|
208
|
+
EnforcedStyle: empty_lines
|
209
|
+
# Enabled: false
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
changelog_formatter
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at leipeleon@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Leon Berenschot
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
# ChangelogFormatter
|
2
|
+
|
3
|
+
TODO:
|
4
|
+
- put helpers into the class
|
5
|
+
- better documentation
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'changelog_formatter'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install changelog_formatter
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### The changelog
|
26
|
+
|
27
|
+
### Rails
|
28
|
+
|
29
|
+
Controller:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
@changelog = ChangelogFormatter.to_a
|
33
|
+
```
|
34
|
+
|
35
|
+
Helper
|
36
|
+
|
37
|
+
``` ruby
|
38
|
+
def changelog_icon_for_type(type)
|
39
|
+
capture_haml do
|
40
|
+
haml_tag :i, class: "menu-icon fa fa-#{ChangelogFormatter::CHANGELOG_ICONS[type.to_sym]}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
View (in haml)
|
46
|
+
|
47
|
+
``` haml
|
48
|
+
.col-xs-12
|
49
|
+
%p= t(".changelog_intro")
|
50
|
+
- ChangelogFormatter::CHANGELOG_ICONS.each do |type, _|
|
51
|
+
= changelog_icon_for_type(type)
|
52
|
+
|
53
|
+
.col-xs-12
|
54
|
+
%table.table-condensed
|
55
|
+
%tbody
|
56
|
+
- for release in @changelog.each
|
57
|
+
%tr
|
58
|
+
%th{colspan: 2}
|
59
|
+
%h3= release.name
|
60
|
+
- if release.date
|
61
|
+
.small.text-right
|
62
|
+
= release.date
|
63
|
+
- for type, text in release.lines
|
64
|
+
%tr
|
65
|
+
/ %td.right= type
|
66
|
+
%td= changelog_icon_for_type(type)
|
67
|
+
%td= text
|
68
|
+
```
|
69
|
+
|
70
|
+
Translation
|
71
|
+
|
72
|
+
``` yaml
|
73
|
+
nl-NL:
|
74
|
+
changelog:
|
75
|
+
ago: geleden
|
76
|
+
changelog_intro: "We're constantly developing new versions. He're is what we did:"
|
77
|
+
changelog:
|
78
|
+
new: Nieuw
|
79
|
+
fix: Opgeloste bug
|
80
|
+
del: Verwijderd
|
81
|
+
enh: Optimalisatie
|
82
|
+
new: Nieuwe functionaliteit
|
83
|
+
```
|
84
|
+
|
85
|
+
|
86
|
+
### git-flow
|
87
|
+
|
88
|
+
Use this script to generate a release branch, open the CHANGELOG w/ atom
|
89
|
+
and copy the date into the pasteboard (OSX)
|
90
|
+
|
91
|
+
``` bash
|
92
|
+
release is a function
|
93
|
+
release ()
|
94
|
+
{
|
95
|
+
CURRENT_DATE=$(date "+%Y-%m-%d-%H%M");
|
96
|
+
git flow release start ${CURRENT_DATE};
|
97
|
+
echo "Release ${CURRENT_DATE}" | pbcopy;
|
98
|
+
[ -e CHANGE* ] && atom CHANGE*
|
99
|
+
}
|
100
|
+
```
|
101
|
+
|
102
|
+
|
103
|
+
## Development
|
104
|
+
|
105
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
106
|
+
|
107
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
108
|
+
|
109
|
+
## Contributing
|
110
|
+
|
111
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/changelog_formatter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
112
|
+
|
113
|
+
|
114
|
+
## License
|
115
|
+
|
116
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "changelog_formatter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'changelog_formatter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "changelog_formatter"
|
8
|
+
spec.version = ChangelogFormatter::VERSION
|
9
|
+
spec.authors = ["Leon Berenschot"]
|
10
|
+
spec.email = ["leipeleon@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Format a changelog into HTML}
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/LeipeLeon/changelog_formatter"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "activesupport"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "rubocop"
|
29
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "changelog_formatter/version"
|
2
|
+
require 'active_support/core_ext/object/blank'
|
3
|
+
|
4
|
+
class ChangelogFormatter
|
5
|
+
|
6
|
+
CHANGELOG_ICONS = {
|
7
|
+
new: 'plus',
|
8
|
+
enh: 'wrench',
|
9
|
+
fix: 'bug',
|
10
|
+
del: 'minus',
|
11
|
+
}
|
12
|
+
|
13
|
+
attr :lines
|
14
|
+
attr :name
|
15
|
+
|
16
|
+
def initialize(name)
|
17
|
+
@name = name
|
18
|
+
@lines = []
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.to_a(changelog_file = 'CHANGELOG')
|
22
|
+
releases = []
|
23
|
+
release = ChangelogFormatter.new("Next Release")
|
24
|
+
File.open(changelog_file) do |f|
|
25
|
+
f.each_line do |line|
|
26
|
+
if line =~ /^Release/
|
27
|
+
releases << release unless release.lines.size == 0
|
28
|
+
release = ChangelogFormatter.new(line.strip)
|
29
|
+
else
|
30
|
+
release.add_line(line) unless line.blank?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
releases << release
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_line(line)
|
38
|
+
line = line.strip
|
39
|
+
line =~ /^\[(.*)\] (.*)/
|
40
|
+
if $1
|
41
|
+
lines << [$1, $2]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def date
|
46
|
+
if name =~ / (\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})/
|
47
|
+
zone_total_offset = TZInfo::Timezone.get("Europe/Amsterdam").current_period.offset.utc_total_offset / 3600
|
48
|
+
Time.new($1, $2, $3, $4, $5, 0, "+%02d:00" % zone_total_offset)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: changelog_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Leon Berenschot
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- leipeleon@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".ruby-gemset"
|
94
|
+
- ".ruby-version"
|
95
|
+
- ".travis.yml"
|
96
|
+
- CODE_OF_CONDUCT.md
|
97
|
+
- Gemfile
|
98
|
+
- LICENSE.txt
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- bin/console
|
102
|
+
- bin/setup
|
103
|
+
- changelog_formatter.gemspec
|
104
|
+
- lib/changelog_formatter.rb
|
105
|
+
- lib/changelog_formatter/version.rb
|
106
|
+
homepage: https://github.com/LeipeLeon/changelog_formatter
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.5.1
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Format a changelog into HTML
|
130
|
+
test_files: []
|