dpl 1.7.9.travis.657.1 → 1.7.9.travis.662.1
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 +8 -8
- data/Gemfile +2 -0
- data/README.md +9 -0
- data/lib/dpl/provider.rb +2 -0
- data/lib/dpl/provider/ops_works.rb +6 -2
- data/lib/dpl/provider/s3.rb +22 -2
- data/spec/provider/ops_works_spec.rb +9 -0
- data/spec/provider/s3_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjlhNDdjMGE4ODg3NDJhMTMwZGVlNGVmYTAxODhjYThkYWJiYmMxZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGM3NmI3NDk5ZjM0YjZlZDE1N2UwODQyYjk1MjM5Y2EzNmY4OTcyNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGYzZTg0YTk3MGQ1YmEzYzgxMmEwNGQyNzRhOWIyMzg2NzU0NjY5NWJjMmQ3
|
10
|
+
NGY1MWFlOWEzNzlmODc0OTBlOTZiNjFhOGM0MGQyNDRjYmRlYmUxYmU2Yjlh
|
11
|
+
NzdhZmQ0OTNmZGE5YzMwOTE3M2U3YTAwYTIwZTNlOTk4YzhhMzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjUwZmI4MDNmZTVhYTFjMGUxNzQ3ZDk5M2E2ODhjNzc4ZTBhZmU1M2MxOTFi
|
14
|
+
OWVkMTkxN2I3NTk2ZTA5MWU3MzAwM2QzZDRhODRhNDdlYjYzZjk3OWI3MzM3
|
15
|
+
NjMxMWY0MzNkZGU3YzRmMmNhYmNhNmE2MzBlNGIyY2M1YTFhNjM=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -204,6 +204,15 @@ As a rule of thumb, you should switch to the Git strategy if you run into issues
|
|
204
204
|
* **dot_match**: When set to `true`, upload files starting a `.`.
|
205
205
|
* **index_document_suffix**: Set the index document of a S3 website.
|
206
206
|
|
207
|
+
#### File-specific `Cache-Control` and `Expires` headers
|
208
|
+
|
209
|
+
It is possible to set file-specific `Cache-Control` and `Expires` headers using `value: file[, file]` format.
|
210
|
+
|
211
|
+
##### Example:
|
212
|
+
|
213
|
+
--cache_control="no-cache: index.html"
|
214
|
+
--expires="\"2012-12-21 00:00:00 -0000\": *.css, *.js"
|
215
|
+
|
207
216
|
#### Examples:
|
208
217
|
|
209
218
|
dpl --provider=s3 --access-key-id=<access-key-id> --secret-access-key=<secret-access-key> --bucket=<bucket> --acl=public_read
|
data/lib/dpl/provider.rb
CHANGED
@@ -154,6 +154,7 @@ module DPL
|
|
154
154
|
|
155
155
|
def cleanup
|
156
156
|
return if options[:skip_cleanup]
|
157
|
+
puts "Performing #{__method__}"
|
157
158
|
context.shell "mv .dpl ~/dpl"
|
158
159
|
context.shell "git stash --all"
|
159
160
|
context.shell "mv ~/dpl .dpl"
|
@@ -161,6 +162,7 @@ module DPL
|
|
161
162
|
|
162
163
|
def uncleanup
|
163
164
|
return if options[:skip_cleanup]
|
165
|
+
puts "Performing #{__method__}"
|
164
166
|
context.shell "git stash pop"
|
165
167
|
end
|
166
168
|
|
@@ -69,13 +69,17 @@ module DPL
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def create_deployment
|
72
|
-
|
72
|
+
deployment_config = {
|
73
73
|
stack_id: ops_works_app[:stack_id],
|
74
74
|
app_id: option(:app_id),
|
75
75
|
command: {name: 'deploy'},
|
76
76
|
comment: travis_deploy_comment,
|
77
77
|
custom_json: custom_json.to_json
|
78
|
-
|
78
|
+
}
|
79
|
+
if !options[:instance_ids].nil?
|
80
|
+
deployment_config[:instance_ids] = option(:instance_ids)
|
81
|
+
end
|
82
|
+
data = client.create_deployment(deployment_config)
|
79
83
|
log "Deployment created: #{data[:deployment_id]}"
|
80
84
|
return unless options[:wait_until_deployed]
|
81
85
|
print "Deploying "
|
data/lib/dpl/provider/s3.rb
CHANGED
@@ -38,9 +38,9 @@ module DPL
|
|
38
38
|
Dir.glob(*glob_args) do |filename|
|
39
39
|
content_type = MIME::Types.type_for(filename).first.to_s
|
40
40
|
opts = { :content_type => content_type }.merge(encoding_option_for(filename))
|
41
|
-
opts[:cache_control] = options[:cache_control] if options[:cache_control]
|
41
|
+
opts[:cache_control] = get_option_value_by_filename(options[:cache_control], filename) if options[:cache_control]
|
42
42
|
opts[:acl] = options[:acl] if options[:acl]
|
43
|
-
opts[:expires] = options[:expires] if options[:expires]
|
43
|
+
opts[:expires] = get_option_value_by_filename(options[:expires], filename) if options[:expires]
|
44
44
|
unless File.directory?(filename)
|
45
45
|
log "uploading %p" % filename
|
46
46
|
api.buckets[option(:bucket)].objects.create(upload_path(filename), File.read(filename), opts)
|
@@ -73,6 +73,26 @@ module DPL
|
|
73
73
|
{}
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
def get_option_value_by_filename(option_values, filename)
|
78
|
+
return option_values if !option_values.kind_of?(Array)
|
79
|
+
preferred_value = nil
|
80
|
+
hashes = option_values.select {|value| value.kind_of?(Hash) }
|
81
|
+
hashes.each do |hash|
|
82
|
+
hash.each do |value, patterns|
|
83
|
+
unless patterns.kind_of?(Array)
|
84
|
+
patterns = [patterns]
|
85
|
+
end
|
86
|
+
patterns.each do |pattern|
|
87
|
+
if File.fnmatch?(pattern, filename)
|
88
|
+
preferred_value = value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
preferred_value = option_values.select {|value| value.kind_of?(String) }.last if preferred_value.nil?
|
94
|
+
return preferred_value
|
95
|
+
end
|
76
96
|
end
|
77
97
|
end
|
78
98
|
end
|
@@ -71,6 +71,15 @@ describe DPL::Provider::OpsWorks do
|
|
71
71
|
expect(client).to receive(:describe_deployments).with({deployment_ids: ['deployment_id']}).and_return({deployments: [status: 'running']}, {deployments: [status: 'successful']})
|
72
72
|
provider.push_app
|
73
73
|
end
|
74
|
+
|
75
|
+
example 'with :instance-ids' do
|
76
|
+
provider.options.update(app_id: 'app-id', instance_ids: ['instance-id'])
|
77
|
+
expect(client).to receive(:describe_apps).with(app_ids: ['app-id']).and_return({apps: [ops_works_app]})
|
78
|
+
expect(client).to receive(:create_deployment).with(
|
79
|
+
stack_id: 'stack-id', app_id: 'app-id', instance_ids:['instance-id'], command: {name: 'deploy'}, comment: 'Deploy build 123 via Travis CI', custom_json: custom_json
|
80
|
+
).and_return({})
|
81
|
+
provider.push_app
|
82
|
+
end
|
74
83
|
end
|
75
84
|
|
76
85
|
describe "#api" do
|
data/spec/provider/s3_spec.rb
CHANGED
@@ -80,6 +80,22 @@ describe DPL::Provider::S3 do
|
|
80
80
|
provider.push_app
|
81
81
|
end
|
82
82
|
|
83
|
+
example "Sets different Cache and Expiration" do
|
84
|
+
option_list = []
|
85
|
+
provider.options.update(:cache_control => ["max-age=99999999", "no-cache" => ["foo.html", "bar.txt"], "max-age=9999" => "*.txt"], :expires => ["2012-12-21 00:00:00 -0000", "1970-01-01 00:00:00 -0000" => "*.html"])
|
86
|
+
expect(Dir).to receive(:glob).and_yield("foo.html").and_yield("bar.txt").and_yield("baz.js")
|
87
|
+
expect(File).to receive(:read).exactly(3).times.and_return("")
|
88
|
+
allow_any_instance_of(AWS::S3::ObjectCollection).to receive(:create) do |_instance, key, _data, options|
|
89
|
+
option_list << { key: key, options: options }
|
90
|
+
end
|
91
|
+
provider.push_app
|
92
|
+
expect(option_list).to match_array([
|
93
|
+
{ key: "foo.html", options: hash_including(:cache_control => "no-cache", :expires => "1970-01-01 00:00:00 -0000") },
|
94
|
+
{ key: "bar.txt", options: hash_including(:cache_control => "max-age=9999", :expires => "2012-12-21 00:00:00 -0000") },
|
95
|
+
{ key: "baz.js", options: hash_including(:cache_control => "max-age=99999999", :expires => "2012-12-21 00:00:00 -0000") },
|
96
|
+
])
|
97
|
+
end
|
98
|
+
|
83
99
|
example "Sets ACL" do
|
84
100
|
provider.options.update(:acl => "public_read")
|
85
101
|
expect(Dir).to receive(:glob).and_yield(__FILE__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.9.travis.
|
4
|
+
version: 1.7.9.travis.662.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|