Sha256: af2148f3b0c5eb60e34c87ab2b31a465b1082d57eff8fefeb4b4741fba30ffab
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require 'active_support/core_ext' module Jax module Generators module LightSource class LightSourceGenerator < Jax::Generators::PluggableCommand argument :name, :desc => "The name of this light source", :banner => "[name]" argument :type, :default => "point", :desc => "The light type: one of 'point', 'spot', 'directional'", :banner => "[point|spot|directional]" def self.source_root File.expand_path("templates", File.dirname(__FILE__)) end def light template 'light.yml.tt', File.join("app/resources/light_sources", "#{file_name}.yml") end protected def jax_light_type type = self.type.strip.upcase case type when 'POINT', 'SPOT', 'DIRECTIONAL' then return type+"_LIGHT" else raise ArgumentError, "Unexpected light type: "+type end end def banner "jax generate light #{self.arguments.map { |a| a.usage }.join(' ')}" end def file_name name.underscore end def class_name name.camelize end def plural_name name.pluralize end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems