octopress-deploy 1.0.5 → 1.1.0

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: 5b40f670b3da0ca63247f292839e1f3ac4078c12
4
- data.tar.gz: 2dad3bffc5e0d5a73ebe993d8918c2d63d04fb2f
3
+ metadata.gz: 6606cff1ff42e965567713c41b4da108d87e9b6f
4
+ data.tar.gz: 2d2a9ddc507baaed0bb08b255a5092839ac8ed02
5
5
  SHA512:
6
- metadata.gz: ea4356aae147e4a0f3de99ca98235b729fd48fc19e53fccecd2896b38e2f86b1c8e91c3652861ebadd52f03b5eee4886540a281352388b8274192bbb5a4cf3f1
7
- data.tar.gz: 2c91be9d8efeea20adff8b408fb578394abbcd439315fcaa805d04a95180d77620ceece1ab6d290766908428be0e3ac21c11baa1737b90cf7889fdcc8109efe4
6
+ metadata.gz: d20780fe819e5233b6debeab56442de4fef9470bb6123869635b9bc614689a6c783cc81f36a12414c1110e3979309888ded340cb5229bd0dc03d7c585c43c41d
7
+ data.tar.gz: fb5bf4c2574fa50fa05301464426cfb13233d1bfbda31871ed1d5bc3c7d1a1cd01e08a671dfc5b8ca906348bb61c097f80b61d6b13f270645f82848a7672004b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.0.5 - 2015-02-06
4
+
5
+ - Added incremental uploads to S3. [#46](https://github.com/octopress/deploy/pull/46)
6
+
3
7
  ### 1.0.5 - 2015-02-04
4
8
 
5
9
  - Fixed issue where an S3 pull wouldn't create some directories.
data/README.md CHANGED
@@ -87,6 +87,7 @@ account access information.
87
87
  | `secret_access_key` | AWS secret key | |
88
88
  | `remote_path` | Directory files should be synced to. | / |
89
89
  | `verbose` | [optional] Display all file actions during deploy. | false |
90
+ | `incremental` | [optional] Incremental deploy (only updated files) | false |
90
91
  | `region` | [optional] Region for your AWS bucket | us-east-1 |
91
92
  | `delete` | Delete files in `remote_path` not found in `site_dir` | false |
92
93
  | `headers` | Set headers for matched files | [] |
@@ -75,6 +75,7 @@ module Octopress
75
75
  c.option 'region', '-r', '--region REGION', 'AWS region (default: us-east-1)'
76
76
  c.option 'remote_path', '-d', '--dir DIR', 'Deploy site into a subdirectory.'
77
77
  c.option 'verbose', '-v', '--verbose', 'Log verbose output when deploying'
78
+ c.option 'incremental', '-i', '--incremental', 'Only upload new/changed files'
78
79
  c.option 'delete', '--delete', 'Sync file deletion'
79
80
  add_common_init_options(c)
80
81
 
@@ -19,6 +19,7 @@ module Octopress
19
19
  @region = options[:region] || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
20
20
  @remote_path = (options[:remote_path] || '/').sub(/^\//,'')
21
21
  @verbose = options[:verbose]
22
+ @incremental = options[:incremental]
22
23
  @delete = options[:delete]
23
24
  @headers = options[:headers] || []
24
25
  @remote_path = @remote_path.sub(/^\//,'') # remove leading slash
@@ -76,12 +77,21 @@ module Octopress
76
77
  s3_filename = remote_path(file)
77
78
  o = @bucket.objects[s3_filename]
78
79
  file_with_options = get_file_with_metadata(file, s3_filename);
80
+ s3sum = o.etag.tr('"','')
79
81
 
80
- o.write(file_with_options)
81
- if @verbose
82
- puts "+ #{remote_path(file)}"
83
- else
84
- progress('+')
82
+ if @incremental && (s3sum == Digest::MD5.file(file).hexdigest)
83
+ if @verbose
84
+ puts "= #{remote_path(file)}"
85
+ else
86
+ progress('=')
87
+ end
88
+ else
89
+ o.write(file_with_options)
90
+ if @verbose
91
+ puts "+ #{remote_path(file)}"
92
+ else
93
+ progress('+')
94
+ end
85
95
  end
86
96
  end
87
97
  end
@@ -229,10 +239,9 @@ module Octopress
229
239
  #{"secret_access_key: #{options[:secret_access_key]}".ljust(40)} # Keep it safe; keep it secret. Keep this file in your .gitignore.
230
240
  #{"remote_path: #{options[:remote_path] || '/'}".ljust(40)} # relative path on bucket where files should be copied.
231
241
  #{"region: #{options[:remote_path] || 'us-east-1'}".ljust(40)} # Region where your bucket is located.
232
- #{"verbose: true".ljust(40)} # Print out all file operations.
233
-
234
- #{"# delete: #{options[:delete] || 'true'}".ljust(40)} # Remove files from destination which do not match source files.
235
- #{"# verbose: #{options[:verbose] || 'false'}".ljust(40)} # Print out all file operations.
242
+ #{"verbose: #{options[:verbose] || 'false'}".ljust(40)} # Print out all file operations.
243
+ #{"incremental: #{options[:incremental] || 'false'}".ljust(40)} # Only upload new/changed files
244
+ #{"delete: #{options[:delete] || 'false'}".ljust(40)} # Remove files from destination which do not match source files.
236
245
  CONFIG
237
246
  end
238
247
 
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Deploy
3
- VERSION = "1.0.5"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/test/_clash.yml CHANGED
@@ -5,7 +5,7 @@
5
5
  reset:
6
6
  - cleanup
7
7
  - cp -r source/ _site
8
- - ruby _garbage.rb
8
+ - ruby garbage.rb
9
9
  -
10
10
  title: Test local Rsync
11
11
  before:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorator