Module: DanarchyDeploy::Applicator

Defined in:
lib/danarchy_deploy/applicator.rb,
lib/danarchy_deploy/applicator/ssl.rb,
lib/danarchy_deploy/applicator/nginx.rb,
lib/danarchy_deploy/applicator/phpfpm.rb,
lib/danarchy_deploy/applicator/redmine.rb,
lib/danarchy_deploy/applicator/wordpress.rb,
lib/danarchy_deploy/applicator/wordpress/wpcli.rb,
lib/danarchy_deploy/applicator/wordpress/wpconfig.rb

Defined Under Namespace

Modules: Redmine, SSL, WordPress Classes: Nginx, PHPFPM

Class Method Summary collapse

Class Method Details

.new(os, user, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/danarchy_deploy/applicator.rb', line 8

def self.new(os, user, options)
  puts "\n" + self.name

  user[:applications].each do |domain, app|
    app[:domain] = domain.to_s
    app[:username] = user[:username]
    app[:path] = app[:path] ? app[:path] : user[:home] + '/' + app[:domain]

    Dir.exist?(app[:path]) || FileUtils.mkdir_p(app[:path], mode: 0755)
    FileUtils.chown_R(user[:username], user[:username], app[:path])

    if app[:archives] && options[:first_run]
      puts "\n > Deploying archives for #{domain}"
      perms = { uid: user[:uid], gid: user[:gid] }
      app[:archives].map{|a| a[:perms] = perms }
      puts "\n   |> Applying user's ownership to archives: #{perms}"
      DanarchyDeploy::Archiver.new(app[:archives], options)
    end

    app = DanarchyDeploy::Applicator::PHPFPM.new(app, options)    if app[:phpfpm]
    app = DanarchyDeploy::Applicator::Nginx.new(app, options)     if app[:nginx]
    app = DanarchyDeploy::Applicator::WordPress.new(app, options) if app[:app] == 'wordpress'
    app = DanarchyDeploy::Applicator::Redmine.new(app, options)   if app[:app] == 'redmine'

    app.delete_if { |k, v| [:username, :domain].include? k }
    user[:applications][domain] = app
  end

  user
end