ipecache 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5ad45c0cf7996f6d4de2efaaa587963a8a663ab
4
- data.tar.gz: 3146198d7fcc41a23e46be2a1c3b2dd82ab0d7dd
3
+ metadata.gz: 773200b12ae0343b65d2a65c39eab74626449f59
4
+ data.tar.gz: 36d5094174abfd8d5d93f71395a341f933fd01f6
5
5
  SHA512:
6
- metadata.gz: 60944d51c94150df073c004321b7f9ad8334b5a93dd6e5bc472c053b5ba1f9b13165b8c224e1167d013b882974d464759c5159c4ed006e3a830a054e816fb86b
7
- data.tar.gz: e4f212f99206a89b183401a4db4b99ef3b3bd646f84c85ee9a21584e76ed01651079b4a69eaac86ca562d6dd89c51bf330270ffcf2a97cd436780e08a6e27b2c
6
+ metadata.gz: c21e8f7f4b3ca6baa5a0add9fb71e6825da1b58185cf59aa543008f30e08a2a035792f6be5b7f4cb8413c4f1e283f111aa845163239c3560a704cc7c51600bb9
7
+ data.tar.gz: 7a4847e31b811d89fb79cdfed6a3c3a96598a23678d59df346608dce98976bceab3a7e181941233e21e679cde78915d359f0252c04038ae2adbc22f9799469b9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.12 (April 20th, 2016)
2
+
3
+ Features:
4
+
5
+ - Varnish plugin (Thanks to @luisdavim https://github.com/jonlives/ipecache/pull/14)
6
+
1
7
  ## 0.0.11 (September 3rd, 2015)
2
8
 
3
9
  Bugfixes:
data/README.md CHANGED
@@ -95,6 +95,9 @@ For more information on how to configure the SWISS TXT CDN plugin, please read t
95
95
  #### Amazon Cloudfront
96
96
  For more information on how to configure the Amazon Cloudfront CDN plugin, please read the [plugins/Cloudfront.md](plugins/Cloudfront.md) file.
97
97
 
98
+ #### MaxCDN
99
+ For more information on how to configure the MaxCDN plugin, please read the [plugins/MaxCDN.md](plugins/MaxCDN.md) file.
100
+
98
101
  Ipecache Usage
99
102
  -----------
100
103
  The main component of Ipecache, and the program which initialises and calls all plugins is called `ipecache`.
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.11'
5
+ gem.version = '0.0.12'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/ipecache'
@@ -62,6 +62,7 @@ module Ipecache
62
62
  )
63
63
  plugin_puts "#{result[:id]}: #{result[:status]}, #{result[:invalidation_batch][:paths][:items].length} item(s)"
64
64
  end
65
+ plugin_puts "This invalidation costs #{paths.length*0.005} Euro"
65
66
  end
66
67
  end
67
68
  end
