### Home Classes Methods

### In Files

- lib/padrino-gen/generators/app.rb

### Parent

Thor::Group

### Methods

- ::banner
- ::source_root
- #create_app

### Included Modules

- Thor::Actions
- Padrino::Generators::Actions

### Files

- README.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Generators
- Padrino::Generators::Actions
- Padrino::Generators::Actions::ClassMethods
- Padrino::Generators::App
- Padrino::Generators::AppRootNotFound
- Padrino::Generators::Cli
- Padrino::Generators::Component
- Padrino::Generators::Components
- Padrino::Generators::Components::Actions
- Padrino::Generators::Controller
- Padrino::Generators::Mailer
- Padrino::Generators::Migration
- Padrino::Generators::Model
- Padrino::Generators::Plugin
- Padrino::Generators::Project
- Padrino::Generators::Runner
- Padrino::Generators::SqlHelpers
- Padrino::Generators::Task
- ActiveRecord
- ActiveRecord::Schema
- Object

No matching classes.

# Padrino::Generators::App

Responsible for applications within a Padrino project. Creates and mounts the application and gives the user related information.

### Public Class Methods

banner() click to toggle source

    # File lib/padrino-gen/generators/app.rb, line 13
    def self.banner; "padrino-gen app [name]"; end

source_root() click to toggle source

    # File lib/padrino-gen/generators/app.rb, line 12
    def self.source_root; File.expand_path(File.dirname(__FILE__)); end

### Public Instance Methods

create_app() click to toggle source

Copies over the Padrino base admin application.

    # File lib/padrino-gen/generators/app.rb, line 31
    def create_app
      self.destination_root = options[:root]
      @app_folder = name.gsub(/\W/, '_').underscore
      @app_name   = @app_folder.camelize
      if in_app_root?
        @project_name = options[:namespace].underscore.camelize
        @project_name = fetch_project_name(@app_folder) if @project_name.empty?
        if already_exists?(@app_name, @project_name)
          say "#{@app_name} already exists."
          say "Please, change the name."
          return
        else
          lowercase_app_folder = @app_folder.downcase
          self.behavior = :revoke if options[:destroy]
          app_skeleton(lowercase_app_folder, options[:tiny])
          empty_directory destination_root("public/#{lowercase_app_folder}")
          inject_into_file destination_root('config/apps.rb'), "\nPadrino.mount('#{@project_name}::#{@app_name}', :app_file => Padrino.root('#{lowercase_app_folder}/app.rb')).to('/#{lowercase_app_folder}')\n", :before => /^Padrino.mount.*\.to\('\/'\)$/

          return if self.behavior == :revoke
          say
          say '=' * 65, :green
          say "Your #{@app_name} application has been installed."
          say '=' * 65, :green
          say "This application has been mounted to /#{@app_name.downcase}"
          say "You can configure a different path by editing 'config/apps.rb'"
        end
      else
        say 'You are not at the root of a Padrino application! (config/boot.rb not found)'
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.