Class: RailsConfig::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

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

Instance Method Details

#copy_initializerObject



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

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

#copy_settingsObject



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

def copy_settings
  template "settings.yml", "config/settings.yml"
  template "settings.local.yml", "config/settings.local.yml"
  directory "settings", "config/settings"
end

#modify_gitignoreObject



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

def modify_gitignore
  if File.exists?('.gitignore')
    append_to_file '.gitignore' do
      "\n"                                +
        "config/settings.local.yml\n"       +
        "config/settings/*.local.yml\n"     +
        "config/environments/*.local.yml\n"
    end
  end
end