s3_website 1.2.1 → 1.3.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: 2028b50197c43a95e0e1963ed6d74cfa5266d239
4
- data.tar.gz: 7e4e1967b2ebe1dfe468ad031e0de5dc25a59449
3
+ metadata.gz: 561234b232d8d9b1224e698eaf666b85f5bd5c2e
4
+ data.tar.gz: 676365b786bb1917db01cf2892c38e8d1213c3ff
5
5
  SHA512:
6
- metadata.gz: 561ab252bb5f20f8c0d1988aa954836ad002d7cc67eb362cef40a03b6403bfc85946fe8d3b61b019fee6ee80d9224df8cd03a713cdf6dcbd81e0ee6aed196dbc
7
- data.tar.gz: ef8227835fa2f8545f94e0fee1be0b50764d32b6d104059e2c3e8f70b501e79f22b41cc30aecb4066085d266a3a661df33c25d7dcbf7fcaf0d29fea5a0a6c639
6
+ metadata.gz: 85a28d6ed372877f119e5eb98b3d7785e28438c14218c552ff136a812262960f174451a508fd6946a47cd759d6a06a96a3b22a92a88420ec0437932204cc5662
7
+ data.tar.gz: 0ad1d01d491b2e3a44e8075d2df2aee92116f391752e93e6d206194f425d3b34a5f4af28b46c5b68736060046c3ee7caa51be8c1cd7d41010d95d2bd7429dfe6
data/changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 1.3.0
6
+
7
+ * Show a progress indicator when calculating diff
8
+
5
9
  ## 1.2.1
6
10
 
7
11
  * Use `print` instead of `puts` when printing to stdout in a concurrent context
@@ -24,6 +24,7 @@ Feature: Invalidate the Cloudfront distribution
24
24
  And the output should equal
25
25
  """
26
26
  Deploying features/support/test_site_dirs/cdn-powered.with-one-change.blog.fi/_site/* to s3-website-test.net
27
+ Calculating diff ... done
27
28
  Uploading 1 changed file(s)
28
29
  Upload index.html: Success!
29
30
  Done! Go visit: http://s3-website-test.net.s3-website-us-east-1.amazonaws.com/index.html
@@ -11,6 +11,7 @@ Feature: remove an S3 website page from S3
11
11
  And the output should equal
12
12
  """
