class Detroit::Erbside
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 %>" ...
Constants
- MANPAGE
Loction of manpage for tool.
Attributes
exclude[RW]
Exclude subpaths from `path`.
ignore[RW]
Exclude subpaths from `path` by matching basename.
path[RW]
Paths of lifes to render.
prompt[RW]
Prompt on each write.
resources[RW]
Metadata resources, default is project metadata.
Public Instance Methods
assemble?(station, options={})
click to toggle source
This tool ties into the `generate` station of the standard assembly.
@return [Boolean]
# File lib/detroit-erbside.rb, line 74 def assemble?(station, options={}) return true if station == :generate end
generate()
click to toggle source
Render templates.
# File lib/detroit-erbside.rb, line 60 def generate options = {} options[:prompt] = prompt options[:exclude] = exclude options[:ignore] = ignore options[:resources] = resources || metadata ::Erbside::Runner.new(path, options).render end
prerequisite()
click to toggle source
Load requirements and set attribute defaults.
@return [void]
# File lib/detroit-erbside.rb, line 31 def prerequisite require 'erbside' require 'shellwords' @path = 'lib' end
Private Instance Methods
metadata()
click to toggle source
If project metadata responds to `#to_h` then we can us it.
Calls superclass method
# File lib/detroit-erbside.rb, line 81 def metadata data = super if data.respond_to?(:to_h) data.to_h else nil end end