Sha256: d9c8d14f9923dbe235aac5c4e963badc854d36aa1fb0a0adbfd7d78c988d5ff9

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module Rid::Generators
  class ApplicationGenerator < Base
    argument :app_path, :type => :string

    def create_root
      self.destination_root = File.expand_path(app_path, destination_root)
 
      empty_directory '.'
      FileUtils.cd(destination_root) if File.directory?(destination_root)
    end

    def create_root_files
      template "ridrc", ".ridrc"
      copy_file "README"
      copy_file "gitignore", ".gitignore" unless options[:skip_git]
      template "_id"
      copy_file "validate_doc_update.js"
      empty_directory "lists"
      empty_directory "shows"
      empty_directory "updates"
      empty_directory "views"
    end

    def create_attachments_files
      empty_directory "_attachments"
      inside "_attachments" do
        empty_directory "images"
        empty_directory "javascripts"
        directory "stylesheets"
        template "index.html"
      end
    end

    def create_lib_files
      empty_directory "lib"
      inside "lib" do
        copy_file "mustache.js"
        empty_directory "templates"
        inside "templates" do
          template "layout.mustache"
        end
      end
    end

    protected

    def app_name
      @app_name ||= File.basename(destination_root)
    end

    def app_title
      @app_title ||= app_name.humanize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rid-0.4.0 lib/rid/generators/application/application_generator.rb