convenlu 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/convenlu/convention.json +32 -0
- data/lib/convenlu/convention_file.rb +17 -0
- data/lib/convenlu/format.rb +13 -0
- data/lib/convenlu/prompt.rb +7 -4
- data/lib/convenlu/reader.rb +15 -0
- data/lib/convenlu/repository.rb +19 -0
- data/lib/convenlu/rules.json +4 -0
- data/lib/convenlu/standard.rb +21 -0
- data/lib/convenlu/version.rb +3 -1
- metadata +25 -3
- data/lib/convenlu/custom_convention.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa9a115218ea20e37dc95a425bc51b66cd5e57f92e8342f10fbc29aac828522
|
4
|
+
data.tar.gz: 79d3ff31dfe56eb7a256f98926350386847c204bc7e83a247d52d6f09fbb5294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e4697aef7d0e630a85225920d7ca498713df343a63963f170e3dd06e40c530d43352b5f41f16579a0f814e36a80d77d72dba0839d172a5eecb7b7580d613ab
|
7
|
+
data.tar.gz: 341caedd1d31826e9ba323e818f96a4f647272c50dcfc23db39aae3f17ab4de2a62004a7bab670e9fa482b3d8b3228da2cc3399e28251bc3dd62be12c576a352
|
@@ -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,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'convenlu/version'
|
4
|
+
|
5
|
+
module Convenlu
|
6
|
+
class ConventionFile
|
7
|
+
def self.path(json_file)
|
8
|
+
development_path = File.join(Dir.pwd, 'lib', 'convenlu', json_file)
|
9
|
+
if Dir.pwd.split('/')[-1] == 'convenlu' || File.exist?(development_path)
|
10
|
+
development_path
|
11
|
+
else
|
12
|
+
File.join(Gem.dir, 'gems', "convenlu-#{Convenlu::VERSION}", 'lib', 'convenlu',
|
13
|
+
json_file)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -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/
|
4
|
+
require 'convenlu/repository'
|
5
|
+
require 'convenlu/standard'
|
5
6
|
|
6
7
|
module Convenlu
|
7
8
|
class Prompt
|
8
9
|
def self.start
|
9
10
|
prompt = TTY::Prompt.new
|
10
|
-
prompt.collect do
|
11
|
+
commit = prompt.collect do
|
11
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', Standard.commit_types)
|
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,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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'convenlu/convention_file'
|
4
|
+
require 'convenlu/reader'
|
5
|
+
|
6
|
+
module Convenlu
|
7
|
+
class Standard
|
8
|
+
def self.commit_types
|
9
|
+
commit_types_file = Reader.read_file(ConventionFile.path('convention.json'))
|
10
|
+
convention = Reader.read_json(commit_types_file)
|
11
|
+
convention.map do |type|
|
12
|
+
"#{type.keys.join}: #{type.values.join}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.rules
|
17
|
+
rules_file = Reader.read_file(ConventionFile.path('rules.json'))
|
18
|
+
Reader.read_json(rules_file)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/convenlu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convenlu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- julio cabrera
|
8
|
+
- eusebio ajas
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2021-
|
12
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -52,6 +53,20 @@ dependencies:
|
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '3.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: git
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.8.1
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.1
|
55
70
|
- !ruby/object:Gem::Dependency
|
56
71
|
name: tty-prompt
|
57
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +98,7 @@ dependencies:
|
|
83
98
|
description: Commit message will be formatted based on defined stantards
|
84
99
|
email:
|
85
100
|
- juliocabrera820@gmail.com
|
101
|
+
- eusebioajas6@gmail.com
|
86
102
|
executables:
|
87
103
|
- convenlu
|
88
104
|
extensions: []
|
@@ -92,10 +108,16 @@ files:
|
|
92
108
|
- bin/convenlu
|
93
109
|
- bin/setup
|
94
110
|
- lib/convenlu.rb
|
95
|
-
- lib/convenlu/
|
111
|
+
- lib/convenlu/convention.json
|
112
|
+
- lib/convenlu/convention_file.rb
|
113
|
+
- lib/convenlu/format.rb
|
96
114
|
- lib/convenlu/interface.rb
|
97
115
|
- lib/convenlu/prompt.rb
|
116
|
+
- lib/convenlu/reader.rb
|
117
|
+
- lib/convenlu/repository.rb
|
118
|
+
- lib/convenlu/rules.json
|
98
119
|
- lib/convenlu/spinner.rb
|
120
|
+
- lib/convenlu/standard.rb
|
99
121
|
- lib/convenlu/version.rb
|
100
122
|
homepage: https://github.com/juliocabrera820/convenlu
|
101
123
|
licenses:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module Convenlu
|
6
|
-
class CustomConvention
|
7
|
-
def self.read
|
8
|
-
file = File.read("#{Dir.pwd}/convention.json")
|
9
|
-
convention = JSON.parse(file)
|
10
|
-
convention.map do |type|
|
11
|
-
"#{type.keys.join}: #{type.values.join}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|