jayzes-akamai_purger 0.1.3 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,14 @@
1
1
  = akamai_purger
2
2
 
3
- Description goes here.
3
+ Command line utility to run Akamai cache purges from the command line.
4
+
5
+ sudo gem install jayzes-akamai_purger
6
+
7
+ then run:
8
+
9
+ akamai_purge -u <username> -p <password> -l <url_to_purge>
10
+
11
+ The gem will automatically make the SOAP call to run the cache purge with the given credentials. Typically purges take 7 minutes to propagate fully.
4
12
 
5
13
  == Copyright
6
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.7
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{akamai_purger}
5
- s.version = "0.1.3"
5
+ s.version = "0.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jay Zeschin"]
9
- s.date = %q{2009-05-29}
9
+ s.date = %q{2009-05-30}
10
10
  s.default_executable = %q{akamai_purge}
11
11
  s.email = %q{jay.zeschin@factorylabs.com}
12
12
  s.executables = ["akamai_purge"]
data/lib/akamai_purger.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'optparse'
3
+ require 'cgi'
3
4
  require 'soap/wsdlDriver'
4
5
 
5
6
  class AkamaiPurger
@@ -8,7 +9,7 @@ class AkamaiPurger
8
9
 
9
10
  def initialize(args)
10
11
  opts = OptionParser.new do |opts|
11
- opts.banner = "Usage: #{File.basename($0)} [options]"
12
+ opts.banner = "Usage: #{File.basename($0)} [options] URLs"
12
13
 
13
14
  opts.on('-h', '--help', 'Show this message') do
14
15
  puts opts
@@ -23,27 +24,37 @@ class AkamaiPurger
23
24
  @password = pass
24
25
  end
25
26
 
26
- opts.on('-l', '--url [URL]', "Specifies the URL to purge.") do |url|
27
- @url = url
27
+ opts.on('-e', '--email [EMAILS]', "Specifies the e-mail addresses (comma separated) to receive the purge notification.") do |emails|
28
+ @emails = emails
28
29
  end
29
30
 
30
-
31
31
  end
32
32
 
33
33
  @args = opts.parse!(args)
34
+ @urls = args.join(',')
35
+ end
36
+
37
+ def assemble_options
38
+ options = []
39
+ options << "email-notification=#{@emails}" if @emails
40
+ options
34
41
  end
35
42
 
36
43
  def run
37
- unless @username && @password && @url
38
- puts "User, password, and URL must be supplied!"
44
+ unless @username && @password && @urls
45
+ puts "User, password, and URLs must be supplied!"
39
46
  exit 1
40
47
  end
41
48
 
42
- puts "Sending purge request for #{@url}."
49
+ puts "Sending purge request for #{@urls}..."
43
50
  driver = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
44
51
  driver.options["protocol.http.basic_auth"] << [WSDL_URL, @username, @password]
45
- result = driver.purgeRequest(@username, @password, '', [], @url)
52
+ result = driver.purgeRequest(@username, @password, '', assemble_options, @urls.split(','))
46
53
 
47
- puts "Purge request #{ result.resultCode == '100' ? 'was successful' : 'failed' }."
54
+ if result.resultCode == '100'
55
+ puts "Purge request was successful. Purge should be complete within #{result.estTime.to_i/60} minutes."
56
+ else
57
+ puts "Purge request failed with the message '#{result.resultMsg}'."
58
+ end
48
59
  end
49
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jayzes-akamai_purger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Zeschin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-29 00:00:00 -07:00
12
+ date: 2009-05-30 00:00:00 -07:00
13
13
  default_executable: akamai_purge
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency