Class: Pluto::Formatter
- Inherits:
-
Object
- Object
- Pluto::Formatter
- Includes:
- LogUtils::Logging, Models
- Defined in:
- lib/pluto/formatter.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(opts, config) ⇒ Formatter
constructor
A new instance of Formatter.
- #run(arg) ⇒ Object
- #site ⇒ Object
Constructor Details
#initialize(opts, config) ⇒ Formatter
Returns a new instance of Formatter.
10 11 12 13 |
# File 'lib/pluto/formatter.rb', line 10 def initialize( opts, config ) @opts = opts @config = config end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
15 16 17 |
# File 'lib/pluto/formatter.rb', line 15 def opts @opts end |
Instance Method Details
#run(arg) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pluto/formatter.rb', line 21 def run( arg ) manifest_name = opts.manifest manifest_name = manifest_name.downcase.gsub('.txt', '' ) # remove .txt if present logger.debug "manifest=#{manifest_name}" # check for matching manifests manifests = installed_template_manifests.select { |m| m[0] == manifest_name+'.txt' } if manifests.empty? puts "*** error: unknown template pack '#{manifest_name}'; use pluto -l to list installed template packs" exit 2 end manifestsrc = manifests[0][1] pakpath = opts.output_path name = arg Pakman::Templater.new.merge_pak( manifestsrc, pakpath, binding, name ) end |
#site ⇒ Object
17 18 19 |
# File 'lib/pluto/formatter.rb', line 17 def site @config end |