Class: DPL::Provider::CloudFiles

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/cloud_files.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #check_app, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, deprecated, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#apiObject



16
17
18
# File 'lib/dpl/provider/cloud_files.rb', line 16

def api
  @api ||= Fog::Storage.new(:provider => 'Rackspace', :rackspace_username => option(:username), :rackspace_api_key => option(:api_key), :rackspace_region => option(:region))
end

#check_authObject



20
21
22
# File 'lib/dpl/provider/cloud_files.rb', line 20

def check_auth
  log "Authenticated as #{option(:username)}"
end

#needs_key?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/dpl/provider/cloud_files.rb', line 12

def needs_key?
  false
end

#push_appObject

Raises:



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dpl/provider/cloud_files.rb', line 24

def push_app
  container = api.directories.get(option(:container))

  raise Error, 'The specified container does not exist.' if container.nil?

  glob_args = ['**/*']
  glob_args << File::FNM_DOTMATCH if options[:dot_match]

  Dir.glob(*glob_args).each do |name|
    container.files.create(:key => name, :body => File.open(name)) unless File.directory?(name)
  end
end