capistrano-php-tools 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/capistrano-php-tools.gemspec +27 -0
- data/lib/capistrano/php_tools/version.rb +5 -0
- data/lib/capistrano/php_tools.rb +1 -0
- data/lib/capistrano/tasks/apc_clear.rake +34 -0
- data/lib/capistrano-php-tools.rb +0 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f67b435722c7013ec78af525079015031b5290e4
|
4
|
+
data.tar.gz: 3f22ddc37a47ba772f6a5d4e47f0e8c83ca10de3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b9da25a7e7b30e67e63230f3f4a152a84a3e6026c3b174da1024c43e39b912193c9517d83b33906fc0b901fb9a80a0f65d098f92308ab20b5f779183979dc03d
|
7
|
+
data.tar.gz: 6cd4fbeb1bd5f8ea437d4daae8d87fbbeff018b2ee21f5a212c4beb152e52454a0f9e07897c5c8cf60706224a0f9cd241f535a5292b6999c3b7e227f85a31ea5
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
Capistrano::PHPTools
|
2
|
+
====================
|
3
|
+
This gem provides various utility tasks for PHP based sites that use capistrano for deployment.
|
4
|
+
Currently it provides a method to clear the APC (Alternative PHP Cache) to avoid encountering memory allocation errors.
|
5
|
+
|
6
|
+
Installation & Setup
|
7
|
+
--------------------
|
8
|
+
Add the following to your `Gemfile`:
|
9
|
+
|
10
|
+
group :development do
|
11
|
+
gem 'capistrano', '~> 3.1'
|
12
|
+
gem 'capistrano-php-tools', '~> 1.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
Then run:
|
16
|
+
|
17
|
+
bundle install
|
18
|
+
|
19
|
+
In order to make use of the tools you have to set a `uri` variable in your capistrano settings. This variable
|
20
|
+
should be the full uri to your deployed site. An example setup would be to set this variable in each stage file.
|
21
|
+
So in your `config/deploy/production.rb` file:
|
22
|
+
|
23
|
+
set :uri, 'http://example.com'
|
24
|
+
|
25
|
+
Usage
|
26
|
+
-----
|
27
|
+
Add this line to your `Capfile`
|
28
|
+
|
29
|
+
require 'capistrano/php_tools'
|
30
|
+
|
31
|
+
An example which clears the APC after deployment:
|
32
|
+
|
33
|
+
namespace :deploy do
|
34
|
+
after :finishing, "php_tools:apc_clear"
|
35
|
+
end
|
36
|
+
|
37
|
+
Credits
|
38
|
+
-------
|
39
|
+
Initial implementation of the gem functionality developed by [Chad Fennell](https://github.com/chadfennell).
|
40
|
+
|
41
|
+
Gem assembled by [Bryce Kalow](https://github.com/BRKalow).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/php_tools/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "capistrano-php-tools"
|
8
|
+
gem.version = Capistrano::PHPTools::VERSION
|
9
|
+
gem.authors = ["Bryce Kalow", "Chad Fennell"]
|
10
|
+
gem.email = ["hello@brycekalow.name", "fenne035@umn.edu"]
|
11
|
+
gem.description = <<-EOF.gsub(/^\s+/, '')
|
12
|
+
Provides various utility tasks for PHP based sites that use capistrano for deployment.
|
13
|
+
|
14
|
+
Currently provides a method to clear the APC to avoid encountering memory allocation errors.
|
15
|
+
EOF
|
16
|
+
gem.summary = "Provides various utility tasks for PHP based sites that use capistrano for deployment."
|
17
|
+
gem.homepage = "https://github.com/UMNLibraries/capistrano-php-tools"
|
18
|
+
|
19
|
+
gem.files = `git ls-files`.split($/)
|
20
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
|
24
|
+
gem.add_dependency "capistrano", "~> 3.1"
|
25
|
+
gem.add_dependency "rest-client", "~> 1.8"
|
26
|
+
gem.add_development_dependency "rake", "~> 0"
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].each {|file| load file }
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
namespace :php_tools do
|
4
|
+
|
5
|
+
desc "Clear the APC cache"
|
6
|
+
task :apc_clear do
|
7
|
+
on roles(:app) do
|
8
|
+
unless fetch(:uri)
|
9
|
+
raise "uri not set, please set it in your deployment or stage settings:\nset :uri, 'http://example.com'"
|
10
|
+
end
|
11
|
+
|
12
|
+
puts 'Clearing APC Cache to prevent memmory allocation errors.'
|
13
|
+
|
14
|
+
apc_clear_uri = "#{fetch(:uri)}/apc_clear.php"
|
15
|
+
apc_clear_path = "#{current_path}/apc_clear.php"
|
16
|
+
apc_clear_code = <<-CODE
|
17
|
+
<?php
|
18
|
+
apc_clear_cache();
|
19
|
+
apc_clear_cache('user');
|
20
|
+
apc_clear_cache('opcode');
|
21
|
+
CODE
|
22
|
+
|
23
|
+
execute "touch #{apc_clear_path} && echo \"#{apc_clear_code}\" >> #{apc_clear_path}"
|
24
|
+
|
25
|
+
puts "Sending HTTP GET request to: #{apc_clear_uri}"
|
26
|
+
response = RestClient.get apc_clear_uri
|
27
|
+
if response.code != 200
|
28
|
+
raise "Failed to clear APC cache. GET #{apc_clear_uri} returned #{response.code}"
|
29
|
+
end
|
30
|
+
|
31
|
+
execute "rm #{apc_clear_path}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-php-tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryce Kalow
|
8
|
+
- Chad Fennell
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rest-client
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.8'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.8'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: |
|
57
|
+
Provides various utility tasks for PHP based sites that use capistrano for deployment.
|
58
|
+
Currently provides a method to clear the APC to avoid encountering memory allocation errors.
|
59
|
+
email:
|
60
|
+
- hello@brycekalow.name
|
61
|
+
- fenne035@umn.edu
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- ".gitignore"
|
67
|
+
- Gemfile
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- capistrano-php-tools.gemspec
|
71
|
+
- lib/capistrano-php-tools.rb
|
72
|
+
- lib/capistrano/php_tools.rb
|
73
|
+
- lib/capistrano/php_tools/version.rb
|
74
|
+
- lib/capistrano/tasks/apc_clear.rake
|
75
|
+
homepage: https://github.com/UMNLibraries/capistrano-php-tools
|
76
|
+
licenses: []
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Provides various utility tasks for PHP based sites that use capistrano for
|
98
|
+
deployment.
|
99
|
+
test_files: []
|