Sha256: 38987de54e412208d826fab9b67cae6040f3bdedffe52f52868ca3c48e64235f

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

require 'sproutcore/generator_helper'

class LanguageGenerator < 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("#{file_path}.lproj",'js', nil, "#{file_path}/strings")
      build_client_directories(m, fp)
      m.template 'strings.js', fp
    end
  end

  protected
    def banner
      <<-EOS
Adds a language to a SproutCore project

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

12 entries across 12 versions & 1 rubygems

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