chmd 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/.github/workflows/release.yml +45 -0
- data/.gitignore +60 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +8 -0
- data/bin/chmd +22 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/chmd.gemspec +33 -0
- data/lib/chmd.rb +109 -0
- data/lib/chmd/version.rb +5 -0
- data/spec/chmd_spec.rb +7 -0
- data/spec/make_spec.rb +19 -0
- data/spec/spec_helper.rb +16 -0
- metadata +99 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6825fc3e2a7dcc568b5404a092a5a8e832c27cbf408fa13e493ef0af5aebd9eb
|
|
4
|
+
data.tar.gz: 9d1cd4a0bb320b61d7ecdb92b189e35c3934611c86c0cf986e63ac207192999d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ae30762304183340673eba0b8aab893647d13f52cbf699caf1de33e592cda1986f311319f09ce253eda85caffaeb5268d2c1f3b4e51299cb396fcdd5192250c1
|
|
7
|
+
data.tar.gz: '079cec0602b258cb64ff24250aca44b43dfe50f385d62acfdf2b96be28ffb270e79222a5a62f336d8dd74e1dca5761f565fb575fe3dc75577be8b8138bfed913'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Release Gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
- name: Set up Ruby 2.7
|
|
15
|
+
uses: actions/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
version: 2.7.x
|
|
18
|
+
|
|
19
|
+
- name: Build and test with Rake
|
|
20
|
+
run: |
|
|
21
|
+
gem install bundler
|
|
22
|
+
bundle install --jobs 4 --retry 3
|
|
23
|
+
bundle exec rake
|
|
24
|
+
|
|
25
|
+
- name: Publish to RubyGems
|
|
26
|
+
run: |
|
|
27
|
+
mkdir -p $HOME/.gem
|
|
28
|
+
touch $HOME/.gem/credentials
|
|
29
|
+
chmod 0600 $HOME/.gem/credentials
|
|
30
|
+
echo -e "---\n:rubygems_api_key: ${RUBYGEMS_TOKEN}" > $HOME/.gem/credentials
|
|
31
|
+
gem build *.gemspec
|
|
32
|
+
gem push *.gem
|
|
33
|
+
env:
|
|
34
|
+
RUBYGEMS_TOKEN: ${{secrets.RUBYGEMS_TOKEN}}
|
|
35
|
+
|
|
36
|
+
- name: Create Release
|
|
37
|
+
id: create_release
|
|
38
|
+
uses: actions/create-release@v1
|
|
39
|
+
env:
|
|
40
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
with:
|
|
42
|
+
tag_name: ${{ github.ref }}
|
|
43
|
+
release_name: Release ${{ github.ref }}
|
|
44
|
+
draft: false
|
|
45
|
+
prerelease: false
|
data/.gitignore
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
# Used by dotenv library to load environment variables.
|
|
14
|
+
# .env
|
|
15
|
+
|
|
16
|
+
# Ignore Byebug command history file.
|
|
17
|
+
.byebug_history
|
|
18
|
+
|
|
19
|
+
## Specific to RubyMotion:
|
|
20
|
+
.dat*
|
|
21
|
+
.repl_history
|
|
22
|
+
build/
|
|
23
|
+
*.bridgesupport
|
|
24
|
+
build-iPhoneOS/
|
|
25
|
+
build-iPhoneSimulator/
|
|
26
|
+
|
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
28
|
+
#
|
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
32
|
+
#
|
|
33
|
+
# vendor/Pods/
|
|
34
|
+
|
|
35
|
+
## Documentation cache and generated files:
|
|
36
|
+
/.yardoc/
|
|
37
|
+
/_yardoc/
|
|
38
|
+
/doc/
|
|
39
|
+
/rdoc/
|
|
40
|
+
|
|
41
|
+
## Environment normalization:
|
|
42
|
+
/.bundle/
|
|
43
|
+
/vendor/bundle
|
|
44
|
+
/lib/bundler/man/
|
|
45
|
+
|
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
48
|
+
# Gemfile.lock
|
|
49
|
+
# .ruby-version
|
|
50
|
+
# .ruby-gemset
|
|
51
|
+
|
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
53
|
+
.rvmrc
|
|
54
|
+
|
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
|
56
|
+
# .rubocop-https?--*
|
|
57
|
+
|
|
58
|
+
# rspec failure tracking
|
|
59
|
+
.rspec_status
|
|
60
|
+
*.swp
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v1.0](https://github.com/eggplants/chmd/releases/tag/v1.0) - 2021-08-10 02:39:47 ([compare](https://github.com/eggplants/chmd/compare/v0.2...v1.0))
|
|
4
|
+
|
|
5
|
+
- [47908579895ebbed0202f57083de72703ed9b82a](https://github.com/eggplants/chmd/commit/47908579895ebbed0202f57083de72703ed9b82a)
|
|
6
|
+
- fix: ci syntax
|
|
7
|
+
- [552ec473d2ba8b51d4c284a3b15ede680f05461f](https://github.com/eggplants/chmd/commit/552ec473d2ba8b51d4c284a3b15ede680f05461f)
|
|
8
|
+
- add: swp to ignore
|
|
9
|
+
- [9b45e5c8285a0e73ad9fc7a70f219f26853895cb](https://github.com/eggplants/chmd/commit/9b45e5c8285a0e73ad9fc7a70f219f26853895cb)
|
|
10
|
+
- fix: version
|
|
11
|
+
- [5784cabe38858a9d71a79849703f4e35264268b2](https://github.com/eggplants/chmd/commit/5784cabe38858a9d71a79849703f4e35264268b2)
|
|
12
|
+
- add: ci
|
|
13
|
+
- [3d2b8c7b4005d8589e6e6060e66afc09d781421e](https://github.com/eggplants/chmd/commit/3d2b8c7b4005d8589e6e6060e66afc09d781421e)
|
|
14
|
+
- add: gem requirements
|
|
15
|
+
- [88e089e071abe5f62c2b8b43d9002e0f3854556b](https://github.com/eggplants/chmd/commit/88e089e071abe5f62c2b8b43d9002e0f3854556b)
|
|
16
|
+
- fix: error handler for git command
|
|
17
|
+
|
|
18
|
+
## [v0.2](https://github.com/eggplants/chmd/releases/tag/v0.2) - 2021-08-09 20:16:40 ([compare](https://github.com/eggplants/chmd/compare/v0.1...v0.2))
|
|
19
|
+
|
|
20
|
+
- [4dc07614cad192582fa7c9b8efaf9f65cdd4243a](https://github.com/eggplants/chmd/commit/4dc07614cad192582fa7c9b8efaf9f65cdd4243a)
|
|
21
|
+
- update: readme
|
|
22
|
+
- [ede6c14fff8f6b72e05f7d7df2ab4a2fd384cc1c](https://github.com/eggplants/chmd/commit/ede6c14fff8f6b72e05f7d7df2ab4a2fd384cc1c)
|
|
23
|
+
- fix: relpath to abspath and make syntax more common
|
|
24
|
+
|
|
25
|
+
## [v0.1](https://github.com/eggplants/chmd/releases/tag/v0.1) - 2021-08-09 18:54:09 ([compare](https://github.com/eggplants/chmd/compare/v0.0...v0.1))
|
|
26
|
+
|
|
27
|
+
- [02cd225b84d1fc85049876a2e17acc6950d8162f](https://github.com/eggplants/chmd/commit/02cd225b84d1fc85049876a2e17acc6950d8162f)
|
|
28
|
+
- fix: mistakes of tag regex
|
|
29
|
+
- [e5fe2a676a1c6b531d965b786ce6527e5199bf7c](https://github.com/eggplants/chmd/commit/e5fe2a676a1c6b531d965b786ce6527e5199bf7c)
|
|
30
|
+
- update: readme
|
|
31
|
+
- [9355492f4b10b6f79c7182a67e85f25f1d46ce67](https://github.com/eggplants/chmd/commit/9355492f4b10b6f79c7182a67e85f25f1d46ce67)
|
|
32
|
+
- lint
|
|
33
|
+
|
|
34
|
+
## [v0.0](https://github.com/eggplants/chmd/releases/tag/v0.0) - 2021-08-09 18:34:01 ([compare](https://github.com/eggplants/chmd/compare/36270608f2c0473e284ef41d2f65fdf9a30a15ea...v0.0))
|
|
35
|
+
|
|
36
|
+
- [b9724e0ce294ccc4ac250838a91e8e864816d35c](https://github.com/eggplants/chmd/commit/b9724e0ce294ccc4ac250838a91e8e864816d35c)
|
|
37
|
+
- add: installation
|
|
38
|
+
- [36270608f2c0473e284ef41d2f65fdf9a30a15ea](https://github.com/eggplants/chmd/commit/36270608f2c0473e284ef41d2f65fdf9a30a15ea)
|
|
39
|
+
- init
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
chmd (1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.4.4)
|
|
10
|
+
rake (12.3.3)
|
|
11
|
+
rspec (3.10.0)
|
|
12
|
+
rspec-core (~> 3.10.0)
|
|
13
|
+
rspec-expectations (~> 3.10.0)
|
|
14
|
+
rspec-mocks (~> 3.10.0)
|
|
15
|
+
rspec-core (3.10.1)
|
|
16
|
+
rspec-support (~> 3.10.0)
|
|
17
|
+
rspec-expectations (3.10.1)
|
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
+
rspec-support (~> 3.10.0)
|
|
20
|
+
rspec-mocks (3.10.2)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.10.0)
|
|
23
|
+
rspec-support (3.10.2)
|
|
24
|
+
|
|
25
|
+
PLATFORMS
|
|
26
|
+
ruby
|
|
27
|
+
|
|
28
|
+
DEPENDENCIES
|
|
29
|
+
bundler
|
|
30
|
+
chmd!
|
|
31
|
+
rake (~> 12.0)
|
|
32
|
+
rspec (~> 3.0)
|
|
33
|
+
|
|
34
|
+
BUNDLED WITH
|
|
35
|
+
2.2.25
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Haruna (eggplants)
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `chmd`
|
|
2
|
+
|
|
3
|
+
- Make CHANGELOG.md from git-log and git-tag
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```txt
|
|
8
|
+
# Changelog
|
|
9
|
+
<blank line>
|
|
10
|
+
## [<tagname>](<gh_url>/releases/tag/<tagname>) - <timestamp> ([compare](<gh_url>/compare/<prev_tagname | init_commit_hash>...<tagname>))
|
|
11
|
+
<blank line>
|
|
12
|
+
- [<commit_hash>](<gh_url>/commit/<commit_hash>)
|
|
13
|
+
- <message>
|
|
14
|
+
- [<commit_hash>](<gh_url>/commit/<commit_hash>)
|
|
15
|
+
- <message>
|
|
16
|
+
...
|
|
17
|
+
- [<commit_hash>](<gh_url>/commit/<commit_hash>)
|
|
18
|
+
- <message>
|
|
19
|
+
<blank line>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
$ curl -L https://git.io/JRuUu -o chmd && chmod +x $_
|
|
26
|
+
# inside git repo
|
|
27
|
+
$ ./chmd | less # check output
|
|
28
|
+
$ ./chmd > CHANGELOG.md
|
|
29
|
+
# outside git repo
|
|
30
|
+
$ ./chmd
|
|
31
|
+
Error: outside git repo, or git is not installed.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- If you want to globally run this command,
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
$ sudo install -m 755 chmd /usr/local/bin/chmd
|
|
38
|
+
$ which chmd
|
|
39
|
+
/usr/local/bin/mkch
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Sample
|
|
43
|
+
|
|
44
|
+
- [face-symmetrizer/CHANGELOG.md](https://github.com/eggplants/face-symmetrizer/blob/master/CHANGELOG.md)
|
|
45
|
+
- Made by `chmd`
|
|
46
|
+
|
|
47
|
+
## Requirements
|
|
48
|
+
|
|
49
|
+
- Ruby
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
data/Rakefile
ADDED
data/bin/chmd
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'chmd'
|
|
5
|
+
require 'chmd/version'
|
|
6
|
+
require 'optparse'
|
|
7
|
+
|
|
8
|
+
OptionParser.new do |opt|
|
|
9
|
+
opt.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
|
10
|
+
opt.separator 'options are:'
|
|
11
|
+
opt.on('-h', '--help', 'Show this message') do
|
|
12
|
+
puts opt
|
|
13
|
+
exit
|
|
14
|
+
end
|
|
15
|
+
opt.on('-v', '--version', 'Show version') do
|
|
16
|
+
puts Chmd::VERSION
|
|
17
|
+
exit
|
|
18
|
+
end
|
|
19
|
+
opt.parse!(ARGV)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
puts Chmd.make
|
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'chmd'
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/chmd.gemspec
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'chmd/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'chmd'
|
|
9
|
+
spec.version = Chmd::VERSION
|
|
10
|
+
spec.authors = ['eggplants']
|
|
11
|
+
spec.email = ['w10776e8w@yahoo.co.jp']
|
|
12
|
+
spec.summary = 'Make CHANGELOG.md from git log and tags.'
|
|
13
|
+
spec.description = 'Make CHANGELOG.md from git log and tags of repositorywhich origin exists on github.'
|
|
14
|
+
spec.homepage = 'https://github.com/eggplants/chmd'
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
spec.metadata = {
|
|
18
|
+
'allowed_push_host' => 'https://rubygems.org',
|
|
19
|
+
'homepage_uri' => spec.homepage,
|
|
20
|
+
'source_code_uri' => spec.homepage,
|
|
21
|
+
'changelog_uri' => 'https://github.com/eggplants/chmd/blob/main/CHANGELOG.md'
|
|
22
|
+
}
|
|
23
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
24
|
+
spec.executables = 'chmd'
|
|
25
|
+
spec.bindir = 'bin'
|
|
26
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
27
|
+
spec.require_paths = ['lib']
|
|
28
|
+
|
|
29
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
|
30
|
+
|
|
31
|
+
spec.add_development_dependency 'bundler'
|
|
32
|
+
spec.add_development_dependency 'rake'
|
|
33
|
+
end
|
data/lib/chmd.rb
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'English'
|
|
4
|
+
require 'mkmf'
|
|
5
|
+
|
|
6
|
+
MakeMakefile::Logging.quiet = true
|
|
7
|
+
|
|
8
|
+
module MakeMakefile
|
|
9
|
+
# MakeMakefile::Logging
|
|
10
|
+
module Logging
|
|
11
|
+
@logfile = File::NULL
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# atext
|
|
16
|
+
module Chmd
|
|
17
|
+
class << self
|
|
18
|
+
def make
|
|
19
|
+
Make.new.make
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# class for making changelog.md
|
|
24
|
+
class Make
|
|
25
|
+
attr_reader :remote_url, :tags
|
|
26
|
+
|
|
27
|
+
def initialize
|
|
28
|
+
@remote_url = self.class.set_remote
|
|
29
|
+
@tags = self.class.set_tags
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def make
|
|
33
|
+
['# Changelog'] | @tags.map do |tag, commits|
|
|
34
|
+
next unless tag =~ /tag: /
|
|
35
|
+
|
|
36
|
+
_, timestamp, = commits.first.map(&:strip)
|
|
37
|
+
tag_name = tag.scan(/(?<=tag: )[^,]+/).first
|
|
38
|
+
prev_tag_name = self.class.get_prev_tag_name(@tags, tag)
|
|
39
|
+
tag_info = self.class.parse_tag_info(tag_name, prev_tag_name, @remote_url, timestamp)
|
|
40
|
+
tag_commits_info = self.class.parse_tag_commits(commits, @remote_url).compact
|
|
41
|
+
['', tag_info, '', tag_commits_info]
|
|
42
|
+
end.compact
|
|
43
|
+
end
|
|
44
|
+
class << self
|
|
45
|
+
def parse_tag_info(tag_name, prev_tag_name, remote_url, timestamp)
|
|
46
|
+
"## [#{tag_name}](#{remote_url}/releases/tag/#{tag_name}) " \
|
|
47
|
+
+ "- #{timestamp} ([compare](#{remote_url}/compare/#{prev_tag_name}...#{tag_name}))"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_prev_tag_name(tags, current_tag)
|
|
51
|
+
(
|
|
52
|
+
tags.keys[tags.keys.index(current_tag) + 1] \
|
|
53
|
+
||= tags.values.last.last.first
|
|
54
|
+
).sub('tag: ', '')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def parse_tag_commits(commits, remote_url)
|
|
58
|
+
commits.map do |hash, _, msg|
|
|
59
|
+
if msg =~ /changelog/i
|
|
60
|
+
nil
|
|
61
|
+
else
|
|
62
|
+
<<~A
|
|
63
|
+
- [#{hash}](#{remote_url}/commit/#{hash})
|
|
64
|
+
- #{msg}
|
|
65
|
+
A
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def set_tags
|
|
71
|
+
ref = nil
|
|
72
|
+
tags = {}
|
|
73
|
+
logs = `git log --pretty=format:"%H %ad %s %D" \
|
|
74
|
+
--date=format:'%Y-%m-%d %H:%M:%S'`.split "\n"
|
|
75
|
+
logs.map { _1.split "\t" }.each do |c|
|
|
76
|
+
ref = c[-1] unless c[3].nil?
|
|
77
|
+
tags[ref] = tags[ref].nil? ? [c[0, 3]] : tags[ref] + [c[0, 3]]
|
|
78
|
+
end
|
|
79
|
+
tags
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def set_remote
|
|
83
|
+
check_git_command_exist
|
|
84
|
+
check_git_remote_is_github
|
|
85
|
+
remote_urls = `git remote get-url origin`.split("\n").grep(/github\.com/)
|
|
86
|
+
unless remote_urls.size == 1
|
|
87
|
+
warn 'Error: remote origin is not on github.com.'
|
|
88
|
+
exit 1
|
|
89
|
+
end
|
|
90
|
+
remote_urls[0].sub(/.git$/, '')
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def check_git_command_exist
|
|
94
|
+
return if find_executable 'git'
|
|
95
|
+
|
|
96
|
+
warn 'Error: Git is not installed.'
|
|
97
|
+
exit 1
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def check_git_remote_is_github
|
|
101
|
+
system 'git rev-parse --show-toplevel', %i[out err] => File::NULL
|
|
102
|
+
return if $CHILD_STATUS.success?
|
|
103
|
+
|
|
104
|
+
warn 'Error: You are outside git repo.'
|
|
105
|
+
exit 1
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/chmd/version.rb
ADDED
data/spec/chmd_spec.rb
ADDED
data/spec/make_spec.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Chmd::Make do
|
|
4
|
+
it 'has initializer' do
|
|
5
|
+
expect(Chmd::Make.new).not_to be nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'has an instance value: remote_url' do
|
|
9
|
+
expect(Chmd::Make.new.remote_url).to eq 'https://github.com/eggplants/chmd'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'has an instance value: tags' do
|
|
13
|
+
expect(Chmd::Make.new.tags).not_to be nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'can make' do
|
|
17
|
+
expect(Chmd::Make.new.make[0]).to eq '# Changelog'
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'chmd'
|
|
5
|
+
|
|
6
|
+
RSpec.configure do |config|
|
|
7
|
+
# Enable flags like --only-failures and --next-failure
|
|
8
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
|
9
|
+
|
|
10
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
11
|
+
config.disable_monkey_patching!
|
|
12
|
+
|
|
13
|
+
config.expect_with :rspec do |c|
|
|
14
|
+
c.syntax = :expect
|
|
15
|
+
end
|
|
16
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: chmd
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '1.0'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- eggplants
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-08-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
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: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Make CHANGELOG.md from git log and tags of repositorywhich origin exists
|
|
42
|
+
on github.
|
|
43
|
+
email:
|
|
44
|
+
- w10776e8w@yahoo.co.jp
|
|
45
|
+
executables:
|
|
46
|
+
- chmd
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- ".github/workflows/release.yml"
|
|
51
|
+
- ".gitignore"
|
|
52
|
+
- ".rspec"
|
|
53
|
+
- ".travis.yml"
|
|
54
|
+
- CHANGELOG.md
|
|
55
|
+
- Gemfile
|
|
56
|
+
- Gemfile.lock
|
|
57
|
+
- LICENSE.txt
|
|
58
|
+
- README.md
|
|
59
|
+
- Rakefile
|
|
60
|
+
- bin/chmd
|
|
61
|
+
- bin/console
|
|
62
|
+
- bin/setup
|
|
63
|
+
- chmd.gemspec
|
|
64
|
+
- lib/chmd.rb
|
|
65
|
+
- lib/chmd/version.rb
|
|
66
|
+
- spec/chmd_spec.rb
|
|
67
|
+
- spec/make_spec.rb
|
|
68
|
+
- spec/spec_helper.rb
|
|
69
|
+
homepage: https://github.com/eggplants/chmd
|
|
70
|
+
licenses:
|
|
71
|
+
- MIT
|
|
72
|
+
metadata:
|
|
73
|
+
allowed_push_host: https://rubygems.org
|
|
74
|
+
homepage_uri: https://github.com/eggplants/chmd
|
|
75
|
+
source_code_uri: https://github.com/eggplants/chmd
|
|
76
|
+
changelog_uri: https://github.com/eggplants/chmd/blob/main/CHANGELOG.md
|
|
77
|
+
post_install_message:
|
|
78
|
+
rdoc_options: []
|
|
79
|
+
require_paths:
|
|
80
|
+
- lib
|
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: 2.5.0
|
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
requirements: []
|
|
92
|
+
rubygems_version: 3.2.22
|
|
93
|
+
signing_key:
|
|
94
|
+
specification_version: 4
|
|
95
|
+
summary: Make CHANGELOG.md from git log and tags.
|
|
96
|
+
test_files:
|
|
97
|
+
- spec/chmd_spec.rb
|
|
98
|
+
- spec/make_spec.rb
|
|
99
|
+
- spec/spec_helper.rb
|