ipecache 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/bin/ipecache +10 -0
- data/ipecache.gemspec +1 -1
- data/lib/ipecache/plugins/akamai.rb +1 -1
- data/lib/ipecache/plugins/ats_chef.rb +1 -1
- data/lib/ipecache/plugins/edgecast.rb +2 -2
- data/lib/ipecache/plugins/fastly.rb +2 -2
- data/lib/ipecache/plugins/plugin.rb +11 -0
- data/lib/ipecache/runner.rb +3 -1
- data/plugins/ATSChef.md +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ipecache (0.0.
|
4
|
+
ipecache (0.0.3)
|
5
5
|
app_conf (>= 0.4.0)
|
6
6
|
choice (>= 0.1.6)
|
7
7
|
faraday_middleware (>= 0.9.0)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
httpi (2.0.2)
|
26
26
|
rack
|
27
27
|
multipart-post (1.2.0)
|
28
|
-
nokogiri (1.5.
|
28
|
+
nokogiri (1.5.9)
|
29
29
|
nori (2.0.4)
|
30
30
|
rack (1.4.1)
|
31
31
|
savon (2.1.0)
|
data/bin/ipecache
CHANGED
@@ -40,6 +40,12 @@ Choice.options do
|
|
40
40
|
long '--cdn-only'
|
41
41
|
desc 'Only purge from CDNs'
|
42
42
|
end
|
43
|
+
|
44
|
+
option :log_file, :required => false do
|
45
|
+
short '-l'
|
46
|
+
long '--log-file'
|
47
|
+
desc 'Log errors to specified file in addition to stdout'
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
if Choice.choices[:status]
|
@@ -66,6 +72,10 @@ else
|
|
66
72
|
Choice.help
|
67
73
|
end
|
68
74
|
|
75
|
+
if Choice.choices[:log_file]
|
76
|
+
@log_file = Choice.choices[:log_file]
|
77
|
+
end
|
78
|
+
|
69
79
|
if !Choice.choices[:cdnonly]
|
70
80
|
puts ""
|
71
81
|
puts "Running plugins registered for Proxy Purge..."
|
data/ipecache.gemspec
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'ipecache'
|
5
|
-
gem.version = '0.0.
|
5
|
+
gem.version = '0.0.3'
|
6
6
|
gem.authors = ["Jon Cowie"]
|
7
7
|
gem.email = 'jonlives@gmail.com'
|
8
8
|
gem.homepage = 'https://github.com/jonlives/ipecache'
|
@@ -53,7 +53,7 @@ module Ipecache
|
|
53
53
|
</soap:Envelope>")
|
54
54
|
response_hash = response.to_hash
|
55
55
|
if response_hash[:purge_request_response][:return][:result_msg] != "Success."
|
56
|
-
|
56
|
+
plugin_puts_error(url,"An Error occured: #{response_hash[:purge_request_response][:return][:result_msg]}")
|
57
57
|
exit 1
|
58
58
|
else
|
59
59
|
plugin_puts "Purge successful!"
|
@@ -46,8 +46,8 @@ module Ipecache
|
|
46
46
|
response = connection.put("/v2/mcc/customers/#{account_id}/edge/purge",{ :MediaPath => url, :MediaType => 8})
|
47
47
|
|
48
48
|
if response.status != 200
|
49
|
-
|
50
|
-
|
49
|
+
plugin_puts_error(url,"Response Code: #{response.status}")
|
50
|
+
plugin_puts_error(url,response.body)
|
51
51
|
exit 1
|
52
52
|
else
|
53
53
|
plugin_puts "Purge successful!"
|
@@ -41,8 +41,8 @@ module Ipecache
|
|
41
41
|
response = http.request(request)
|
42
42
|
|
43
43
|
if response.code.to_i != 200
|
44
|
-
|
45
|
-
|
44
|
+
plugin_puts_error(url,"Response Code: #{response.code}")
|
45
|
+
plugin_puts_error(url,response.body)
|
46
46
|
exit 1
|
47
47
|
else
|
48
48
|
plugin_puts "Purge successful!"
|
@@ -39,6 +39,10 @@ module Ipecache
|
|
39
39
|
@options[:urls]
|
40
40
|
end
|
41
41
|
|
42
|
+
def log_file
|
43
|
+
@options[:log_file]
|
44
|
+
end
|
45
|
+
|
42
46
|
def name
|
43
47
|
self.class.to_s
|
44
48
|
end
|
@@ -47,6 +51,13 @@ module Ipecache
|
|
47
51
|
puts "#{name}: #{message}"
|
48
52
|
end
|
49
53
|
|
54
|
+
def plugin_puts_error(url,message)
|
55
|
+
if log_file
|
56
|
+
File.open(log_file, 'a') { |file| file.write("#{Time.now.getutc} #{url} #{name}: #{message}\n") }
|
57
|
+
end
|
58
|
+
puts "#{name}: #{message}"
|
59
|
+
end
|
60
|
+
|
50
61
|
private
|
51
62
|
def config
|
52
63
|
@options[:config].plugins.send(self.class.name.to_sym) unless @options[:config].nil? || @options[:config].plugins.nil?
|
data/lib/ipecache/runner.rb
CHANGED
data/plugins/ATSChef.md
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipecache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: app_conf
|