cf-s3-invalidator 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,9 +29,12 @@ Then you can just run:
29
29
 
30
30
  ## Development
31
31
 
32
- Run Cucumber tests:
32
+ [![Build Status](https://secure.travis-ci.org/laurilehmijoki/cf-s3-invalidator.png)]
33
+ (http://travis-ci.org/laurilehmijoki/cf-s3-invalidator)
33
34
 
34
- `bundle exec cucumber`
35
+ Run tests:
36
+
37
+ `rake test`
35
38
 
36
39
  ## License
37
40
 
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ desc "Build the project"
2
+ task :default => 'test'
3
+
4
+ desc "Run tests"
5
+ task :test do
6
+ sh "bundle exec cucumber"
7
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cf-s3-invalidator'
3
- s.version = '0.3.3'
3
+ s.version = '0.3.4'
4
4
  s.summary = 'A tool for invalidating AWS S3-based Cloudfront distributions'
5
5
  s.description =
6
6
  'This lib fetches the names of all objects on an Amazon Web
@@ -16,7 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.homepage = 'https://github.com/laurilehmijoki/cf-s3-invalidator'
17
17
 
18
18
  s.add_dependency 'aws-sdk'
19
+ s.add_dependency 'colored'
19
20
 
20
21
  s.add_development_dependency 'cucumber'
22
+ s.add_development_dependency 'rake'
21
23
  s.add_development_dependency 'aruba', '>= 0.4.7'
22
24
  end
@@ -1,7 +1,7 @@
1
1
  Feature: cloudfront-s3-invalidator CLI help
2
2
  In order to use the invalidator
3
3
  As a geek
4
- I want to run cf-s3-inv and see what the help document
4
+ I want to run cf-s3-inv and see instructions for using the software
5
5
 
6
6
  Scenario: Run cf-s3-inv without arguments and the configuration file
7
7
  When I run `cf-s3-inv`
@@ -2,7 +2,7 @@ Feature: cloudfront-s3-invalidator without AWS credentials
2
2
 
3
3
  In order to invalidate my S3-based Cloudfront distribution
4
4
  As a geek without AWS credentials
5
- I want to run cf-s3-inv and see my that it tells me I have no valid credentials
5
+ I want to run cf-s3-inv and see that it tells me I have no valid credentials
6
6
 
7
7
  Scenario: Run cf-s3-inv with the configuration file that has invalid AWS access key
8
8
  Given a file named "_cf_s3_invalidator.yml" with:
@@ -13,14 +13,14 @@ Feature: cloudfront-s3-invalidator without AWS credentials
13
13
  cloudfront_distribution_id: CF_ID
14
14
  """
15
15
  When I run `cf-s3-inv`
16
- And the output should contain:
16
+ Then the output should contain:
17
17
  """
18
18
  The AWS Access Key Id you provided does not exist in our records. (AWS::S3::Errors::InvalidAccessKeyId)
19
19
  """
20
20
 
21
21
  Scenario: Run cf-s3-inv with CLI arguments containing invalid AWS access key
22
22
  When I run `cf-s3-inv --key invalid-aws-key --secret invalid-aws-secret --bucket some-bucket --distribution some-dist`
23
- And the output should contain:
23
+ Then the output should contain:
24
24
  """
25
25
  The AWS Access Key Id you provided does not exist in our records. (AWS::S3::Errors::InvalidAccessKeyId)
26
26
  """
@@ -9,10 +9,14 @@ require 'cucumber/rspec/doubles'
9
9
  # Following from 'aruba/cucumber'
10
10
  Before do
11
11
  @__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
12
- ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
13
- end
12
+ ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
13
+ end
14
14
 
15
- After do
16
- ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
17
- end
15
+ After do
16
+ ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
17
+ end
18
+
19
+ Before do
20
+ @aruba_timeout_seconds = 10
21
+ end
18
22
  # End of following from 'aruba/cucumber'
@@ -1,7 +1,9 @@
1
+ require 'rubygems'
1
2
  require 'openssl'
2
3
  require 'digest/sha1'
3
4
  require 'net/https'
4
5
  require 'base64'
6
+ require 'colored'
5
7
 
6
8
  # Adapted from:
7
9
  # Confabulus @ http://blog.confabulus.com/2011/05/13/cloudfront-invalidation-from-ruby
@@ -45,14 +47,14 @@ class CloudfrontInvalidator
45
47
 
46
48
  def print_operation_result(http_response, items)
47
49
  success = http_response.code == '201'
48
- puts "Invalidating Cloudfront items"
50
+ puts "Invalidating Cloudfront items".cyan
49
51
  items.each do |item|
50
- puts " #{item}"
52
+ puts " #{item}".blue
51
53
  end
52
54
  if success
53
- puts "succeeded"
55
+ puts "succeeded".green.bold
54
56
  else
55
- puts "FAILED, reason:"
57
+ puts "FAILED, reason:".red
56
58
  puts http_response.body
57
59
  end
58
60
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-s3-invalidator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lauri Lehmijoki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-04 00:00:00 Z
18
+ date: 2012-07-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: aws-sdk
@@ -32,7 +32,7 @@ dependencies:
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: cucumber
35
+ name: colored
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
@@ -43,12 +43,40 @@ dependencies:
43
43
  segments:
44
44
  - 0
45
45
  version: "0"
46
- type: :development
46
+ type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
- name: aruba
49
+ name: cucumber
50
50
  prerelease: false
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: aruba
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
52
80
  none: false
53
81
  requirements:
54
82
  - - ">="
@@ -60,7 +88,7 @@ dependencies:
60
88
  - 7
61
89
  version: 0.4.7
62
90
  type: :development
63
- version_requirements: *id003
91
+ version_requirements: *id005
64
92
  description: |-
65
93
  This lib fetches the names of all objects on an Amazon Web
66
94
  Services S3 bucket. Then it calls the Cloudfront invalidation REST API on the
@@ -78,6 +106,7 @@ files:
78
106
  - .gitignore
79
107
  - Gemfile
80
108
  - README.md
109
+ - Rakefile
81
110
  - bin/cf-s3-inv
82
111
  - cf-s3-invalidator.gemspec
83
112
  - features/cloudfront-s3-invalidator-help.feature