s3_website 2.6.0 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 092f7440dce07a7188fa3c262eb670ee1ce3fcfa
4
- data.tar.gz: f33f91a77cebaefdfd7cb37783184a210ab06222
3
+ metadata.gz: c6bd443ae587cab4726f6ed2e3f11051bb62f7c4
4
+ data.tar.gz: 4e7410d745fc3a59f26fdc83c16d182a0ba9396f
5
5
  SHA512:
6
- metadata.gz: fb3f83a880087f6b7f71ac89fdfe356db8c53e28c9f8b899b8bf4da8d96d1f8df4f0001af67e487d8fbee995a9c7dd4a4a5bbaac2f2b3fadee804c80b287c3df
7
- data.tar.gz: f25b7a9f0d394497adfd2af1b672fcefc1514d739547a2bba2b83ed68b34984cf837552b457abf293f85f61f6dec46d95e3763118c7675ffdf3ab209b47c4c1f
6
+ metadata.gz: 6672d992af55beb7954846d8b47652d6c3918ab71616a68b54b4559a59705957572a99d87b364d15f92c81202401173608f26b35acc54f03d8711d0d60358e3e
7
+ data.tar.gz: 4c2fed94893a54a957f895c3ca57d54f02de2517437a564cccf90320fb18ee7349b9dd37b84e9b1e308e67fe672d7b16f91e879cc2ab221ece55af3e947c040d
data/README.md CHANGED
@@ -435,6 +435,7 @@ Contributors (in alphabetical order)
435
435
  * stanislas
436
436
  * Tate Johnson
437
437
  * Toby Marsden
438
+ * Tom Bell
438
439
  * Trevor Fitzgerald
439
440
  * Zee Spencer
440
441
 
data/changelog.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 2.6.1
6
+
7
+ * Always invalidate the object */index.html* if the setting `cloudfront_invalidate_root` is on
8
+
9
+ See https://github.com/laurilehmijoki/s3_website/pull/130 for discussion
10
+
5
11
  ## 2.6.0
6
12
 
7
13
  * Support `--config-dir` in `cfg apply`
@@ -1,3 +1,3 @@
1
1
  module S3Website
2
- VERSION = '2.6.0'
2
+ VERSION = '2.6.1'
3
3
  end
@@ -1 +1 @@
1
- a5da7e6ad06239171fffe9c4822ca814
1
+ 7a47d1df31ffe3bb8093719149222afd
@@ -66,7 +66,7 @@ object CloudFront {
66
66
  }
67
67
 
68
68
  def awsCloudFrontClient(config: Config) = new AmazonCloudFrontClient(awsCredentials(config))
69
-
69
+
70
70
  def toInvalidationBatches(pushSuccessReports: Seq[PushSuccessReport])(implicit config: Config): Seq[InvalidationBatch] = {
71
71
  val invalidationPaths: Seq[String] = {
72
72
  def withDefaultPathIfNeeded(paths: Seq[String]) = {
@@ -81,11 +81,14 @@ object CloudFront {
81
81
  )
82
82
  if (containsPotentialDefaultRootObject) paths :+ "/" else paths
83
83
  }
84
+ def withIndexPathIfNeeded(paths: Seq[String]) = {
85
+ if (config.cloudfront_invalidate_root.contains(true)) paths :+ "/index.html" else paths
86
+ }
84
87
  val paths = pushSuccessReports
85
88
  .filter(needsInvalidation) // Assume that redirect objects are never cached.
86
89
  .map(toInvalidationPath)
87
- .map (applyInvalidateRootSetting)
88
- withDefaultPathIfNeeded(paths)
90
+ .map(applyInvalidateRootSetting)
91
+ withIndexPathIfNeeded(withDefaultPathIfNeeded(paths))
89
92
  }
90
93
 
91
94
  invalidationPaths
@@ -99,7 +102,7 @@ object CloudFront {
99
102
  }
100
103
 
101
104
  def applyInvalidateRootSetting(path: String)(implicit config: Config) =
102
- if (config.cloudfront_invalidate_root.exists(_ == true))
105
+ if (config.cloudfront_invalidate_root.contains(true))
103
106
  path.replaceFirst("/index.html$", "/")
104
107
  else
105
108
  path
@@ -215,7 +215,18 @@ class S3WebsiteSpec extends Specification {
215
215
  setLocalFile("articles/index.html")
216
216
  setOutdatedS3Keys("articles/index.html")
217
217
  push
218
- sentInvalidationRequest.getInvalidationBatch.getPaths.getItems.toSeq.sorted must equalTo(("/articles/" :: Nil).sorted)
218
+ sentInvalidationRequest.getInvalidationBatch.getPaths.getItems.toSeq must contain("/articles/")
219
+ }
220
+
221
+ "always invalidate the root path" in new BasicSetup {
222
+ config = """
223
+ |cloudfront_distribution_id: EGM1J2JJX9Z
224
+ |cloudfront_invalidate_root: true
225
+ """.stripMargin
226
+ setLocalFile("articles/index.html")
227
+ setOutdatedS3Keys("articles/index.html")
228
+ push
229
+ sentInvalidationRequest.getInvalidationBatch.getPaths.getItems.toSeq must contain("/index.html")
219
230
  }
220
231
  }
221
232
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-02 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor