Sha256: f5d507718c803bc1fc1aea009fb25bc4e31dddfba1a690ed21395152ef7f940d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'fileutils'

module Bib
  module Opsworks
    class Composer

      def copy_vendor(release_path, deploy_user)
        app_current = ::File.expand_path("#{release_path}/../../current")
        vendor_dir  = "#{app_current}/vendor"

        deploy_username  = deploy_user['user']
        deploy_group     = deploy_user['group']

        release_vendor = "#{release_path}/vendor"
        
        log.debug("Copy Vendor: Copying from #{vendor_dir} to #{release_vendor}")        
        result = ::FileUtils.cp_r vendor_dir, release_vendor, :verbose => true if ::File.exists?(vendor_dir)
        
        log.debug("Chown Vendor #{release_vendor} to #{deploy_username}.#{deploy_group}")
        result = ::FileUtils.chown_R deploy_username, deploy_group, release_vendor, :verbose => true if ::File.exists?(release_vendor)
      end
      
      def log
        if(defined?(Chef))
          Chef::Log
        else
          unless(@logger)
            require 'logger'
            @logger = Logger.new($stdout)
          end
          @logger
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
BibOpsworks-0.0.8 lib/bib/opsworks/composer.rb