13
13
  Deploying features/support/test_site_dirs/unpublish-a-post.com/_site/* to s3-website-test.net
14
+ Calculating diff ... done
14
15
  No new or changed files to upload
15
16
  Delete index.html: Success!
16
17
  Done! Go visit: http://s3-website-test.net.s3-website-us-east-1.amazonaws.com/index.html
@@ -7,6 +7,7 @@ Feature: upload a Jekyll site
7
7
  And the output should contain
8
8
  """
9
9
  Deploying features/support/test_site_dirs/jekyllrb.com/_site/* to s3-website-test.net
10
+ Calculating diff ... done
10
11
  Uploading 2 new file(s)
11
12
  """
12
13
  And the output should contain
@@ -7,6 +7,7 @@ Feature: upload a Nanoc site
7
7
  And the output should contain
8
8
  """
9
9
  Deploying features/support/test_site_dirs/nanoc.ws/public/output/* to s3-website-test.net
10
+ Calculating diff ... done
10
11
  Uploading 2 new file(s)
11
12
  """
12
13
  And the output should contain
@@ -11,6 +11,7 @@ Feature: upload S3 website to S3
11
11
  And the output should contain
12
12
  """
13
13
  Deploying features/support/test_site_dirs/my.blog.com/_site/* to s3-website-test.net
14
+ Calculating diff ... done
14
15
  Uploading 2 new file(s)
15
16
  """
16
17
  And the output should contain
@@ -55,6 +56,7 @@ Feature: upload S3 website to S3
55
56
  And the output should contain
56
57
  """
57
58
  Deploying features/support/test_site_dirs/new-and-changed-files.com/_site/* to s3-website-test.net
59
+ Calculating diff ... done
58
60
  Uploading 1 new and 1 changed file(s)
59
61
  """
60
62
  And the output should contain
@@ -78,6 +80,7 @@ Feature: upload S3 website to S3
78
80
  And the output should equal
79
81
  """
80
82
  Deploying features/support/test_site_dirs/only-changed-files.com/_site/* to s3-website-test.net
83
+ Calculating diff ... done
81
84
  Uploading 1 changed file(s)
82
85
  Upload index.html: Success!
83
86
  Done! Go visit: http://s3-website-test.net.s3-website-us-east-1.amazonaws.com/index.html
@@ -91,6 +94,7 @@ Feature: upload S3 website to S3
91
94
  And the output should equal
92
95
  """
93
96
  Deploying features/support/test_site_dirs/no-new-or-changed-files.com/_site/* to s3-website-test.net
97
+ Calculating diff ... done
94
98
  No new or changed files to upload
95
99
  Done! Go visit: http://s3-website-test.net.s3-website-us-east-1.amazonaws.com/index.html
96
100
 
@@ -8,6 +8,7 @@ Feature: Security
8
8
  And the output should equal
9
9
  """
10
10
  Deploying features/support/test_site_dirs/site-that-contains-s3-website-file.com/_site/* to another-s3-website-test.net
11
+ Calculating diff ... done
11
12
  No new or changed files to upload
12
13
  Done! Go visit: http://another-s3-website-test.net.s3-website-us-east-1.amazonaws.com/index.html
13
14
 
@@ -58,6 +58,24 @@ def push_files
58
58
  }
59
59
  end
60
60
 
61
+ module S3Website
62
+ class DiffHelper
63
+ class DiffProgressIndicator
64
+ def initialize(start_msg, end_msg)
65
+ puts "#{start_msg} #{end_msg}"
66
+ end
67
+
68
+ def render_next_step
69
+ # Simplify testing of stdout by doing nothing here.
70
+ end
71
+
72
+ def finish
73
+ # Simplify testing of stdout by doing nothing here.
74
+ end
75
+ end
76
+ end
77
+ end
78
+
61
79
  module Kernel
62
80
  require 'stringio'
63
81
 
@@ -1,12 +1,22 @@
1
1
  module S3Website
2
2
  class DiffHelper
3
3
  def self.resolve_files_to_upload(s3_bucket, site_dir, config)
4
- s3_data_source = Filey::DataSources::AwsSdkS3.new(s3_bucket, config)
5
- fs_data_source = Filey::DataSources::FileSystem.new(site_dir)
6
- changed_local_files =
7
- Filey::Comparison.list_changed(fs_data_source, s3_data_source)
8
- new_local_files =
9
- Filey::Comparison.list_missing(fs_data_source, s3_data_source)
4
+ progress_indicator = DiffProgressIndicator.new('Calculating diff', "... done\n")
5
+ s3_data_source = Filey::DataSources::AwsSdkS3.new(s3_bucket, config) { |filey|
6
+ progress_indicator.render_next_step
7
+ }
8
+ fs_data_source = Filey::DataSources::FileSystem.new(site_dir) { |filey|
9
+ progress_indicator.render_next_step
10
+ }
11
+ changed_local_files = Filey::Comparison.list_changed(
12
+ fs_data_source,
13
+ s3_data_source
14
+ )
15
+ new_local_files = Filey::Comparison.list_missing(
16
+ fs_data_source,
17
+ s3_data_source
18
+ )
19
+ progress_indicator.finish
10
20
  [ normalise(changed_local_files), normalise(new_local_files) ]
11
21
  end
12
22
 
@@ -17,5 +27,73 @@ module S3Website
17
27
  filey.full_path.sub(/\.\//, '')
18
28
  }
19
29
  end
30
+
31
+ class DiffProgressIndicator
32
+ def initialize(init_msg, end_msg)
33
+ @end_msg = end_msg
34
+ @ordinal_direction = 'n' # start from north
35
+ print init_msg
36
+ print ' '
37
+ DiffProgressIndicator.render_ordinal_direction @ordinal_direction
38
+ end
39
+
40
+ def render_next_step
41
+ @ordinal_direction = DiffProgressIndicator.next_ordinal_direction @ordinal_direction
42
+ print("\b" + DiffProgressIndicator.render_ordinal_direction(@ordinal_direction))
43
+ end
44
+
45
+ def finish
46
+ print "\b"
47
+ print @end_msg
48
+ end
49
+
50
+ private
51
+
52
+ def self.render_ordinal_direction(ordinal_direction)
53
+ case ordinal_direction
54
+ when 'n'
55
+ '|'
56
+ when 'ne'
57
+ '/'
58
+ when 'e'
59
+ '-'
60
+ when 'se'
61
+ '\\'
62
+ when 's'
63
+ '|'
64
+ when 'sw'
65
+ '/'
66
+ when 'w'
67
+ '-'
68
+ when 'nw'
69
+ '\\'
70
+ else
71
+ raise 'Unknown ordinal direction ' + ordinal_direction
72
+ end
73
+ end
74
+
75
+ def self.next_ordinal_direction(current_ordinal_direction)
76
+ case current_ordinal_direction
77
+ when 'n'
78
+ 'ne'
79
+ when 'ne'
80
+ 'e'
81
+ when 'e'
82
+ 'se'
83
+ when 'se'
84
+ 's'
85
+ when 's'
86
+ 'sw'
87
+ when 'sw'
88
+ 'w'
89
+ when 'w'
90
+ 'nw'
91
+ when 'nw'
92
+ 'n'
93
+ else
94
+ raise 'Unknown ordinal direction ' + current_ordinal_direction
95
+ end
96
+ end
97
+ end
20
98
  end
21
99
  end
data/s3_website.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "s3_website"
6
- s.version = "1.2.1"
6
+ s.version = "1.3.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.default_executable = %q{s3_website}
19
19
 
20
20
  s.add_dependency 'aws-sdk', '~> 1.8.5'
21
- s.add_dependency 'filey-diff', '~> 1.3'
21
+ s.add_dependency 'filey-diff', '~> 1.4'
22
22
  s.add_dependency 'simple-cloudfront-invalidator', '~> 1'
23
23
  s.add_dependency 'erubis', '~> 2.7.0'
24
24
  s.add_dependency 'mime-types', '= 1.19'
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: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-26 00:00:00.000000000 Z
11
+ date: 2013-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simple-cloudfront-invalidator
43
43
  requirement: !ruby/object:Gem::Requirement