Sha256: 21193999a0ada113443dafcbabae589ac9e7ba5f10ee0cb60f6bcd3860f57fc6

Contents?: true

Size: 1.14 KB

Versions: 46

Compression:

Stored size: 1.14 KB

Contents

require 'dpl/provider'

module DPL
  class Provider
    class CloudFiles < Provider
      requires 'net-ssh',    load: 'net/ssh',    version: '~> 2.9.2' # Anything higher requires Ruby 2.x
      requires 'mime-types', load: 'mime/types', version: '~> 2.6.2' # Anything higher requires Ruby 2.x
      requires 'fog-rackspace', load: 'fog/rackspace'
      experimental 'Rackspace Cloud Files'

      def needs_key?
        false
      end

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

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

      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
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
dpl-1.8.30.travis.1849.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.30.travis.1843.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.29.travis.1841.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.29 lib/dpl/provider/cloud_files.rb
dpl-1.8.28 lib/dpl/provider/cloud_files.rb
dpl-1.8.29.travis.1816.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.28.travis.1813.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.28.travis.1809.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.28.travis.1806.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.27 lib/dpl/provider/cloud_files.rb
dpl-1.8.28.travis.1787.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.27.travis.1786.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.27.travis.1783.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1779.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1777.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1776.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1775.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1771.3 lib/dpl/provider/cloud_files.rb
dpl-1.8.26.travis.1765.3 lib/dpl/provider/cloud_files.rb