Sha256: ec8f7e025c11520f45bfbbb25c7eb653698a3b6dd9de79ffc9d930565c4bf8c3

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'fileutils'
require 'logger'

module Bib
  module Opsworks
    class Composer

      def copy_vendor(release_path, deploy_user)

        log_file = File.new('/tmp/test-copy-vendor.log', 'a')
        log = Logger.new(log_file, 'weekly')
        $stderr = log_file
        $stdout = log_file
        
        
        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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BibOpsworks-0.0.9.1 lib/bib/opsworks/composer.rb
BibOpsworks-0.0.9 lib/bib/opsworks/composer.rb