Sha256: a4d23ffda5400e529ab35170ccb66c4a4f2217374ec3905ccef26badca5837ed

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

require 'sproutcore/generator_helper'

class TestGenerator < 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('tests', 'rhtml')
      build_client_directories(m, fp)
      m.template 'test.rhtml', fp
    end
  end

  protected
    def banner
      <<-EOS
Add a test to a SproutCore project

USAGE: #{$0} #{spec.name} client_name/test_name
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

12 entries across 12 versions & 1 rubygems

Version Path
sproutcore-0.9.0 generators/test/test_generator.rb
sproutcore-0.9.1 generators/test/test_generator.rb
sproutcore-0.9.10 sc_generators/test/test_generator.rb
sproutcore-0.9.11 sc_generators/test/test_generator.rb
sproutcore-0.9.2 generators/test/test_generator.rb
sproutcore-0.9.5 generators/test/test_generator.rb
sproutcore-0.9.3 generators/test/test_generator.rb
sproutcore-0.9.4 generators/test/test_generator.rb
sproutcore-0.9.9 generators/test/test_generator.rb
sproutcore-0.9.8 generators/test/test_generator.rb
sproutcore-0.9.6 generators/test/test_generator.rb
sproutcore-0.9.7 generators/test/test_generator.rb