datapimp 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8450023c69c542a3cc5d8bb3284eb30a3c371065
4
- data.tar.gz: 0e5c349b02973ff2c14d38ed6c9412228bd7f533
3
+ metadata.gz: 47197614b0c4d6c1516dc06bc52effb6a1925dfb
4
+ data.tar.gz: 29ac24ff99fa81657cf073209d38cf8152368153
5
5
  SHA512:
6
- metadata.gz: 64cb820bf348bc5700f1681ac9eb72041c6d8cbb803bd7fcc7819c73bf3828b2431680184cc414e217cff6e1722a0c5337b5b1d708ff4b3bd5d8e28917f00642
7
- data.tar.gz: 26016c6f68c370a5c8ccc160191688bfa4d1b4219ee2698233b782cc61ac2613642a0df5414057de6232269a10bf829a5b47edbdb96e36d3eacedc7825dbb4db
6
+ metadata.gz: fffa9d02fdd46d56a9ab41673bf943c097f50729902f0274aabb67de126f1ea09ef4a4acff4dae0b47bdf69c7f3653efd75fe5009bd92865d74bb57bd900adc0
7
+ data.tar.gz: f82e0a60066538e96fedfb58e5060e910447fe9fc60e9f6b7e39c9c78c953142512973291b9d8eb144e5f408d4fe3a18d936d42b47c5af96796c8fa90f6a67ad
@@ -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
- binding.pry
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
- m = deploy_manifest
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={})
@@ -1,3 +1,3 @@
1
1
  module Datapimp
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datapimp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Soeder