roger_style_guide 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/roger_style_guide/generators/component_generator.rb +20 -1
- data/lib/roger_style_guide/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4defbadc1eb9d02c26c8e4b377ac3fa31800f166
|
4
|
+
data.tar.gz: 0f98815f6336aa23483ea610a4cb01021316ae72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36139a5957fec35fb88adf4ff43796f31a5edb07c6d242daa77c8624f0fdb22c5ec933b21ebd69a2a7216286a1334a4f23b26125e82e4f458decde06fe79233a
|
7
|
+
data.tar.gz: 6f1a8c24f8aa21a24612e371e4c52817f05380b2511c518feb5dff23e301ae3dfc8faeff56d6c0740b819ab45bcc30e59f7633738dfcf8dd07966b66a5202bac
|
data/README.md
CHANGED
@@ -11,17 +11,20 @@ Quick & easy component generation:
|
|
11
11
|
|
12
12
|
`roger generate component NAME`
|
13
13
|
|
14
|
-
will generate this structure in your components path:
|
14
|
+
will generate this structure in your components path by default:
|
15
15
|
```
|
16
16
|
NAME.html.erb
|
17
17
|
_NAME.html.erb
|
18
18
|
_NAME.scss
|
19
19
|
```
|
20
20
|
|
21
|
+
If you have a `PROJECT_PATH/lib/component_template` directory it will use that. This makes it easier to use custom templates.
|
22
|
+
|
21
23
|
Options for the command are:
|
22
24
|
|
23
25
|
* `--js` : Will generate a `NAME.js` file too
|
24
26
|
* `--extension=EXT` : Will generate a `_NAME.EXT` instead of `_NAME.html.erb`
|
27
|
+
* `--template_path=PATH` : The directory to use as template (uses `roger.project.path/lib/component_template` as default and if that doesn't exist it will use the internal template).
|
25
28
|
|
26
29
|
#### Helper
|
27
30
|
The `component` function is simplification of the `partial` function. Taking this directory structure:
|
@@ -11,6 +11,12 @@ module RogerStyleGuide::Generators
|
|
11
11
|
desc: "Components path, default: roger.project.html_path/#{RogerStyleGuide.components_path}"
|
12
12
|
)
|
13
13
|
|
14
|
+
class_option(
|
15
|
+
:template_path,
|
16
|
+
type: :string,
|
17
|
+
desc: "Template path, default: roger.project.path/lib/component_template"
|
18
|
+
)
|
19
|
+
|
14
20
|
class_option(
|
15
21
|
:js,
|
16
22
|
type: :boolean,
|
@@ -25,7 +31,15 @@ module RogerStyleGuide::Generators
|
|
25
31
|
default: "html.erb")
|
26
32
|
|
27
33
|
def self.source_root
|
28
|
-
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def source_paths
|
38
|
+
if options[:template_path]
|
39
|
+
[options[:template_path]]
|
40
|
+
else
|
41
|
+
[project_template_path, File.dirname(__FILE__) + "/component/template"]
|
42
|
+
end
|
29
43
|
end
|
30
44
|
|
31
45
|
def do
|
@@ -50,6 +64,11 @@ module RogerStyleGuide::Generators
|
|
50
64
|
Roger::Cli::Base.project &&
|
51
65
|
Roger::Cli::Base.project.html_path + RogerStyleGuide.components_path
|
52
66
|
end
|
67
|
+
|
68
|
+
def project_template_path
|
69
|
+
Roger::Cli::Base.project &&
|
70
|
+
Roger::Cli::Base.project.path + "lib/component_template"
|
71
|
+
end
|
53
72
|
end
|
54
73
|
end
|
55
74
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roger_style_guide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flurin Egger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roger
|