capobvious 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +60 -0
- data/capobvious.gemspec +1 -1
- data/lib/capistrano/ext/capobvious.rb +10 -14
- metadata +1 -1
data/README
CHANGED
@@ -1 +1,61 @@
|
|
1
|
+
Add to the end of Capfile
|
1
2
|
require 'capistrano/ext/capobvious'
|
3
|
+
|
4
|
+
some task need 7z
|
5
|
+
Ubuntu: sudo apt-get install p7zip-full
|
6
|
+
|
7
|
+
|
8
|
+
backup:db
|
9
|
+
if you want to backup your production postgres database
|
10
|
+
it will create 7z archive at your tmp/backup project folder & shared/backup on server (NOTE: it need p7zip installed on server)
|
11
|
+
|
12
|
+
backup:sys
|
13
|
+
backup your system folder on server to 7z archive at tmp/backup & shared/backup on server (NOTE: need p7zip)
|
14
|
+
|
15
|
+
backup:clean
|
16
|
+
delete all files in server shared/backup folder
|
17
|
+
|
18
|
+
|
19
|
+
assets:precompile
|
20
|
+
precompiles assets on developer's machine & sends it to server
|
21
|
+
NOTE:
|
22
|
+
if in config/deploy.rb will be setted :assets to true, task will run automatically by deploy
|
23
|
+
|
24
|
+
|
25
|
+
db:create
|
26
|
+
will create a Postgresql database and user with password that stored in database.yml
|
27
|
+
|
28
|
+
db:seed
|
29
|
+
run rake db:seed with right RAILS_ENV
|
30
|
+
|
31
|
+
db:pg_import
|
32
|
+
import remote server postgresql database to your development postgresql database IT WILL DELETE YOUR DEV DATABASE (NOTE: need installed p7zip)
|
33
|
+
|
34
|
+
|
35
|
+
rake TASK=db:seed
|
36
|
+
runs custom rake task
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
nginx:restart
|
41
|
+
nginx:reload
|
42
|
+
nginx:start
|
43
|
+
nginx:stop
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
bundle:install
|
48
|
+
|
49
|
+
|
50
|
+
log:tail
|
51
|
+
catch errors with tail -f log
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
unicorn:start
|
56
|
+
unicorn:stop
|
57
|
+
unicorn:restart
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
data/capobvious.gemspec
CHANGED
@@ -27,7 +27,8 @@ set :db_file_name, "#{database}-#{timestamp}.sql"
|
|
27
27
|
set :db_archive_ext, "7z"
|
28
28
|
|
29
29
|
|
30
|
-
after "deploy:symlink", "auto:run"
|
30
|
+
#after "deploy:symlink", "auto:run"
|
31
|
+
before "deploy:restart", "auto:run"
|
31
32
|
after "deploy:setup", "db:create", "nginx:conf"
|
32
33
|
namespace :auto do
|
33
34
|
task :run do
|
@@ -87,17 +88,16 @@ namespace :db do
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
90
|
-
|
91
|
-
desc "Run custom task usage: cap
|
92
|
-
task :
|
91
|
+
# PRIKHA-TASK
|
92
|
+
desc "Run custom task usage: cap rake TASK=patch:project_category"
|
93
|
+
task :rake do
|
93
94
|
if ENV.has_key?('TASK')
|
94
95
|
p "running rake task: #{ENV['TASK']}"
|
95
96
|
run "cd #{current_path} && bundle exec rake RAILS_ENV=#{rails_env} #{ENV['TASK']}"
|
96
97
|
else
|
97
|
-
puts 'Please specify correct task: cap
|
98
|
+
puts 'Please specify correct task: cap rake TASK= some_task'
|
98
99
|
end
|
99
100
|
end
|
100
|
-
#==== PRIKHA-END ====
|
101
101
|
|
102
102
|
namespace :backup do
|
103
103
|
desc "Backup a database"
|
@@ -139,14 +139,10 @@ end
|
|
139
139
|
namespace :assets do
|
140
140
|
desc "Assets precompile"
|
141
141
|
task :precompile do
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
run("cd #{current_path}/public && rm -rf assets/ && tar xzf assets.tar.gz && rm assets.tar.gz")
|
147
|
-
else
|
148
|
-
puts "assets is disabled in config/deploy.rb to enable add line set :assets, true"
|
149
|
-
end
|
142
|
+
system("bundle exec rake assets:precompile && cd public && tar czf assets.tar.gz assets/")
|
143
|
+
upload("public/assets.tar.gz","#{current_path}/public/assets.tar.gz")
|
144
|
+
system("rm public/assets.tar.gz && rm -rf tmp/assets && mv public/assets tmp/assets")
|
145
|
+
run("cd #{current_path}/public && rm -rf assets/ && tar xzf assets.tar.gz && rm assets.tar.gz")
|
150
146
|
end
|
151
147
|
end
|
152
148
|
|