lite-component 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/generators/rails/component_generator.rb +31 -15
- data/lib/generators/rails/templates/{install.js → component.js} +0 -0
- data/lib/generators/rails/templates/component.rb.tt +6 -0
- data/lib/generators/rails/templates/{install.scss → component.scss} +0 -0
- data/lib/lite/component/version.rb +1 -1
- metadata +5 -5
- data/lib/generators/rails/templates/install.rb.erb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e363087100ee78c9e7a154815680d42707467ff16f9f77606c8cfecf4e7afe7a
|
4
|
+
data.tar.gz: fefd80fb36d4fd2e35e533258fb27434c18e78841f0c5d3ebd5f4cb83b58efa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cceae23254cf5e0e80693929580910a6c798a6201f03280504700a81381dfecb71f2eb5c322b76c98aa5e06ec6ce1b83583c8a8cdf2ed8efa32725f44df0404
|
7
|
+
data.tar.gz: 0ad326b891c245dc231f15b366f33f11a7196a7c7d2190abdcb8fa297086ab35ac042a8abd427e496ca22bd07a63b0069150a8a61bc6e1426d84a169b6068ac6
|
data/.rubocop.yml
CHANGED
@@ -12,14 +12,16 @@ Layout/EmptyLinesAroundClassBody:
|
|
12
12
|
EnforcedStyle: empty_lines_except_namespace
|
13
13
|
Layout/EmptyLinesAroundModuleBody:
|
14
14
|
EnforcedStyle: empty_lines_except_namespace
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 100
|
15
17
|
Metrics/BlockLength:
|
16
18
|
Enabled: false
|
17
19
|
Metrics/ClassLength:
|
18
20
|
Enabled: false
|
19
|
-
Metrics/LineLength:
|
20
|
-
Max: 100
|
21
21
|
Naming/FileName:
|
22
22
|
Enabled: false
|
23
|
+
Naming/MemoizedInstanceVariableName:
|
24
|
+
Enabled: false
|
23
25
|
RSpec/ExampleLength:
|
24
26
|
Enabled: false
|
25
27
|
RSpec/MultipleExpectations:
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.0.3] - 2019-12-20
|
10
|
+
### Changed
|
11
|
+
- Reworked component generator
|
12
|
+
|
9
13
|
## [1.0.2] - 2019-12-19
|
10
14
|
### Changed
|
11
15
|
- Rewrite the internals of component building and rendering
|
data/Gemfile.lock
CHANGED
@@ -5,37 +5,53 @@ require 'rails/generators'
|
|
5
5
|
module Rails
|
6
6
|
class ComponentGenerator < Rails::Generators::NamedBase
|
7
7
|
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
check_class_collision suffix: 'Component'
|
10
|
+
|
8
11
|
class_option :skip_erb, type: :boolean, default: false
|
9
12
|
class_option :skip_css, type: :boolean, default: false
|
10
13
|
class_option :skip_js, type: :boolean, default: false
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
template('install.rb.erb', "app/components/#{name}_component.rb")
|
15
|
+
def copy_components
|
16
|
+
path = File.join('app', 'components', class_path, "#{file_name}_component.rb")
|
17
|
+
empty_directory('app/components')
|
18
|
+
template('component.rb.tt', path)
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
21
|
+
def create_erbs
|
20
22
|
return if options['skip_erb']
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
create_file("app/views/components/#{file_parts.join('/')}")
|
24
|
+
path = File.join('app', 'views', 'components', class_path, "_#{file_name}.html.erb")
|
25
|
+
empty_directory('app/views')
|
26
|
+
create_file(path)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def copy_javascripts
|
30
30
|
return if options['skip_js']
|
31
31
|
|
32
|
-
|
32
|
+
path = File.join('app', 'assets', 'javascripts', 'components', class_path, "#{file_name}.js")
|
33
|
+
empty_directory('app/assets')
|
34
|
+
template('component.js', path)
|
33
35
|
end
|
34
36
|
|
35
|
-
|
37
|
+
# rubocop:disable Layout/LineLength
|
38
|
+
def copy_stylesheets
|
36
39
|
return if options['skip_css']
|
37
40
|
|
38
|
-
|
41
|
+
path = File.join('app', 'assets', 'stylesheets', 'components', class_path, "#{file_name}.scss")
|
42
|
+
empty_directory('app/assets')
|
43
|
+
template('component.scss', path)
|
44
|
+
end
|
45
|
+
# rubocop:enable Layout/LineLength
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def file_name
|
50
|
+
@_file_name ||= remove_possible_suffix(super)
|
51
|
+
end
|
52
|
+
|
53
|
+
def remove_possible_suffix(name)
|
54
|
+
name.sub(/_?component$/i, '')
|
39
55
|
end
|
40
56
|
|
41
57
|
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-component
|
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-12-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -161,9 +161,9 @@ files:
|
|
161
161
|
- bin/setup
|
162
162
|
- lib/generators/rails/USAGE
|
163
163
|
- lib/generators/rails/component_generator.rb
|
164
|
-
- lib/generators/rails/templates/
|
165
|
-
- lib/generators/rails/templates/
|
166
|
-
- lib/generators/rails/templates/
|
164
|
+
- lib/generators/rails/templates/component.js
|
165
|
+
- lib/generators/rails/templates/component.rb.tt
|
166
|
+
- lib/generators/rails/templates/component.scss
|
167
167
|
- lib/lite/component.rb
|
168
168
|
- lib/lite/component/base.rb
|
169
169
|
- lib/lite/component/collection.rb
|