Sha256: d35c052d7842d98e7e57b7fed2cda68c13f1b5203ef2a9637f7fa87377a24dd4

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 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

12 entries across 12 versions & 1 rubygems

Version Path
sproutcore-0.9.12 sc_generators/client/client_generator.rb
sproutcore-0.9.15 sc_generators/client/client_generator.rb
sproutcore-0.9.13 sc_generators/client/client_generator.rb
sproutcore-0.9.14 sc_generators/client/client_generator.rb
sproutcore-0.9.19 sc_generators/client/client_generator.rb
sproutcore-0.9.16 sc_generators/client/client_generator.rb
sproutcore-0.9.17 sc_generators/client/client_generator.rb
sproutcore-0.9.18 sc_generators/client/client_generator.rb
sproutcore-0.9.21 sc_generators/client/client_generator.rb
sproutcore-0.9.20 sc_generators/client/client_generator.rb
sproutcore-0.9.23 sc_generators/client/client_generator.rb
sproutcore-0.9.22 sc_generators/client/client_generator.rb