Class: Alchemy::Upgrader

Inherits:
Object
  • Object
show all
Extended by:
Shell
Defined in:
lib/alchemy/upgrader.rb

Direct Known Subclasses

SevenPointThree, SevenPointZero

Defined Under Namespace

Classes: SevenPointThree, SevenPointZero

Constant Summary

Constants included from Shell

Shell::COLORS

Class Method Summary collapse

Methods included from Shell

add_todo, desc, display_todos, log, silence!, silenced?, todo, todos, verbose!

Class Method Details

.copy_new_config_fileObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/alchemy/upgrader.rb', line 12

def copy_new_config_file
  desc "Copy configuration file."
  config_file = Rails.root.join("config/alchemy/config.yml")
  default_config = File.join(File.dirname(__FILE__), "../../config/alchemy/config.yml")
  if !File.exist? config_file
    log "No configuration file found. Creating it."
    FileUtils.cp default_config, Rails.root.join("config/alchemy/config.yml")
  elsif FileUtils.identical? default_config, config_file
    log "Configuration file already present.", :skip
  else
    log "Custom configuration file found."
    FileUtils.cp default_config, Rails.root.join("config/alchemy/config.yml.defaults")
    log "Copied new default configuration file."
    todo "Check the default configuration file (./config/alchemy/config.yml.defaults) for new configuration options and insert them into your config file.", "Configuration has changed"
  end
end