lite-command 1.0.2 → 1.0.3
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/.rubocop.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +59 -3
- data/README.md +16 -0
- data/lib/generators/lite/command/install_generator.rb +17 -0
- data/lib/generators/lite/command/templates/install.rb +4 -0
- data/lib/generators/rails/USAGE +9 -0
- data/lib/generators/rails/command_generator.rb +34 -0
- data/lib/generators/rails/templates/command.rb.tt +6 -0
- data/lib/generators/rails/templates/spec.rb.tt +7 -0
- data/lib/lite/command.rb +3 -0
- data/lib/lite/command/version.rb +1 -1
- data/lite-command.gemspec +1 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aa7ea6342f56811303cb6cc8a66b5e18111548090782212cafc3567c8dbd35a
|
4
|
+
data.tar.gz: 28a8b68ec9dd2977cda7f393e35e63833a3f41fbff27893d6b68e4579a3d18b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c20e8692e9265e812aa384cdb85fff5fb1e1f6727478c1cbf3b665b2f1d23311d6cc9f173e2054f734a0eaf9d4df00d56433502bc8ae343357e8ecf8c54a0c1
|
7
|
+
data.tar.gz: 2852a4135fddb7c6aae80791f0cfda298c0abb04b82c44373f342733589fe363c19df52cd6361983ec402a5c93cf405639858d300ded85920ced6f6f89e0f44b
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,75 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-command (1.0.
|
4
|
+
lite-command (1.0.3)
|
5
5
|
lite-errors
|
6
6
|
lite-memoize
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
+
actionpack (6.0.0)
|
12
|
+
actionview (= 6.0.0)
|
13
|
+
activesupport (= 6.0.0)
|
14
|
+
rack (~> 2.0)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (6.0.0)
|
19
|
+
activesupport (= 6.0.0)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
activesupport (6.0.0)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
i18n (>= 0.7, < 2)
|
27
|
+
minitest (~> 5.1)
|
28
|
+
tzinfo (~> 1.1)
|
29
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
11
30
|
ast (2.4.0)
|
31
|
+
builder (3.2.3)
|
12
32
|
colorize (0.8.1)
|
33
|
+
concurrent-ruby (1.1.5)
|
34
|
+
crass (1.0.4)
|
13
35
|
diff-lcs (1.3)
|
36
|
+
erubi (1.8.0)
|
14
37
|
fasterer (0.6.0)
|
15
38
|
colorize (~> 0.7)
|
16
39
|
ruby_parser (>= 3.13.0)
|
40
|
+
generator_spec (0.9.4)
|
41
|
+
activesupport (>= 3.0.0)
|
42
|
+
railties (>= 3.0.0)
|
43
|
+
i18n (1.6.0)
|
44
|
+
concurrent-ruby (~> 1.0)
|
17
45
|
jaro_winkler (1.5.3)
|
18
46
|
lite-errors (1.0.1)
|
19
|
-
lite-memoize (1.0.
|
47
|
+
lite-memoize (1.0.3)
|
48
|
+
loofah (2.2.3)
|
49
|
+
crass (~> 1.0.2)
|
50
|
+
nokogiri (>= 1.5.9)
|
51
|
+
method_source (0.9.2)
|
52
|
+
mini_portile2 (2.4.0)
|
53
|
+
minitest (5.11.3)
|
54
|
+
nokogiri (1.10.4)
|
55
|
+
mini_portile2 (~> 2.4.0)
|
20
56
|
parallel (1.17.0)
|
21
|
-
parser (2.6.
|
57
|
+
parser (2.6.4.0)
|
22
58
|
ast (~> 2.4.0)
|
59
|
+
rack (2.0.7)
|
60
|
+
rack-test (1.1.0)
|
61
|
+
rack (>= 1.0, < 3)
|
62
|
+
rails-dom-testing (2.0.3)
|
63
|
+
activesupport (>= 4.2.0)
|
64
|
+
nokogiri (>= 1.6)
|
65
|
+
rails-html-sanitizer (1.2.0)
|
66
|
+
loofah (~> 2.2, >= 2.2.2)
|
67
|
+
railties (6.0.0)
|
68
|
+
actionpack (= 6.0.0)
|
69
|
+
activesupport (= 6.0.0)
|
70
|
+
method_source
|
71
|
+
rake (>= 0.8.7)
|
72
|
+
thor (>= 0.20.3, < 2.0)
|
23
73
|
rainbow (3.0.0)
|
24
74
|
rake (12.3.3)
|
25
75
|
rspec (3.8.0)
|
@@ -50,7 +100,12 @@ GEM
|
|
50
100
|
ruby_parser (3.13.1)
|
51
101
|
sexp_processor (~> 4.9)
|
52
102
|
sexp_processor (4.12.1)
|
103
|
+
thor (0.20.3)
|
104
|
+
thread_safe (0.3.6)
|
105
|
+
tzinfo (1.2.5)
|
106
|
+
thread_safe (~> 0.1)
|
53
107
|
unicode-display_width (1.6.0)
|
108
|
+
zeitwerk (2.1.9)
|
54
109
|
|
55
110
|
PLATFORMS
|
56
111
|
ruby
|
@@ -58,6 +113,7 @@ PLATFORMS
|
|
58
113
|
DEPENDENCIES
|
59
114
|
bundler
|
60
115
|
fasterer
|
116
|
+
generator_spec
|
61
117
|
lite-command!
|
62
118
|
rake
|
63
119
|
rspec
|
data/README.md
CHANGED
@@ -24,10 +24,21 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Table of Contents
|
26
26
|
|
27
|
+
* [Setup](#setup)
|
27
28
|
* [Simple](#simple)
|
28
29
|
* [Complex](#complex)
|
29
30
|
* [Extensions](#extensions)
|
30
31
|
|
32
|
+
## Setup
|
33
|
+
|
34
|
+
`rails g lite:command:install` will generate the following file:
|
35
|
+
`../app/commands/application_command.rb`
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
class ApplicationCommand < Lite::Command::Complex
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
31
42
|
## Simple
|
32
43
|
|
33
44
|
Simple commands build quick class based calls but cannot be extended.
|
@@ -60,6 +71,11 @@ command.call
|
|
60
71
|
Complex commands can be used in instance and class based calls and
|
61
72
|
extended with access to errors and memoization.
|
62
73
|
|
74
|
+
Use `rails g decorator NAME` will generate the following file:
|
75
|
+
`../app/decorators/[name]_decorator.rb`
|
76
|
+
|
77
|
+
You will then need to fill this class with the required `execute` method as shown below:
|
78
|
+
|
63
79
|
```ruby
|
64
80
|
class SearchMovies < Lite::Command::Complex
|
65
81
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Lite
|
6
|
+
module Command
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
|
9
|
+
source_root File.expand_path('../templates', __FILE__)
|
10
|
+
|
11
|
+
def copy_application_query_file
|
12
|
+
copy_file('install.rb', 'app/commands/application_command.rb')
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Rails
|
6
|
+
class CommandGenerator < Rails::Generators::NamedBase
|
7
|
+
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
check_class_collision suffix: 'Command'
|
10
|
+
|
11
|
+
def copy_files
|
12
|
+
path = File.join('app', 'commands', class_path, "#{file_name}_command.rb")
|
13
|
+
empty_directory('app/commands')
|
14
|
+
template('command.rb.tt', path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def copy_specs
|
18
|
+
path = File.join('spec', 'commands', class_path, "#{file_name}_command_spec.rb")
|
19
|
+
empty_directory('spec/commands')
|
20
|
+
template('spec.rb.tt', path)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def file_name
|
26
|
+
@_file_name ||= remove_possible_suffix(super)
|
27
|
+
end
|
28
|
+
|
29
|
+
def remove_possible_suffix(name)
|
30
|
+
name.sub(/_?command$/i, '')
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/lite/command.rb
CHANGED
data/lib/lite/command/version.rb
CHANGED
data/lite-command.gemspec
CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
|
43
43
|
spec.add_development_dependency 'bundler'
|
44
44
|
spec.add_development_dependency 'fasterer'
|
45
|
+
spec.add_development_dependency 'generator_spec'
|
45
46
|
spec.add_development_dependency 'rake'
|
46
47
|
spec.add_development_dependency 'rspec'
|
47
48
|
spec.add_development_dependency 'rubocop'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lite-errors
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: generator_spec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +173,12 @@ files:
|
|
159
173
|
- _config.yml
|
160
174
|
- bin/console
|
161
175
|
- bin/setup
|
176
|
+
- lib/generators/lite/command/install_generator.rb
|
177
|
+
- lib/generators/lite/command/templates/install.rb
|
178
|
+
- lib/generators/rails/USAGE
|
179
|
+
- lib/generators/rails/command_generator.rb
|
180
|
+
- lib/generators/rails/templates/command.rb.tt
|
181
|
+
- lib/generators/rails/templates/spec.rb.tt
|
162
182
|
- lib/lite/command.rb
|
163
183
|
- lib/lite/command/complex.rb
|
164
184
|
- lib/lite/command/exceptions.rb
|