Class: Dpl::Providers::Cloudfiles

Inherits:
Dpl::Provider show all
Defined in:
lib/dpl/providers/cloudfiles.rb

Constant Summary

Constants inherited from Dpl::Provider

Dpl::Provider::FOLDS, Dpl::Provider::STAGES

Instance Attribute Summary

Attributes inherited from Dpl::Provider

#key_name, #repo_name

Instance Method Summary collapse

Methods inherited from Dpl::Provider

#before_finish, #before_init, #before_install, #before_prepare, #before_setup, #chmod, #cleanup, #cmd, #compact, #err, #error, #escape, examples, #expand, #file?, #finish?, #fold, #fold?, #info, #initialize, install_deps, install_deps?, #mkdir_p, move_files, #msg, #mv, #only, #open, #opt_for, #opt_key, #opts_for, #print, #quote, #read, #remove_dpl_dir, #rm_rf, #run, #run_cmd, #run_cmds, #run_stage, #run_stage?, #script, #setup_dpl_dir, #setup_git_config, #setup_git_http_user_agent, #setup_git_ssh, #setup_ssh_key, #shell, #sq, #ssh_keygen, #symbolize, #try_ssh_access, #uncleanup, unmove_files, validate_runtimes, #wait_for_ssh_access, #warn

Methods included from Dpl::Provider::Dsl

#apt, #apt?, #cmds, #description, #env, #errs, #full_name, #gem, #gem?, #keep, #move, #msgs, #needs, #needs?, #node_js, #npm, #npm?, #opt, #path, #pip, #pip?, #python, #ruby_pre?, #ruby_version, #runtimes, #status, #strs, #summary, #user_agent, #vars

Methods included from Squiggle

#sq

Methods included from Assets

#asset

Methods included from Env

included, #opts

Methods included from ConfigFile

included, #opts

Methods included from Interpolate

#interpolate, #obfuscate, #vars

Methods included from Memoize

included

Constructor Details

This class inherits a constructor from Dpl::Provider

Instance Method Details

#apiObject



52
53
54
55
56
57
58
59
# File 'lib/dpl/providers/cloudfiles.rb', line 52

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

#containerObject



48
49
50
# File 'lib/dpl/providers/cloudfiles.rb', line 48

def container
  @container ||= api.directories.get(super) || error(:missing_container)
end

#deployObject



31
32
33
34
35
# File 'lib/dpl/providers/cloudfiles.rb', line 31

def deploy
  paths.each do |path|
    container.files.create(key: path, body: File.open(path))
  end
end

#globObject



42
43
44
45
46
# File 'lib/dpl/providers/cloudfiles.rb', line 42

def glob
  glob = [super]
  glob << File::FNM_DOTMATCH if dot_match?
  glob
end

#pathsObject



37
38
39
40
# File 'lib/dpl/providers/cloudfiles.rb', line 37

def paths
  paths = Dir.glob(*glob)
  paths.reject { |path| File.directory?(path) }
end