Class: AppGenerator

Inherits:
Rails::Generator::Base show all
Defined in:
lib/rails_generator/generators/applications/app/app_generator.rb

Constant Summary collapse

DEFAULT_SHEBANG =
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
DATABASES =
%w( mysql oracle postgresql sqlite2 sqlite3 frontbase ibm_db )
DEFAULT_DATABASE =
'sqlite3'

Instance Attribute Summary

Attributes inherited from Rails::Generator::Base

#args, #destination_root, #source_root

Attributes included from Rails::Generator::Options

#options

Instance Method Summary collapse

Methods inherited from Rails::Generator::Base

#destination_path, #source_path

Methods included from Rails::Generator::Options

included

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ AppGenerator

Returns a new instance of AppGenerator.



17
18
19
20
21
22
23
24
25
# File 'lib/rails_generator/generators/applications/app/app_generator.rb', line 17

def initialize(runtime_args, runtime_options = {})
  super

  usage if args.empty?
  usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))

  @destination_root = args.shift
  @app_name = File.basename(File.expand_path(@destination_root))
end

Instance Method Details

#after_generateObject



41
42
43
44
45
# File 'lib/rails_generator/generators/applications/app/app_generator.rb', line 41

def after_generate
  if options[:template]
    Rails::TemplateRunner.new(options[:template], @destination_root)
  end
end

#manifestObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rails_generator/generators/applications/app/app_generator.rb', line 27

def manifest
  record do |m|
    create_directories(m)
    create_root_files(m)
    create_app_files(m)
    create_config_files(m)
    create_script_files(m)
    create_test_files(m)
    create_public_files(m)
    create_documentation_file(m)
    create_log_files(m)
  end
end