Sha256: bfb27f6d3203282dc7597a38847b656737e8c08fd5e57feb6ffccdeb68c797a1

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Couch::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 "couchrc", ".couchrc"
      copy_file "README"
      copy_file "gitignore", ".gitignore" unless options[:skip_git]
      template "_id.js"
      copy_file "validate_doc_update.js"
      empty_directory_with_gitkeep "lists"
      empty_directory_with_gitkeep "shows"
      empty_directory_with_gitkeep "updates"
      empty_directory_with_gitkeep "views"
    end

    def create_attachments_files
      empty_directory "_attachments"
      inside "_attachments" do
        empty_directory_with_gitkeep "images"
        empty_directory_with_gitkeep "javascripts"
        directory "stylesheets"
        template "index.html"
      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

3 entries across 3 versions & 1 rubygems

Version Path
couch-0.1.0 lib/couch/generators/application/application_generator.rb
couch-0.0.4 lib/couch/generators/application/application_generator.rb
couch-0.0.3 lib/couch/generators/application/application_generator.rb