Class: Isomorfeus::Installer::InstallTargets

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

Class Method Summary collapse

Class Method Details

.executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/isomorfeus/installer/install_targets.rb', line 5

def execute
  targets_string = Isomorfeus::Installer.options[:targets]
  targets_string = 'web' if targets_string == 'all'
  targets = targets_string.split(' ')
  targets = targets_string.split(',') if targets.empty?
  targets = targets_string.split(', ') if targets.empty?

  # install web first
  targets.unshift(targets.delete('web')) if targets.include?('web')

  targets.each do |target|
    target = target.camelize
    if Isomorfeus::Installer::Target.const_defined?(target, false)

      target_class = Isomorfeus::Installer::Target.const_get(target)
      target_class.execute
    else
      raise "No such target #{target} available."
    end
  end
end