Sha256: 6bb8f4a26303a95027dd641b758458b3e54faa33763dc7372d4d71fdfcb92df3

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

require_relative 'applicator/wordpress'
require_relative 'applicator/nginx'
require_relative 'applicator/phpfpm'
require_relative 'applicator/ssl'

module DanarchyDeploy
  module Applicator
    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
danarchy_deploy-0.2.11 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.10 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.9 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.8 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.7 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.6 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.5 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.4 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.3 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.2 lib/danarchy_deploy/applicator.rb
danarchy_deploy-0.2.1 lib/danarchy_deploy/applicator.rb