s3_website_monadic 0.0.32 → 0.0.33

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: 87c870c1dae2ea36e452f7df0b0f7565c5cec616
4
- data.tar.gz: 4e8324a2207a37a3f991490d187c27d35139c04b
3
+ metadata.gz: f701f980a56f1ae501c3a926f7bf90c667670f0b
4
+ data.tar.gz: 6661ae37dfdbb82218ef2e51e0597830860d36a4
5
5
  SHA512:
6
- metadata.gz: 5fdcff5e2fad65a9a895bc7669db2690f70c9dd4e7ab54be0962a99a279dda4f88542373eb476e7a6750c2580554888f329aa240ff9d346f26648128adc2a38c
7
- data.tar.gz: 0221384872bd4914d9585f5f63074f0b9286600491abdce62f411c5e545d42bd41a484bdf04c686be79350fcb5d71e28d865004f371ef0e32f8caafc04660800
6
+ metadata.gz: 3609367267234c2e73d0f2aa3b97c8cd7c489b8e208c69a3c1dce34b18f3f1ededc87e05dab97b2f463b641ad1700c0423fab5867ceb7c291f0cfb85d03026a7
7
+ data.tar.gz: 745e768c92b07c378ba48a43059af8d72e487f0b972920e809d26105b530acc7d92fd0630980980ad3ed6674256791ae5352f09ef351e4826a0741034581db04
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ Gemfile.lock
8
8
  .idea
9
9
  target
10
10
  .idea_modules
11
+ .vagrant
data/README.md CHANGED
@@ -72,6 +72,12 @@ s3_bucket: blog.example.com
72
72
  roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances),
73
73
  you can omit the `s3_id` and `s3_secret` keys in the config file.)
74
74
 
