Sha256: e402698188cd581a20d6303106f20f2f50716e05c94cdd91597e19eaecbeb537

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

require 'sproutcore/generator_helper'

class ClientGenerator < RubiGen::Base

  include SproutCore::GeneratorHelper
  
  default_options :author => nil
  
  attr_reader :name
  
  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|
      m.directory 'clients'
      apply_template(m,"clients/#{@name}")
      m.readme '../README'
    end
  end

  protected
    def banner
      <<-EOS
Creates a ...

USAGE: #{$0} #{spec.name} name
EOS
    end

    def add_options!(opts)
      opts.on('-l', "--library=LIBRARY_ROOT", String, "Specify an alternate library root other than current working directory", "Default: working directory") { |options[:library_root] | }
    end
    
    def extract_options
      # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
      @destination_root = File.expand_path(options[:library_root]) unless options[:library_root].nil?
    end
    
end

Version data entries

11 entries across 11 versions & 1 rubygems

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