Class: Alchemy::Upgrader

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

Direct Known Subclasses

FourPointOne, FourPointTwo

Defined Under Namespace

Modules: Tasks Classes: FourPointOne, FourPointTwo

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


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

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