convenlu 0.3.0 → 0.5.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 +4 -4
- data/lib/convenlu/convention.json +32 -0
- data/lib/convenlu/format.rb +13 -0
- data/lib/convenlu/prompt.rb +9 -6
- data/lib/convenlu/reader.rb +23 -0
- data/lib/convenlu/repository.rb +19 -0
- data/lib/convenlu/version.rb +3 -1
- metadata +28 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863ee07430717cbd4570309733d9a613f5e262a561ed37ed2c203eee39f10049
|
4
|
+
data.tar.gz: 6b245d298a572866ef04d4f255364753dade55c5b3e5c79444d3bd50bb131f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eec7c63ce0a9280e5777f417ecdf7b8e38af1fc79975d886e2a35b145a43ca73c778a1a7d5eb3cd4d055760da724988f167f08ab85abe6933d3f99c67b4cd92
|
7
|
+
data.tar.gz: 8b27e272c8e0e0886c8ec63a1f7e8a74fd8b6ae1581593fc5ce4c5872b68b81057718f59b1ecf81d2cfe30552760fc039645a4920c82db890b2c3a2d0f21d7be
|
@@ -0,0 +1,32 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"build": "changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
|
4
|
+
},
|
5
|
+
{
|
6
|
+
"chore": "other changes that don't modify src or test files"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"ci": "changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"docs": "documentation only changes"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"feat": "a new feature"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"fix": "a bug fix"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"perf": "a code change that improves performance"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"refactor": "a code change that neither fixes a bug nor adds a feature"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"style": "changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"test": "adding missing tests or correcting existing tests"
|
31
|
+
}
|
32
|
+
]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Convenlu
|
2
|
+
class Format
|
3
|
+
def self.to_plain_text(commit)
|
4
|
+
full_commit = ''
|
5
|
+
full_commit << commit[:type].split(':')[0]
|
6
|
+
full_commit << "(#{commit[:scope]})" if commit.key?(:scope)
|
7
|
+
full_commit << ": #{commit[:title]}"
|
8
|
+
full_commit << "\n\n#{commit[:description]}"
|
9
|
+
full_commit << "\n\n#{commit[:footer]}" if commit.key?(:footer)
|
10
|
+
full_commit
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/convenlu/prompt.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'tty-prompt'
|
4
|
+
require 'convenlu/reader'
|
5
|
+
require 'convenlu/repository'
|
4
6
|
|
5
7
|
module Convenlu
|
6
8
|
class Prompt
|
7
9
|
def self.start
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
response_scope = @prompt.yes?('do you want to add a scope?', default: false)
|
10
|
+
prompt = TTY::Prompt.new
|
11
|
+
commit = prompt.collect do
|
12
|
+
response_scope = prompt.yes?('do you want to add a scope?', default: false)
|
12
13
|
key(:scope).ask('enter the commit scope') if response_scope
|
13
|
-
key(:type).select('select the commit type',
|
14
|
+
key(:type).select('select the commit type', Reader.read_json)
|
14
15
|
key(:title).ask('write a short title', required: true)
|
15
16
|
key(:description).ask('provide a longer description', required: true)
|
16
|
-
response_footer =
|
17
|
+
response_footer = prompt.yes?('do you want to add a footer?', default: false)
|
17
18
|
key(:footer).ask('write the commit footer', required: true) if response_footer
|
18
19
|
end
|
20
|
+
@repo = Repository.new
|
21
|
+
@repo.create_commit(commit)
|
19
22
|
end
|
20
23
|
end
|
21
24
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require_relative 'version'
|
5
|
+
|
6
|
+
module Convenlu
|
7
|
+
class Reader
|
8
|
+
def self.read_json
|
9
|
+
relative_path = File.join(Dir.pwd, 'lib', 'convenlu', 'convention.json')
|
10
|
+
if Dir.pwd.split('/')[-1] == 'convenlu' || File.exist?(relative_path)
|
11
|
+
file = File.read(relative_path)
|
12
|
+
else
|
13
|
+
convention_absolute_path = File.join(Gem.dir, 'gems', "convenlu-#{Convenlu::VERSION}", 'lib', 'convenlu',
|
14
|
+
'convention.json')
|
15
|
+
file = File.read(convention_absolute_path)
|
16
|
+
end
|
17
|
+
convention = JSON.parse(file)
|
18
|
+
convention.map do |type|
|
19
|
+
"#{type.keys.join}: #{type.values.join}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'git'
|
4
|
+
require 'convenlu/format'
|
5
|
+
|
6
|
+
module Convenlu
|
7
|
+
class Repository
|
8
|
+
attr_reader :git
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@git = Git.open(Dir.pwd)
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_commit(commit)
|
15
|
+
@formatted_commit = Format.to_plain_text(commit)
|
16
|
+
@git.commit(@formatted_commit)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/convenlu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convenlu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- julio cabrera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,34 +52,48 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: git
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: tty-prompt
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 0.23.0
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 0.23.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: tty-spinner
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.9.3
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 0.9.3
|
83
97
|
description: Commit message will be formatted based on defined stantards
|
84
98
|
email:
|
85
99
|
- juliocabrera820@gmail.com
|
@@ -92,8 +106,12 @@ files:
|
|
92
106
|
- bin/convenlu
|
93
107
|
- bin/setup
|
94
108
|
- lib/convenlu.rb
|
109
|
+
- lib/convenlu/convention.json
|
110
|
+
- lib/convenlu/format.rb
|
95
111
|
- lib/convenlu/interface.rb
|
96
112
|
- lib/convenlu/prompt.rb
|
113
|
+
- lib/convenlu/reader.rb
|
114
|
+
- lib/convenlu/repository.rb
|
97
115
|
- lib/convenlu/spinner.rb
|
98
116
|
- lib/convenlu/version.rb
|
99
117
|
homepage: https://github.com/juliocabrera820/convenlu
|