Sha256: 2d4fb70e95200e539fd3b546b60cf26fcb678b7fa8df5712b4eef11bf43009d3

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

=begin rdoc
  DeployDirectory

  Deploy directory will rsync a local directory to 
  each instance of your cloud. 
  
  example:
    has_directory 'name', :from => '/local/path', :to => '/path/on/server/'
    
  The above example will place the contents of '/local/path' at '/path/on/server/name'
=end
module PoolParty
  class Deploydirectory
    
    virtual_resource(:deploy_directory) do
      
      def loaded(opts={}, &block)        
        add_unpack_directory
      end
      
      def before_configure
        package_deploy_directory
      end
      
      def package_deploy_directory
        ::Suitcase::Zipper.add("#{::File.expand_path(from)}", "user_directory/")
      end
      
      def add_unpack_directory
        has_directory("#{::File.dirname(to)}")
        has_exec("unpack-#{::File.basename(to)}-deploy-directory") do
          requires get_directory("#{::File.dirname(to)}")
          command "cp -R /var/poolparty/dr_configure/user_directory/#{name}/* #{to}"
        end
        
        if owner?
          has_exec(:name => "chown-#{name}") do
            command "chown #{owner} -R #{to}/#{name}"
          end
        end
        
      end
      
    end
    
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
auser-poolparty-1.1.6 lib/poolparty/plugins/deploy_directory.rb
auser-poolparty-1.1.7 lib/poolparty/plugins/deploy_directory.rb
fairchild-poolparty-1.1.5 lib/poolparty/plugins/deploy_directory.rb