capistrano-akamai 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 89c6abd4619e5f011da4703136dbddd745094168
4
+ data.tar.gz: 2e7ba2f30ab645c127a27763bbbe19a2309ffde7
5
+ SHA512:
6
+ metadata.gz: b6b7999bda2be0bd0692071e301472cdae65a5b799d59ea022df8f9e79f4ab4bca8d36554814f645e7e4a203a61aea86c571b53a2aa90257ed304943148de067
7
+ data.tar.gz: bf96f628fd5544c22cee43f076009c25341ad73c3ec25c09d192338ee57f8370ae0533ef59cf11220de1fa14784afff90b378422945d45c7becc6b1925bcefc3
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-akamai.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Douglas Jarquin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,81 @@
1
+ # Capistrano::Akamai
2
+
3
+ A capistrano plugin that can be used to purge or invalidate Akamai cache post deploy. Currently, it only provides one task, but in the idea is to generate dynamic lists of files based on the latest SCM changes.
4
+
5
+ ## Tasks
6
+
7
+ ```
8
+ cap akamai:invalidate:cpcode # Mark the cached content in a cpcode as invalid
9
+ ```
10
+
11
+ ## Purge vs. Invalidate
12
+
13
+ Purge:
14
+ > Remove the content from Akamai edge server caches. The next time the edge server receives a request for the content, it will retrieve the current version from the origin server. If it cannot retrieve a current version, it will follow instructions in your edge server configuration.
15
+ > _Note that "Purge" can increase the load on the origin more than "Invalidate". With 'invalidate', objects are not removed from cache and full objects are not retrieved from the origin unless they are newer than the cached versions._
16
+
17
+ Invalidate:
18
+
19
+ > Mark the cached content as invalid. The next time the Akamai edge server receives a request for the content, it will send an HTTP conditional get (If-Modified-Since) request to the origin. If the content has changed, the origin server will return a full fresh copy; otherwise, the origin normally will respond that the content has not changed, and Akamai can serve the already-cached content.
20
+
21
+ ## Installation
22
+
23
+ Add this line to your application's Gemfile:
24
+
25
+ ```
26
+ gem 'capistrano-akamai'
27
+ ```
28
+
29
+ And then execute:
30
+
31
+ ```
32
+ $ bundle
33
+ ```
34
+
35
+ Or install it yourself as:
36
+
37
+ ```
38
+ $ gem install capistrano-akamai
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Add this line to the top of your `deploy.rb`:
44
+
45
+ ```
46
+ require 'capistrano/akamai'
47
+ ```
48
+
49
+ Then supply the required configuration variables.
50
+
51
+ In your `deploy.rb`:
52
+
53
+ ```
54
+ set :akamai_username, ''
55
+ set :akamai_password, ''
56
+ set :akamai_cpcode, ''
57
+ set :akamai_emails, [''] # optional
58
+ ```
59
+
60
+ Or with environment variables:
61
+
62
+ ```
63
+ # akamai
64
+ export AKAMAI_USERNAME=""
65
+ export AKAMAI_PASSWORD=""
66
+ export AKAMAI_CPCODE=""
67
+ ```
68
+
69
+ Lastly, add the task after deploy:
70
+
71
+ ```
72
+ after 'deploy', 'akamai:invalidate:cpcode'
73
+ ```
74
+
75
+ ## Contributing
76
+
77
+ 1. Fork it
78
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
79
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
80
+ 4. Push to the branch (`git push origin my-new-feature`)
81
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/akamai/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'capistrano-akamai'
8
+ spec.version = Capistrano::Akamai::VERSION
9
+ spec.authors = ['Douglas Jarquin']
10
+ spec.email = ['douglasjarquin@me.com']
11
+ spec.description = %q{A capistrano plugin to purge or invalidate Akamai's Edge cache}
12
+ spec.summary = %q{Trigger a callback to invalidate or purge Akamai's Edge cache after deploys}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'akamai_api', '>= 0.0.5'
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'rake'
24
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano/akamai/version'
@@ -0,0 +1 @@
1
+ require 'capistrano/akamai/version'
@@ -0,0 +1,40 @@
1
+ require 'capistrano'
2
+ require 'akamai_api'
3
+
4
+ module Capistrano
5
+ module Akamai
6
+ VERSION = '0.0.1'
7
+
8
+ def self.extend(configuration)
9
+ configuration.load do
10
+ Capistrano::Configuration.instance.load do
11
+
12
+ _cset(:akamai_username, ENV['AKAMAI_USERNAME'])
13
+ _cset(:akamai_password, ENV['AKAMAI_PASSWORD'])
14
+ _cset(:akamai_cpcode, ENV['AKAMAI_CPCODE'])
15
+ _cset(:akamai_emails, [''])
16
+
17
+ AkamaiApi.config.merge! :auth => [fetch(:akamai_username), fetch(:akamai_password)]
18
+ ccu = AkamaiApi::Ccu
19
+
20
+ namespace :akamai do
21
+ namespace :invalidate do
22
+ desc 'Mark the cached content in a cpcode as invalid'
23
+ task :cpcode, :on_error => :continue do
24
+ silence_stream(STDOUT) do
25
+ @response = ccu.invalidate_cpcode fetch(:akamai_cpcode), :email => fetch(:akamai_emails)
26
+ end
27
+ logger.important "#{@response.code} - #{@response.status}" unless @response.code < 200
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ if Capistrano::Configuration.instance
38
+ Capistrano::Akamai.extend(Capistrano::Configuration.instance)
39
+ end
40
+
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-akamai
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Douglas Jarquin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: akamai_api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A capistrano plugin to purge or invalidate Akamai's Edge cache
56
+ email:
57
+ - douglasjarquin@me.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - capistrano-akamai.gemspec
68
+ - lib/capistrano-akamai.rb
69
+ - lib/capistrano/akamai.rb
70
+ - lib/capistrano/akamai/version.rb
71
+ homepage: ''
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.6
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Trigger a callback to invalidate or purge Akamai's Edge cache after deploys
95
+ test_files: []
96
+ has_rdoc: