trailblazer-generator 0.1.0 → 0.2.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb9a67ff10d18f3e0fb7f311aa0da6935d99271
|
4
|
+
data.tar.gz: '09677213244d6fb93ed3b003f20dd0c51fdf1b6e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d7af331322f3b78092f19a7738a6e886eb5a236bf9ccfa2287745dda1654bb626e5506a8885bb51558ed4e249979149a67ed2c9418570a7f9690b5c6f35542
|
7
|
+
data.tar.gz: 5a4d6388cb8225f66d4ea6d5802646acb5c2af252b67a86efd7ddaee852b46adda6e0d8d3060137c97023f26fe5824ccde91cabfe74ddc56a14176672cc69862
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## 0.0.2 - 2017-11-02
|
10
|
+
### Added
|
11
|
+
- Support --template-engine option (@emaglio)
|
12
|
+
|
13
|
+
## 0.0.1 - 2017-11-02
|
14
|
+
### Added
|
15
|
+
- Initial Release
|
16
|
+
|
17
|
+
[Unreleased]: https://github.com/fernandes/changelog/compare/v0.2.0...HEAD
|
@@ -8,13 +8,14 @@ class Trailblazer::Generator::Builder::View < Trailblazer::Operation
|
|
8
8
|
|
9
9
|
def generate_actions!(options, params:)
|
10
10
|
actions = params[:options]['actions'].split(',')
|
11
|
+
template_engine = params[:options]['template_engine']
|
11
12
|
actions.each do |action|
|
12
|
-
generate_file(options, name: params[:name], action: action)
|
13
|
+
generate_file(options, name: params[:name], action: action, template_engine: template_engine)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
|
-
def generate_file(options, name:, action:)
|
18
|
+
def generate_file(options, name:, action:, template_engine:)
|
18
19
|
model = Trailblazer::Generator::Cell.build_model(
|
19
20
|
name: name, action: action
|
20
21
|
)
|
@@ -22,7 +23,7 @@ class Trailblazer::Generator::Builder::View < Trailblazer::Operation
|
|
22
23
|
content = Cell.(model, params)
|
23
24
|
|
24
25
|
name = Trailblazer::Generator::Inflector.underscore(name)
|
25
|
-
path = File.join('app', 'concepts', name, 'view', "#{action}
|
26
|
+
path = File.join('app', 'concepts', name, 'view', "#{action}.#{template_engine}")
|
26
27
|
|
27
28
|
Trailblazer::Generator::Output.new(path: path, content: content).save
|
28
29
|
end
|
@@ -4,10 +4,26 @@ module Trailblazer
|
|
4
4
|
desc "cell NAME", "Generates cell file"
|
5
5
|
long_desc <<-CELL_LONG_DESC
|
6
6
|
|
7
|
-
`generate cell` generate cell file
|
7
|
+
`generate cell` generate cell and view file
|
8
|
+
|
9
|
+
Actions Available:
|
10
|
+
* new
|
11
|
+
* show
|
12
|
+
* index (will generate item as well)
|
13
|
+
* edit
|
14
|
+
* generic (if name doesn't match above, is generic)
|
15
|
+
|
16
|
+
Template Engine for view:
|
17
|
+
* default => erb
|
18
|
+
|
19
|
+
Examples:
|
20
|
+
`generate cell BlogPost --actions index,foo --template-engine slim`
|
21
|
+
|
22
|
+
Will generate an index, item and foo cell files and the corrisponding template using slim
|
8
23
|
|
9
24
|
CELL_LONG_DESC
|
10
25
|
options actions: :required
|
26
|
+
option :template_engine, default: "erb"
|
11
27
|
def cell(name)
|
12
28
|
Trailblazer::Generator::Builder::Cell.(name: name, options: options)
|
13
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Celso Fernandes
|
@@ -162,6 +162,7 @@ extra_rdoc_files: []
|
|
162
162
|
files:
|
163
163
|
- ".gitignore"
|
164
164
|
- ".travis.yml"
|
165
|
+
- CHANGELOG.md
|
165
166
|
- Gemfile
|
166
167
|
- Guardfile
|
167
168
|
- LICENSE.txt
|