lite-decorator 1.0.1 → 1.0.2
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 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +54 -54
- data/README.md +14 -10
- data/lib/generators/rails/USAGE +0 -1
- data/lib/generators/rails/decorator_generator.rb +0 -6
- data/lib/generators/rails/templates/decorator.rb.tt +1 -1
- data/lib/lite/decorator/version.rb +1 -1
- data/lib/lite/decorator.rb +0 -1
- metadata +3 -6
- data/lib/generators/lite/decorator/install_generator.rb +0 -17
- data/lib/generators/lite/decorator/templates/install.rb +0 -4
- data/lib/generators/rails/templates/spec.rb.tt +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8f590887adbfbc787652b595395aca01700c7169a77ef6d7b7a5630dda0821b
|
|
4
|
+
data.tar.gz: 6e59ffe6c8bcf5e49154f6f8cc1d3189df6601b0c15a05d59d55a8514a56c736
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba89992c465fd806edbd55d7ab95a16701ae857f5d1210e3942714461ca52dd959b2776d7406642a8bab8c39424f1ca81d4a72212486796825f0e21e8c0c25ff
|
|
7
|
+
data.tar.gz: bcdfa0ab0388a69d98f9d258de4b031d5aa092ade4dd7238f6ff908974aafc4ac27c049e638ae3635f1d7f3a3b6f86e0caad925100e0c0c3a3f75cc78a050d0e
|
data/.rubocop.yml
CHANGED
|
@@ -5,8 +5,6 @@ AllCops:
|
|
|
5
5
|
TargetRubyVersion: 2.6
|
|
6
6
|
DisplayCopNames: true
|
|
7
7
|
DisplayStyleGuide: true
|
|
8
|
-
LineLength:
|
|
9
|
-
Max: 100
|
|
10
8
|
Layout/EmptyLinesAroundBlockBody:
|
|
11
9
|
Exclude:
|
|
12
10
|
- 'spec/**/**/*'
|
|
@@ -14,6 +12,8 @@ Layout/EmptyLinesAroundClassBody:
|
|
|
14
12
|
EnforcedStyle: empty_lines_except_namespace
|
|
15
13
|
Layout/EmptyLinesAroundModuleBody:
|
|
16
14
|
EnforcedStyle: empty_lines_except_namespace
|
|
15
|
+
Layout/LineLength:
|
|
16
|
+
Max: 100
|
|
17
17
|
Metrics/BlockLength:
|
|
18
18
|
Exclude:
|
|
19
19
|
- 'spec/**/**/*'
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.0.2] - 2019-12-20
|
|
10
|
+
### Removed
|
|
11
|
+
- Removed lite-decorator generator
|
|
12
|
+
- Removed spec from rails generator
|
|
13
|
+
|
|
9
14
|
## [1.0.1] - 2019-09-02
|
|
10
15
|
### Added
|
|
11
16
|
- Add rails generators
|
data/Gemfile.lock
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lite-decorator (1.0.
|
|
4
|
+
lite-decorator (1.0.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
actionpack (6.0.
|
|
10
|
-
actionview (= 6.0.
|
|
11
|
-
activesupport (= 6.0.
|
|
12
|
-
rack (~> 2.0)
|
|
9
|
+
actionpack (6.0.2.1)
|
|
10
|
+
actionview (= 6.0.2.1)
|
|
11
|
+
activesupport (= 6.0.2.1)
|
|
12
|
+
rack (~> 2.0, >= 2.0.8)
|
|
13
13
|
rack-test (>= 0.6.3)
|
|
14
14
|
rails-dom-testing (~> 2.0)
|
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
16
|
-
actionview (6.0.
|
|
17
|
-
activesupport (= 6.0.
|
|
16
|
+
actionview (6.0.2.1)
|
|
17
|
+
activesupport (= 6.0.2.1)
|
|
18
18
|
builder (~> 3.1)
|
|
19
19
|
erubi (~> 1.4)
|
|
20
20
|
rails-dom-testing (~> 2.0)
|
|
21
21
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
22
|
-
activemodel (6.0.
|
|
23
|
-
activesupport (= 6.0.
|
|
24
|
-
activerecord (6.0.
|
|
25
|
-
activemodel (= 6.0.
|
|
26
|
-
activesupport (= 6.0.
|
|
27
|
-
activesupport (6.0.
|
|
22
|
+
activemodel (6.0.2.1)
|
|
23
|
+
activesupport (= 6.0.2.1)
|
|
24
|
+
activerecord (6.0.2.1)
|
|
25
|
+
activemodel (= 6.0.2.1)
|
|
26
|
+
activesupport (= 6.0.2.1)
|
|
27
|
+
activesupport (6.0.2.1)
|
|
28
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
29
29
|
i18n (>= 0.7, < 2)
|
|
30
30
|
minitest (~> 5.1)
|
|
31
31
|
tzinfo (~> 1.1)
|
|
32
|
-
zeitwerk (~> 2.
|
|
32
|
+
zeitwerk (~> 2.2)
|
|
33
33
|
ast (2.4.0)
|
|
34
|
-
builder (3.2.
|
|
34
|
+
builder (3.2.4)
|
|
35
35
|
colorize (0.8.1)
|
|
36
36
|
concurrent-ruby (1.1.5)
|
|
37
|
-
crass (1.0.
|
|
37
|
+
crass (1.0.5)
|
|
38
38
|
database_cleaner (1.7.0)
|
|
39
39
|
diff-lcs (1.3)
|
|
40
|
-
erubi (1.
|
|
41
|
-
fasterer (0.
|
|
40
|
+
erubi (1.9.0)
|
|
41
|
+
fasterer (0.8.1)
|
|
42
42
|
colorize (~> 0.7)
|
|
43
|
-
ruby_parser (>= 3.
|
|
43
|
+
ruby_parser (>= 3.14.1)
|
|
44
44
|
generator_spec (0.9.4)
|
|
45
45
|
activesupport (>= 3.0.0)
|
|
46
46
|
railties (>= 3.0.0)
|
|
47
|
-
i18n (1.
|
|
47
|
+
i18n (1.7.0)
|
|
48
48
|
concurrent-ruby (~> 1.0)
|
|
49
|
-
jaro_winkler (1.5.
|
|
50
|
-
loofah (2.
|
|
49
|
+
jaro_winkler (1.5.4)
|
|
50
|
+
loofah (2.4.0)
|
|
51
51
|
crass (~> 1.0.2)
|
|
52
52
|
nokogiri (>= 1.5.9)
|
|
53
53
|
method_source (0.9.2)
|
|
54
54
|
mini_portile2 (2.4.0)
|
|
55
|
-
minitest (5.
|
|
56
|
-
nokogiri (1.10.
|
|
55
|
+
minitest (5.13.0)
|
|
56
|
+
nokogiri (1.10.7)
|
|
57
57
|
mini_portile2 (~> 2.4.0)
|
|
58
|
-
parallel (1.
|
|
59
|
-
parser (2.6.
|
|
58
|
+
parallel (1.19.1)
|
|
59
|
+
parser (2.6.5.0)
|
|
60
60
|
ast (~> 2.4.0)
|
|
61
|
-
rack (2.0.
|
|
61
|
+
rack (2.0.8)
|
|
62
62
|
rack-test (1.1.0)
|
|
63
63
|
rack (>= 1.0, < 3)
|
|
64
64
|
rails-dom-testing (2.0.3)
|
|
65
65
|
activesupport (>= 4.2.0)
|
|
66
66
|
nokogiri (>= 1.6)
|
|
67
|
-
rails-html-sanitizer (1.
|
|
68
|
-
loofah (~> 2.
|
|
69
|
-
railties (6.0.
|
|
70
|
-
actionpack (= 6.0.
|
|
71
|
-
activesupport (= 6.0.
|
|
67
|
+
rails-html-sanitizer (1.3.0)
|
|
68
|
+
loofah (~> 2.3)
|
|
69
|
+
railties (6.0.2.1)
|
|
70
|
+
actionpack (= 6.0.2.1)
|
|
71
|
+
activesupport (= 6.0.2.1)
|
|
72
72
|
method_source
|
|
73
73
|
rake (>= 0.8.7)
|
|
74
74
|
thor (>= 0.20.3, < 2.0)
|
|
75
75
|
rainbow (3.0.0)
|
|
76
|
-
rake (
|
|
77
|
-
rspec (3.
|
|
78
|
-
rspec-core (~> 3.
|
|
79
|
-
rspec-expectations (~> 3.
|
|
80
|
-
rspec-mocks (~> 3.
|
|
81
|
-
rspec-core (3.
|
|
82
|
-
rspec-support (~> 3.
|
|
83
|
-
rspec-expectations (3.
|
|
76
|
+
rake (13.0.1)
|
|
77
|
+
rspec (3.9.0)
|
|
78
|
+
rspec-core (~> 3.9.0)
|
|
79
|
+
rspec-expectations (~> 3.9.0)
|
|
80
|
+
rspec-mocks (~> 3.9.0)
|
|
81
|
+
rspec-core (3.9.0)
|
|
82
|
+
rspec-support (~> 3.9.0)
|
|
83
|
+
rspec-expectations (3.9.0)
|
|
84
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
85
|
-
rspec-support (~> 3.
|
|
86
|
-
rspec-mocks (3.
|
|
85
|
+
rspec-support (~> 3.9.0)
|
|
86
|
+
rspec-mocks (3.9.0)
|
|
87
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
88
|
-
rspec-support (~> 3.
|
|
89
|
-
rspec-support (3.
|
|
90
|
-
rubocop (0.
|
|
88
|
+
rspec-support (~> 3.9.0)
|
|
89
|
+
rspec-support (3.9.0)
|
|
90
|
+
rubocop (0.78.0)
|
|
91
91
|
jaro_winkler (~> 1.5.1)
|
|
92
92
|
parallel (~> 1.10)
|
|
93
93
|
parser (>= 2.6)
|
|
94
94
|
rainbow (>= 2.2.2, < 4.0)
|
|
95
95
|
ruby-progressbar (~> 1.7)
|
|
96
96
|
unicode-display_width (>= 1.4.0, < 1.7)
|
|
97
|
-
rubocop-performance (1.
|
|
97
|
+
rubocop-performance (1.5.1)
|
|
98
98
|
rubocop (>= 0.71.0)
|
|
99
|
-
rubocop-rspec (1.
|
|
100
|
-
rubocop (>= 0.
|
|
99
|
+
rubocop-rspec (1.37.1)
|
|
100
|
+
rubocop (>= 0.68.1)
|
|
101
101
|
ruby-progressbar (1.10.1)
|
|
102
|
-
ruby_parser (3.
|
|
102
|
+
ruby_parser (3.14.1)
|
|
103
103
|
sexp_processor (~> 4.9)
|
|
104
|
-
sexp_processor (4.
|
|
105
|
-
sqlite3 (1.4.
|
|
106
|
-
thor (0.
|
|
104
|
+
sexp_processor (4.13.0)
|
|
105
|
+
sqlite3 (1.4.2)
|
|
106
|
+
thor (1.0.1)
|
|
107
107
|
thread_safe (0.3.6)
|
|
108
108
|
tzinfo (1.2.5)
|
|
109
109
|
thread_safe (~> 0.1)
|
|
110
110
|
unicode-display_width (1.6.0)
|
|
111
|
-
zeitwerk (2.
|
|
111
|
+
zeitwerk (2.2.2)
|
|
112
112
|
|
|
113
113
|
PLATFORMS
|
|
114
114
|
ruby
|
|
@@ -128,4 +128,4 @@ DEPENDENCIES
|
|
|
128
128
|
sqlite3
|
|
129
129
|
|
|
130
130
|
BUNDLED WITH
|
|
131
|
-
2.0.
|
|
131
|
+
2.0.2
|
data/README.md
CHANGED
|
@@ -27,22 +27,26 @@ Or install it yourself as:
|
|
|
27
27
|
* [Setup](#setup)
|
|
28
28
|
* [Usage](#usage)
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Setup
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
`../app/decorators/application_decorator.rb`
|
|
32
|
+
### Generator
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
Use `rails g decorator NAME` will generate the following files:
|
|
35
|
+
|
|
36
|
+
```erb
|
|
37
|
+
app/decorators/[name]_decorator.rb
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
If a `ApplicationDecorator` file in the `app/decorators` directory is available, the
|
|
41
|
+
generator will create file that inherit from `ApplicationDecorator` if not it will
|
|
42
|
+
fallback to `Lite::Decorator::Base`.
|
|
43
|
+
|
|
44
|
+
## Decorator
|
|
41
45
|
|
|
42
|
-
You will
|
|
46
|
+
You will need to fill this class with the methods you want to decorate:
|
|
43
47
|
|
|
44
48
|
```ruby
|
|
45
|
-
class UserDecorator <
|
|
49
|
+
class UserDecorator < Lite::Decorator::Base
|
|
46
50
|
|
|
47
51
|
def full_name
|
|
48
52
|
first_name + ' ' + last_name
|
|
@@ -51,7 +55,7 @@ class UserDecorator < ApplicationDecorator
|
|
|
51
55
|
end
|
|
52
56
|
```
|
|
53
57
|
|
|
54
|
-
##
|
|
58
|
+
## Usage
|
|
55
59
|
|
|
56
60
|
To access the decorator you need to pass the object to the decorator class and thats it.
|
|
57
61
|
You can even decorate a collection of objects by passing the collection to `decorate`.
|
data/lib/generators/rails/USAGE
CHANGED
|
@@ -14,12 +14,6 @@ module Rails
|
|
|
14
14
|
template('decorator.rb.tt', path)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def copy_specs
|
|
18
|
-
path = File.join('spec', 'decorators', class_path, "#{file_name}_decorator_spec.rb")
|
|
19
|
-
empty_directory('spec/decorators')
|
|
20
|
-
template('spec.rb.tt', path)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
17
|
private
|
|
24
18
|
|
|
25
19
|
def file_name
|
data/lib/lite/decorator.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lite-decorator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
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-12-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -186,12 +186,9 @@ files:
|
|
|
186
186
|
- _config.yml
|
|
187
187
|
- bin/console
|
|
188
188
|
- bin/setup
|
|
189
|
-
- lib/generators/lite/decorator/install_generator.rb
|
|
190
|
-
- lib/generators/lite/decorator/templates/install.rb
|
|
191
189
|
- lib/generators/rails/USAGE
|
|
192
190
|
- lib/generators/rails/decorator_generator.rb
|
|
193
191
|
- lib/generators/rails/templates/decorator.rb.tt
|
|
194
|
-
- lib/generators/rails/templates/spec.rb.tt
|
|
195
192
|
- lib/lite/decorator.rb
|
|
196
193
|
- lib/lite/decorator/base.rb
|
|
197
194
|
- lib/lite/decorator/version.rb
|
|
@@ -215,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
215
212
|
- !ruby/object:Gem::Version
|
|
216
213
|
version: '0'
|
|
217
214
|
requirements: []
|
|
218
|
-
rubygems_version: 3.
|
|
215
|
+
rubygems_version: 3.1.1
|
|
219
216
|
signing_key:
|
|
220
217
|
specification_version: 4
|
|
221
218
|
summary: Ruby Decorator based framework (aka decorator/presenter objects)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails/generators'
|
|
4
|
-
|
|
5
|
-
module Lite
|
|
6
|
-
module Decorator
|
|
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/decorators/application_decorator.rb')
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|