s3_website 2.3.1 → 2.4.0
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/README.md +3 -0
- data/changelog.md +6 -0
- data/lib/s3_website/version.rb +1 -1
- data/resources/s3_website.jar.md5 +1 -1
- data/src/main/scala/s3/website/Diff.scala +22 -16
- data/src/test/scala/s3/website/S3WebsiteSpec.scala +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b26682cbb78c10aa527d65993f265c3b97af2450
|
|
4
|
+
data.tar.gz: 3bd33a3a6440de3a8f83b257828bc815e0e4e439
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c102eab9efbb9d438329a32456c5ee55a11f096fe18e25767eb7029055d76c3176c1b7bd0c085fe1df8fcf19f54708fe30c8261bec947df8a299548e27dfedde
|
|
7
|
+
data.tar.gz: 89fc0705033813863965ea64abec0ee1e3137f70bcf5fdfe3bda40380aeb062cd5d9a6c79a3d535ae1cd4ce4ba579388abc595239a1bdec83cf2c923c8259f8c
|
data/README.md
CHANGED
|
@@ -169,6 +169,9 @@ ignore_on_server:
|
|
|
169
169
|
- file_managed_by_somebody_else
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
If you add the magic word `ignore_on_server: _DELETE_NOTHING_ON_THE_S3_BUCKET_`,
|
|
173
|
+
`s3_website push` will never delete any objects on the bucket.
|
|
174
|
+
|
|
172
175
|
### Excluding files from upload
|
|
173
176
|
|
|
174
177
|
You can instruct `s3_website` not to push certain files:
|
data/changelog.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses [Semantic Versioning](http://semver.org).
|
|
4
4
|
|
|
5
|
+
## 2.4.0
|
|
6
|
+
|
|
7
|
+
* Add `ignore_on_server: _DELETE_NOTHING_ON_THE_S3_BUCKET_` for the sake of convenience
|
|
8
|
+
|
|
9
|
+
See https://github.com/laurilehmijoki/s3_website/issues/121 for discussion.
|
|
10
|
+
|
|
5
11
|
## 2.3.1
|
|
6
12
|
|
|
7
13
|
* Add Windows support
|
data/lib/s3_website/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d4b00c407f92dde48e4937d61c7be20d
|
|
@@ -39,23 +39,29 @@ object Diff {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
def resolveDeletes(s3Files: Future[Either[ErrorReport, Seq[S3File]]], redirects: Seq[Redirect])
|
|
42
|
-
(implicit site: Site, logger: Logger, executor: ExecutionContextExecutor): Future[Either[ErrorReport, Seq[S3Key]]] =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
(implicit site: Site, logger: Logger, executor: ExecutionContextExecutor): Future[Either[ErrorReport, Seq[S3Key]]] =
|
|
43
|
+
if (site.config.ignore_on_server.contains(Left(DELETE_NOTHING_MAGIC_WORD))) {
|
|
44
|
+
logger.debug(s"Ignoring all files on the bucket, since the setting $DELETE_NOTHING_MAGIC_WORD is on.")
|
|
45
|
+
Future(Right(Nil))
|
|
46
|
+
} else {
|
|
47
|
+
val localS3Keys = Files.listSiteFiles.map(site resolveS3Key)
|
|
48
|
+
|
|
49
|
+
s3Files map { s3Files: Either[ErrorReport, Seq[S3File]] =>
|
|
50
|
+
for {
|
|
51
|
+
remoteS3Keys <- s3Files.right.map(_ map (_.s3Key)).right
|
|
52
|
+
} yield {
|
|
53
|
+
val keysToRetain = (localS3Keys ++ (redirects map { _.s3Key })).toSet
|
|
54
|
+
remoteS3Keys filterNot { s3Key =>
|
|
55
|
+
val ignoreOnServer = site.config.ignore_on_server.exists(_.fold(
|
|
56
|
+
(ignoreRegex: String) => rubyRegexMatches(s3Key, ignoreRegex),
|
|
57
|
+
(ignoreRegexes: Seq[String]) => ignoreRegexes.exists(rubyRegexMatches(s3Key, _))
|
|
58
|
+
))
|
|
59
|
+
if (ignoreOnServer) logger.debug(s"Ignoring $s3Key on server")
|
|
60
|
+
(keysToRetain contains s3Key) || ignoreOnServer
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
|
|
65
|
+
|
|
66
|
+
val DELETE_NOTHING_MAGIC_WORD = "_DELETE_NOTHING_ON_THE_S3_BUCKET_"
|
|
61
67
|
}
|
|
@@ -18,6 +18,7 @@ import org.mockito.{ArgumentCaptor, Matchers, Mockito}
|
|
|
18
18
|
import org.specs2.mutable.{BeforeAfter, Specification}
|
|
19
19
|
import org.specs2.specification.Scope
|
|
20
20
|
import s3.website.CloudFront.CloudFrontSetting
|
|
21
|
+
import s3.website.Diff.DELETE_NOTHING_MAGIC_WORD
|
|
21
22
|
import s3.website.Push.{CliArgs}
|
|
22
23
|
import s3.website.S3.S3Setting
|
|
23
24
|
import s3.website.model.Config.S3_website_yml
|
|
@@ -344,6 +345,17 @@ class S3WebsiteSpec extends Specification {
|
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
347
|
|
|
348
|
+
"ignore_on_server: _DELETE_NOTHING_ON_THE_S3_BUCKET_" should {
|
|
349
|
+
"result in no files being deleted on the S3 bucket" in new BasicSetup {
|
|
350
|
+
config = s"""
|
|
351
|
+
|ignore_on_server: $DELETE_NOTHING_MAGIC_WORD
|
|
352
|
+
""".stripMargin
|
|
353
|
+
setS3Files(S3File("file.txt", ""))
|
|
354
|
+
push
|
|
355
|
+
noDeletesOccurred
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
347
359
|
"""
|
|
348
360
|
ignore_on_server:
|
|
349
361
|
- regex
|
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.
|
|
4
|
+
version: 2.4.0
|
|
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
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|