capones_recipes 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/capones_recipes.gemspec +1 -1
- data/lib/recipes/database/sync.rb +75 -72
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/capones_recipes.gemspec
CHANGED
@@ -69,37 +69,6 @@ Capistrano::Configuration.instance.load do
|
|
69
69
|
logger.important "sync database from the stage '#{stage}' to local finished"
|
70
70
|
end
|
71
71
|
|
72
|
-
desc <<-DESC
|
73
|
-
Syncs database from the selected mutli_stage environement to the local develoment environment.
|
74
|
-
The database credentials will be read from your local config/database.yml file and a copy of the
|
75
|
-
dump will be kept within the shared sync directory. The amount of backups that will be kept is
|
76
|
-
declared in the sync_backups variable and defaults to 5.
|
77
|
-
DESC
|
78
|
-
task :kuhsaft, :roles => :db, :only => { :primary => true } do
|
79
|
-
# Use production on non-multistage
|
80
|
-
set :stage, 'production' unless exists?(:stage)
|
81
|
-
|
82
|
-
filename = "database.kuhsaft.#{stage}.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
83
|
-
on_rollback { delete "#{shared_path}/sync/#{filename}" }
|
84
|
-
|
85
|
-
# Remote DB dump
|
86
|
-
username, password, database, host = remote_database_config(stage)
|
87
|
-
host_option = host ? "--host='#{host}'" : ""
|
88
|
-
run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} pages localized_pages contents assets tags taggings | bzip2 -9 > #{shared_path}/sync/#{filename}" do |channel, stream, data|
|
89
|
-
puts data
|
90
|
-
end
|
91
|
-
purge_old_backups "database"
|
92
|
-
|
93
|
-
# Download dump
|
94
|
-
download "#{shared_path}/sync/#{filename}", filename
|
95
|
-
|
96
|
-
# Local DB import
|
97
|
-
username, password, database, host = database_config('development')
|
98
|
-
system "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}; rm -f #{filename}"
|
99
|
-
|
100
|
-
logger.important "sync database from the stage '#{stage}' to local finished"
|
101
|
-
end
|
102
|
-
|
103
72
|
desc <<-DESC
|
104
73
|
Sync declared directories from the selected multi_stage environment to the local development
|
105
74
|
environment. The synced directories must be declared as an array of Strings with the sync_directories
|
@@ -124,6 +93,38 @@ Capistrano::Configuration.instance.load do
|
|
124
93
|
logger.important "sync filesystem from the stage '#{stage}' to local finished"
|
125
94
|
end
|
126
95
|
|
96
|
+
namespace :kuhsaft do
|
97
|
+
desc <<-DESC
|
98
|
+
Syncs database from the selected mutli_stage environement to the local develoment environment.
|
99
|
+
The database credentials will be read from your local config/database.yml file and a copy of the
|
100
|
+
dump will be kept within the shared sync directory. The amount of backups that will be kept is
|
101
|
+
declared in the sync_backups variable and defaults to 5.
|
102
|
+
DESC
|
103
|
+
task :db, :roles => :db, :only => { :primary => true } do
|
104
|
+
# Use production on non-multistage
|
105
|
+
set :stage, 'production' unless exists?(:stage)
|
106
|
+
|
107
|
+
filename = "database.kuhsaft.#{stage}.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
108
|
+
on_rollback { delete "#{shared_path}/sync/#{filename}" }
|
109
|
+
|
110
|
+
# Remote DB dump
|
111
|
+
username, password, database, host = remote_database_config(stage)
|
112
|
+
host_option = host ? "--host='#{host}'" : ""
|
113
|
+
run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} pages localized_pages contents assets tags taggings | bzip2 -9 > #{shared_path}/sync/#{filename}" do |channel, stream, data|
|
114
|
+
puts data
|
115
|
+
end
|
116
|
+
purge_old_backups "database"
|
117
|
+
|
118
|
+
# Download dump
|
119
|
+
download "#{shared_path}/sync/#{filename}", filename
|
120
|
+
|
121
|
+
# Local DB import
|
122
|
+
username, password, database, host = database_config('development')
|
123
|
+
system "bzip2 -d -c #{filename} | mysql -u #{username} --password='#{password}' #{database}; rm -f #{filename}"
|
124
|
+
|
125
|
+
logger.important "sync database from the stage '#{stage}' to local finished"
|
126
|
+
end
|
127
|
+
end
|
127
128
|
end
|
128
129
|
|
129
130
|
namespace :up do
|
@@ -178,47 +179,6 @@ Capistrano::Configuration.instance.load do
|
|
178
179
|
logger.important "sync database from local to the stage '#{stage}' finished"
|
179
180
|
end
|
180
181
|
|
181
|
-
desc <<-DESC
|
182
|
-
Syncs database from the local develoment environment to the selected mutli_stage environement.
|
183
|
-
The database credentials will be read from your local config/database.yml file and a copy of the
|
184
|
-
dump will be kept within the shared sync directory. The amount of backups that will be kept is
|
185
|
-
declared in the sync_backups variable and defaults to 5.
|
186
|
-
DESC
|
187
|
-
task :kuhsaft, :roles => :db, :only => { :primary => true } do
|
188
|
-
# Use production on non-multistage
|
189
|
-
set :stage, 'production' unless exists?(:stage)
|
190
|
-
|
191
|
-
filename = "database.kuhsaft.#{stage}.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
192
|
-
|
193
|
-
on_rollback do
|
194
|
-
delete "#{shared_path}/sync/#{filename}"
|
195
|
-
system "rm -f #{filename}"
|
196
|
-
end
|
197
|
-
|
198
|
-
# Make a backup before importing
|
199
|
-
username, password, database, host = remote_database_config(stage)
|
200
|
-
host_option = host ? "--host='#{host}'" : ""
|
201
|
-
run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} pages localized_pages contents assets tags taggings | bzip2 -9 > #{shared_path}/sync/#{filename}" do |channel, stream, data|
|
202
|
-
puts data
|
203
|
-
end
|
204
|
-
|
205
|
-
# Local DB export
|
206
|
-
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
207
|
-
username, password, database, host = database_config('development')
|
208
|
-
host_option = host ? "--host='#{host}'" : ""
|
209
|
-
system "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
210
|
-
upload filename, "#{shared_path}/sync/#{filename}"
|
211
|
-
system "rm -f #{filename}"
|
212
|
-
|
213
|
-
# Remote DB import
|
214
|
-
username, password, database, host = remote_database_config(stage)
|
215
|
-
host_option = host ? "--host='#{host}'" : ""
|
216
|
-
run "bzip2 -d -c #{shared_path}/sync/#{filename} | mysql -u #{username} --password='#{password}' #{host_option} #{database}; rm -f #{shared_path}/sync/#{filename}"
|
217
|
-
purge_old_backups "database"
|
218
|
-
|
219
|
-
logger.important "sync database from local to the stage '#{stage}' finished"
|
220
|
-
end
|
221
|
-
|
222
182
|
desc <<-DESC
|
223
183
|
Sync declared directories from the local development environement to the selected multi_stage
|
224
184
|
environment. The synced directories must be declared as an array of Strings with the sync_directories
|
@@ -248,6 +208,49 @@ Capistrano::Configuration.instance.load do
|
|
248
208
|
logger.important "sync filesystem from local to the stage '#{stage}' finished"
|
249
209
|
end
|
250
210
|
|
211
|
+
namespace :kuhsaft do
|
212
|
+
desc <<-DESC
|
213
|
+
Syncs database from the local develoment environment to the selected mutli_stage environement.
|
214
|
+
The database credentials will be read from your local config/database.yml file and a copy of the
|
215
|
+
dump will be kept within the shared sync directory. The amount of backups that will be kept is
|
216
|
+
declared in the sync_backups variable and defaults to 5.
|
217
|
+
DESC
|
218
|
+
task :db, :roles => :db, :only => { :primary => true } do
|
219
|
+
# Use production on non-multistage
|
220
|
+
set :stage, 'production' unless exists?(:stage)
|
221
|
+
|
222
|
+
filename = "database.kuhsaft.#{stage}.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
223
|
+
|
224
|
+
on_rollback do
|
225
|
+
delete "#{shared_path}/sync/#{filename}"
|
226
|
+
system "rm -f #{filename}"
|
227
|
+
end
|
228
|
+
|
229
|
+
# Make a backup before importing
|
230
|
+
username, password, database, host = remote_database_config(stage)
|
231
|
+
host_option = host ? "--host='#{host}'" : ""
|
232
|
+
run "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} pages localized_pages contents assets tags taggings | bzip2 -9 > #{shared_path}/sync/#{filename}" do |channel, stream, data|
|
233
|
+
puts data
|
234
|
+
end
|
235
|
+
|
236
|
+
# Local DB export
|
237
|
+
filename = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql.bz2"
|
238
|
+
username, password, database, host = database_config('development')
|
239
|
+
host_option = host ? "--host='#{host}'" : ""
|
240
|
+
system "mysqldump -u #{username} --password='#{password}' #{host_option} #{database} | bzip2 -9 > #{filename}"
|
241
|
+
upload filename, "#{shared_path}/sync/#{filename}"
|
242
|
+
system "rm -f #{filename}"
|
243
|
+
|
244
|
+
# Remote DB import
|
245
|
+
username, password, database, host = remote_database_config(stage)
|
246
|
+
host_option = host ? "--host='#{host}'" : ""
|
247
|
+
run "bzip2 -d -c #{shared_path}/sync/#{filename} | mysql -u #{username} --password='#{password}' #{host_option} #{database}; rm -f #{shared_path}/sync/#{filename}"
|
248
|
+
purge_old_backups "database"
|
249
|
+
|
250
|
+
logger.important "sync database from local to the stage '#{stage}' finished"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
251
254
|
end
|
252
255
|
|
253
256
|
#
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: capones_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Roman Simecek
|
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
requirements:
|
161
161
|
- - ">="
|
162
162
|
- !ruby/object:Gem::Version
|
163
|
-
hash: -
|
163
|
+
hash: -640331763891336183
|
164
164
|
segments:
|
165
165
|
- 0
|
166
166
|
version: "0"
|