capones_recipes 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capones_recipes/tasks/bookyt/setup.rb +1 -1
- data/lib/capones_recipes/tasks/database/sync.rb +14 -12
- data/lib/capones_recipes/tasks/rails/bundler.rb +1 -1
- data/lib/capones_recipes/tasks/rails/database_yml.rb +1 -1
- data/lib/capones_recipes/tasks/rails/logs.rb +4 -4
- data/lib/capones_recipes/tasks/rails/mod_rails.rb +38 -0
- data/lib/capones_recipes/tasks/rails31/rails31.rb +6 -0
- data/lib/capones_recipes/tasks/rails31.rb +1 -0
- data/lib/capones_recipes/version.rb +1 -1
- metadata +38 -4
@@ -10,7 +10,7 @@ Capistrano::Configuration.instance(true).load do
|
|
10
10
|
run "mkdir -p #{shared_path}/initializer"
|
11
11
|
|
12
12
|
modules = [:pos, :salary, :stock, :projects].inject([]) do |out, pos|
|
13
|
-
out << "bookyt_#{pos.to_s}" if
|
13
|
+
out << "bookyt_#{pos.to_s}" #if utilities.yes? "Install bookyt_#{pos.to_s}"
|
14
14
|
|
15
15
|
out
|
16
16
|
end
|
@@ -64,13 +64,14 @@ Capistrano::Configuration.instance.load do
|
|
64
64
|
|
65
65
|
# Local DB import
|
66
66
|
username, password, database, host = database_config('development')
|
67
|
-
|
68
|
-
|
67
|
+
run_locally "rake db:drop && rake db:create"
|
68
|
+
run_locally "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
|
69
|
+
run_locally "rm -f #{filename}"
|
69
70
|
|
70
71
|
logger.important "sync database from the stage '#{stage}' to local finished"
|
71
72
|
|
72
73
|
# Start db:migrate
|
73
|
-
|
74
|
+
run_locally "rake db:migrate"
|
74
75
|
end
|
75
76
|
|
76
77
|
desc <<-DESC
|
@@ -91,7 +92,7 @@ Capistrano::Configuration.instance.load do
|
|
91
92
|
end
|
92
93
|
logger.info "sync #{syncdir} from #{server}:#{port} to local"
|
93
94
|
destination, base = Pathname.new(syncdir).split
|
94
|
-
|
95
|
+
run_locally "rsync --verbose --archive --compress --copy-links --delete --stats --rsh='ssh -p #{port}' #{user}@#{server}:#{current_path}/#{syncdir} #{destination.to_s}"
|
95
96
|
end
|
96
97
|
|
97
98
|
logger.important "sync filesystem from the stage '#{stage}' to local finished"
|
@@ -134,8 +135,9 @@ Capistrano::Configuration.instance.load do
|
|
134
135
|
|
135
136
|
# Local DB import
|
136
137
|
username, password, database, host = database_config('development')
|
137
|
-
|
138
|
-
|
138
|
+
run_locally "rake db:drop && rake db:create"
|
139
|
+
run_locally "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}"
|
140
|
+
run_locally "rm -f #{filename}"
|
139
141
|
|
140
142
|
logger.important "sync database from the stage '#{stage}' to local finished"
|
141
143
|
end
|
@@ -181,9 +183,9 @@ Capistrano::Configuration.instance.load do
|
|
181
183
|
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
182
184
|
username, password, database, host = database_config('development')
|
183
185
|
host_option = host ? "--host='#{host}'" : ""
|
184
|
-
|
186
|
+
run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
185
187
|
upload filename, "#{shared_path}/sync/#{filename}"
|
186
|
-
|
188
|
+
run_locally "rm -f #{filename}"
|
187
189
|
|
188
190
|
# Remote DB import
|
189
191
|
username, password, database, host = remote_database_config(stage)
|
@@ -219,7 +221,7 @@ Capistrano::Configuration.instance.load do
|
|
219
221
|
|
220
222
|
# Sync directory up
|
221
223
|
logger.info "sync #{syncdir} to #{server}:#{port} from local"
|
222
|
-
|
224
|
+
run_locally "rsync --verbose --archive --compress --keep-dirlinks --delete --stats --rsh='ssh -p #{port}' #{syncdir} #{user}@#{server}:#{current_path}/#{destination.to_s}"
|
223
225
|
end
|
224
226
|
logger.important "sync filesystem from local to the stage '#{stage}' finished"
|
225
227
|
end
|
@@ -248,7 +250,7 @@ Capistrano::Configuration.instance.load do
|
|
248
250
|
|
249
251
|
on_rollback do
|
250
252
|
delete "#{shared_path}/sync/#{filename}"
|
251
|
-
|
253
|
+
run_locally "rm -f #{filename}"
|
252
254
|
end
|
253
255
|
|
254
256
|
# Make a backup before importing
|
@@ -262,9 +264,9 @@ Capistrano::Configuration.instance.load do
|
|
262
264
|
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
263
265
|
username, password, database, host = database_config('development')
|
264
266
|
host_option = host ? "--host='#{host}'" : ""
|
265
|
-
|
267
|
+
run_locally "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
266
268
|
upload filename, "#{shared_path}/sync/#{filename}"
|
267
|
-
|
269
|
+
run_locally "rm -f #{filename}"
|
268
270
|
|
269
271
|
# Remote DB import
|
270
272
|
username, password, database, host = remote_database_config(stage)
|
@@ -2,13 +2,13 @@ Capistrano::Configuration.instance.load do
|
|
2
2
|
desc "Watch the log on the application server."
|
3
3
|
task :watch_logs, :role => [:app] do
|
4
4
|
log_file = "#{shared_path}/log/#{rails_env}.log"
|
5
|
-
|
5
|
+
|
6
6
|
run "tail -f #{log_file}" do |channel, stream, data|
|
7
|
-
puts data if stream == :out
|
8
|
-
if stream == :err
|
7
|
+
puts data if stream == :out
|
8
|
+
if stream == :err
|
9
9
|
puts "[Error: #{channel[:host]}->#{rails_env}] #{data}"
|
10
10
|
break
|
11
|
-
end
|
11
|
+
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :webistrano do
|
3
|
+
namespace :mod_rails do
|
4
|
+
desc "start mod_rails & Apache"
|
5
|
+
task :start, :roles => :app, :except => { :no_release => true } do
|
6
|
+
as = fetch(:runner, "app")
|
7
|
+
invoke_command "#{apache_init_script} start", :via => run_method, :as => as
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "stop mod_rails & Apache"
|
11
|
+
task :stop, :roles => :app, :except => { :no_release => true } do
|
12
|
+
as = fetch(:runner, "app")
|
13
|
+
invoke_command "#{apache_init_script} stop", :via => run_method, :as => as
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "restart mod_rails"
|
17
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
18
|
+
as = fetch(:runner, "app")
|
19
|
+
restart_file = fetch(:mod_rails_restart_file, "#{deploy_to}/current/tmp/restart.txt")
|
20
|
+
invoke_command "touch #{restart_file}", :via => run_method, :as => as
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
namespace :deploy do
|
26
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
27
|
+
webistrano.mod_rails.restart
|
28
|
+
end
|
29
|
+
|
30
|
+
task :start, :roles => :app, :except => { :no_release => true } do
|
31
|
+
webistrano.mod_rails.start
|
32
|
+
end
|
33
|
+
|
34
|
+
task :stop, :roles => :app, :except => { :no_release => true } do
|
35
|
+
webistrano.mod_rails.stop
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob(File.join(File.dirname(__FILE__), '/rails31/*.rb')).sort.each { |f| require f }
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capones_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Roman Simecek (CyT)
|
@@ -11,7 +16,8 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-11-
|
19
|
+
date: 2011-11-03 00:00:00 +01:00
|
20
|
+
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: capistrano
|
@@ -21,6 +27,9 @@ dependencies:
|
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
24
33
|
version: "0"
|
25
34
|
type: :runtime
|
26
35
|
version_requirements: *id001
|
@@ -32,6 +41,9 @@ dependencies:
|
|
32
41
|
requirements:
|
33
42
|
- - ">="
|
34
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
35
47
|
version: "0"
|
36
48
|
type: :runtime
|
37
49
|
version_requirements: *id002
|
@@ -43,6 +55,9 @@ dependencies:
|
|
43
55
|
requirements:
|
44
56
|
- - ">="
|
45
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
46
61
|
version: "0"
|
47
62
|
type: :runtime
|
48
63
|
version_requirements: *id003
|
@@ -54,6 +69,9 @@ dependencies:
|
|
54
69
|
requirements:
|
55
70
|
- - ">="
|
56
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
57
75
|
version: "0"
|
58
76
|
type: :runtime
|
59
77
|
version_requirements: *id004
|
@@ -65,6 +83,9 @@ dependencies:
|
|
65
83
|
requirements:
|
66
84
|
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
68
89
|
version: "0"
|
69
90
|
type: :development
|
70
91
|
version_requirements: *id005
|
@@ -76,6 +97,9 @@ dependencies:
|
|
76
97
|
requirements:
|
77
98
|
- - ">="
|
78
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
79
103
|
version: "0"
|
80
104
|
type: :development
|
81
105
|
version_requirements: *id006
|
@@ -129,6 +153,9 @@ files:
|
|
129
153
|
- lib/capones_recipes/tasks/rails/bundler.rb
|
130
154
|
- lib/capones_recipes/tasks/rails/database_yml.rb
|
131
155
|
- lib/capones_recipes/tasks/rails/logs.rb
|
156
|
+
- lib/capones_recipes/tasks/rails/mod_rails.rb
|
157
|
+
- lib/capones_recipes/tasks/rails31.rb
|
158
|
+
- lib/capones_recipes/tasks/rails31/rails31.rb
|
132
159
|
- lib/capones_recipes/tasks/restful_authentication.rb
|
133
160
|
- lib/capones_recipes/tasks/restful_authentication/setup.rb
|
134
161
|
- lib/capones_recipes/tasks/settings_logic.rb
|
@@ -137,6 +164,7 @@ files:
|
|
137
164
|
- lib/capones_recipes/tasks/thinking_sphinx/thinking_sphinx.rb
|
138
165
|
- lib/capones_recipes/tasks/utilities.rb
|
139
166
|
- lib/capones_recipes/version.rb
|
167
|
+
has_rdoc: true
|
140
168
|
homepage: http://github.com/raskhadafi/capones-recipes
|
141
169
|
licenses:
|
142
170
|
- MIT
|
@@ -150,17 +178,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
178
|
requirements:
|
151
179
|
- - ">="
|
152
180
|
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
153
184
|
version: "0"
|
154
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
186
|
none: false
|
156
187
|
requirements:
|
157
188
|
- - ">="
|
158
189
|
- !ruby/object:Gem::Version
|
190
|
+
hash: 3
|
191
|
+
segments:
|
192
|
+
- 0
|
159
193
|
version: "0"
|
160
194
|
requirements: []
|
161
195
|
|
162
196
|
rubyforge_project:
|
163
|
-
rubygems_version: 1.
|
197
|
+
rubygems_version: 1.3.7
|
164
198
|
signing_key:
|
165
199
|
specification_version: 3
|
166
200
|
summary: Some capistrano recipes for use.
|