Class: Rails::Generators::AppGenerator

Inherits:
AppBase show all
Defined in:
railties/lib/rails/commands/application.rb,
railties/lib/rails/generators/rails/app/app_generator.rb

Constant Summary

Constant Summary

Constants inherited from AppBase

Rails::Generators::AppBase::DATABASES, Rails::Generators::AppBase::JDBC_DATABASES

Instance Attribute Summary

Attributes inherited from AppBase

#rails_template

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from AppBase

add_shared_options_for

Methods inherited from Base

base_root, class_option, default_source_root, desc, hook_for, inherited, namespace, remove_hook_for, source_root

Methods included from Actions

#add_source, #capify!, #environment, #gem, #generate, #git, #initializer, #lib, #plugin, #rake, #rakefile, #readme, #route, #vendor

Constructor Details

- (AppGenerator) initialize(*args)

Returns a new instance of AppGenerator

Raises:



152
153
154
155
156
157
158
159
160
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 152

def initialize(*args)
  raise Error, "Options should be given after the application name. For details run: rails --help" if args[0].blank?

  super

  if !options[:skip_active_record] && !DATABASES.include?(options[:database])
    raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
  end
end

Class Method Details

+ (Boolean) exit_on_failure?

We want to exit on failure to be kind to other libraries This is only when accessing via CLI

Returns:

  • (Boolean)


24
25
26
# File 'railties/lib/rails/commands/application.rb', line 24

def self.exit_on_failure?
  true
end

Instance Method Details

- (Object) create_active_record_files



184
185
186
187
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 184

def create_active_record_files
  return if options[:skip_active_record]
  build(:database_yml)
end

- (Object) create_app_files



172
173
174
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 172

def create_app_files
  build(:app)
end

- (Object) create_boot_file



180
181
182
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 180

def create_boot_file
  template "config/boot.rb"
end

- (Object) create_config_files



176
177
178
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 176

def create_config_files
  build(:config)
end

- (Object) create_db_files



189
190
191
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 189

def create_db_files
  build(:db)
end

- (Object) create_doc_files



193
194
195
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 193

def create_doc_files
  build(:doc)
end

- (Object) create_lib_files



197
198
199
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 197

def create_lib_files
  build(:lib)
end

- (Object) create_log_files



201
202
203
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 201

def create_log_files
  build(:log)
end

- (Object) create_public_files



205
206
207
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 205

def create_public_files
  build(:public_directory)
end

- (Object) create_root_files



164
165
166
167
168
169
170
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 164

def create_root_files
  build(:readme)
  build(:rakefile)
  build(:configru)
  build(:gitignore) unless options[:skip_git]
  build(:gemfile)   unless options[:skip_gemfile]
end

- (Object) create_script_files



209
210
211
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 209

def create_script_files
  build(:script)
end

- (Object) create_test_files



213
214
215
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 213

def create_test_files
  build(:test) unless options[:skip_test_unit]
end

- (Object) create_tmp_files



217
218
219
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 217

def create_tmp_files
  build(:tmp)
end

- (Object) create_vendor_files



221
222
223
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 221

def create_vendor_files
  build(:vendor)
end

- (Object) finish_template



225
226
227
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 225

def finish_template
  build(:leftovers)
end