Class: Rmails::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/rmails/installer.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Installer

Returns a new instance of Installer.



10
11
12
13
14
15
16
17
18
# File 'lib/rmails/installer.rb', line 10

def initialize(params={})
  @passwords    = params[:passwords]||[]
  @clear        = params[:clear]
  @interpreter  = AutomateIt.new(:project => "system")
  @interpreter.include_in(self)
  @interpreter.set :rake_task, Rake::Task
  @interpreter.set :rails_root, Rails.root
  @interpreter.set :passwords, @passwords
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rmails/installer.rb', line 20

def run
  @interpreter.invoke '01_prepare_server'
  Bundler.with_clean_env do
    @interpreter.shell_manager.sh("bundle install --without development assets")
  end
  if @clear
    puts '!! Going to TRUNCATE database'
  else
    @interpreter.shell_manager.sh("rake db:data:dump")
  end
  @interpreter.invoke '02_setup_database'
  @interpreter.invoke '03_setup_postfix'
  @interpreter.invoke '04_setup_dovecot'
  @interpreter.invoke '05_setup_nginx'
  @interpreter.invoke '06_setup_dspam'
  @interpreter.invoke '07_setup_amavis'
  @interpreter.invoke '08_setup_spamassassin'
  @interpreter.invoke '09_setup_awstats'
  @interpreter.invoke 'XX_start_services'
  unless @clear
    @interpreter.shell_manager.sh("rake db:data:load")
  end
end