Class: DartTrails::Tilt::Engine
- Inherits:
-
Object
- Object
- DartTrails::Tilt::Engine
- Includes:
- Logging
- Defined in:
- lib/dart_trails/tilt/engine.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#compile ⇒ Object
This should return a string, the creation of a file is an unfortunate side effect (the dart2js compiler does not allow you to direct the compiled output to stdout).
- #config ⇒ Object
-
#initialize(file, data, options = {}) ⇒ Engine
constructor
A new instance of Engine.
Methods included from Logging
Constructor Details
#initialize(file, data, options = {}) ⇒ Engine
Returns a new instance of Engine.
9 10 11 12 |
# File 'lib/dart_trails/tilt/engine.rb', line 9 def initialize(file, data, = {}) @options = defaults.merge() @file = fetch_file(file, data) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/dart_trails/tilt/engine.rb', line 7 def file @file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/dart_trails/tilt/engine.rb', line 7 def @options end |
Instance Method Details
#compile ⇒ Object
This should return a string, the creation of a file is an unfortunate side effect (the dart2js compiler does not allow you to direct the compiled output to stdout). So I will need to read in the file, and unlink it when I am finished with it.
Also keep in mind that dart2js also creates .deps and .map files which will need to be cleaned up.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dart_trails/tilt/engine.rb', line 26 def compile redirect = { [:out, :err] => '/dev/null' } success = system( command, *, output_file_option, input_file, redirect ) if success log(:info, "Successfully compiled #{file.path}.") read_and_unlink else log(:error, "Failed to compile #{file.path}.") '' end end |
#config ⇒ Object
14 15 16 |
# File 'lib/dart_trails/tilt/engine.rb', line 14 def config DartTrails end |