codelog 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +6 -0
- data/lib/codelog.rb +1 -0
- data/lib/codelog/cli.rb +7 -0
- data/lib/codelog/command/bump.rb +48 -0
- data/lib/codelog/command/setup.rb +1 -1
- data/lib/codelog/message.rb +6 -2
- data/lib/codelog/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc0db61aa88a54e953d1bc0abcb652f776fa596db6fc21f17008ee96e65f00d
|
4
|
+
data.tar.gz: f426e53e20594ff0729d50172882e0233d30e7e89338e84d692a1ef73d2d3014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 658c2a502793683766b34f184a244a6c8e75bdef77675e483c2e7b36cf3b8c922cb95ccc715102780a5ed5f26bca97688da3428708167a0c674be0463af262fa
|
7
|
+
data.tar.gz: 730574b14e06985604734ad65248b9580ac404f4a515428ebb66e7d3131a63ef2099e2133e04400c39dc7f4699513d9c4c007e30bf087fa2be2ccf3d17ded93d
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
4
4
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
+
## 0.7.0
|
7
|
+
### Added
|
8
|
+
- Command `codelog bump [major|minor|patch]` that automatically sets the next version
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Typos on the method `maintain_versioning_of_existing_changelog?` name and printed message
|
12
|
+
|
13
|
+
---
|
6
14
|
## 0.6.0
|
7
15
|
### Added
|
8
16
|
- The `new` command receives a `NAME` parameter that will be converted to the unreleased file name
|
data/README.md
CHANGED
@@ -99,6 +99,12 @@ It will execute 3 steps:
|
|
99
99
|
- Deletes the change files at `changelogs/unreleased/` because they now compose the new release. If it was not deleted, the change would appear repeated in the next release.
|
100
100
|
- Updates the `CHANGELOG.md` file by merging all the releases at `changelogs/releases/`.
|
101
101
|
|
102
|
+
If you don't want to specify the release version manually, you can use the `bump` command:
|
103
|
+
```bash
|
104
|
+
$ codelog bump [major|minor|patch] <RELEASE_DATE>
|
105
|
+
```
|
106
|
+
Where the first mandatory parameter is the desired release type, i.e: If you don't have any release, `codelog bump patch` will release the 0.0.1 version.
|
107
|
+
|
102
108
|
## Configuring
|
103
109
|
|
104
110
|
Since version 0.3.0, there are a few configurations that are possible. You can choose:
|
data/lib/codelog.rb
CHANGED
@@ -5,6 +5,7 @@ require 'codelog/version'
|
|
5
5
|
require 'codelog/command/setup'
|
6
6
|
require 'codelog/command/new'
|
7
7
|
require 'codelog/command/release'
|
8
|
+
require 'codelog/command/bump'
|
8
9
|
require 'codelog/command/step/changelog'
|
9
10
|
require 'codelog/command/step/delete'
|
10
11
|
require 'codelog/command/step/version'
|
data/lib/codelog/cli.rb
CHANGED
@@ -23,5 +23,12 @@ module Codelog
|
|
23
23
|
Date.today.strftime(Codelog::Config.date_input_format))
|
24
24
|
Codelog::Command::Release.run version_number, release_date
|
25
25
|
end
|
26
|
+
|
27
|
+
desc 'bump [VERSION_TYPE] <RELEASE_DATE>', 'Bumps the next version,
|
28
|
+
being it major, minor or patch'
|
29
|
+
def bump(version_type, release_date =
|
30
|
+
Date.today.strftime(Codelog::Config.date_input_format))
|
31
|
+
Codelog::Command::Bump.run version_type, release_date
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Codelog
|
2
|
+
module Command
|
3
|
+
class Bump
|
4
|
+
CHANGELOG_RELEASES_PATH = 'changelogs/releases/'.freeze
|
5
|
+
CHANGELOG_RELEASE_REGEXP = /^\d*\.{1}\d*\.{1}\d*$/
|
6
|
+
VALID_VERSION_TYPES = ['major', 'minor', 'patch'].freeze
|
7
|
+
INITIAL_RELEASE_VERSION = '0.0.0'.freeze
|
8
|
+
|
9
|
+
def self.run(version_type, release_date)
|
10
|
+
Codelog::Command::Bump.new.run version_type, release_date
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(version_type, release_date)
|
14
|
+
unless VALID_VERSION_TYPES.include?(version_type.downcase)
|
15
|
+
abort(Codelog::Message::Error.invalid_version_type(version_type))
|
16
|
+
end
|
17
|
+
|
18
|
+
Codelog::Command::Release.run(next_version(version_type), release_date)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def next_version(version_type)
|
24
|
+
last_version = last_created_changelog.split('.').map(&:to_i)
|
25
|
+
|
26
|
+
case version_type.downcase
|
27
|
+
when 'major'
|
28
|
+
last_version = [(last_version[0] + 1), 0, 0]
|
29
|
+
when 'minor'
|
30
|
+
last_version = [last_version.first, (last_version[1] + 1), 0]
|
31
|
+
when 'patch'
|
32
|
+
last_version[2] += 1
|
33
|
+
end
|
34
|
+
last_version.join('.')
|
35
|
+
end
|
36
|
+
|
37
|
+
def last_created_changelog
|
38
|
+
released_versions = Dir.glob(File.join(CHANGELOG_RELEASES_PATH, '*.md*')).map do |file_path|
|
39
|
+
file_path.gsub(CHANGELOG_RELEASES_PATH, '').gsub('.md', '')
|
40
|
+
end.grep(CHANGELOG_RELEASE_REGEXP)
|
41
|
+
|
42
|
+
released_versions.max_by do |version_string|
|
43
|
+
Gem::Version.new(version_string)
|
44
|
+
end || INITIAL_RELEASE_VERSION
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -45,7 +45,7 @@ module Codelog
|
|
45
45
|
|
46
46
|
def handle_existing_changelog
|
47
47
|
return unless old_changelog_exists?
|
48
|
-
if yes? Codelog::Message::Warning.
|
48
|
+
if yes? Codelog::Message::Warning.maintain_versioning_of_existing_changelog?
|
49
49
|
puts '== Copying existing changelog to releases folder =='
|
50
50
|
copy_and_mark_changelog
|
51
51
|
elsif yes? Codelog::Message::Warning.delete_existing_changelog?
|
data/lib/codelog/message.rb
CHANGED
@@ -36,6 +36,10 @@ module Codelog
|
|
36
36
|
def could_not_parse_yaml(error)
|
37
37
|
"#{prefix}: #{error.problem.capitalize} in #{error.file}:#{error.line}"
|
38
38
|
end
|
39
|
+
|
40
|
+
def invalid_version_type(version_type)
|
41
|
+
"#{version_type} is not a valid version type."
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
|
@@ -45,9 +49,9 @@ module Codelog
|
|
45
49
|
'WARNING'
|
46
50
|
end
|
47
51
|
|
48
|
-
def
|
52
|
+
def maintain_versioning_of_existing_changelog?
|
49
53
|
"#{prefix}: There is already a file named CHANGELOG.md within " \
|
50
|
-
'your project. Do you wish to
|
54
|
+
'your project. Do you wish to maintain its versioning? (Y/N)'
|
51
55
|
end
|
52
56
|
|
53
57
|
def delete_existing_changelog?
|
data/lib/codelog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luís Bevilacqua
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2018-
|
15
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: thor
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/codelog.rb
|
119
119
|
- lib/codelog/cli.rb
|
120
120
|
- lib/codelog/clis/interactive.rb
|
121
|
+
- lib/codelog/command/bump.rb
|
121
122
|
- lib/codelog/command/new.rb
|
122
123
|
- lib/codelog/command/release.rb
|
123
124
|
- lib/codelog/command/setup.rb
|