Sha256: 5e497dc6d2308251388e3441427fd55d88f801874fc296c183815ef4f7f7a765

Contents?: true

Size: 1.75 KB

Versions: 16

Compression:

Stored size: 1.75 KB

Contents

require "#{File.dirname(__FILE__)}/../../lib/coherent"

class GalleryGenerator < CoherentBaseGenerator

  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
                              Config::CONFIG['ruby_install_name'])

  COHERENT_URL = ""
  COHERENT_FOLDER = "ext/coherent"
  
  default_options :author => nil

  attr_reader :name, :nib_name

  def initialize(runtime_args, runtime_options = {})
    super
    usage if args.empty?
    @destination_root = File.expand_path(args.shift)
    @name = base_name
    extract_options
  end

  def manifest
    record do |m|
      # Ensure appropriate folder(s) exists
      m.directory ''
      BASEDIRS.each { |path| m.directory path }

      copy_template_folder m
    end
  end

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

USAGE: #{spec.name} name
EOS
    end

    def add_options!(opts)
      opts.separator ''
      opts.separator 'Options:'
      # For each option below, place the default
      # at the top of the file next to "default_options"
      # opts.on("-a", "--author=\"Your Name\"", String,
      #         "Some comment about this option",
      #         "Default: none") { |o| options[:author] = o }
      opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
    end

    def extract_options
      # 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]
      @nib_name= options[:nib_name]
    end

    # Installation skeleton.  Intermediate directories are automatically
    # created so don't sweat their absence here.
    BASEDIRS = %w(
      src
      test
    )
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
coherent-0.6.11 demo_generators/gallery/gallery_generator.rb
coherent-0.6.10 demo_generators/gallery/gallery_generator.rb
coherent-0.6.9 demo_generators/gallery/gallery_generator.rb
coherent-0.6.8 demo_generators/gallery/gallery_generator.rb
coherent-0.6.7 demo_generators/gallery/gallery_generator.rb
coherent-0.6.6 demo_generators/gallery/gallery_generator.rb
coherent-0.6.5 demo_generators/gallery/gallery_generator.rb
coherent-0.6.4 demo_generators/gallery/gallery_generator.rb
coherent-0.6.2 demo_generators/gallery/gallery_generator.rb
coherent-0.6.1 demo_generators/gallery/gallery_generator.rb
coherent-0.6.0 demo_generators/gallery/gallery_generator.rb
coherent-0.4.3 demo_generators/gallery/gallery_generator.rb
coherent-0.4.2 demo_generators/gallery/gallery_generator.rb
coherent-0.4.1 demo_generators/gallery/gallery_generator.rb
coherent-0.4.0 demo_generators/gallery/gallery_generator.rb
coherent-0.3.0 demo_generators/gallery/gallery_generator.rb