middleman-s3_sync 3.0.31 → 3.0.32

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: 5f431194b1a96375b88da5f61aae633e9281bd3b
4
- data.tar.gz: 1ee6ebd0ff9c2c793917db1caa3f44fc3d00e3bd
3
+ metadata.gz: b3ce2090b4283bf6444fb03b7b96dc6f9937054f
4
+ data.tar.gz: be1f3af6a566204373a92c67092c0c5baa90677d
5
5
  SHA512:
6
- metadata.gz: 37ec664a5db9d9225ab9634a1a481f0e248926ee247a0c5f0a1b653737edd1b900865de2830c2f0db1356d8d9763022663b38574b8d4f2514ec81c4a833c698d
7
- data.tar.gz: f6088910de0c27cd4b60ea18579709bbe0c56c45d75be7fb701e2f67d4da80246c077605c2afa74faf88b79097de1064a1c16004584bcc1b85d4ad016040782c
6
+ metadata.gz: 2629ce0cd38aa495a15e29ba5f75034036e079cbfd9cab5a489501f026ea5617f50ac2805e6f55d6b4cc0dcdc180d1dc68c57fb8b0daeee0bf46e159f422ffd7
7
+ data.tar.gz: d64dc99cfdf998310b396dd16da776c257c42e3ff9a79f00ddeefd78eb212f64e9be01a80ae27f1a0e0656d8fd2d252ddeec96f9126aab029464076231a17afe
data/README.md CHANGED
@@ -105,12 +105,37 @@ map to the following values:
105
105
 
106
106
  | Setting | Environment Variable |
107
107
  | --------------------- | ---------------------------------- |
108
- | aws_access_key_id | ```ENV['AWS_ACCESS_KEY_ID``` |
108
+ | aws_access_key_id | ```ENV['AWS_ACCESS_KEY_ID']``` |
109
109
  | aws_secret_access_key | ```ENV['AWS_SECRET_ACCESS_KEY']``` |
110
110
 
111
111
  The environment is used when the credentials are not set in the activate
112
112
  method or passed through the ```.s3_sync``` configuration file.
113
113
 
114
+ ### IAM Policy
115
+
116
+ Here's a sample IAM policy that will allow a user to update the site
117
+ contained in a bucket named "mysite.com":
118
+
119
+ ```
120
+ {
121
+ "Version": "2012-10-17",
122
+ "Statement": [
123
+ {
124
+ "Effect": "Allow",
125
+ "Action": "s3:*",
126
+ "Resource": "arn:aws:s3:::mysite.com"
127
+ },
128
+ {
129
+ "Effect": "Allow",
130
+ "Action": "s3:*",
131
+ "Resource": "arn:aws:s3:::mysite.com/*"
132
+ }
133
+ ]
134
+ }
135
+ ```
136
+
137
+ This will give full access to both the bucket and it's contents.
138
+
114
139
  ## Push All Content to S3
115
140
 
116
141
  There are situations where you might need to push the files to S3. In
@@ -1,10 +1,12 @@
1
1
  require 'middleman-core/cli'
2
- require 'middleman-s3_sync/extension'
3
2
 
4
3
  module Middleman
5
4
  module Cli
6
5
  class S3Sync < Thor
7
6
  include Thor::Actions
7
+
8
+ check_unknown_options!
9
+
8
10
  namespace :s3_sync
9
11
 
10
12
  def self.exit_on_failure?
@@ -12,15 +14,15 @@ module Middleman
12
14
  end
13
15
 
14
16
  desc "s3_sync", "Pushes the minimum set of files needed to S3"
15
- option :force, type: :boolean,
16
- desc: "Push all local files to the server",
17
- aliases: :f
18
- option :bucket, type: :string,
19
- desc: "Specify which bucket to use, overrides the configured bucket.",
20
- aliases: :b
21
- option :verbose, type: :boolean,
22
- desc: "Adds more verbosity...",
23
- aliases: :v
17
+ method_option :force, type: :boolean,
18
+ desc: "Push all local files to the server",
19
+ aliases: '-f'
20
+ method_option :bucket, type: :string,
21
+ desc: "Specify which bucket to use, overrides the configured bucket.",
22
+ aliases: '-b'
23
+ method_option :verbose, type: :boolean,
24
+ desc: "Adds more verbosity...",
25
+ aliases: '-v'
24
26
 
25
27
  def s3_sync
26
28
  shared_inst = ::Middleman::Application.server.inst
@@ -29,13 +31,16 @@ module Middleman
29
31
  raise Thor::Error.new "You need to activate the s3_sync extension."
30
32
  end
31
33
 
34
+ s3_sync_options = shared_inst.s3_sync_options
35
+
32
36
  # Override options based on what was passed on the command line...
33
- shared_inst.s3_sync_options.force = options[:force] if options[:force]
34
- shared_inst.s3_sync_options.bucket = options[:bucket] if options[:bucket]
35
- shared_inst.s3_sync_options.verbose = options[:verbose] if options[:verbose]
37
+ s3_sync_options.force = options[:force] if options[:force]
38
+ s3_sync_options.bucket = options[:bucket] if options[:bucket]
39
+ s3_sync_options.verbose = options[:verbose] if options[:verbose]
36
40
 
37
- ::Middleman::S3Sync.sync
41
+ ::Middleman::S3Sync.sync(s3_sync_options)
38
42
  end
39
43
  end
44
+ Base.map('sync' => 's3_sync')
40
45
  end
41
46
  end
@@ -21,7 +21,7 @@ module Middleman
21
21
  # Define the after_build step after during configuration so
22
22
  # that it's pushed to the end of the callback chain
23
23
  app.after_build do |builder|
24
- ::Middleman::S3Sync.sync if options.after_build
24
+ ::Middleman::S3Sync.sync(@option) if options.after_build
25
25
  end
26
26
 
27
27
  options.build_dir ||= build_dir
@@ -33,6 +33,10 @@ module Middleman
33
33
  @options
34
34
  end
35
35
 
36
+ def s3_sync_options=(options)
37
+ @options = options
38
+ end
39
+
36
40
  module Helpers
37
41
  def s3_sync_options
38
42
  ::Middleman::S3Sync.s3_sync_options
@@ -14,9 +14,11 @@ module Middleman
14
14
  class << self
15
15
  include Status
16
16
 
17
- def sync
17
+ def sync(options)
18
18
  @app = ::Middleman::Application.server.inst
19
19
 
20
+ self.s3_sync_options = options
21
+
20
22
  unless work_to_be_done?
21
23
  say_status "\nAll S3 files are up to date."
22
24
  return
@@ -123,7 +123,7 @@ module Middleman
123
123
  elsif directory?
124
124
  :directory
125
125
  end
126
- unless alternate_encoding?
126
+ if options.verbose
127
127
  say_status "Ignoring".yellow + " #{remote_path} #{ reason ? "(#{reason})".white : "" }"
128
128
  end
129
129
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.0.31"
3
+ VERSION = "3.0.32"
4
4
  end
5
5
  end
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.31
4
+ version: 3.0.32
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-07-30 00:00:00.000000000 Z
12
+ date: 2014-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core