changelog-rb 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.txt +21 -0
- data/README.md +123 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/changelog/0.1.0/added_add_script.yml +4 -0
- data/changelog/0.1.0/added_basic_print_script.yml +4 -0
- data/changelog/0.1.0/added_something.yml +4 -0
- data/changelog/0.1.0/added_tag_script.yml +4 -0
- data/changelog/0.1.0/added_untag_script.yml +4 -0
- data/changelog/0.1.0/make_print_supports_version_folders.yml +4 -0
- data/changelog/0.1.0/support_getting_title_from_git_commit.yml +4 -0
- data/changelog/0.1.0/tag.yml +1 -0
- data/changelog/unreleased/.gitkeep +0 -0
- data/changelog-rb.gemspec +31 -0
- data/exe/changelog +5 -0
- data/lib/changelog/add.rb +48 -0
- data/lib/changelog/cli.rb +56 -0
- data/lib/changelog/helpers/git.rb +9 -0
- data/lib/changelog/helpers/shell.rb +9 -0
- data/lib/changelog/print.rb +71 -0
- data/lib/changelog/setup.rb +15 -0
- data/lib/changelog/tag.rb +27 -0
- data/lib/changelog/untag.rb +28 -0
- data/lib/changelog/version.rb +3 -0
- data/lib/changelog-rb.rb +16 -0
- data/lib/templates/item.yml +4 -0
- data/lib/templates/tag.yml +1 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 602243340e6c3344d89a4da97217bab961ebda21
|
4
|
+
data.tar.gz: ec756a4544bbf0acb16d3df88e772cd89d127872
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b1d4dd3a25590a3133d8242c603d94bf98d8ed86b878750707ac0f714597ffadd3f50304288b5993362be36957e452a9f9f001a646933ab94945736d2e4e7553
|
7
|
+
data.tar.gz: 74b16d04e3251ecc61dfd83fff16bc94c5d66e30288ff6309e14e1ec89b08b48cfee497fc0020f6a0ff5e39087c274c9e02f695d539c39f9410d5997d52702fc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [Unreleased]
|
4
|
+
|
5
|
+
## [0.1.0] - 2017-09-18
|
6
|
+
### Added
|
7
|
+
- Added something (@pinglamb)
|
8
|
+
- ✨ Added untag script (@pinglamb)
|
9
|
+
- ✨ Added add script (@pinglamb)
|
10
|
+
- ✨ Added basic print script (@pinglamb)
|
11
|
+
- ✨ Added tag script (@pinglamb)
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- ✨ Make print supports version folders (@pinglamb)
|
15
|
+
- ✨ Support getting title from git commit (@pinglamb)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
changelog-rb (0.1.0)
|
5
|
+
activesupport
|
6
|
+
semantic (~> 1.6.0)
|
7
|
+
thor (~> 0.20.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (5.1.4)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (~> 0.7)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
concurrent-ruby (1.0.5)
|
18
|
+
diff-lcs (1.3)
|
19
|
+
fakefs (0.11.2)
|
20
|
+
i18n (0.8.6)
|
21
|
+
minitest (5.10.3)
|
22
|
+
rake (10.5.0)
|
23
|
+
rspec (3.6.0)
|
24
|
+
rspec-core (~> 3.6.0)
|
25
|
+
rspec-expectations (~> 3.6.0)
|
26
|
+
rspec-mocks (~> 3.6.0)
|
27
|
+
rspec-core (3.6.0)
|
28
|
+
rspec-support (~> 3.6.0)
|
29
|
+
rspec-expectations (3.6.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.6.0)
|
32
|
+
rspec-mocks (3.6.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.6.0)
|
35
|
+
rspec-support (3.6.0)
|
36
|
+
semantic (1.6.0)
|
37
|
+
thor (0.20.0)
|
38
|
+
thread_safe (0.3.6)
|
39
|
+
tzinfo (1.2.3)
|
40
|
+
thread_safe (~> 0.1)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
bundler (~> 1.16.a)
|
47
|
+
changelog-rb!
|
48
|
+
fakefs (~> 0.11.2)
|
49
|
+
rake (~> 10.0)
|
50
|
+
rspec (~> 3.0)
|
51
|
+
|
52
|
+
BUNDLED WITH
|
53
|
+
1.16.0.pre.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 pinglamb
|
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,123 @@
|
|
1
|
+
# changelog-rb
|
2
|
+
|
3
|
+
For project that uses feature branches and merge requests, it is common that the `CHANGELOG.md` will have conflicts. In order to prevent that, it is better to manage changelog items in a separate folder (`./changelog`) and generate the `CHANGELOG.md` during release.
|
4
|
+
|
5
|
+
This gem defines a bunch of commands to simplify the management of changelog items in `./changelog`.
|
6
|
+
|
7
|
+
The `CHANGELOG.md` generated will follow the amazing [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'changelog-rb'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle install
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install changelog-rb
|
24
|
+
|
25
|
+
## Folder Structure
|
26
|
+
|
27
|
+
```
|
28
|
+
- changelog
|
29
|
+
- 0.1.1
|
30
|
+
- fixed_something.yml
|
31
|
+
- tag.yml
|
32
|
+
- 0.1.0
|
33
|
+
- added_something.yml
|
34
|
+
- changed_something.yml
|
35
|
+
- tag.yml
|
36
|
+
- unreleased
|
37
|
+
- added_something.yml
|
38
|
+
- changed_something.yml
|
39
|
+
- removed_something.yml
|
40
|
+
```
|
41
|
+
|
42
|
+
All the pending/unreleased changelog items should be in the `unreleased` folder. Once you release a new version, the corresoding changelog items in `unreleased` should be moved over to `[RELEASE VERSION]` folder.
|
43
|
+
|
44
|
+
The `tag.yml` in release folder is for recording the date of release.
|
45
|
+
|
46
|
+
## Usage
|
47
|
+
|
48
|
+
There are a bunch of commands helping you to manage the changelog items. They are base on the awesome library [thor](https://github.com/erikhuda/thor) so you can always check all the command options by running `changelog help [COMMAND]`.
|
49
|
+
|
50
|
+
### `setup`
|
51
|
+
|
52
|
+
Set up the basic folder structure.
|
53
|
+
|
54
|
+
```
|
55
|
+
$ changelog setup
|
56
|
+
```
|
57
|
+
|
58
|
+
### `add`
|
59
|
+
|
60
|
+
Add a changelog item.
|
61
|
+
|
62
|
+
| `-t` | Type of changes (one of the following `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`) | If not specified, it will try to derive it from the first word of the title |
|
63
|
+
| `-u` | Author | If not specified, it will be $USER |
|
64
|
+
| `-g` | From git commit comment | *Magic*. Get the git commit comment as changelog title. Please try to use it with `gitmoji`. |
|
65
|
+
|
66
|
+
```
|
67
|
+
$ changelog add "Changed something"
|
68
|
+
# type: Changed
|
69
|
+
# title: Changed something
|
70
|
+
# user: someone
|
71
|
+
|
72
|
+
$ git commit -m "Fixed something"
|
73
|
+
$ changelog add -g
|
74
|
+
# type: Fixed
|
75
|
+
# title: Fixed something
|
76
|
+
# user: someone
|
77
|
+
|
78
|
+
$ gitmoji
|
79
|
+
$ changelog add -g
|
80
|
+
# type: Added
|
81
|
+
# title: ✨Added something
|
82
|
+
# user: someone
|
83
|
+
|
84
|
+
```
|
85
|
+
|
86
|
+
### `tag`
|
87
|
+
|
88
|
+
Move `unreleased` changelog items to the `version` given and tag today as release date.
|
89
|
+
|
90
|
+
```
|
91
|
+
$ changelog tag 0.1.0
|
92
|
+
```
|
93
|
+
|
94
|
+
### `untag`
|
95
|
+
|
96
|
+
Move the changelog items in `version` back to `unreleased` and clean it up.
|
97
|
+
|
98
|
+
```
|
99
|
+
$ changelog untag 0.1.0
|
100
|
+
```
|
101
|
+
|
102
|
+
### `print`
|
103
|
+
|
104
|
+
Convert `./changelog` to `CHANGELOG.md`
|
105
|
+
|
106
|
+
```
|
107
|
+
$ changelog print
|
108
|
+
```
|
109
|
+
|
110
|
+
|
111
|
+
## Development
|
112
|
+
|
113
|
+
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.
|
114
|
+
|
115
|
+
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).
|
116
|
+
|
117
|
+
## Contributing
|
118
|
+
|
119
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/changelog-rb.
|
120
|
+
|
121
|
+
## License
|
122
|
+
|
123
|
+
The gem is available as open source under the terms of the [MIT License](https://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-rb"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
date: 2017-09-18
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "changelog/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "changelog-rb"
|
8
|
+
spec.version = Changelog::VERSION
|
9
|
+
spec.authors = ["pinglamb"]
|
10
|
+
spec.email = ["pinglambs@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Make developers happy with http://keepachangelog.com/.}
|
13
|
+
spec.homepage = "https://github.com/pinglamb/changelog-rb"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "thor", "~> 0.20.0"
|
24
|
+
spec.add_runtime_dependency "activesupport"
|
25
|
+
spec.add_runtime_dependency "semantic", "~> 1.6.0"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.16.a"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
spec.add_development_dependency "fakefs", "~> 0.11.2"
|
31
|
+
end
|
data/exe/changelog
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'changelog/helpers/shell'
|
3
|
+
require 'changelog/helpers/git'
|
4
|
+
|
5
|
+
module Changelog
|
6
|
+
class Add < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
File.expand_path('../../templates', __FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
no_commands do
|
14
|
+
def go(title, nature: '', author: '', git: nil)
|
15
|
+
@title = if git.nil?
|
16
|
+
title
|
17
|
+
else
|
18
|
+
git = git.presence || 'HEAD'
|
19
|
+
Changelog::Helpers::Git.comment(git)
|
20
|
+
end
|
21
|
+
@title = @title.gsub(/:\w+:/, '')
|
22
|
+
@nature = nature.presence || extract_nature_from_title(@title)
|
23
|
+
@author = author.presence || Changelog::Helpers::Shell.system_user
|
24
|
+
|
25
|
+
raise 'title is blank' if @title.blank?
|
26
|
+
raise 'nature is blank' if @nature.blank?
|
27
|
+
raise 'nature is invalid' unless @nature.in?(Changelog.natures)
|
28
|
+
raise 'author is blank' if @author.blank?
|
29
|
+
|
30
|
+
filename = @title.parameterize.underscore
|
31
|
+
|
32
|
+
empty_directory 'changelog/unreleased' unless File.exists?('changelog/unreleased')
|
33
|
+
template 'item.yml', "changelog/unreleased/#{filename}.yml"
|
34
|
+
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
def extract_nature_from_title(title)
|
39
|
+
first_word = title.parameterize.split('-').first.try(:capitalize)
|
40
|
+
if Changelog.natures.include?(first_word)
|
41
|
+
first_word
|
42
|
+
else
|
43
|
+
''
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'changelog-rb'
|
3
|
+
|
4
|
+
module Changelog
|
5
|
+
class CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
package_name 'changelog'
|
9
|
+
|
10
|
+
desc 'version', 'Show current version'
|
11
|
+
def version
|
12
|
+
say Changelog::VERSION
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'setup', 'Set up changelog folder structure'
|
16
|
+
def setup
|
17
|
+
Changelog::Setup.new.go
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'add [TITLE]', 'Add a new changelog item'
|
21
|
+
method_option :nature,
|
22
|
+
type: :string,
|
23
|
+
desc: 'Type of changes. Default: Derive from first word of TITLE',
|
24
|
+
lazy_default: '',
|
25
|
+
enum: Changelog.natures,
|
26
|
+
aliases: %w(--type -t)
|
27
|
+
method_option :author,
|
28
|
+
type: :string,
|
29
|
+
desc: 'User who makes the changes. Default: $USER',
|
30
|
+
lazy_default: '',
|
31
|
+
aliases: %w(--user -u)
|
32
|
+
method_option :git,
|
33
|
+
type: :string,
|
34
|
+
desc: 'Extracts the title from git commit comment. Default: HEAD',
|
35
|
+
lazy_default: '',
|
36
|
+
aliases: %w(-g)
|
37
|
+
def add(title = '')
|
38
|
+
Changelog::Add.new.go(title, options.symbolize_keys)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'tag VERSION', 'Tag the unreleased changes to a version'
|
42
|
+
def tag(version)
|
43
|
+
Changelog::Tag.new.go(version)
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'untag VERSION', 'Moved the changes from version folder to unreleased'
|
47
|
+
def untag(version)
|
48
|
+
Changelog::Untag.new.go(version)
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'print', 'Print ./changelog to CHANGELOG.md'
|
52
|
+
def print
|
53
|
+
Changelog::Print.new.go
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'yaml'
|
3
|
+
require 'semantic'
|
4
|
+
|
5
|
+
module Changelog
|
6
|
+
class Print < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
no_commands do
|
10
|
+
def go
|
11
|
+
remove_file 'CHANGELOG.md'
|
12
|
+
add_file 'CHANGELOG.md'
|
13
|
+
|
14
|
+
append_to_file 'CHANGELOG.md', "# Changelog\n\n", verbose: false
|
15
|
+
|
16
|
+
shell.say_status :append, "changes in changelog/unreleased", :green unless shell.mute?
|
17
|
+
append_to_file 'CHANGELOG.md', "## [Unreleased]\n", verbose: false
|
18
|
+
print_changes 'unreleased'
|
19
|
+
|
20
|
+
version_folders.each do |version|
|
21
|
+
shell.say_status :append, "changes in changelog/#{version}", :green unless shell.mute?
|
22
|
+
print_version_header version
|
23
|
+
print_changes version
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_version_header(folder)
|
28
|
+
append_to_file 'CHANGELOG.md', "\n", verbose: false, force: true
|
29
|
+
|
30
|
+
meta = YAML.load_file(File.join(destination_root, "changelog/#{folder}/tag.yml"))
|
31
|
+
date = meta['date'].to_s
|
32
|
+
append_to_file 'CHANGELOG.md', "## [#{folder}] - #{date}\n", verbose: false
|
33
|
+
end
|
34
|
+
|
35
|
+
def print_changes(folder)
|
36
|
+
items = {}
|
37
|
+
changelog_files(folder).each do |file|
|
38
|
+
yaml = YAML.load_file(file)
|
39
|
+
items[yaml['type']] ||= []
|
40
|
+
items[yaml['type']] << "#{yaml['title'].strip} (@#{yaml['author']})"
|
41
|
+
end
|
42
|
+
|
43
|
+
sections = []
|
44
|
+
Changelog.natures.each.with_index do |nature, i|
|
45
|
+
if changes = items[nature].presence
|
46
|
+
lines = []
|
47
|
+
lines << "### #{nature}\n"
|
48
|
+
changes.each do |change|
|
49
|
+
lines << "- #{change}\n"
|
50
|
+
end
|
51
|
+
sections << lines.join
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
append_to_file 'CHANGELOG.md', sections.join("\n"), verbose: false, force: true
|
56
|
+
end
|
57
|
+
|
58
|
+
def version_folders
|
59
|
+
(Dir[File.join(destination_root, 'changelog/*')] - [
|
60
|
+
File.join(destination_root, "changelog/unreleased")
|
61
|
+
]).collect {|path| File.basename(path)}.sort_by {|version| Semantic::Version.new(version)}.reverse
|
62
|
+
end
|
63
|
+
|
64
|
+
def changelog_files(folder)
|
65
|
+
Dir[File.join(destination_root, "changelog/#{folder}/*.yml")] - [
|
66
|
+
File.join(destination_root, "changelog/#{folder}/tag.yml")
|
67
|
+
]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Changelog
|
4
|
+
class Setup < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
no_commands do
|
8
|
+
def go
|
9
|
+
empty_directory 'changelog'
|
10
|
+
empty_directory 'changelog/unreleased'
|
11
|
+
create_file 'changelog/unreleased/.gitkeep'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Changelog
|
4
|
+
class Tag < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
File.expand_path('../../templates', __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
no_commands do
|
12
|
+
def go(version)
|
13
|
+
@version = version
|
14
|
+
@date = Date.today.to_s
|
15
|
+
|
16
|
+
empty_directory "changelog/#{@version}"
|
17
|
+
template 'tag.yml', "changelog/#{@version}/tag.yml"
|
18
|
+
|
19
|
+
shell.say_status :move, "changelog/#{@version}/*.yml from changelog/unreleased", :green unless shell.mute?
|
20
|
+
FileUtils.mv(
|
21
|
+
Dir[File.join(destination_root, 'changelog/unreleased/*.yml')],
|
22
|
+
File.join(destination_root, "changelog/#{@version}")
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Changelog
|
4
|
+
class Untag < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
File.expand_path('../../templates', __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
no_commands do
|
12
|
+
def go(version)
|
13
|
+
@version = version
|
14
|
+
|
15
|
+
remove_file "changelog/#{@version}/tag.yml"
|
16
|
+
|
17
|
+
empty_directory 'changelog/unreleased'
|
18
|
+
shell.say_status :move, "changelog/#{@version}/*.yml to changelog/unreleased", :green unless shell.mute?
|
19
|
+
FileUtils.mv(
|
20
|
+
Dir[File.join(destination_root, "changelog/#{@version}/*.yml")],
|
21
|
+
File.join(destination_root, 'changelog/unreleased')
|
22
|
+
)
|
23
|
+
|
24
|
+
remove_file "changelog/#{@version}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/changelog-rb.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext'
|
3
|
+
|
4
|
+
require "changelog/version"
|
5
|
+
|
6
|
+
module Changelog
|
7
|
+
def self.natures
|
8
|
+
['Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Security'].freeze
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require "changelog/setup"
|
13
|
+
require "changelog/add"
|
14
|
+
require "changelog/tag"
|
15
|
+
require "changelog/untag"
|
16
|
+
require "changelog/print"
|
@@ -0,0 +1 @@
|
|
1
|
+
date: <%= @date %>
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: changelog-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pinglamb
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.20.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.20.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: semantic
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.16.a
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.16.a
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: fakefs
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.11.2
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.11.2
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- pinglambs@gmail.com
|
114
|
+
executables:
|
115
|
+
- changelog
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".travis.yml"
|
122
|
+
- CHANGELOG.md
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- bin/console
|
129
|
+
- bin/setup
|
130
|
+
- changelog-rb.gemspec
|
131
|
+
- changelog/0.1.0/added_add_script.yml
|
132
|
+
- changelog/0.1.0/added_basic_print_script.yml
|
133
|
+
- changelog/0.1.0/added_something.yml
|
134
|
+
- changelog/0.1.0/added_tag_script.yml
|
135
|
+
- changelog/0.1.0/added_untag_script.yml
|
136
|
+
- changelog/0.1.0/make_print_supports_version_folders.yml
|
137
|
+
- changelog/0.1.0/support_getting_title_from_git_commit.yml
|
138
|
+
- changelog/0.1.0/tag.yml
|
139
|
+
- changelog/unreleased/.gitkeep
|
140
|
+
- exe/changelog
|
141
|
+
- lib/changelog-rb.rb
|
142
|
+
- lib/changelog/add.rb
|
143
|
+
- lib/changelog/cli.rb
|
144
|
+
- lib/changelog/helpers/git.rb
|
145
|
+
- lib/changelog/helpers/shell.rb
|
146
|
+
- lib/changelog/print.rb
|
147
|
+
- lib/changelog/setup.rb
|
148
|
+
- lib/changelog/tag.rb
|
149
|
+
- lib/changelog/untag.rb
|
150
|
+
- lib/changelog/version.rb
|
151
|
+
- lib/templates/item.yml
|
152
|
+
- lib/templates/tag.yml
|
153
|
+
homepage: https://github.com/pinglamb/changelog-rb
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.6.11
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Make developers happy with http://keepachangelog.com/.
|
177
|
+
test_files: []
|