s3_website 2.1.12 → 2.1.13

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: a449c3c953cddea37d7efa16cae0007a968b6c6c
4
- data.tar.gz: 070ec243442e743bb4a3435543c6035e2fa329b3
3
+ metadata.gz: 7f58dc2a4c31a05615ccfabc88ab06787fe6d9c2
4
+ data.tar.gz: 4848ab9653a8c796ee94fbd97ec59691d9b1e17b
5
5
  SHA512:
6
- metadata.gz: e702135da6028c112ad3272e20dd26002ff8b7876c29c51b0be67e5f897f5bfe3fb12d4d33248c5814efb7040536b0eaff01a4effcce818489b64cd63a3a7e51
7
- data.tar.gz: dd752d292566b6c9bb6c4ef026402b2cba9d92236187f9f54ba7b4585699823ccc4b8d54ee27e30de6eae40bc4dd01ad4551dda949dd7314c73989f17d9b5d94
6
+ metadata.gz: 33d258cac936218cd84292e0111dfa5edb4dcd792cf2a81693abcb446f161bb6bd33bb2a0cba3c6496df0d573307c1f0d34e735ce40d2c360483b58478ee75e5
7
+ data.tar.gz: af4dce07242118c7d680c252a10877347bca41ddba90a595c2bb4fd22bd5b4e93bd36a0e079e3a168e1d7c1c61f566d748220b352daba7992487546e7421cf2b
@@ -2,6 +2,12 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 2.1.13
6
+
7
+ * Print JVM stack trace on error and `--verbose`
8
+
9
+ This eases debugging
10
+
5
11
  ## 2.1.12
6
12
 
7
13
  * Exit with status 1 when encountering an unrecognised CLI option
@@ -1,3 +1,3 @@
1
1
  module S3Website
2
- VERSION = '2.1.12'
2
+ VERSION = '2.1.13'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  package s3.website
2
2
 
3
+ import s3.website.ErrorReport._
3
4
  import s3.website.model.{FileUpdate, Config}
4
5
  import com.amazonaws.services.cloudfront.{AmazonCloudFrontClient, AmazonCloudFront}
5
6
  import com.amazonaws.services.cloudfront.model.{TooManyInvalidationsInProgressException, Paths, InvalidationBatch, CreateInvalidationRequest}
@@ -60,8 +61,8 @@ object CloudFront {
60
61
  def reportMessage = s"${Invalidated.renderVerb} ${invalidatedItemsCount ofType "item"} on CloudFront"
61
62
  }
62
63
 
63
- case class FailedInvalidation(error: Throwable) extends FailureReport {
64
- def reportMessage = s"Failed to invalidate the CloudFront distribution (${error.getMessage})"
64
+ case class FailedInvalidation(error: Throwable)(implicit logger: Logger) extends ErrorReport {
65
+ def reportMessage = errorMessage(s"Failed to invalidate the CloudFront distribution", error)
65
66
  }
66
67
 
67
68
  def awsCloudFrontClient(config: Config) = new AmazonCloudFrontClient(awsCredentials(config))
@@ -8,7 +8,7 @@ class Logger(val verboseOutput: Boolean) {
8
8
  def fail(msg: String) = log(Failure, msg)
9
9
 
10
10
  def info(report: SuccessReport) = log(Success, report.reportMessage)
11
- def info(report: FailureReport) = fail(report.reportMessage)
11
+ def info(report: ErrorReport) = fail(report.reportMessage)
12
12
 
13
13
  def pending(msg: String) = log(Wait, msg)
14
14
 
@@ -1,5 +1,6 @@
1
1
  package s3.website
2
2
 
3
+ import s3.website.ErrorReport.errorMessage
3
4
  import s3.website.model._
4
5
  import com.amazonaws.services.s3.{AmazonS3, AmazonS3Client}
5
6
  import com.amazonaws.services.s3.model._
@@ -140,7 +141,7 @@ object S3 {
140
141
  type UpdateFutures = Seq[Either[ErrorReport, Future[PushErrorOrSuccess]]]
141
142
  type ErrorOrS3Files = Either[ErrorReport, Seq[S3File]]
142
143
 
143
- sealed trait PushFailureReport extends FailureReport
144
+ sealed trait PushFailureReport extends ErrorReport
144
145
  sealed trait PushSuccessReport extends SuccessReport {
145
146
  def s3Key: String
146
147
  }
@@ -208,12 +209,12 @@ object S3 {
208
209
  def reportMessage = s"${Deleted.renderVerb} $s3Key"
209
210
  }
210
211
 
211
- case class FailedUpload(s3Key: String, error: Throwable) extends PushFailureReport {
212
- def reportMessage = s"Failed to upload $s3Key (${error.getMessage})"
212
+ case class FailedUpload(s3Key: String, error: Throwable)(implicit logger: Logger) extends PushFailureReport {
213
+ def reportMessage = errorMessage(s"Failed to upload $s3Key", error)
213
214
  }
214
215
 
215
- case class FailedDelete(s3Key: String, error: Throwable) extends PushFailureReport {
216
- def reportMessage = s"Failed to delete $s3Key (${error.getMessage})"
216
+ case class FailedDelete(s3Key: String, error: Throwable)(implicit logger: Logger) extends PushFailureReport {
217
+ def reportMessage = errorMessage(s"Failed to delete $s3Key", error)
217
218
  }
218
219
 
219
220
  type S3ClientProvider = (Config) => AmazonS3
@@ -13,25 +13,27 @@ package object website {
13
13
  }
14
14
  trait SuccessReport extends Report
15
15
 
16
- trait FailureReport extends Report
17
-
18
16
  trait ErrorReport extends Report
19
17
 
20
18
  object ErrorReport {
21
19
  def apply(t: Throwable)(implicit logger: Logger) = new ErrorReport {
22
- override def reportMessage = {
23
- val extendedReport =
24
- if (logger.verboseOutput)
25
- Some(t.getStackTrace take 5)
26
- else
27
- None
28
- s"${t.getMessage}${extendedReport.fold("")(stackTraceElems => "\n" + stackTraceElems.mkString("\n"))}"
29
- }
20
+ override def reportMessage = errorMessage(t)
30
21
  }
31
22
 
32
23
  def apply(msg: String) = new ErrorReport {
33
24
  override def reportMessage = msg
34
25
  }
26
+
27
+ def errorMessage(msg: String, t: Throwable)(implicit logger: Logger): String = s"$msg (${errorMessage(t)})"
28
+
29
+ def errorMessage(t: Throwable)(implicit logger: Logger): String = {
30
+ val extendedReport =
31
+ if (logger.verboseOutput)
32
+ Some(t.getStackTrace)
33
+ else
34
+ None
35
+ s"${t.getMessage}${extendedReport.fold("")(stackTraceElems => "\n" + stackTraceElems.mkString("\n"))}"
36
+ }
35
37
  }
36
38
 
37
39
  trait RetrySetting {
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.1.12
4
+ version: 2.1.13
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-06-27 00:00:00.000000000 Z
11
+ date: 2014-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor