class PoiseGit::Resources::PoiseGit::Resource
A `poise_git` resource to manage Python installations using pip.
@provides poise_git @action checkout @action export @action sync @example
poise_git '/srv/myapp' do repository 'https://...' deploy_key data_bag_item('deploy_keys', 'myapp')['key'] end
Public Class Methods
new(*args)
click to toggle source
@api private
Calls superclass method
# File lib/poise_git/resources/poise_git.rb, line 54 def initialize(*args) super # Because the superclass declares this, we have to as well. Should be # removable at some point when Chef makes everything use the provider # resolver system instead. @resource_name = :poise_git if defined?(@resource_name) && @resource_name @provider = ::PoiseGit::Resources::PoiseGit::Provider if defined?(@provider) && @provider end
Public Instance Methods
after_created()
click to toggle source
Hook to force the git install via recipe if needed.
Calls superclass method
# File lib/poise_git/resources/poise_git.rb, line 110 def after_created if !parent_git && node['poise-git']['default_recipe'] # Use the default recipe to give us a parent the next time we ask. run_context.include_recipe(node['poise-git']['default_recipe']) # Force it to re-expand the cache next time. @parent_git = nil end super end
deploy_key(val=nil)
click to toggle source
@!attribute deploy_key
SSH deploy key as either a string value or a path to a key file. @return [String]
# File lib/poise_git/resources/poise_git.rb, line 71 def deploy_key(val=nil) # Use a SafeString for literal deploy keys so they aren't shown. val = SafeString.new(val) if val && !deploy_key_is_local?(val) set_or_return(:deploy_key, val, kind_of: String) end
deploy_key_is_local?(key=nil)
click to toggle source
Guess if the deploy key is a local path or literal value.
@api private @param key [String, nil] Key value to check. Defaults to self.key. @return [Boolean]
# File lib/poise_git/resources/poise_git.rb, line 90 def deploy_key_is_local?(key=nil) key ||= deploy_key # Try to be mindful of Windows-y paths here even though they almost # certainly won't actually work later on with ssh. key && key =~ /\A(\/|[a-zA-Z]:)/ end
deploy_key_path()
click to toggle source
Path to deploy key.
@api private @return [String]
# File lib/poise_git/resources/poise_git.rb, line 101 def deploy_key_path @deploy_key_path ||= if deploy_key_is_local? deploy_key else "#{Chef::Config[:file_cache_path]}/poise_git_deploy_#{Zlib.crc32(name)}" end end
ssh_wrapper_path()
click to toggle source
Default SSH wrapper path.
@api private @return [String]
# File lib/poise_git/resources/poise_git.rb, line 81 def ssh_wrapper_path @ssh_wrapper_path ||= "#{Chef::Config[:file_cache_path]}/poise_git_wrapper_#{Zlib.crc32(name)}" end