Class: DPL::Provider::CloudFiles

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

Instance Method Summary collapse

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:

  • (Error)


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