Class: PoolParty::Plugin::DeployDirectory

Inherits:
Plugin show all
Defined in:
lib/poolparty/plugins/deploy_directory.rb

Instance Attribute Summary

Attributes inherited from PoolParty::PoolPartyBaseClass

#init_opts, #ordered_resources

Instance Method Summary collapse

Methods inherited from Plugin

#after_create, #before_load, #bootstrap_commands, #bootstrap_gems, #calls, #cloud, #configure_commands, #enable, inherited, #initialize, #is_plugin?

Methods included from Callbacks

included

Methods included from DependencyResolverCloudExtensions

#to_properties_hash

Methods included from CloudResourcer

#dependency_resolver, #instances, #plugin_directory, #run_stored_block, #store_block, #stored_block, #using

Methods inherited from Service

add_has_and_does_not_have_methods_for, #cloud, #to_properties_hash

Methods inherited from PoolParty::PoolPartyBaseClass

add_has_and_does_not_have_methods_for, #add_resource, add_resource_lookup_method, #add_service, #add_to_parent_if_parent_exists_and_is_a_service, #get_local_resource, #get_name_from_options_and_extra_options, #get_resource, #handle_option_values, #in_local_resources?, #initialize, #inspect, #is_a_resource?, #is_plugin?, #plugin_store, #resource, #resources, #run_in_context, #run_with_callbacks, #search_in_known_locations, #store_in_local_resources, #to_hash, #to_json

Methods included from SearchablePaths

included

Constructor Details

This class inherits a constructor from PoolParty::Plugin::Plugin

Instance Method Details

#add_unpack_directoryObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/poolparty/plugins/deploy_directory.rb', line 37

def add_unpack_directory
  has_directory(to)
  has_exec("unpack-#{::File.basename(to)}-deploy-directory",
    :requires => get_directory(to),
    :command => "cp -R /var/poolparty/dr_configure/user_directory/#{dir_name}/* #{to}")
  if owner
    has_exec(:name => "chown-#{name}", :command => "chown #{owner} -R #{to}")
  end     

  if mode
    has_exec(:name => "chmod-#{name}", :command => "chmod #{mode} #{to}")
  end
end

#before_configureObject



28
29
30
31
# File 'lib/poolparty/plugins/deploy_directory.rb', line 28

def before_configure
  update_from_repo if git_pull_first
  package_deploy_directory
end

#loaded(opts = {}, &block) ⇒ Object



24
25
26
# File 'lib/poolparty/plugins/deploy_directory.rb', line 24

def loaded(opts={}, &block)        
  add_unpack_directory
end

#package_deploy_directoryObject



33
34
35
# File 'lib/poolparty/plugins/deploy_directory.rb', line 33

def package_deploy_directory
  ::Suitcase::Zipper.add("#{from}", "user_directory/")
end

#update_from_repoObject



51
52
53
# File 'lib/poolparty/plugins/deploy_directory.rb', line 51

def update_from_repo
  `cd #{from} && git pull`
end