cap_passenger_ping 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Sascha Brink
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,47 @@
1
+ = cap_passenger_ping
2
+
3
+ This gem is a capistrano task to ping your website and warm up passenger after deploy.
4
+ It sends a http request to your website after passenger is restarted. The website is defined by :domain in deploy.rb.
5
+
6
+ == Why
7
+
8
+ If you use passenger, your application is loaded after the first hit is received by your website.
9
+ The whole load process takes some time, so you want to make sure this happens as soon as possible
10
+ after deploy.
11
+
12
+ == Installation
13
+
14
+ Assuming, you're using Rails 3, add to your <tt>Gemfile</tt>:
15
+
16
+ gem 'cap_passenger_ping'
17
+
18
+ and in your <tt>config/deploy.rb</tt>:
19
+
20
+ require 'cap_passenger_ping/recipes'
21
+
22
+ == How
23
+
24
+ If you don't want to use a gem for such a simple task, here's the relevant code snippet:
25
+
26
+ task :ping do
27
+ require 'net/http'
28
+ begin
29
+ Timeout.timeout(2) { Net::HTTP.get_response(domain, "/", "80") }
30
+ puts " #{domain} is online."
31
+ rescue Timeout::Error
32
+ puts " #{domain} is warming up."
33
+ end
34
+ end
35
+
36
+
37
+ == Note on Patches/Pull Requests
38
+
39
+ * Fork the project.
40
+ * Make your feature addition or bug fix.
41
+ * Commit, do not mess with rakefile, version, or history.
42
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
43
+ * Send me a pull request.
44
+
45
+ == Copyright
46
+
47
+ Copyright (c) 2010 Sascha Brink. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "cap_passenger_ping"
8
+ gem.summary = %Q{Capistrano task to ping your website and warm up passenger after deploy}
9
+ gem.description = %Q{Capistrano task to ping your website and warm up passenger after deploy}
10
+ gem.email = "sascha.brink@gmail.com"
11
+ gem.homepage = "http://github.com/sbrink/cap_passenger_ping"
12
+ gem.authors = ["Sascha Brink"]
13
+ gem.files = FileList["[A-Z]*", "{lib,spec}/**/*"] - FileList["**/*.log"]
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
20
+ #task :default => :spec
21
+
22
+ require 'rake/rdoctask'
23
+ Rake::RDocTask.new do |rdoc|
24
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
25
+
26
+ rdoc.rdoc_dir = 'rdoc'
27
+ rdoc.title = "cap_passenger_ping #{version}"
28
+ rdoc.rdoc_files.include('README*')
29
+ rdoc.rdoc_files.include('lib/**/*.rb')
30
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.0
@@ -0,0 +1,25 @@
1
+ # Just add "require 'cap_passenger_ping/recipes'" in your Capistrano deploy.rb
2
+
3
+ Capistrano::Configuration.instance(:must_exist).load do
4
+ after "deploy:start", "deploy:web:ping"
5
+ after "deploy:restart", "deploy:web:ping"
6
+ after "deploy:web:enabled", "deploy:web:ping"
7
+
8
+ namespace :deploy do
9
+ namespace :web do
10
+
11
+ desc "Pings your website to warm up passenger after deploy"
12
+ task :ping do
13
+ require 'net/http'
14
+ begin
15
+ Timeout.timeout(2) { Net::HTTP.get_response(domain, "/", "80") }
16
+ puts " #{domain} is online."
17
+ rescue Timeout::Error
18
+ puts " #{domain} is warming up."
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cap_passenger_ping
3
+ version: !ruby/object:Gem::Version
4
+ hash: 59
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 0
10
+ version: 0.9.0
11
+ platform: ruby
12
+ authors:
13
+ - Sascha Brink
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-28 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Capistrano task to ping your website and warm up passenger after deploy
23
+ email: sascha.brink@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - README.rdoc
31
+ files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ - Rakefile
35
+ - VERSION
36
+ - lib/cap_passenger_ping/recipes.rb
37
+ has_rdoc: true
38
+ homepage: http://github.com/sbrink/cap_passenger_ping
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --charset=UTF-8
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Capistrano task to ping your website and warm up passenger after deploy
71
+ test_files: []
72
+