trailblazer-generator 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 581643780930a5755ea935f17e700e1edcdff8aa
4
- data.tar.gz: 3b5cd01cd379be68220b5b536421d87132ba541f
3
+ metadata.gz: 8fb9a67ff10d18f3e0fb7f311aa0da6935d99271
4
+ data.tar.gz: '09677213244d6fb93ed3b003f20dd0c51fdf1b6e'
5
5
  SHA512:
6
- metadata.gz: 35a72610f78d5f6336d94314fd729d7ad9c6c6e90faa9b6a0661f83895fffbfb839a592a135c242756f05d3db02ea5ffb5258783cb4da4c220ff4559270b4af2
7
- data.tar.gz: 175a55cf36c55581c17b980ecd2bdb1c27b87e247b97f7cdc0d102875637402b9cfd56260150d33fb926f1e025d4adad17e5d35e126a273cadf2cbbced40d236
6
+ metadata.gz: 92d7af331322f3b78092f19a7738a6e886eb5a236bf9ccfa2287745dda1654bb626e5506a8885bb51558ed4e249979149a67ed2c9418570a7f9690b5c6f35542
7
+ data.tar.gz: 5a4d6388cb8225f66d4ea6d5802646acb5c2af252b67a86efd7ddaee852b46adda6e0d8d3060137c97023f26fe5824ccde91cabfe74ddc56a14176672cc69862
@@ -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}.erb")
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
@@ -1,2 +1,4 @@
1
+ <% if options[:template_engine] == 'erb' %>
1
2
  <h1><%= name %>#<%= action %></h1>
2
3
  <p>Find me in app/concepts/<%= underscore_name %>/view/<%= action %>.erb</p>
4
+ <% 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
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  module Generator
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  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.1.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