capobvious 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capistrano/ext/capobvious.rb +72 -0
- data/lib/capobvious/version.rb +1 -1
- metadata +2 -2
@@ -16,6 +16,9 @@ Capistrano::Configuration.instance.load do
|
|
16
16
|
set :use_sudo, false unless exists?(:use_sudo)
|
17
17
|
set :scm, :git unless exists?(:scm)
|
18
18
|
|
19
|
+
|
20
|
+
set :unicorn_init, "unicorn_#{application}"
|
21
|
+
|
19
22
|
run_local_psql = if `uname -a`.include?("Darwin")
|
20
23
|
"psql -h localhost -U postgres"
|
21
24
|
else
|
@@ -156,6 +159,10 @@ Capistrano::Configuration.instance.load do
|
|
156
159
|
task :reset do
|
157
160
|
run "cd #{current_path} && bundle exec rake RAILS_ENV=#{rails_env} db:reset"
|
158
161
|
end
|
162
|
+
task :hard_reset
|
163
|
+
run "cd #{current_path} && bundle exec rake RAILS_ENV=#{rails_env} db:migrate VERSION=0 && bundle exec rake RAILS_ENV=#{rails_env} db:migrate && bundle exec rake RAILS_ENV=#{rails_env} db:seed"
|
164
|
+
end
|
165
|
+
|
159
166
|
task :migrate do
|
160
167
|
run "cd #{current_path} && bundle exec rake RAILS_ENV=#{rails_env} db:migrate"
|
161
168
|
end
|
@@ -476,6 +483,71 @@ Capistrano::Configuration.instance.load do
|
|
476
483
|
run "cd #{current_path} && bundle exec unicorn -c #{unicorn_conf} -E #{rails_env} -D"
|
477
484
|
end
|
478
485
|
end
|
486
|
+
|
487
|
+
task :init do
|
488
|
+
template = <<EOF
|
489
|
+
#! /bin/sh
|
490
|
+
# File: /etc/init.d/<%= unicorn_init %>
|
491
|
+
### BEGIN INIT INFO
|
492
|
+
# Provides: unicorn
|
493
|
+
# Required-Start: $local_fs $remote_fs $network $syslog
|
494
|
+
# Required-Stop: $local_fs $remote_fs $network $syslog
|
495
|
+
# Default-Start: 2 3 4 5
|
496
|
+
# Default-Stop: 0 1 6
|
497
|
+
# Short-Description: starts the unicorn web server
|
498
|
+
# Description: starts unicorn
|
499
|
+
### END INIT INFO
|
500
|
+
|
501
|
+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
502
|
+
DAEMON=/home/nyaa/.rvm/bin/system_unicorn
|
503
|
+
DAEMON_OPTS="<%= unicorn_conf %>"
|
504
|
+
NAME=unicorn_<%= application %>
|
505
|
+
DESC="Unicorn app for <%= application %>"
|
506
|
+
PID=<% unicorn_pid %>
|
507
|
+
|
508
|
+
case "$1" in
|
509
|
+
start)
|
510
|
+
echo -n "Starting $DESC: "
|
511
|
+
$DAEMON $DAEMON_OPTS
|
512
|
+
echo "$NAME."
|
513
|
+
;;
|
514
|
+
stop)
|
515
|
+
echo -n "Stopping $DESC: "
|
516
|
+
kill -QUIT `cat $PID`
|
517
|
+
echo "$NAME."
|
518
|
+
;;
|
519
|
+
restart)
|
520
|
+
echo -n "Restarting $DESC: "
|
521
|
+
kill -QUIT `cat $PID`
|
522
|
+
sleep 1
|
523
|
+
$DAEMON $DAEMON_OPTS
|
524
|
+
echo "$NAME."
|
525
|
+
;;
|
526
|
+
reload)
|
527
|
+
echo -n "Reloading $DESC configuration: "
|
528
|
+
kill -HUP `cat $PID`
|
529
|
+
echo "$NAME."
|
530
|
+
;;
|
531
|
+
*)
|
532
|
+
echo "Usage: $NAME {start|stop|restart|reload}" >&2
|
533
|
+
exit 1
|
534
|
+
;;
|
535
|
+
esac
|
536
|
+
|
537
|
+
exit 0
|
538
|
+
EOF
|
539
|
+
erb = ERB.new(template)
|
540
|
+
init = erb.result(binding)
|
541
|
+
file_path = "/etc/init.d/#{unicorn_init}"
|
542
|
+
put init, "/tmp/#{unicorn_init}"
|
543
|
+
run "#{sudo} mv /tmp/#{unicorn_init} #{file_path} && #{sudo} chmod +x #{file_path}"
|
544
|
+
end
|
545
|
+
task :init_defaults do
|
546
|
+
"#{sudo} /usr/sbin/update-rc.d -f #{unicorn_init} defaults"
|
547
|
+
end
|
548
|
+
task :init_remove do
|
549
|
+
"sudo update-rc.d #{unicorn_init} remove"
|
550
|
+
end
|
479
551
|
end
|
480
552
|
|
481
553
|
namespace :deploy do
|
data/lib/capobvious/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capobvious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|