simple-cloudfront-invalidator 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -0
- data/Rakefile +3 -0
- data/lib/simple-cloudfront-invalidator.rb +2 -1
- data/simple-cloudfront-invalidator.gemspec +1 -1
- data/spec/simple_cloudfront_invalidator_spec.rb +19 -6
- metadata +102 -103
data/README.md
CHANGED
@@ -5,6 +5,14 @@ Status](https://secure.travis-ci.org/laurilehmijoki/simple-cloudfront-invalidato
|
|
5
5
|
|
6
6
|
A library for invalidating AWS Cloudfront items.
|
7
7
|
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
This gem is meant to be used as a dependency in other Ruby projects.
|
11
|
+
|
12
|
+
Take a look at <https://github.com/laurilehmijoki/cf-s3-invalidator>, which
|
13
|
+
makes it possible to invalidate S3-based Cloudfront distributions from the
|
14
|
+
command-line interface.
|
15
|
+
|
8
16
|
## Tests
|
9
17
|
|
10
18
|
Run `rake test`.
|
data/Rakefile
CHANGED
@@ -29,7 +29,8 @@ module SimpleCloudfrontInvalidator
|
|
29
29
|
res = sign_and_call(
|
30
30
|
"https://cloudfront.amazonaws.com/2012-05-05/distribution/#{@distribution}/invalidation",
|
31
31
|
Net::HTTP::Post, body)
|
32
|
-
create_report(items)
|
32
|
+
return { :text_report => create_report(items),
|
33
|
+
:invalidated_items_count => items.length }
|
33
34
|
end
|
34
35
|
|
35
36
|
private
|
@@ -2,15 +2,28 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module SimpleCloudfrontInvalidator
|
4
4
|
describe CloudfrontClient do
|
5
|
-
|
5
|
+
before(:each) do
|
6
6
|
VCR.use_cassette('cloudfront', :match_requests_on => [:host]) do
|
7
7
|
@client = CloudfrontClient.new('some aws key', 'aws secret', 'cloudfrontdistid')
|
8
|
-
report = @client.invalidate(['index.html', 'articles.html'])
|
9
|
-
report.join('').should include("Invalidating Cloudfront items...")
|
10
|
-
report.join('').should include("/index.html")
|
11
|
-
report.join('').should include("/articles.html")
|
12
|
-
report.join('').should include("succeeded")
|
8
|
+
@report = @client.invalidate(['index.html', 'articles.html'])
|
13
9
|
end
|
14
10
|
end
|
11
|
+
|
12
|
+
it "calls the Cloudfront invalidation API" do
|
13
|
+
expect(@report).to_not be nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns a textual report on the invalidation' do
|
17
|
+
textual_report = @report[:text_report]
|
18
|
+
textual_report.join('').should include("Invalidating Cloudfront items...")
|
19
|
+
textual_report.join('').should include("/index.html")
|
20
|
+
textual_report.join('').should include("/articles.html")
|
21
|
+
textual_report.join('').should include("succeeded")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns the count of successfully invalidated items' do
|
25
|
+
count = @report[:invalidated_items_count]
|
26
|
+
expect(count).to be 2
|
27
|
+
end
|
15
28
|
end
|
16
29
|
end
|
metadata
CHANGED
@@ -1,116 +1,118 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-cloudfront-invalidator
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Lauri Lehmijoki
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: colored
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 2
|
32
|
-
version: "1.2"
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.2'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
47
38
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: vcr
|
51
39
|
prerelease: false
|
52
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
41
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: vcr
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
61
54
|
type: :development
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: webmock
|
65
55
|
prerelease: false
|
66
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: webmock
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
67
65
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
75
70
|
type: :development
|
76
|
-
version_requirements: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: rake
|
79
71
|
prerelease: false
|
80
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
73
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
89
86
|
type: :development
|
90
|
-
version_requirements: *id005
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: require_relative
|
93
87
|
prerelease: false
|
94
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
89
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: require_relative
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
103
102
|
type: :development
|
104
|
-
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
105
110
|
description:
|
106
111
|
email: lauri.lehmijoki@iki.fi
|
107
112
|
executables: []
|
108
|
-
|
109
113
|
extensions: []
|
110
|
-
|
111
114
|
extra_rdoc_files: []
|
112
|
-
|
113
|
-
files:
|
115
|
+
files:
|
114
116
|
- .gitignore
|
115
117
|
- .travis.yml
|
116
118
|
- Gemfile
|
@@ -122,37 +124,34 @@ files:
|
|
122
124
|
- spec/simple_cloudfront_invalidator_spec.rb
|
123
125
|
- spec/test_helper.rb
|
124
126
|
homepage: https://github.com/laurilehmijoki/simple-cloudfront-invalidator
|
125
|
-
licenses:
|
127
|
+
licenses:
|
126
128
|
- MIT
|
127
129
|
post_install_message:
|
128
130
|
rdoc_options: []
|
129
|
-
|
130
|
-
require_paths:
|
131
|
+
require_paths:
|
131
132
|
- lib
|
132
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
134
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
|
138
|
-
segments:
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
segments:
|
139
140
|
- 0
|
140
|
-
|
141
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
hash: 3317433845191601945
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
143
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
segments:
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
segments:
|
148
149
|
- 0
|
149
|
-
|
150
|
+
hash: 3317433845191601945
|
150
151
|
requirements: []
|
151
|
-
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.8.
|
153
|
+
rubygems_version: 1.8.24
|
154
154
|
signing_key:
|
155
155
|
specification_version: 3
|
156
156
|
summary: A library for invalidating Cloudfront distributions
|
157
157
|
test_files: []
|
158
|
-
|