Class: Jax::Generators::Material::MaterialGenerator
- Inherits:
-
PluggableCommand
- Object
- Thor::Group
- Command
- PluggableCommand
- Jax::Generators::Material::MaterialGenerator
- Defined in:
- lib/jax/generators/material/material_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = [], *other) ⇒ MaterialGenerator
constructor
A new instance of MaterialGenerator.
- #material ⇒ Object
Methods inherited from PluggableCommand
Methods inherited from Command
Methods included from Usage
Constructor Details
#initialize(args = [], *other) ⇒ MaterialGenerator
Returns a new instance of MaterialGenerator.
10 11 12 13 |
# File 'lib/jax/generators/material/material_generator.rb', line 10 def initialize(args = [], *other) chain.unshift args.pop while args.length > 1 # name is arg0 super(args, *other) end |
Class Method Details
.source_root ⇒ Object
15 16 17 |
# File 'lib/jax/generators/material/material_generator.rb', line 15 def self.source_root File.("templates", File.dirname(__FILE__)) end |
.supported_shaders ⇒ Object
50 51 52 53 54 |
# File 'lib/jax/generators/material/material_generator.rb', line 50 def supported_shaders Jax.application.shaders.select do |shader| shader.manifest && !shader.manifest.empty? end end |
Instance Method Details
#material ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jax/generators/material/material_generator.rb', line 19 def material filename = File.join("app/resources/materials", "#{file_name}.yml") if [:append] tmp = "tmp/amendment.#{file_name}.yml" template 'append.yml.tt', tmp, :verbose => false if File.file?(filename) say_status :append, filename, :green else say_status :missing, filename, :red return end File.open(filename, "a+") { |f| f.puts File.read(tmp) } # doesn't append if the end of the file matches string identically - usually useful, but in this case troublesome. # append_to_file File.join("app/resources/materials", "#{file_name}.yml"), File.read("tmp/amendment.#{file_name}.yml") remove_file tmp, :verbose => false else template 'material.yml.tt', filename end end |