75
+ S3_website implements supports for reading environment variables from a file using
76
+ the [dotenv](https://github.com/bkeepers/dotenv) gem. You can create a `.env` file
77
+ in the project's root directory to take advantage of this feature. Please have
78
+ a look at [dotenv's usage guide](https://github.com/bkeepers/dotenv#usage) for
79
+ syntax information.
80
+
75
81
  ## Project goals
76
82
 
77
83
  * Provide a command-line interface tool for deploying and managing S3 websites
@@ -141,13 +147,6 @@ gzip:
141
147
  Remember that the extensions here are referring to the *compiled* extensions,
142
148
  not the pre-processed extensions.
143
149
 
144
- #### Gzip zopfli
145
-
146
- By adding the line `gzip_zopfli: true` into the config file, you can benefit
147
- from the zopfli algorithm, which is 100% compatible with the traditional gzip
148
- algorithm. A zopfli compression takes longer but results in about 5% smaller
149
- files.
150
-
151
150
  ### Using non-standard AWS regions
152
151
 
153
152
  By default, `s3_website_monadic` uses the US Standard Region. You can upload your
@@ -408,6 +407,7 @@ Contributors (in alphabetical order)
408
407
  * Christopher Petersen
409
408
  * David Michael Barr
410
409
  * David Raffensperger
410
+ * Douglas Teoh
411
411
  * Greg Karékinian
412
412
  * John Allison
413
413
  * Jordan White
@@ -0,0 +1,9 @@
1
+ # Vagrant
2
+
3
+ Use Vagrant for testing the installation procedure on Linux.
4
+
5
+ Here's howto:
6
+
7
+ 1. Install <https://www.vagrantup.com/downloads.html>
8
+ 2. `cd vagrant && vagrant status`
9
+ 3. launch with `vagrant up <name>` and ssh into with `vagrant ssh <name>`
@@ -97,7 +97,7 @@ def resolve_jar(project_root, logger)
97
97
  project_root + '/target/scala-2.11/s3_website.jar'
98
98
  released_jar_lookup_paths = [
99
99
  project_root + "/s3_website-#{S3Website::VERSION}.jar",
100
- ENV['TMPDIR'] + "/s3_website-#{S3Website::VERSION}.jar"
100
+ (ENV['TMPDIR'] || '/tmp') + "/s3_website-#{S3Website::VERSION}.jar"
101
101
  ]
102
102
  found_jar = ([development_jar_path] + released_jar_lookup_paths)
103
103
  .select { |jar_path|
data/changelog.md CHANGED
@@ -40,6 +40,19 @@ This project uses [Semantic Versioning](http://semver.org).
40
40
 
41
41
  * You can no longer use this gem as a Ruby library
42
42
 
43
+ * `gzip_zopfli: true`
44
+
45
+ At the time of writing, there does not exist a stable zopfli implementation
46
+ for Java.
47
+
48
+ ## 1.8.1
49
+
50
+ * Do not push the *.env* file
51
+
52
+ ## 1.8.0
53
+
54
+ * Add support for (dotenv)[https://github.com/bkeepers/dotenv]
55
+
43
56
  ## 1.7.6
44
57
 
45
58
  * Remove a test setting from *Gemfile*
@@ -1,3 +1,3 @@
1
1
  module S3Website
2
- VERSION = '0.0.32'
2
+ VERSION = '0.0.33'
3
3
  end
data/lib/s3_website.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'thor'
3
+ require 'dotenv'
4
+
5
+ Dotenv.load
3
6
 
4
7
  require File.dirname(__FILE__) + "/s3_website/version"
data/release CHANGED
@@ -6,6 +6,7 @@ require_relative 'lib/s3_website/version'
6
6
  version = S3Website::VERSION
7
7
  unless ENV['S3_WEBSITE_RELEASE_KEY']
8
8
  puts "Set the S3_WEBSITE_RELEASE_KEY environmental variable. It should be your personal GitHub access token."
9
+ exit 1
9
10
  end
10
11
 
11
12
  def run(cmd)
data/s3_website.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'thor', '= 0.18.1'
21
21
  s.add_dependency 'configure-s3-website', '= 1.5.5'
22
22
  s.add_dependency 'colored', '1.2'
23
+ s.add_dependency 'dotenv', '~> 0.11.1'
23
24
 
24
25
  s.add_development_dependency 'rake', '10.1.1'
25
26
  s.add_development_dependency 'octokit', '3.1.0'
@@ -122,7 +122,8 @@ object Files {
122
122
  (exclusionRegexes: Seq[String]) => exclusionRegexes exists (rubyRegexMatches(s3Key, _))
123
123
  )
124
124
  }
125
- val doNotUpload = excludeByConfig || s3Key == "s3_website.yml"
125
+ val neverUpload = "s3_website.yml" :: ".env" :: Nil
126
+ val doNotUpload = excludeByConfig || (neverUpload contains s3Key)
126
127
  if (doNotUpload) logger.debug(s"Excluded $s3Key from upload")
127
128
  doNotUpload
128
129
  }
@@ -103,7 +103,14 @@ package object website {
103
103
  case exception: AmazonServiceException => Some(exception.getStatusCode)
104
104
  case _ => None
105
105
  }
106
- httpStatusCode.exists(c => c >= 400 && c < 500)
106
+ val isAwsTimeoutException =
107
+ error match {
108
+ case exception: AmazonServiceException =>
109
+ // See http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList
110
+ exception.getErrorCode == "RequestTimeout"
111
+ case _ => false
112
+ }
113
+ httpStatusCode.exists(c => c >= 400 && c < 500) && !isAwsTimeoutException
107
114
  }
108
115
 
109
116
  implicit class NumReport(val num: Int) extends AnyVal {
@@ -109,6 +109,26 @@ class S3WebsiteSpec extends Specification {
109
109
  verify(amazonS3Client, times(1)).putObject(Matchers.any(classOf[PutObjectRequest]))
110
110
  }
111
111
 
112
+ "try again if the request times out" in new AllInSameDirectory with EmptySite with MockAWS with DefaultRunMode {
113
+ var attempt = 0
114
+ when(amazonS3Client putObject Matchers.any(classOf[PutObjectRequest])) thenAnswer new Answer[PutObjectResult] {
115
+ def answer(invocation: InvocationOnMock) = {
116
+ attempt += 1
117
+ if (attempt < 2) {
118
+ val e = new AmazonServiceException("Too long a request")
119
+ e.setStatusCode(400)
120
+ e.setErrorCode("RequestTimeout")
121
+ throw e
122
+ } else {
123
+ new PutObjectResult
124
+ }
125
+ }
126
+ }
127
+ setLocalFile("index.html")
128
+ val exitStatus = push
129
+ verify(amazonS3Client, times(2)).putObject(Matchers.any(classOf[PutObjectRequest]))
130
+ }
131
+
112
132
  "try again if the delete fails" in new AllInSameDirectory with EmptySite with MockAWS with DefaultRunMode {
113
133
  setS3Files(S3File("old.html", md5Hex("<h1>old text</h1>")))
114
134
  deleteFailsAndThenSucceeds(howManyFailures = 5)
@@ -274,6 +294,14 @@ class S3WebsiteSpec extends Specification {
274
294
  }
275
295
  }
276
296
 
297
+ ".env file" should { // The .env file is the https://github.com/bkeepers/dotenv file
298
+ "never be uploaded" in new AllInSameDirectory with EmptySite with MockAWS with DefaultRunMode {
299
+ setLocalFile(".env")
300
+ push
301
+ noUploadsOccurred must beTrue
302
+ }
303
+ }
304
+
277
305
  "exclude_from_upload: string" should {
278
306
  "result in matching files not being uploaded" in new AllInSameDirectory with EmptySite with MockAWS with DefaultRunMode {
279
307
  config = "exclude_from_upload: .DS_.*?"
@@ -0,0 +1,25 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = "2"
6
+
7
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
+ vms = {
9
+ 'ubuntu_14.04' => {
10
+ :box_url => 'https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box',
11
+ :ip => '33.33.33.0'
12
+ },
13
+ 'centos_6.5' => {
14
+ :box_url => 'http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-puppet.box',
15
+ :ip => '33.33.33.1'
16
+ }
17
+ }
18
+ vms.each do |vm_name, vm_opts|
19
+ config.vm.define vm_name do |node_config|
20
+ node_config.vm.box = vm_name
21
+ node_config.vm.box_url = vm_opts.fetch(:box_url)
22
+ node_config.vm.network :private_network, ip: vm_opts.fetch(:ip)
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website_monadic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
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-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.11.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.11.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +109,7 @@ files:
95
109
  - LICENSE
96
110
  - README.md
97
111
  - Rakefile
112
+ - additional-docs/development.md
98
113
  - additional-docs/example-configurations.md
99
114
  - additional-docs/setting-up-aws-credentials.md
100
115
  - assembly.sbt
@@ -124,6 +139,7 @@ files:
124
139
  - src/main/scala/s3/website/model/ssg.scala
125
140
  - src/main/scala/s3/website/package.scala
126
141
  - src/test/scala/s3/website/S3WebsiteSpec.scala
142
+ - vagrant/Vagrantfile
127
143
  homepage: https://github.com/laurilehmijoki/s3_website/tree/s3_website_monadic
128
144
  licenses:
129
145
  - MIT