@@ -0,0 +1,50 @@
1
+ require 'ipecache/plugins/plugin'
2
+
3
+ module Ipecache
4
+ module Plugins
5
+ class Varnish < Plugin
6
+ name :varnish
7
+ hooks :proxy_purge
8
+
9
+ def perform
10
+ safe_require 'uri'
11
+
12
+ hosts = config.hosts
13
+ use_ssh = config.use_ssh
14
+ action = (config.action.upcase == "PURGE") ? "PURGE" : "BAN"
15
+ key = config.auth_key
16
+
17
+ if !hosts
18
+ plugin_puts "No hosts in config file specified. Exiting..."
19
+ exit 1
20
+ end
21
+
22
+ request = (action == "BAN") ? "Banning" : "Purging"
23
+
24
+ with = (use_ssh) ? "ssh curl" : "curl";
25
+
26
+ urls.each do |u|
27
+ url = u.chomp.gsub(/\*$/,'').gsub(/\*/,'.*')
28
+ plugin_puts ("#{request} #{url} through #{with}")
29
+ hosts.each do |varnish|
30
+ hostname = URI.parse(url).host
31
+ path = URI.parse(url).path
32
+ if use_ssh
33
+ result = `ssh #{varnish} 'curl -X #{action} -s -o /dev/null -w \"%{http_code}\" --header \"X-BAN-Auth: #{key}\" --header \"Host: #{hostname}\" \"http://localhost#{path}\"'`
34
+ else
35
+ result = `curl -X #{action} -s -o /dev/null -w "%{http_code}" --header "X-BAN-Auth: #{key}" --header "Host: #{hostname}" "http://#{varnish}#{path}"`
36
+ end
37
+ if result.include?("200")
38
+ plugin_puts "--#{request} from #{varnish} sucessfully"
39
+ elsif result.include?("404")
40
+ plugin_puts "--#{action} from #{varnish} not needed, asset not found"
41
+ else
42
+ plugin_puts_error(url,"--#{action} from #{varnish} failed with http_code = #{result}")
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
data/plugins/MaxCDN.md ADDED
@@ -0,0 +1,18 @@
1
+ MaxCDN
2
+ ========
3
+ Purges URLS from MaxCDN
4
+
5
+ Hooks
6
+ -----
7
+ - `cdn_purge`
8
+
9
+ Configuration
10
+ -------------
11
+ ```yaml
12
+ plugins:
13
+ maxcdn:
14
+ alias: myalias
15
+ token: 1A2B
16
+ secret: abc123
17
+ zone: 1234
18
+ ```
@@ -0,0 +1,41 @@
1
+ Varnish
2
+ ========
3
+ Uses a defined set of Hosts from the config and purges/bans the URL list from each Varnish Server
4
+ Adapted from the Local plugin
5
+
6
+ Hooks
7
+ -----
8
+ - `proxy_purge`
9
+
10
+ Configuration
11
+ -------------
12
+ ```yaml
13
+ plugins:
14
+ varnish:
15
+ hosts:
16
+ - cache1.mydomain.com
17
+ - cache2.mydomain.com
18
+ use_ssh: false
19
+ action: ban
20
+ auth_key: <authapikey>
21
+ ```
22
+
23
+ #### hosts
24
+ This defines an array of Hosts to send the purge request
25
+
26
+ - Type: `Array`
27
+
28
+ #### use_ssh
29
+ This enables a SSH-Wrapper to run the purge request locally on the Cache Server
30
+
31
+ - Type: `Boolean`
32
+
33
+ #### action
34
+ This defines whether use BAN or PURGE
35
+
36
+ - Type: `String`
37
+
38
+ ### auth_key
39
+ This defines the authorization key sent in the headers with the request
40
+
41
+ - Type: `String`
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipecache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cowie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: app_conf
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: choice
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.1.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday_middleware
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.9.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.9.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: public_suffix
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.4.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.4.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aws-sdk-v1
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: maxcdn
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.2.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.2.1
97
97
  description: An extensible tool for purging urls from caches and CDNs
@@ -101,7 +101,7 @@ executables:
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".gitignore"
104
+ - .gitignore
105
105
  - CHANGELOG.md
106
106
  - Gemfile
107
107
  - Gemfile.lock
@@ -122,6 +122,7 @@ files:
122
122
  - lib/ipecache/plugins/maxcdn.rb
123
123
  - lib/ipecache/plugins/plugin.rb
124
124
  - lib/ipecache/plugins/swisstxt_cdn.rb
125
+ - lib/ipecache/plugins/varnish.rb
125
126
  - lib/ipecache/runner.rb
126
127
  - plugins/ATSChef.md
127
128
  - plugins/Akamai.md
@@ -130,8 +131,10 @@ files:
130
131
  - plugins/Edgecast.md
131
132
  - plugins/Fastly.md
132
133
  - plugins/Local.md
134
+ - plugins/MaxCDN.md
133
135
  - plugins/README.md
134
136
  - plugins/SWISS_TXT_CDN.md
137
+ - plugins/Varnish.md
135
138
  homepage: https://github.com/jonlives/ipecache
136
139
  licenses: []
137
140
  metadata: {}
@@ -141,19 +144,18 @@ require_paths:
141
144
  - lib
142
145
  required_ruby_version: !ruby/object:Gem::Requirement
143
146
  requirements:
144
- - - ">="
147
+ - - '>='
145
148
  - !ruby/object:Gem::Version
146
149
  version: '0'
147
150
  required_rubygems_version: !ruby/object:Gem::Requirement
148
151
  requirements:
149
- - - ">="
152
+ - - '>='
150
153
  - !ruby/object:Gem::Version
151
154
  version: '0'
152
155
  requirements: []
153
156
  rubyforge_project:
154
- rubygems_version: 2.2.2
157
+ rubygems_version: 2.0.14
155
158
  signing_key:
156
159
  specification_version: 4
157
160
  summary: An extensible tool for purging urls from caches and CDNs
158
161
  test_files: []
159
- has_rdoc: