ipecache 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWYxNWE2YWQwNjExY2E0NWUzMzk3ZTAwMDJmYjEzYjk4Nzc2OWY4Nw==
4
+ MjA0NjIxNDgyZmNiMDdiZDIwZGViODU1NzY3MzBlZGFiNjY0ZmYzOQ==
5
5
  data.tar.gz: !binary |-
6
- MzJiMTJiZGMxMWRjNzQxZGEzY2QxYWRjM2U5M2M2Y2RhOWI5ZGNmNw==
6
+ MTM2MjhmNzc4ZTNlODU3MzM5ZDVjNTM4ZmIyZGEzOWM5ODBmNmJjNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTdjZjdlMTdhMjVmZDZkOTNlZjBhNzdkY2JjY2UwYjgzY2MyY2I0MDk2ODZl
10
- NTc5OTFhMDgwMmNiZjdhMzljZGMzOWQ0NDBhMjg3NzcyZDA3YWJjMTIxY2Q5
11
- MTdlMmY3Zjc1NGQzNWVjYWNkMWNkNTFiM2JhNDRkZjU4M2NjMTc=
9
+ NTUwN2JlMTI5NTJkYTVhZjZiMWEzN2EyYmE1OGFjNTU4YmFkMDQzNjY2YjIz
10
+ Y2Y3MGExYjMwYTFlYzJiM2UxMDA0ZGE5MGI2NmE5Zjc4YTA2NmEwZDRlNzVm
11
+ NTA1MTVjZjM0OWZkZjJmOWVlNzZlNzNlODhmMjc4NGFlZGY1MGE=
12
12
  data.tar.gz: !binary |-
