nesquena-cap-recipes 0.2.7 → 0.2.8
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.
- data/Rakefile +1 -1
- data/lib/cap_recipes/tasks/juggernaut.rb +2 -2
- data/lib/cap_recipes/tasks/passenger.rb +5 -3
- data/lib/cap_recipes/tasks/with_scope.rb +22 -0
- metadata +2 -1
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
|
|
5
5
|
require 'spec/rake/spectask'
|
6
6
|
|
7
7
|
GEM = "cap-recipes"
|
8
|
-
GEM_VERSION = "0.2.
|
8
|
+
GEM_VERSION = "0.2.8"
|
9
9
|
SUMMARY = "Collection of capistrano recipes for apache, passenger, memcache, juggernaut and backgroundrb"
|
10
10
|
AUTHOR = "Nathan Esquenazi"
|
11
11
|
EMAIL = "nesquena@gmail.com"
|
@@ -11,13 +11,13 @@ Capistrano::Configuration.instance(true).load do
|
|
11
11
|
desc "Starts the juggernaut push server"
|
12
12
|
task :start, :roles => :app do
|
13
13
|
puts "Starting juggernaut push server"
|
14
|
-
sudo "
|
14
|
+
sudo "juggernaut -c #{juggernaut_config} -d --pid #{juggernaut_pid} --log #{juggernaut_log}"
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "Stops the juggernaut push server"
|
18
18
|
task :stop, :roles => :app do
|
19
19
|
puts "Stopping juggernaut push server"
|
20
|
-
sudo "
|
20
|
+
sudo "juggernaut -c #{juggernaut_config} -k * --pid #{juggernaut_pid} --log #{juggernaut_log}"
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "Restarts the juggernaut push server"
|
@@ -41,9 +41,11 @@ Capistrano::Configuration.instance(true).load do
|
|
41
41
|
|
42
42
|
desc "Update code on server, apply migrations, and restart passenger server"
|
43
43
|
task :with_migrations, :roles => :web do
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
with_role(:web) do
|
45
|
+
deploy.update
|
46
|
+
deploy.migrate
|
47
|
+
deploy.restart
|
48
|
+
end
|
47
49
|
end
|
48
50
|
|
49
51
|
# ===============================================================
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# role = :app
|
2
|
+
def with_role(role, &block)
|
3
|
+
original, ENV['HOSTS'] = ENV['HOSTS'], find_servers(:roles => role).map{|d| d.host}.join(",")
|
4
|
+
begin
|
5
|
+
yield
|
6
|
+
ensure
|
7
|
+
ENV['HOSTS'] = original
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# options = { :user => 'xxxxx', :password => 'xxxxx' }
|
12
|
+
def with_credentials(options={}, &block)
|
13
|
+
original_username, original_password = user, password
|
14
|
+
begin
|
15
|
+
set :user, options[:user] || original_username
|
16
|
+
set :password, options[:password] || original_password
|
17
|
+
yield
|
18
|
+
ensure
|
19
|
+
set :user, original_username
|
20
|
+
set :password, original_password
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nesquena-cap-recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/cap_recipes/tasks/juggernaut.rb
|
30
30
|
- lib/cap_recipes/tasks/memcache.rb
|
31
31
|
- lib/cap_recipes/tasks/passenger.rb
|
32
|
+
- lib/cap_recipes/tasks/with_scope.rb
|
32
33
|
- lib/cap_recipes.rb
|
33
34
|
- spec/cap-recipes-spec.rb
|
34
35
|
has_rdoc: false
|