middleman-s3_sync 3.0.37 → 3.0.38

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: 0a3d596b258f8ad284fe69c1ec98d9a81d012095
4
- data.tar.gz: 19f15e444a731602a38c004ca41216f3296de52c
3
+ metadata.gz: 45f758d7d204535650c4e825a52abc4e69bcf086
4
+ data.tar.gz: 3462381561ce1d269f3dc39a9786237d9c9bef9d
5
5
  SHA512:
6
- metadata.gz: ab5b04bc4666c9c14bcfe9d24e51690ab542b78ad3e1e8f9453773f2f76ada44bcf622cc23dee4f1f760b100cff6b51a3b4e74b35584cd8302f71be7eeb1a60f
7
- data.tar.gz: 690186a84248f7fe826708a8bd64be308e5a8581b0cdc5a0f8a7f0742b32d3a7dcb66f1e7b8a86f39c9f33c0b4d3b433b06afd27da101867a5c0533dc52335c4
6
+ metadata.gz: abc5a66bbd74569d75078288b52cabaf77c1e9afd9b5a687efb9033b2ec879e5f72fa9f722097107e625cc91bdb9cf1ef6c8c8c15e7176338118ad073a3e6185
7
+ data.tar.gz: 9953b988d69940aa385e23a1182fdaa60ce215de6dd05e20702fc2ccc5f6e32725415c586b2923bc27efdfca9c3f6aba1c93203086fd25c0a80a2d02dfb01bec
data/.travis.yml CHANGED
@@ -3,6 +3,8 @@ language: ruby
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
+ - 2.1.5
7
+
6
8
  env:
7
9
  global:
8
10
  - secure: ! 'dQ/vYDmUZEW9LD8IyTRFoRFo24w2yJTYQHuAS24vfKToDZ0BO2/Tpq5lh0vb
@@ -17,6 +17,10 @@ module Middleman
17
17
  app.define_hook :after_s3_sync
18
18
 
19
19
  app.after_configuration do |config|
20
+ # Record the http_prefix if it is set. We will need it while setting
21
+ # the options to detect whether it is set and adjust the prefix value
22
+ # accordingly
23
+ options.http_prefix = app.respond_to? :http_prefix ? app.http_prefix : nil
20
24
 
21
25
  # Define the after_build step after during configuration so
22
26
  # that it's pushed to the end of the callback chain
@@ -3,6 +3,7 @@ module Middleman
3
3
  class Options
4
4
  OPTIONS = [
5
5
  :prefix,
6
+ :http_prefix,
6
7
  :acl,
7
8
  :bucket,
8
9
  :region,
@@ -83,8 +84,17 @@ module Middleman
83
84
  (@path_style.nil? ? true : @path_style)
84
85
  end
85
86
 
87
+ def prefix=(prefix)
88
+ http_prefix = @http_prefix ? @http_prefix.sub(%r{^/}, "") : ""
89
+ if http_prefix.split("/").first == prefix
90
+ @prefix = ""
91
+ else
92
+ @prefix = prefix
93
+ end
94
+ end
95
+
86
96
  def prefix
87
- @prefix.nil? ? "" : "#{@prefix}/"
97
+ @prefix.blank? ? "" : "#{@prefix}/"
88
98
  end
89
99
 
90
100
  def version_bucket
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.0.37"
3
+ VERSION = "3.0.38"
4
4
  end
5
5
  end
data/spec/options_spec.rb CHANGED
@@ -117,4 +117,14 @@ describe Middleman::S3Sync::Options do
117
117
  its(:aws_secret_access_key) { should eq(aws_secret_access_key) }
118
118
  its(:bucket) { should eq(bucket) }
119
119
  end
120
+
121
+ context "prefix with http_prefix" do
122
+ before do
123
+ options.http_prefix = "/blog"
124
+ options.prefix = "blog"
125
+ end
126
+
127
+ its(:prefix) { should eq("")}
128
+ end
129
+
120
130
  end
@@ -22,7 +22,7 @@ describe Middleman::S3Sync::Resource do
22
22
 
23
23
  its(:status) { should eq :new }
24
24
 
25
- it "does not have a remote equivalend" do
25
+ it "does not have a remote equivalent" do
26
26
  expect(resource).not_to be_remote
27
27
  end
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-s3_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.37
4
+ version: 3.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederic Jean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-19 00:00:00.000000000 Z
12
+ date: 2014-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core