Class: Config::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/config/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



6
7
8
# File 'lib/generators/config/install_generator.rb', line 6

def self.source_root
  @_config_source_root ||= File.expand_path("../templates", __FILE__)
end

Instance Method Details

#copy_initializerObject



10
11
12
# File 'lib/generators/config/install_generator.rb', line 10

def copy_initializer
  template "config.rb", "config/initializers/config.rb"
end

#copy_settingsObject



14
15
16
17
18
# File 'lib/generators/config/install_generator.rb', line 14

def copy_settings
  template "settings.yml", "config/#{Config.file_name}.yml"
  template "settings.local.yml", "config/#{Config.file_name}.local.yml"
  directory "settings", "config/#{Config.dir_name}"
end

#modify_gitignoreObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/config/install_generator.rb', line 20

def modify_gitignore
  create_file '.gitignore' unless File.exist? '.gitignore'

  append_to_file '.gitignore' do
    "\n"                                      +
    "config/#{Config.file_name}.local.yml\n"  +
    "config/#{Config.dir_name}/*.local.yml\n" +
    "config/environments/*.local.yml\n"
  end
end