dpl 1.5.2.travis.244.2 → 1.5.2.travis.245.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGFiOGZlNTBhMjA5ZmFiMGFkMmExNWEwZWU5Yzg3ZmUyMzFiMjlkMA==
4
+ NGIxZDFmOGUzM2IxOGZjY2ExZTIzM2I3NWQzNDM4NDY2MzFlYTU2NQ==
5
5
  data.tar.gz: !binary |-
6
- YjEyYzE4MzVjYjJjZTAwNzhmMDY2ZTkzZTMzZDM4YWE1NDhjOGM3NA==
6
+ NGE1YTZmZTQ3MjYzNTVmY2M5NjNiYjExOWUzMjVlMmVkM2IzNzIxNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWZkNTJiODJjYTdiOTk2ZjQ2ZGVhMTQ2MGZlOThiYzYzNmMzNGFlYWY2MTAx
10
- NmRhN2I1ZDAzOTliODUyYjU5YjZjZjFiYjVkY2I3Yjc1NDNiZTZmZmU0MzY1
11
- ZWU0ZmFhMjlhZDc5NjFhMjkxNzNjZTY5ODExNmU1NWU0MWUwZDk=
9
+ MjljYjU0NzJkMmU5ZjM4YTlmNDU1NjQ2N2UyZGViNjcwZjg3NzYxYTU4ZjA3
10
+ YzlmODhhZmE3MmI3ZjdlYmIxY2VlOTIwMWI1NzE4MjQwZTY4MDhmYjA4Njcy
11
+ Y2ExOGI0OGU0MTM1YzRiOGI4M2I3M2QzYTNjZDQ3MGE3YTcyYzU=
12
12
  data.tar.gz: !binary |-
13
- YmMwNjk0NTY1MjIyYjhiYzQyM2E1YmFjMTE0M2NhYzYzYTZhZTc1MzRiNzQ1
14
- NDhlYjJkNmQ3OTY2MzJjNjE1ZTM5ZjJiM2IwZjFjMmRkYzVmZjQ2YWQyOWRh
15
- M2NhN2FjOTVhYmVkNmY0ZmZhYjllMWQ4ZDFkZTFjNGJjYTJkMmE=
13
+ YmQ5OTEzZWZjNmMxY2QwYjNhODQzMzQ3ODQ5YTRkYzMzY2U3N2I2MDZmOTU1
14
+ MmRmYjQwZmI1YjRkMWI3MDUyYjgxMzE3ZTc4YTE1ZjE5NzBmYmE1NTI4ZTIw
15
+ N2FiZjJkNTdjODcxZjc5N2EyYzYzMWQ0N2I2OWE3NGQ4MzZjZTQ=
data/Gemfile CHANGED
@@ -26,3 +26,7 @@ end
26
26
  group :sss do
27
27
  gem 'aws-sdk'
28
28
  end
