Class: Detroit::Erbside
- Inherits:
-
Tool
- Object
- Tool
- Detroit::Erbside
- Includes:
- Standard
- Defined in:
- lib/detroit-erbside.rb
Overview
Erbside tool is an inline templating tool for source code. It can be useful for keeping information uptodate that is static in code, but dynamic to the project itself. A good example a ‘VERSION` constant.
module MyApp
VERSION = "1.2.0" #:erb: VERSION = "<%= version %>"
...
Constant Summary collapse
- MANPAGE =
Loction of manpage for tool.
File.dirname(__FILE__) + '/../man/detroit-erbside.5'
Instance Attribute Summary collapse
-
#exclude ⇒ Object
Exclude subpaths from ‘path`.
-
#ignore ⇒ Object
Exclude subpaths from ‘path` by matching basename.
-
#path ⇒ Object
Paths of lifes to render.
-
#prompt ⇒ Object
Prompt on each write.
-
#resources ⇒ Object
Metadata resources, default is project metadata.
Instance Method Summary collapse
-
#assemble?(station, options = {}) ⇒ Boolean
This tool ties into the ‘generate` station of the standard assembly.
-
#generate ⇒ Object
Render templates.
-
#prerequisite ⇒ void
Load requirements and set attribute defaults.
Instance Attribute Details
#exclude ⇒ Object
Exclude subpaths from ‘path`.
45 46 47 |
# File 'lib/detroit-erbside.rb', line 45 def exclude @exclude end |
#ignore ⇒ Object
Exclude subpaths from ‘path` by matching basename.
48 49 50 |
# File 'lib/detroit-erbside.rb', line 48 def ignore @ignore end |
#path ⇒ Object
Paths of lifes to render.
39 40 41 |
# File 'lib/detroit-erbside.rb', line 39 def path @path end |
#prompt ⇒ Object
Prompt on each write.
51 52 53 |
# File 'lib/detroit-erbside.rb', line 51 def prompt @prompt end |
#resources ⇒ Object
Metadata resources, default is project metadata.
54 55 56 |
# File 'lib/detroit-erbside.rb', line 54 def resources @resources end |
Instance Method Details
#assemble?(station, options = {}) ⇒ Boolean
This tool ties into the ‘generate` station of the standard assembly.
74 75 76 |
# File 'lib/detroit-erbside.rb', line 74 def assemble?(station, ={}) return true if station == :generate end |
#generate ⇒ Object
Render templates.
60 61 62 63 64 65 66 67 68 |
# File 'lib/detroit-erbside.rb', line 60 def generate = {} [:prompt] = prompt [:exclude] = exclude [:ignore] = ignore [:resources] = resources || ::Erbside::Runner.new(path, ).render end |
#prerequisite ⇒ void
This method returns an undefined value.
Load requirements and set attribute defaults.
31 32 33 34 35 36 |
# File 'lib/detroit-erbside.rb', line 31 def prerequisite require 'erbside' require 'shellwords' @path = 'lib' end |