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
2a0b7e85
Unverified
Commit
2a0b7e85
authored
Jan 27, 2018
by
Karl Kloppenborg
Committed by
GitHub
Jan 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from Tensho/sneakers-restart
Correct Timing in Sneakers Restart Task
parents
3a5ecde3
b298b43a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
36 deletions
+26
-36
capistrano-sneakers.gemspec
+0
-1
lib/capistrano/sneakers.rb
+1
-11
lib/capistrano/tasks/monit.rake
+19
-0
lib/capistrano/tasks/sneakers.rake
+6
-24
No files found.
capistrano-sneakers.gemspec
View file @
2a0b7e85
# coding: utf-8
lib
=
File
.
expand_path
(
'../lib'
,
__FILE__
)
lib
=
File
.
expand_path
(
'../lib'
,
__FILE__
)
$LOAD_PATH
.
unshift
(
lib
)
unless
$LOAD_PATH
.
include?
(
lib
)
$LOAD_PATH
.
unshift
(
lib
)
unless
$LOAD_PATH
.
include?
(
lib
)
require
'capistrano/sneakers/version'
require
'capistrano/sneakers/version'
...
...
lib/capistrano/sneakers.rb
View file @
2a0b7e85
require
'capistrano/sneakers/version'
load
File
.
expand_path
(
'../tasks/sneakers.rake'
,
__FILE__
)
cap_version
=
Gem
::
Specification
.
find_by_name
(
'capistrano'
).
version
if
cap_version
>=
Gem
::
Version
.
new
(
'3.0.0'
)
#
# Load Tasks from sneakers "cap" file
#
load
File
.
expand_path
(
'../tasks/sneakers.rake'
,
__FILE__
)
else
raise
Gem
::
LoadError
,
"Capistrano-Sneakers requires capistrano version 3.0.0 or greater, version detected:
#{
cap_version
}
"
end
lib/capistrano/tasks/monit.rake
View file @
2a0b7e85
...
@@ -63,5 +63,24 @@ namespace :sneakers do
...
@@ -63,5 +63,24 @@ namespace :sneakers do
def
sudo_if_needed
(
command
)
def
sudo_if_needed
(
command
)
fetch
(
:sneakers_monit_use_sudo
)
?
sudo
(
command
)
:
execute
(
command
)
fetch
(
:sneakers_monit_use_sudo
)
?
sudo
(
command
)
:
execute
(
command
)
end
end
def
template_sneakers
(
from
,
to
,
role
)
[
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
role
.
hostname
}
-
#{
fetch
(
:stage
)
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
role
.
hostname
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
fetch
(
:stage
)
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.rb.erb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.erb"
),
File
.
expand_path
(
"../../templates/
#{
from
}
.rb.erb"
,
__FILE__
),
File
.
expand_path
(
"../../templates/
#{
from
}
.erb"
,
__FILE__
)
].
each
do
|
path
|
if
File
.
file?
(
path
)
erb
=
File
.
read
(
path
)
upload!
StringIO
.
new
(
ERB
.
new
(
erb
).
result
(
binding
)),
to
break
end
end
end
end
end
end
end
lib/capistrano/tasks/sneakers.rake
View file @
2a0b7e85
namespace
:load
do
namespace
:load
do
task
:defaults
do
task
:defaults
do
set
:sneakers_default_hooks
,
->
{
true
}
set
:sneakers_default_hooks
,
->
{
true
}
...
@@ -18,9 +17,7 @@ namespace :load do
...
@@ -18,9 +17,7 @@ namespace :load do
end
end
end
end
namespace
:deploy
do
namespace
:deploy
do
before
:starting
,
:check_sneakers_hooks
do
before
:starting
,
:check_sneakers_hooks
do
invoke
'sneakers:add_default_hooks'
if
fetch
(
:sneakers_default_hooks
)
invoke
'sneakers:add_default_hooks'
if
fetch
(
:sneakers_default_hooks
)
end
end
...
@@ -31,7 +28,6 @@ namespace :deploy do
...
@@ -31,7 +28,6 @@ namespace :deploy do
end
end
namespace
:sneakers
do
namespace
:sneakers
do
def
for_each_sneakers_process
(
reverse
=
false
,
&
block
)
def
for_each_sneakers_process
(
reverse
=
false
,
&
block
)
pids
=
processes_sneakers_pids
pids
=
processes_sneakers_pids
pids
.
reverse!
if
reverse
pids
.
reverse!
if
reverse
...
@@ -196,7 +192,9 @@ namespace :sneakers do
...
@@ -196,7 +192,9 @@ namespace :sneakers do
on
roles
fetch
(
:sneakers_role
)
do
|
role
|
on
roles
fetch
(
:sneakers_role
)
do
|
role
|
as_sneakers_user
(
role
)
do
as_sneakers_user
(
role
)
do
for_each_sneakers_process
do
|
pid_file
,
idx
|
for_each_sneakers_process
do
|
pid_file
,
idx
|
start_sneakers
(
pid_file
,
idx
)
unless
sneakers_pid_process_exists?
(
pid_file
)
unless
sneakers_pid_process_exists?
(
pid_file
)
start_sneakers
(
pid_file
,
idx
)
end
end
end
end
end
end
end
...
@@ -205,6 +203,9 @@ namespace :sneakers do
...
@@ -205,6 +203,9 @@ namespace :sneakers do
desc
'Restart sneakers'
desc
'Restart sneakers'
task
:restart
do
task
:restart
do
invoke!
'sneakers:stop'
invoke!
'sneakers:stop'
# It takes some time to stop serverengine processes and cleanup pidfiles.
# We should wait until pidfiles will be removed.
sleep
5
invoke
'sneakers:start'
invoke
'sneakers:start'
end
end
...
@@ -249,23 +250,4 @@ namespace :sneakers do
...
@@ -249,23 +250,4 @@ namespace :sneakers do
end
end
end
end
end
end
def
template_sneakers
(
from
,
to
,
role
)
[
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
role
.
hostname
}
-
#{
fetch
(
:stage
)
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
role
.
hostname
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
-
#{
fetch
(
:stage
)
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.rb.erb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.rb"
),
File
.
join
(
'lib'
,
'capistrano'
,
'templates'
,
"
#{
from
}
.erb"
),
File
.
expand_path
(
"../../templates/
#{
from
}
.rb.erb"
,
__FILE__
),
File
.
expand_path
(
"../../templates/
#{
from
}
.erb"
,
__FILE__
)
].
each
do
|
path
|
if
File
.
file?
(
path
)
erb
=
File
.
read
(
path
)
upload!
StringIO
.
new
(
ERB
.
new
(
erb
).
result
(
binding
)),
to
break
end
end
end
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