29
+
30
+ group :cloud_files do
31
+ gem 'fog'
32
+ end
data/README.md CHANGED
@@ -17,6 +17,7 @@ Dpl supports the following providers:
17
17
  * [RubyGems](#rubygems)
18
18
  * [S3](#s3)
19
19
  * [Divshot.io](#divshotio)
20
+ * [Rackspace Cloud Files](#rackspace-cloud-files)
20
21
 
21
22
  ## Installation:
22
23
 
@@ -209,3 +210,16 @@ As a rule of thumb, you should switch to the Git strategy if you run into issues
209
210
 
210
211
  dpl --provider=dotcloud --api_key=<api_key> --app=<app>
211
212
  dpl --provider=dotcloud --api_key=<api_key> --app=<app> --service=<service>
213
+
214
+ ### Rackspace Cloud Files:
215
+
216
+ #### Options:
217
+
218
+ * **username**: Rackspace Username.
219
+ * **api-key**: Rackspace API Key.
220
+ * **region**: Cloud Files Region. The region in which your Cloud Files container exists.
221
+ * **container**: Container Name. The container where you would like your files to be uploaded.
222
+
223
+ #### Examples:
224
+
225
+ dpl --provider=cloudfiles --username=<username> --api-key=<api-key> --region=<region> --container=<container>
data/lib/dpl/provider.rb CHANGED
@@ -18,6 +18,7 @@ module DPL
18
18
  autoload :CloudFoundry, 'dpl/provider/cloud_foundry'
19
19
  autoload :PyPI, 'dpl/provider/pypi'
20
20
  autoload :Divshot, 'dpl/provider/divshot'
21
+ autoload :CloudFiles, 'dpl/provider/cloud_files'
21
22
 
22
23
  def self.new(context, options)
23
24
  return super if self < Provider
@@ -0,0 +1,32 @@
1
+ require 'dpl/provider'
2
+
3
+ module DPL
4
+ class Provider
5
+ class CloudFiles < Provider
6
+ requires 'fog'
7
+ experimental 'Rackspace Cloud Files'
8
+
9
+ def needs_key?
10
+ false
11
+ end
12
+
13
+ def api
14
+ @api ||= Fog::Storage.new(:provider => 'Rackspace', :rackspace_username => option(:username), :rackspace_api_key => option(:api_key), :rackspace_region => option(:region))
15
+ end
16
+
17
+ def check_auth
18
+ log "Authenticated as #{option(:username)}"
19
+ end
20
+
21
+ def push_app
22
+ container = api.directories.get(option(:container))
23
+
24
+ raise Error, 'The specified container does not exist.' if container.nil?
25
+
26
+ Dir.glob('**/*').each do |name|
27
+ container.files.create(:key => name, :body => File.open(name)) unless File.directory?(name)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,77 @@
1
+ require 'spec_helper'
2
+ require 'dpl/provider/cloud_files'
3
+ require 'fog'
4
+
5
+ describe DPL::Provider::CloudFiles do
6
+ before :each do
7
+ Fog.mock!
8
+ end
9
+
10
+ subject :provider do
11
+ described_class.new(DummyContext.new, :username => 'username', :api_key => 'api key', :container => 'travis', :region => 'dfw')
12
+ end
13
+
14
+ describe :needs_key? do
15
+ example do
16
+ provider.needs_key?.should == false
17
+ end
18
+ end
19
+
20
+ describe :api do
21
+ example do
22
+ Fog::Storage.should_receive(:new).with(:provider => 'Rackspace', :rackspace_username => 'username', :rackspace_api_key => 'api key', :rackspace_region => 'dfw')
23
+
24
+ provider.api
25
+ end
26
+ end
27
+
28
+ describe :check_auth do
29
+ example do
30
+ provider.should_receive(:log).with('Authenticated as username')
31
+
32
+ provider.check_auth
33
+ end
34
+ end
35
+
36
+ describe :push_app do
37
+ let :files do
38
+ files = double
39
+
40
+ directory = double
41
+ directory.stub(:files) { files }
42
+
43
+ directories = double
44
+ directories.should_receive(:get).with('travis').and_return(directory)
45
+
46
+ service = double(:service)
47
+ service.stub(:directories) { directories }
48
+ provider.stub(:api) { service }
49
+
50
+ files
51
+ end
52
+
53
+ example do
54
+ files.should_receive(:create).with(:key => 'a', :body => 'a body')
55
+ files.should_receive(:create).with(:key => 'b', :body => 'b body')
56
+ files.should_receive(:create).with(:key => 'c', :body => 'c body')
57
+
58
+ Dir.should_receive(:glob).with('**/*').and_return(['a', 'b', 'c'])
59
+ File.stub(:open) { |name| "#{name} body" }
60
+
61
+ provider.push_app
62
+ end
63
+ end
64
+
65
+ describe :deploy do
66
+ example 'Not Found' do
67
+ directories = double
68
+ directories.stub(:get) { nil }
69
+
70
+ service = double(:service)
71
+ service.stub(:directories) { directories }
72
+ provider.stub(:api) { service }
73
+
74
+ expect { provider.deploy }.to raise_error(DPL::Error, 'The specified container does not exist.')
75
+ end
76
+ end
77
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2.travis.244.2
4
+ version: 1.5.2.travis.245.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -86,6 +86,7 @@ files:
86
86
  - lib/dpl/error.rb
87
87
  - lib/dpl/provider.rb
88
88
  - lib/dpl/provider/appfog.rb
89
+ - lib/dpl/provider/cloud_files.rb
89
90
  - lib/dpl/provider/cloud_foundry.rb
90
91
  - lib/dpl/provider/cloudcontrol.rb
91
92
  - lib/dpl/provider/divshot.rb
@@ -106,6 +107,7 @@ files:
106
107
  - notes/heroku.md
107
108
  - spec/cli_spec.rb
108
109
  - spec/provider/appfog_spec.rb
110
+ - spec/provider/cloud_files_spec.rb
109
111
  - spec/provider/cloudcontrol_spec.rb
110
112
  - spec/provider/divshot_spec.rb
111
113
  - spec/provider/dotcloud_spec.rb