convenlu 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 863ee07430717cbd4570309733d9a613f5e262a561ed37ed2c203eee39f10049
4
- data.tar.gz: 6b245d298a572866ef04d4f255364753dade55c5b3e5c79444d3bd50bb131f16
3
+ metadata.gz: 3fa9a115218ea20e37dc95a425bc51b66cd5e57f92e8342f10fbc29aac828522
4
+ data.tar.gz: 79d3ff31dfe56eb7a256f98926350386847c204bc7e83a247d52d6f09fbb5294
5
5
  SHA512:
6
- metadata.gz: 6eec7c63ce0a9280e5777f417ecdf7b8e38af1fc79975d886e2a35b145a43ca73c778a1a7d5eb3cd4d055760da724988f167f08ab85abe6933d3f99c67b4cd92
7
- data.tar.gz: 8b27e272c8e0e0886c8ec63a1f7e8a74fd8b6ae1581593fc5ce4c5872b68b81057718f59b1ecf81d2cfe30552760fc039645a4920c82db890b2c3a2d0f21d7be
6
+ metadata.gz: b3e4697aef7d0e630a85225920d7ca498713df343a63963f170e3dd06e40c530d43352b5f41f16579a0f814e36a80d77d72dba0839d172a5eecb7b7580d613ab
7
+ data.tar.gz: 341caedd1d31826e9ba323e818f96a4f647272c50dcfc23db39aae3f17ab4de2a62004a7bab670e9fa482b3d8b3228da2cc3399e28251bc3dd62be12c576a352
@@ -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
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'tty-prompt'
4
- require 'convenlu/reader'
5
4
  require 'convenlu/repository'
5
+ require 'convenlu/standard'
6
6
 
7
7
  module Convenlu
8
8
  class Prompt
@@ -11,7 +11,7 @@ module Convenlu
11
11
  commit = prompt.collect do
12
12
  response_scope = prompt.yes?('do you want to add a scope?', default: false)
13
13
  key(:scope).ask('enter the commit scope') if response_scope
14
- key(:type).select('select the commit type', Reader.read_json)
14
+ key(:type).select('select the commit type', Standard.commit_types)
15
15
  key(:title).ask('write a short title', required: true)
16
16
  key(:description).ask('provide a longer description', required: true)
17
17
  response_footer = prompt.yes?('do you want to add a footer?', default: false)
@@ -1,23 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require_relative 'version'
5
4
 
6
5
  module Convenlu
7
6
  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
7
+ def self.read_file(path)
8
+ File.read(path)
9
+ end
10
+
11
+ def self.read_json(file)
12
+ JSON.parse(file)
21
13
  end
22
14
  end
23
15
  end
@@ -0,0 +1,4 @@
1
+ {
2
+ "subject": 50,
3
+ "body": 100
4
+ }
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Convenlu
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
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.5.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-02-14 00:00:00.000000000 Z
12
+ date: 2021-03-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -97,6 +98,7 @@ dependencies:
97
98
  description: Commit message will be formatted based on defined stantards
98
99
  email:
99
100
  - juliocabrera820@gmail.com
101
+ - eusebioajas6@gmail.com
100
102
  executables:
101
103
  - convenlu
102
104
  extensions: []
@@ -107,12 +109,15 @@ files:
107
109
  - bin/setup
108
110
  - lib/convenlu.rb
109
111
  - lib/convenlu/convention.json
112
+ - lib/convenlu/convention_file.rb
110
113
  - lib/convenlu/format.rb
111
114
  - lib/convenlu/interface.rb
112
115
  - lib/convenlu/prompt.rb
113
116
  - lib/convenlu/reader.rb
114
117
  - lib/convenlu/repository.rb
118
+ - lib/convenlu/rules.json
115
119
  - lib/convenlu/spinner.rb
120
+ - lib/convenlu/standard.rb
116
121
  - lib/convenlu/version.rb
117
122
  homepage: https://github.com/juliocabrera820/convenlu
118
123
  licenses: