Sha256: aab7aa4abb63290077be7c2f8b09df73f7e306c40831d49306f55d37c0f63ac4

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require 'fileutils'
require 'stringio'
require 'bib/opsworks/logging'

module Bib
  module Opsworks
    class Composer
      
      include Logging

      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"
        
        
        if ::File.exists?(vendor_dir)
          fileutils_output = StringIO.new
          ::FileUtils.fileutils_output = fileutils_output
          log.debug("Copy Vendor: Copying from #{vendor_dir} to #{release_vendor}")        
          ::FileUtils.cp_r vendor_dir, release_vendor, :verbose => true 
          log.debug(fileutils_output.string)
        else
          log.info('Vendor dir #{vendor_dir} does not exist')
        end
        
        if ::File.exists?(release_vendor)
          fileutils_output = StringIO.new
          ::FileUtils.fileutils_output = fileutils_output
          log.debug("Chown Vendor #{release_vendor} to #{deploy_username}.#{deploy_group}")
          ::FileUtils.fileutils_output = fileutils_output
          result = ::FileUtils.chown_R deploy_username, deploy_group, release_vendor, :verbose => true 
          log.debug(fileutils_output.string)
        else
          log.info('Release vendor dir #{release_vendor} does not exist')
        end
      end
    end
  end
end

module FileUtils
  def FileUtils.fileutils_output=(new_out)
    @fileutils_output = new_out
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
BibOpsworks-0.1.1 lib/bib/opsworks/composer.rb
BibOpsworks-0.1 lib/bib/opsworks/composer.rb
BibOpsworks-0.0.9.3 lib/bib/opsworks/composer.rb
BibOpsworks-0.0.9.2 lib/bib/opsworks/composer.rb