Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
capistrano-sneakers
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
capistrano-sneakers
Commits
3a5b47e9
Commit
3a5b47e9
authored
May 12, 2015
by
Karl Kloppenborg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from alucardpj/master
solve conflict with capistrano-sidekiq
parents
ec384dbd
ba8422b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
lib/capistrano/tasks/sneakers.rb
+20
-20
No files found.
lib/capistrano/tasks/sneakers.rb
View file @
3a5b47e9
...
...
@@ -32,8 +32,8 @@ end
namespace
:sneakers
do
def
for_each_process
(
reverse
=
false
,
&
block
)
pids
=
processes_pids
def
for_each_
sneakers_
process
(
reverse
=
false
,
&
block
)
pids
=
processes_
sneakers_
pids
pids
.
reverse!
if
reverse
pids
.
each_with_index
do
|
pid_file
,
idx
|
within
current_path
do
...
...
@@ -42,7 +42,7 @@ namespace :sneakers do
end
end
def
processes_pids
def
processes_
sneakers_
pids
pids
=
[]
raise
"sneaker_processes is nil class, cannot continue, please [set :sneaker_processes]"
if
fetch
(
:sneakers_processes
).
nil?
fetch
(
:sneakers_processes
).
times
do
|
idx
|
...
...
@@ -54,11 +54,11 @@ namespace :sneakers do
pids
end
def
pid_process_exists?
(
pid_file
)
pid_file_exists?
(
pid_file
)
and
test
(
*
(
"kill -0 $( cat
#{
pid_file
}
)"
).
split
(
' '
))
def
sneakers_
pid_process_exists?
(
pid_file
)
sneakers_
pid_file_exists?
(
pid_file
)
and
test
(
*
(
"kill -0 $( cat
#{
pid_file
}
)"
).
split
(
' '
))
end
def
pid_file_exists?
(
pid_file
)
def
sneakers_
pid_file_exists?
(
pid_file
)
test
(
*
(
"[ -f
#{
pid_file
}
]"
).
split
(
' '
))
end
...
...
@@ -102,7 +102,7 @@ namespace :sneakers do
info
"Starting the sneakers processes"
#workers.each do |worker|
with
rails_env:
fetch
(
:s
tage
),
workers:
workers
do
with
rails_env:
fetch
(
:s
neakers_env
),
workers:
workers
do
rake
'sneakers:run'
end
#execute :bundle, :exec, :sneakers, args.compact.join(' ')
...
...
@@ -148,8 +148,8 @@ namespace :sneakers do
task
:quiet
do
on
roles
fetch
(
:sneakers_role
)
do
if
test
(
"[ -d
#{
current_path
}
]"
)
# fixes #11
for_each_process
(
true
)
do
|
pid_file
,
idx
|
if
pid_process_exists?
(
pid_file
)
for_each_
sneakers_
process
(
true
)
do
|
pid_file
,
idx
|
if
sneakers_
pid_process_exists?
(
pid_file
)
quiet_sneakers
(
pid_file
)
end
end
...
...
@@ -161,8 +161,8 @@ namespace :sneakers do
task
:stop
do
on
roles
fetch
(
:sneakers_role
)
do
if
test
(
"[ -d
#{
current_path
}
]"
)
for_each_process
(
true
)
do
|
pid_file
,
idx
|
if
pid_process_exists?
(
pid_file
)
for_each_
sneakers_
process
(
true
)
do
|
pid_file
,
idx
|
if
sneakers_
pid_process_exists?
(
pid_file
)
stop_sneakers
(
pid_file
)
end
end
...
...
@@ -173,8 +173,8 @@ namespace :sneakers do
desc
'Start sneakers'
task
:start
do
on
roles
fetch
(
:sneakers_role
)
do
for_each_process
do
|
pid_file
,
idx
|
start_sneakers
(
pid_file
,
idx
)
unless
pid_process_exists?
(
pid_file
)
for_each_
sneakers_
process
do
|
pid_file
,
idx
|
start_sneakers
(
pid_file
,
idx
)
unless
sneakers_
pid_process_exists?
(
pid_file
)
end
end
end
...
...
@@ -188,8 +188,8 @@ namespace :sneakers do
desc
'Rolling-restart sneakers'
task
:rolling_restart
do
on
roles
fetch
(
:sneakers_role
)
do
for_each_process
(
true
)
do
|
pid_file
,
idx
|
if
pid_process_exists?
(
pid_file
)
for_each_
sneakers_
process
(
true
)
do
|
pid_file
,
idx
|
if
sneakers_
pid_process_exists?
(
pid_file
)
stop_sneakers
(
pid_file
)
end
start_sneakers
(
pid_file
,
idx
)
...
...
@@ -200,9 +200,9 @@ namespace :sneakers do
# Delete any pid file not in use
task
:cleanup
do
on
roles
fetch
(
:sneakers_role
)
do
for_each_process
do
|
pid_file
,
idx
|
if
pid_file_exists?
(
pid_file
)
execute
"rm
#{
pid_file
}
"
unless
pid_process_exists?
(
pid_file
)
for_each_
sneakers_
process
do
|
pid_file
,
idx
|
if
sneakers_
pid_file_exists?
(
pid_file
)
execute
"rm
#{
pid_file
}
"
unless
sneakers_
pid_process_exists?
(
pid_file
)
end
end
end
...
...
@@ -213,8 +213,8 @@ namespace :sneakers do
task
:respawn
do
invoke
'sneakers:cleanup'
on
roles
fetch
(
:sneakers_role
)
do
for_each_process
do
|
pid_file
,
idx
|
unless
pid_file_exists?
(
pid_file
)
for_each_
sneakers_
process
do
|
pid_file
,
idx
|
unless
sneakers_
pid_file_exists?
(
pid_file
)
start_sneakers
(
pid_file
,
idx
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment