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, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#apiObject



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

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



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

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

#needs_key?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/dpl/provider/cloud_files.rb', line 9

def needs_key?
  false
end

#push_appObject

Raises:



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dpl/provider/cloud_files.rb', line 21

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