datapimp 1.0.10 → 1.0.11
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 +4 -4
- data/lib/datapimp/cli/create.rb +43 -0
- data/lib/datapimp/sync/s3_bucket.rb +3 -11
- data/lib/datapimp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47197614b0c4d6c1516dc06bc52effb6a1925dfb
|
4
|
+
data.tar.gz: 29ac24ff99fa81657cf073209d38cf8152368153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fffa9d02fdd46d56a9ab41673bf943c097f50729902f0274aabb67de126f1ea09ef4a4acff4dae0b47bdf69c7f3653efd75fe5009bd92865d74bb57bd900adc0
|
7
|
+
data.tar.gz: f82e0a60066538e96fedfb58e5060e910447fe9fc60e9f6b7e39c9c78c953142512973291b9d8eb144e5f408d4fe3a18d936d42b47c5af96796c8fa90f6a67ad
|
data/lib/datapimp/cli/create.rb
CHANGED
@@ -1,3 +1,46 @@
|
|
1
|
+
command 'create cache invalidations' do |c|
|
2
|
+
c.syntax = 'datapimp create cache invalidations'
|
3
|
+
c.description = 'invalidate remote cache layers (i.e. cloudfront after a s3 deploy)'
|
4
|
+
|
5
|
+
Datapimp::Cli.accepts_keys_for(c, :amazon)
|
6
|
+
|
7
|
+
c.option '--all-html', 'Invalidate all HTML paths in the bucket'
|
8
|
+
c.option '--previous-deploy', 'Invalidate all paths from the previous deploy'
|
9
|
+
c.option '--paths PATHS', Array, 'The paths you would like to invalidate'
|
10
|
+
|
11
|
+
c.action do |args, options|
|
12
|
+
options.defaults(:paths => [])
|
13
|
+
|
14
|
+
bucket = Datapimp::Sync::S3Bucket.new(remote: args.first)
|
15
|
+
|
16
|
+
paths = Array(options.paths)
|
17
|
+
|
18
|
+
if options.all_html
|
19
|
+
html_files = bucket.s3.files.select {|file| file.key.match(/\.html/) }
|
20
|
+
|
21
|
+
paths += html_files.map {|file| file.public_url }.map do |url|
|
22
|
+
path = URI.parse(url).path.gsub("/#{bucket.remote}","")
|
23
|
+
index = path.gsub('/index.html','')
|
24
|
+
index = "/" if index == ""
|
25
|
+
[path, index]
|
26
|
+
end
|
27
|
+
|
28
|
+
paths.flatten!
|
29
|
+
end
|
30
|
+
|
31
|
+
if options.previous_deploy
|
32
|
+
items = bucket.deploy_manifest["uploaded"]
|
33
|
+
binding.pry
|
34
|
+
end
|
35
|
+
|
36
|
+
if paths.length > 0
|
37
|
+
log "Posting invalidations for #{ paths.length } paths"
|
38
|
+
Datapimp::Sync.amazon.cdn.post_invalidation(bucket.cloudfront.id, paths)
|
39
|
+
log "Invalidated paths: #{ paths.inspect }"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
1
44
|
command 'create s3 bucket' do |c|
|
2
45
|
c.syntax = 'datapimp create s3 bucket BUCKETNAME'
|
3
46
|
c.description = 'create an s3 bucket to use for website hosting'
|
@@ -13,7 +13,7 @@ module Datapimp
|
|
13
13
|
end
|
14
14
|
|
15
15
|
if redirect == true
|
16
|
-
|
16
|
+
log "Should be creating a redirect bucket"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -57,16 +57,7 @@ module Datapimp
|
|
57
57
|
# so that we aren't deploying stuff which is the
|
58
58
|
# same since last time we deployed
|
59
59
|
def prepare_manifest_for(entries)
|
60
|
-
|
61
|
-
|
62
|
-
entries.each do |entry|
|
63
|
-
destination = Pathname(entry).relative_path_from(local_path).to_s.without_leading_slash
|
64
|
-
|
65
|
-
deploy_manifest.fetch(destination) do
|
66
|
-
next unless destination.match(/\w+\.\w+/)
|
67
|
-
m[destination] = nil
|
68
|
-
end
|
69
|
-
end
|
60
|
+
deploy_manifest
|
70
61
|
end
|
71
62
|
|
72
63
|
def run_update_acl_action(options={})
|
@@ -127,6 +118,7 @@ module Datapimp
|
|
127
118
|
end
|
128
119
|
|
129
120
|
def run_pull_action(options={})
|
121
|
+
|
130
122
|
end
|
131
123
|
|
132
124
|
def run_create_action(options={})
|
data/lib/datapimp/version.rb
CHANGED