Class: Confset::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/generators/confset/install_generator.rb', line 8

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

Instance Method Details

#copy_initializerObject



12
13
14
# File 'lib/generators/confset/install_generator.rb', line 12

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

#copy_settingsObject



16
17
18
19
20
# File 'lib/generators/confset/install_generator.rb', line 16

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

#modify_gitignoreObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/confset/install_generator.rb', line 22

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

  append_to_file ".gitignore" do
    "\n"                                +
    "config/settings.local.yml\n"       +
    "config/settings/*.local.yml\n"     +
    "config/environments/*.local.yml\n"
  end
end