Sha256: 7ece0c1511b11434f292fccb07cef36e6df608059102f55c4fd27ea28d27b6ef
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require 'sproutcore/generator_helper' class ControllerGenerator < RubiGen::Base include SproutCore::GeneratorHelper default_options :author => nil attr_reader :name, :client_location def initialize(runtime_args, runtime_options = {}) super usage if args.empty? @name = args.shift extract_options assign_names!(@name) end def manifest record do |m| fp = client_file_path('controllers','js','controller') build_client_directories(m, fp) m.template 'controller.js', fp fp = client_file_path('tests/controllers', 'rhtml') build_client_directories(m, fp) m.template 'test.rhtml', fp end end protected def banner <<-EOS Creates a SproutCore controller objects USAGE: #{$0} #{spec.name} client_name/controller_name [ClassName] EOS end def add_options!(opts) opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| } end def extract_options @client_location = options[:loc] # for each option, extract it into a local variable (and create an "attr_reader :author" at the top) # Templates can access these value via the attr_reader-generated methods, but not the # raw instance variable value. # @author = options[:author] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sproutcore-0.9.1 | generators/controller/controller_generator.rb |
sproutcore-0.9.0 | generators/controller/controller_generator.rb |