Class: NoBrainer::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- NoBrainer::Generators::InstallGenerator
show all
- Extended by:
- NamespaceFix
- Defined in:
- lib/rails/generators/nobrainer/install_generator.rb
Defined Under Namespace
Classes: RequireProxy
Instance Method Summary
collapse
base_name, base_root, namespace
Instance Method Details
#copy_initializer ⇒ Object
49
50
51
|
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 49
def copy_initializer
template('nobrainer.rb', 'config/initializers/nobrainer.rb')
end
|
#expand_require_rails_all ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 26
def expand_require_rails_all
require_proxy = RequireProxy.new
rails_all_file = require_proxy.resolve_require_path('rails/all.rb')
require_proxy.instance_eval(File.read(rails_all_file))
gsub_file('config/application.rb', %r(^require 'rails/all'$)) do
require_proxy.required_paths.map { |f| "require '#{f}'" }.join("\n")
end
end
|
#remove_active_record ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 36
def remove_active_record
(Dir['config/environments/*'] +
Dir['config/initializers/*'] +
['config/application.rb']).each do |config_file|
(config_file, /active_record/)
end
(Dir['config/**/*active_record*.rb'] +
Dir['app/models/application_record.rb'] +
['config/database.yml'])
.each { |f| remove_file(f) }
end
|