s3_website 2.7.5 → 2.7.6

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: dc5f81b27a2eac7ab3ec3ad55e12c58535f27528
4
- data.tar.gz: 887d9569fed07a82ce91d5c4b8489a2b09ff0ef4
3
+ metadata.gz: d299d7f67b1761c67dec45101228c871af587630
4
+ data.tar.gz: f422c6066800271303d189d4a205744508ca1a63
5
5
  SHA512:
6
- metadata.gz: 7637867a9333db997119d2ef0fa61338aacd7914c27f3f6dd9b67cbaa606215427f498ad09da64ed2dcb0341d1d889a0413f7429a39cdd3524df9f5be5ba8d3d
7
- data.tar.gz: 84adfe0f24852748e94c6c50d56522c06bb09e7fd3c9ae7a9d026ebe864e6bbbceec1cd7f9c4d1ad17e2c6b00ab921b1496f6cb9817f83564ae00241357511f9
6
+ metadata.gz: df7b35cc68abd07816902aa2b1753436b617fc46123d56fab1bf4f023416505f839b35fb21384de059c8ff82f9e6fd9b0283750615b15f1ed2295ac1295217f3
7
+ data.tar.gz: 6686e17eaa28e15c98eb7d8528ab993fb8a545faf9440fe1e0879c5c0c7caf9063e76442cfa46488787da6d680ae7d5773e355dfff42f1ff78f7d1b9391774e8
data/changelog.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 2.7.6
6
+
7
+ * Null-check the result of File.listFiles
8
+
9
+ See <https://github.com/laurilehmijoki/s3_website/issues/145> for discussion.
10
+
5
11
  ## 2.7.5
6
12
 
7
13
  * Remove superfluous dot from error message
@@ -1,3 +1,3 @@
1
1
  module S3Website
2
- VERSION = '2.7.5'
2
+ VERSION = '2.7.6'
3
3
  end
@@ -83,30 +83,24 @@ object Push {
83
83
  ): ExitCode = {
84
84
  logger.info(s"${Deploy.renderVerb} ${site.rootDirectory}/* to ${site.config.s3_bucket}")
85
85
  val s3FilesFuture = resolveS3Files()
86
- val redirectsFuture: Redirects = resolveRedirects(s3FilesFuture)
87
- val redirectReports: Future[Either[ErrorReport, Seq[Future[PushErrorOrSuccess]]]] =
88
- redirectsFuture.map { (errOrRedirects: Either[ErrorReport, Seq[Redirect]]) =>
89
- errOrRedirects.right.map(_.filter(_.needsUpload).map(S3 uploadRedirect _))
90
- }
86
+ val redirectsFuture = resolveRedirects(s3FilesFuture)
87
+ val redirectReports = redirectsFuture.map { errOrRedirects =>
88
+ errOrRedirects.right.map(_.filter(_.needsUpload).map(S3 uploadRedirect _))
89
+ }
91
90
 
92
- val uploadFutures: FutureUploads = resolveUploads(s3FilesFuture)
93
- val uploadReports: Future[Either[ErrorReport, Seq[Future[PushErrorOrSuccess]]]] = for {
94
- errorOrUploads: Either[ErrorReport, Seq[Upload]] <- uploadFutures
91
+ val uploadReports = for {
92
+ errorOrUploads <- resolveUploads(s3FilesFuture)
95
93
  } yield errorOrUploads.right.map(_.map(S3 uploadFile _))
96
94
 
97
- val deleteReports: Future[Either[ErrorReport, Seq[Future[PushErrorOrSuccess]]]] = for {
98
- errorOrUploads: Either[ErrorReport, Seq[Upload]] <- uploadFutures
99
- } yield {
100
- val errorsOrDeleteReports = redirectsFuture.flatMap { (errOrRedirects: Either[ErrorReport, Seq[Redirect]]) =>
101
- errOrRedirects.fold(
102
- err => Future(Left(err)),
103
- redirects => resolveDeletes(s3FilesFuture, redirects)
104
- )
105
- }.map { (deletes: Either[ErrorReport, Seq[S3Key]]) =>
106
- deletes.right.map(keysToDelete => keysToDelete.map(S3 delete _))
107
- }
108
- Await.result(errorsOrDeleteReports, 1 day)
95
+ val deleteReports = redirectsFuture flatMap { errOrRedirects =>
96
+ errOrRedirects.fold(
97
+ err => Future(Left(err)),
98
+ redirects => resolveDeletes(s3FilesFuture, redirects)
99
+ )
100
+ } map { deletes =>
101
+ deletes.right.map(keysToDelete => keysToDelete.map(S3 delete _))
109
102
  }
103
+
110
104
  val allReports = Future.sequence(redirectReports :: uploadReports :: deleteReports :: Nil) map { reports =>
111
105
  reports.foldLeft(Nil: PushReports) { (memo, report: Either[ErrorReport, Seq[Future[PushErrorOrSuccess]]]) =>
112
106
  report match {
@@ -120,7 +114,7 @@ object Push {
120
114
  val finishedPushOps = awaitForResults(Await.result(allReports, 1 day))
121
115
  val invalidationSucceeded = invalidateCloudFrontItems(finishedPushOps)
122
116
 
123
- afterPushFinished(finishedPushOps, invalidationSucceeded)
117
+ report(finishedPushOps, invalidationSucceeded)
124
118
  }
125
119
 
126
120
  def invalidateCloudFrontItems
@@ -157,7 +151,7 @@ object Push {
157
151
 
158
152
  type InvalidationSucceeded = Boolean
159
153
 
160
- def afterPushFinished(finishedPushOps: FinishedPushOperations, invalidationSucceeded: Option[Boolean])
154
+ def report(finishedPushOps: FinishedPushOperations, invalidationSucceeded: Option[Boolean])
161
155
  (implicit config: Config, logger: Logger, pushOptions: PushOptions): ExitCode = {
162
156
  val pushCounts = resolvePushCounts(finishedPushOps)
163
157
  logger.info(s"Summary: ${pushCountsToString(pushCounts)}")
@@ -128,7 +128,10 @@ object Upload {
128
128
  object Files {
129
129
  def recursiveListFiles(f: File): Seq[File] = {
130
130
  val these = f.listFiles
131
- these ++ these.filter(_.isDirectory).flatMap(recursiveListFiles)
131
+ if (these != null)
132
+ these ++ these.filter(_.isDirectory).flatMap(recursiveListFiles)
133
+ else
134
+ Nil
132
135
  }
133
136
 
134
137
  def listSiteFiles(implicit site: Site, logger: Logger) = {
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.7.5
4
+ version: 2.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-21 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor