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
29b35673
Commit
29b35673
authored
Aug 02, 2018
by
ErgoLau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused file
parent
146e66ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
92 deletions
+0
-92
lib/sneakers_helper.rb
+0
-92
No files found.
lib/sneakers_helper.rb
deleted
100644 → 0
View file @
146e66ca
module
SneakersHelper
def
self
.
each_process_with_index
(
reverse
=
false
,
&
block
)
_pid_files
=
pid_files
_pid_files
.
reverse!
if
reverse
_pid_files
.
each_with_index
do
|
pid_file
,
idx
|
within
release_path
do
yield
(
pid_file
,
idx
)
end
end
end
def
self
.
pid_files
sneakers_roles
=
Array
(
fetch
(
:sneakers_roles
))
sneakers_roles
.
select!
{
|
role
|
host
.
roles
.
include?
(
role
)
}
sneakers_roles
.
flat_map
do
|
role
|
processes
=
fetch
(
:sneakers_processes
)
if
processes
==
1
fetch
(
:sneakers_pid
)
else
Array
.
new
(
processes
)
{
|
idx
|
fetch
(
:sneakers_pid
).
gsub
(
/\.pid$/
,
"-
#{
idx
}
.pid"
)
}
end
end
end
def
self
.
pid_file_exists?
(
pid_file
)
test
(
*
(
"[ -f
#{
pid_file
}
]"
).
split
(
' '
))
end
def
self
.
process_exists?
(
pid_file
)
test
(
*
(
"kill -0 $( cat
#{
pid_file
}
)"
).
split
(
' '
))
end
def
self
.
quiet_sneakers
(
pid_file
)
if
fetch
(
:sneakers_use_signals
)
||
fetch
(
:sneakers_run_config
)
execute
:kill
,
"-USR1 `cat
#{
pid_file
}
`"
else
begin
execute
:bundle
,
:exec
,
:sneakersctl
,
'quiet'
,
"
#{
pid_file
}
"
rescue
SSHKit
::
Command
::
Failed
# If gems are not installed eq(first deploy) and sneakers_default_hooks as active
warn
'sneakersctl not found (ignore if this is the first deploy)'
end
end
end
def
self
.
stop_sneakers
(
pid_file
)
if
fetch
(
:sneakers_run_config
)
==
true
execute
:kill
,
"-SIGTERM `cat
#{
pid_file
}
`"
else
if
fetch
(
:stop_sneakers_in_background
,
fetch
(
:sneakers_run_in_background
))
if
fetch
(
:sneakers_use_signals
)
background
:kill
,
"-TERM `cat
#{
pid_file
}
`"
else
background
:bundle
,
:exec
,
:sneakersctl
,
'stop'
,
"
#{
pid_file
}
"
,
fetch
(
:sneakers_timeout
)
end
else
execute
:bundle
,
:exec
,
:sneakersctl
,
'stop'
,
"
#{
pid_file
}
"
,
fetch
(
:sneakers_timeout
)
end
end
end
def
self
.
start_sneakers
(
pid_file
,
idx
=
0
)
if
fetch
(
:sneakers_run_config
)
==
true
# Use sneakers configuration prebuilt in
raise
"[ set :workers, ['worker1', 'workerN'] ] not configured properly, please configure the workers you wish to use"
if
fetch
(
:sneakers_workers
).
nil?
or
fetch
(
:sneakers_workers
)
==
false
or
!
fetch
(
:sneakers_workers
).
kind_of?
Array
workers
=
fetch
(
:sneakers_workers
).
compact
.
join
(
','
)
info
"Starting the sneakers processes"
with
rails_env:
fetch
(
:sneakers_env
),
workers:
workers
do
rake
'sneakers:run'
end
end
end
def
self
.
switch_user
(
role
,
&
block
)
user
=
sneakers_user
(
role
)
if
user
==
role
.
user
block
.
call
else
as
user
do
block
.
call
end
end
end
def
self
.
sneakers_user
(
role
)
properties
=
role
.
properties
properties
.
fetch
(
:sneakers_user
)
||
fetch
(
:sneakers_user
)
||
properties
.
fetch
(
:run_as
)
||
role
.
user
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