13
- ZjFkODA2YTRjZjMwNDk2NTRhN2E1NDA3YWM4ZGEyNTAxZTg5YWRhZjJiZmM0
14
- YzMzOTgxZWNhYmQ0MGZiYWE2MzE2ZGE5ZjY1YzM3MzNlNmJiMzgyMmRkOGNi
15
- NTkxYTEwNGRmZGQxN2Q4ZWQ4ZWM5MTBjNTVkYzNmZTAyMGUxZTI=
13
+ NWVkNDc3NmY3YzhlZTAzMjI3MjkwNTA0YTQzM2RiMjU3NzQzNDMxOGE4MWIx
14
+ M2E2N2Q1MjFkMDU3YjMyZWI1NjVkMzMyYWUyMGExODE4YzM5YWIwZWVkMDVk
15
+ MjU5YjkzZDlhODI3YjU0ZDI0YWQ4ZWQzNGNlYzQzYmUyNTM0N2Q=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.0.7 (July nth, 2014)
2
+
3
+ Features:
4
+
5
+ - Local plugin (Thanks to https://github.com/jmara)
6
+ - SWISSTXT plugin (Thanks to https://github.com/niwo)
7
+
1
8
  ## 0.0.6 (April 28, 2014)
2
9
 
3
10
  Features:
@@ -14,7 +21,7 @@ Bugfixes:
14
21
 
15
22
  Features:
16
23
 
17
- - Switched Akamai plugin to use new CCUAPI (Thanks to https://github.com/adedommelin)
24
+ - Switched Akamai plugin to use new CCUAPI (Thanks to https://github.com/nespresso)
18
25
 
19
26
  ## 0.0.1 (March 20, 2013)
20
27
 
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,44 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipecache (0.0.4)
4
+ ipecache (0.0.6)
5
5
  app_conf (>= 0.4.0)
6
6
  choice (>= 0.1.6)
7
7
  faraday_middleware (>= 0.9.0)
8
- savon (>= 2.1.0)
8
+ public_suffix (>= 1.4.2)
9
9
 
10
10
  GEM
11
- remote: http://rubygems.org/
11
+ remote: https://rubygems.org/
12
12
  specs:
13
- akami (1.2.0)
14
- gyoku (>= 0.4.0)
15
- nokogiri (>= 1.4.0)
16
- app_conf (0.4.0)
17
- builder (3.0.0)
13
+ app_conf (0.4.2)
18
14
  choice (0.1.6)
19
- faraday (0.8.6)
20
- multipart-post (~> 1.1)
21
- faraday_middleware (0.9.0)
22
- faraday (>= 0.7.4, < 0.9)
23
- gyoku (1.0.0)
24
- builder (>= 2.1.2)
25
- httpi (2.0.2)
26
- rack
27
- multipart-post (1.2.0)
28
- nokogiri (1.5.9)
29
- nori (2.0.4)
30
- rack (1.4.1)
31
- savon (2.1.0)
32
- akami (~> 1.2.0)
33
- builder (>= 2.1.2)
34
- gyoku (~> 1.0.0)
35
- httpi (~> 2.0.2)
36
- nokogiri (>= 1.4.0)
37
- nori (~> 2.0.3)
38
- wasabi (~> 3.0.0)
39
- wasabi (3.0.0)
40
- httpi (~> 2.0)
41
- nokogiri (>= 1.4.0)
15
+ faraday (0.9.0)
16
+ multipart-post (>= 1.2, < 3)
17
+ faraday_middleware (0.9.1)
18
+ faraday (>= 0.7.4, < 0.10)
19
+ multipart-post (2.0.0)
20
+ public_suffix (1.4.2)
42
21
 
43
22
  PLATFORMS
44
23
  ruby
data/README.md CHANGED
@@ -48,6 +48,17 @@ plugins:
48
48
  cloudflare:
49
49
  login: foo@bar.com
50
50
  api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
51
+ <<<<<<< HEAD
52
+ local:
53
+ hosts:
54
+ - cache1.mydomain.com
55
+ - cache2.mydomain.com
56
+ use_ssh: false
57
+ =======
58
+ swisstxt_cdn:
59
+ api_key: sample_key_e8e55aff-61e3-4588-ab98-4d3ea58be7c8
60
+ api_secret: xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678
61
+ >>>>>>> swisstxt-master
51
62
  ```
52
63
 
53
64
  #### atschef
@@ -65,6 +76,11 @@ For more information on how to configure the Akamai plugin, please read the [plu
65
76
  #### CloudFlare
66
77
  For more information on how to configure the CloudFlare plugin, please read the [plugins/CloudFlare.md](plugins/CloudFlare.md) file.
67
78
 
79
+ #### Local
80
+ For more information on how to configure the Local plugin, please read the [plugins/Local.md](plugins/Local.md) file.
81
+
82
+ #### SWISS TXT CDN
83
+ For more information on how to configure the SWISS TXT CDN plugin, please read the [plugins/SWISS_TXT_CDN.md](plugins/SWISS_TXT_CDN.md) file.
68
84
 
69
85
 
70
86
  Ipecache Usage
@@ -99,6 +115,7 @@ Ipecache::Plugins::Akamai: enabled
99
115
  Ipecache::Plugins::ATSChef: enabled
100
116
  Ipecache::Plugins::Edgecast: enabled
101
117
  Ipecache::Plugins::Fastly: enabled
118
+ Ipecache::Plugins::Local: enabled
102
119
  ```
103
120
 
104
121
  #### Example (Purging a single URL from local proxies only)
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.6'
5
+ gem.version = '0.0.7'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/ipecache'
@@ -0,0 +1,46 @@
1
+ require 'ipecache/plugins/plugin'
2
+
3
+ module Ipecache
4
+ module Plugins
5
+ class Local < Plugin
6
+ name :local
7
+ hooks :proxy_purge
8
+
9
+ def perform
10
+ safe_require 'uri'
11
+
12
+ hosts = config.hosts
13
+ use_ssh = config.use_ssh
14
+
15
+ if !hosts
16
+ plugin_puts "No hosts in config file specified. Exiting..."
17
+ exit 1
18
+ end
19
+
20
+ with = (use_ssh) ? "ssh curl" : "curl";
21
+
22
+ urls.each do |u|
23
+ url = u.chomp
24
+ plugin_puts ("Purging #{url} through #{with}")
25
+ hosts.each do |local|
26
+ hostname = URI.parse(url).host
27
+ path = URI.parse(url).path
28
+ if use_ssh
29
+ result = `ssh #{local} 'curl -X PURGE -s -o /dev/null -w \"%{http_code}\" --header \"Host: #{hostname}\" \"http://localhost#{path}\"'`
30
+ else
31
+ result = `curl -X PURGE -s -o /dev/null -w "%{http_code}" --header "Host: #{hostname}" "http://#{local}#{path}"`
32
+ end
33
+ if result.include?("200")
34
+ plugin_puts "--Purged from #{local} sucessfully"
35
+ elsif result.include?("404")
36
+ plugin_puts "--Purge from #{local} not needed, asset not found"
37
+ else
38
+ plugin_puts_error(url,"--Purge from #{local} failed with http_code = #{result}")
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,64 @@
1
+ require 'ipecache/plugins/plugin'
2
+
3
+ module Ipecache
4
+ module Plugins
5
+ class SwisstxtCdn < Plugin
6
+ name :swisstxt_cdn
7
+ hooks :cdn_purge
8
+
9
+ def perform
10
+ safe_require 'uri'
11
+ safe_require 'faraday_middleware'
12
+
13
+ plugin_puts "Beginning URL Purge from SWISS TXT CDN..."
14
+
15
+ urls.each do |u|
16
+ url = u.chomp
17
+ plugin_puts ("Purging #{url}")
18
+
19
+ begin
20
+ conn = connection
21
+ unless host = URI.parse(url).host
22
+ raise "Invalid URL: No host found in URL. Missing schema?"
23
+ end
24
+ path = URI.parse(url).path
25
+ response = conn.post('/purge', host: host, path: path)
26
+ rescue => e
27
+ plugin_puts_error(url, e.message)
28
+ continue_on_error ? next : exit(1)
29
+ end
30
+
31
+ if response.status != 200
32
+ plugin_puts_error(url, "Response Code: #{response.status}")
33
+ plugin_puts_error(url, response.body['error'] || response.body)
34
+ exit 1 unless continue_on_error
35
+ else
36
+ plugin_puts "Purge successful!"
37
+ end
38
+ end
39
+ end
40
+
41
+ def connection
42
+ if config.api_key.nil?
43
+ plugin_puts("SWISS TXT CDN API api_key not specified, Exiting...")
44
+ exit 1
45
+ end
46
+
47
+ if config.api_secret.nil?
48
+ plugin_puts("SWISS TXT CDN API api_secret not specified, Exiting...")
49
+ exit 1
50
+ end
51
+
52
+ Faraday.new(url: config.url || 'https://cdn-api.swissttx.ch') do |conn|
53
+ conn.request :url_encoded
54
+ conn.headers[:user_agent] = 'Ipecache'
55
+ conn.headers[:accept] = 'application/json'
56
+ conn.response :json, content_type: /\b(json)$/
57
+ conn.headers['X-API-KEY'] = config.api_key
58
+ conn.headers['X-API-SECRET'] = config.api_secret
59
+ conn.adapter Faraday.default_adapter
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
data/plugins/Akamai.md CHANGED
@@ -21,6 +21,6 @@ This is the username of the Akamai account you want to use
21
21
  - Type: `String`
22
22
 
23
23
  #### password
24
- This is the username of the Akamai account you want to use
24
+ This is the password of the Akamai account you want to use
25
25
 
26
26
  - Type: `String`
data/plugins/Local.md ADDED
@@ -0,0 +1,28 @@
1
+ Local
2
+ ========
3
+ Uses a defined set of Hosts from the config and purges the URL list from each Cache Server e.g. Apache Traffic Server or Varnish Cache
4
+
5
+ Hooks
6
+ -----
7
+ - `proxy_purge`
8
+
9
+ Configuration
10
+ -------------
11
+ ```yaml
12
+ plugins:
13
+ local:
14
+ hosts:
15
+ - cache1.mydomain.com
16
+ - cache2.mydomain.com
17
+ use_ssh: false
18
+ ```
19
+
20
+ #### hosts
21
+ This defines an array of Hosts to send the purge request
22
+
23
+ - Type: `Array`
24
+
25
+ #### use_ssh
26
+ This enables a SSH-Wrapper to run the purge request locally on the Cache Server
27
+
28
+ - Type: `Boolean`
@@ -0,0 +1,31 @@
1
+ SWISS TXT CDN
2
+ =============
3
+ Purges URLS from the [SWISS TXT CDN](http://www.swisstxt.ch/).
4
+
5
+ Hooks
6
+ -----
7
+ - `cdn_purge`
8
+
9
+ Configuration
10
+ -------------
11
+ ```yaml
12
+ plugins:
13
+ swisstxt_cdn:
14
+ api_key: sample_key_e8e55aff-61e3-4588-ab98-4d3ea58be7c8
15
+ api_secret: xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678
16
+ ```
17
+
18
+ #### api_key
19
+ This is the api_key of the SWISS TXT CDN account you want to use
20
+
21
+ - Type: `String`
22
+
23
+ #### api_secret
24
+ This is the api_secret of the SWISS TXT CDN account you want to use
25
+
26
+ - Type: `String`
27
+
28
+ #### url (optional)
29
+ The URL of the SWISS TXT CDN API. This parameter defaults to `https://cdn-api.swissttx.ch` and is not required.
30
+
31
+ - Type: `String`
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipecache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cowie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: app_conf
@@ -88,14 +88,18 @@ files:
88
88
  - lib/ipecache/plugins/cloudflare.rb
89
89
  - lib/ipecache/plugins/edgecast.rb
90
90
  - lib/ipecache/plugins/fastly.rb
91
+ - lib/ipecache/plugins/local.rb
91
92
  - lib/ipecache/plugins/plugin.rb
93
+ - lib/ipecache/plugins/swisstxt_cdn.rb
92
94
  - lib/ipecache/runner.rb
93
95
  - plugins/ATSChef.md
94
96
  - plugins/Akamai.md
95
97
  - plugins/CloudFlare.md
96
98
  - plugins/Edgecast.md
97
99
  - plugins/Fastly.md
100
+ - plugins/Local.md
98
101
  - plugins/README.md
102
+ - plugins/SWISS_TXT_CDN.md
99
103
  homepage: https://github.com/jonlives/ipecache
100
104
  licenses: []
101
105
  metadata: {}
@@ -120,3 +124,4 @@ signing_key:
120
124
  specification_version: 4
121
125
  summary: An extensible tool for purging urls from caches and CDNs
122
126
  test_files: []
127
+ has_rdoc: