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
Overview
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, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
Methods included from Actions
#add_source, #capify!, #environment, #gem, #gem_group, #generate, #git, #initializer, #lib, #rake, #rakefile, #readme, #route, #vendor
Constructor Details
Returns a new instance of AppGenerator.
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 153
def initialize(*args)
if args[0].blank?
if args[1].blank?
raise Error, "Application name should be provided in arguments. For details run: rails --help"
else
raise Error, "Options should be given after the application name. For details run: rails --help"
end
end
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
.exit_on_failure? ⇒ Boolean
We want to exit on failure to be kind to other libraries This is only when accessing via CLI
9
10
11
|
# File 'railties/lib/rails/commands/application.rb', line 9
def self.exit_on_failure?
true
end
|
Instance Method Details
#create_active_record_files ⇒ Object
197
198
199
200
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 197
def create_active_record_files
return if options[:skip_active_record]
build(:database_yml)
end
|
#create_app_files ⇒ Object
181
182
183
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 181
def create_app_files
build(:app)
end
|
#create_bin_files ⇒ Object
185
186
187
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 185
def create_bin_files
build(:bin)
end
|
#create_boot_file ⇒ Object
193
194
195
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 193
def create_boot_file
template "config/boot.rb"
end
|
#create_config_files ⇒ Object
189
190
191
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 189
def create_config_files
build(:config)
end
|
#create_db_files ⇒ Object
202
203
204
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 202
def create_db_files
build(:db)
end
|
#create_lib_files ⇒ Object
206
207
208
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 206
def create_lib_files
build(:lib)
end
|
#create_log_files ⇒ Object
210
211
212
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 210
def create_log_files
build(:log)
end
|
#create_public_files ⇒ Object
214
215
216
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 214
def create_public_files
build(:public_directory)
end
|
#create_root_files ⇒ Object
173
174
175
176
177
178
179
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 173
def create_root_files
build(:readme)
build(:rakefile)
build(:configru)
build(:gitignore) unless options[:skip_git]
build(:gemfile) unless options[:skip_gemfile]
end
|
#create_test_files ⇒ Object
218
219
220
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 218
def create_test_files
build(:test) unless options[:skip_test_unit]
end
|
#create_tmp_files ⇒ Object
222
223
224
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 222
def create_tmp_files
build(:tmp)
end
|
#create_vendor_files ⇒ Object
226
227
228
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 226
def create_vendor_files
build(:vendor)
end
|
#finish_template ⇒ Object
230
231
232
|
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 230
def finish_template
build(:leftovers)
end
|