dpl-cloud_files 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1087ff53955343599cd8a37520c4635a1dbc4bc
4
+ data.tar.gz: 3d1dc7cd623b9f92665a6038d80b111f6e02c6e9
5
+ SHA512:
6
+ metadata.gz: b7483815499067e06b91d2d8b579e600e2625e0797ed0f571d406a6fe565b2c29edc1620c986c71ef2f3e47afd4ec28dc6d958b43b1315d7548442c7e85d26ed
7
+ data.tar.gz: 8e718d01f55bcb226d283d51ea5c62272a033dad0a4b0256e81d4ee3c24aef0ca646a8c08c400e41ea0517085b32ec2a820d68e1f7bcd4e90d6b9b73558194c4
@@ -0,0 +1,3 @@
1
+ require './gemspec_helper'
2
+
3
+ gemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri'], ['fog-rackspace']]
@@ -0,0 +1,35 @@
1
+ require 'dpl/provider'
2
+ require 'fog/rackspace'
3
+
4
+ module DPL
5
+ class Provider
6
+ class CloudFiles < Provider
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
+ glob_args = ['**/*']
27
+ glob_args << File::FNM_DOTMATCH if options[:dot_match]
28
+
29
+ Dir.glob(*glob_args).each do |name|
30
+ container.files.create(:key => name, :body => File.open(name)) unless File.directory?(name)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+ require 'dpl/provider/cloud_files'
3
+ require 'fog/rackspace'
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
+ expect(provider.needs_key?).to eq(false)
17
+ end
18
+ end
19
+
20
+ describe "#api" do
21
+ example do
22
+ expect(Fog::Storage).to 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
+ expect(provider).to 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
+ allow(directory).to receive(:files) { files }
42
+
43
+ directories = double
44
+ expect(directories).to receive(:get).with('travis').and_return(directory)
45
+
46
+ service = double(:service)
47
+ allow(service).to receive(:directories) { directories }
48
+ allow(provider).to receive(:api) { service }
49
+
50
+ files
51
+ end
52
+
53
+ example do
54
+ expect(files).to receive(:create).with(:key => 'a', :body => 'a body')
55
+ expect(files).to receive(:create).with(:key => 'b', :body => 'b body')
56
+ expect(files).to receive(:create).with(:key => 'c', :body => 'c body')
57
+
58
+ expect(Dir).to receive(:glob).with('**/*').and_return(['a', 'b', 'c'])
59
+ allow(File).to receive(:open) { |name| "#{name} body" }
60
+
61
+ provider.push_app
62
+ end
63
+
64
+ example "with dot_match option" do
65
+ provider.options.update(:dot_match => true)
66
+ expect(files).to receive(:create).with(:key => '.a', :body => '.a body')
67
+ expect(files).to receive(:create).with(:key => 'a', :body => 'a body')
68
+
69
+ expect(Dir).to receive(:glob).with('**/*', File::FNM_DOTMATCH).and_return(['.a', 'a'])
70
+ allow(File).to receive(:open) { |name| "#{name} body" }
71
+
72
+ provider.push_app
73
+ end
74
+ end
75
+
76
+ describe "#deploy" do
77
+ example 'Not Found' do
78
+ directories = double
79
+ allow(directories).to receive(:get) { nil }
80
+
81
+ service = double(:service)
82
+ allow(service).to receive(:directories) { directories }
83
+ allow(provider).to receive(:api) { service }
84
+
85
+ expect { provider.deploy }.to raise_error(DPL::Error, 'The specified container does not exist.')
86
+ end
87
+ end
88
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dpl-cloud_files
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Konstantin Haase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dpl
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-ssh
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mime-types
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fog-rackspace
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-its
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: json_pure
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: tins
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: coveralls
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: highline
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: deploy tool abstraction for clients
182
+ email: konstantin.mailinglists@googlemail.com
183
+ executables: []
184
+ extensions: []
185
+ extra_rdoc_files: []
186
+ files:
187
+ - dpl-cloud_files.gemspec
188
+ - lib/dpl/provider/cloud_files.rb
189
+ - spec/provider/cloud_files_spec.rb
190
+ homepage: https://github.com/travis-ci/dpl
191
+ licenses:
192
+ - MIT
193
+ metadata: {}
194
+ post_install_message:
195
+ rdoc_options: []
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '2.2'
203
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ requirements: []
209
+ rubyforge_project:
210
+ rubygems_version: 2.6.13
211
+ signing_key:
212
+ specification_version: 4
213
+ summary: deploy tool
214
+ test_files:
215
+ - spec/provider/cloud_files_spec.rb