bonethug 0.0.73 → 0.0.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/README.md +18 -63
  2. data/TODO.txt +3 -2
  3. data/config/deploy.rb +31 -30
  4. data/lib/bonethug/cli.rb +64 -17
  5. data/lib/bonethug/installer.rb +3 -3
  6. data/lib/bonethug/syncer.rb +113 -0
  7. data/lib/bonethug/utils.rb +23 -23
  8. data/lib/bonethug/version.rb +2 -2
  9. data/lib/bonethug.rb +1 -0
  10. data/skel/project_types/drupal/composer.json +359 -20
  11. data/skel/project_types/drupal/drupal-console +3 -0
  12. data/skel/project_types/drupal/lib/boris.php +7 -0
  13. data/skel/project_types/drupal/lib/drupal_bootstrap.php +13 -0
  14. data/skel/project_types/drupal/lib/drupal_flush_cache.php +5 -0
  15. data/skel/project_types/drupal6/composer.json +359 -20
  16. data/skel/project_types/drupal6/drupal-console +3 -0
  17. data/skel/project_types/drupal6/lib/boris.php +7 -0
  18. data/skel/project_types/drupal6/lib/drupal_bootstrap.php +13 -0
  19. data/skel/project_types/drupal6/lib/drupal_flush_cache.php +5 -0
  20. data/skel/project_types/drupal7/composer.json +347 -8
  21. data/skel/project_types/drupal7/drupal-console +3 -0
  22. data/skel/project_types/drupal7/lib/boris.php +7 -0
  23. data/skel/project_types/drupal7/lib/drupal_bootstrap.php +13 -0
  24. data/skel/project_types/drupal7/lib/drupal_flush_cache.php +5 -0
  25. data/skel/project_types/drupal8/composer.json +359 -20
  26. data/skel/project_types/drupal8/drupal-console +3 -0
  27. data/skel/project_types/drupal8/lib/boris.php +7 -0
  28. data/skel/project_types/drupal8/lib/drupal_bootstrap.php +13 -0
  29. data/skel/project_types/drupal8/lib/drupal_flush_cache.php +5 -0
  30. data/skel/project_types/silverstripe3/bower.json +7 -5
  31. data/skel/project_types/silverstripe3/composer.json +2 -1
  32. data/skel/project_types/silverstripe3/lib/boris.php +7 -0
  33. data/skel/project_types/silverstripe3/lib/ss_bootstrap.php +123 -0
  34. data/skel/project_types/silverstripe3/lib/ss_loadconf.php +104 -104
  35. data/skel/project_types/silverstripe3/public/.htaccess +1 -1
  36. data/skel/project_types/silverstripe3/public/project/_config.php +17 -17
  37. data/skel/project_types/silverstripe3/public/project/code/DataObjects/.gitkeep +0 -0
  38. data/skel/project_types/silverstripe3/public/themes/project/scss/_base.scss +58 -0
  39. data/skel/project_types/silverstripe3/public/themes/project/scss/_colours.scss +12 -0
  40. data/skel/project_types/silverstripe3/public/themes/project/scss/_functions.scss +18 -14
  41. data/skel/project_types/silverstripe3/public/themes/project/scss/_mixins.scss +17 -9
  42. data/skel/project_types/silverstripe3/public/themes/project/scss/_vars.scss +5 -2
  43. data/skel/project_types/silverstripe3/public/themes/project/scss/main.scss +26 -3
  44. data/skel/project_types/silverstripe3/public/themes/project/scss/typography.scss +28 -26
  45. data/skel/project_types/silverstripe3/ss-console +3 -0
  46. data/skel/skel.yml +39 -24
  47. metadata +27 -8
  48. data/config/syncer.rb +0 -101
  49. data/skel/project_types/drupal6/lib/flush_drupal_cache.php +0 -15
  50. data/skel/project_types/drupal7/lib/flush_drupal_cache.php +0 -15
  51. data/skel/project_types/drupal8/lib/flush_drupal_cache.php +0 -11
data/README.md CHANGED
@@ -121,24 +121,6 @@ settings in your config/cnf.yml file*
121
121
 
122
122
  ### Remote Commands
123
123
 
124
- *UPDATE:* Bonethug now supports interactive prompts so this may no longer be
125
- necessary
126
-
127
- Most of these are piped through mina. Mina uses SSH to send a bash script to
128
- the remote server where it is executed. For these commands to work you need to
129
- have the desired host already added to your known hosts file: ~/.ssh/known_hosts
130
- which means you can either connect to the host first, manually add it or switch
131
- off the checking by adding the following to ~/.ssh/config.
132
-
133
-
134
-
135
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136
- Host *
137
- StrictHostKeyChecking no
138
- UserKnownHostsFile=/dev/null
139
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
-
141
-
142
124
 
143
125
  **Setup a remote server**
144
126
 
@@ -210,20 +192,17 @@ wipe the files from your deploy copy.
210
192
 
211
193
  *Sync local application state from another application environment*
212
194
 
213
- `thug sync-local-from {local-environment} {environment-to-pull-data-from}`
195
+ `thug sync-state push-to-local {local-environment} pull-from-remote {environment-to-pull-data-from}`
214
196
 
215
197
  *Sync another application's state in another environment to the local application state*
216
198
 
217
- `thug sync-local-to {local-environment} {environment-to-push-data-to}`
199
+ `thug sync-state pull-from-local {local-environment} push-to-remote {environment-to-push-data-to}`
218
200
 
219
201
 
220
202
  *Sync remote application state with the application state environment - this wraps mina to trigger the sync actions above on a remote server*
221
203
 
222
- `thug sync-remote-from {environment-to-pull-data-from} {environment-to-push-data-to}`
223
-
224
- *Sync another application's state in another environment to the local application state*
204
+ `thug sync-state pull-from-remote {environment-to-pull-data-from} push-to-remote {environment-to-push-data-to}`
225
205
 
226
- `thug sync-backup-to {environment-to-push-data-to} {environment-to-pull-data-from}`
227
206
 
228
207
 
229
208
  Example Workflow
@@ -246,6 +225,9 @@ bower install
246
225
 
247
226
  # --> edit the config/cnf.yml file!!
248
227
 
228
+ # setup local db
229
+ thug init-db local
230
+
249
231
  # watch for changes to sass and coffeescript
250
232
  thug watch
251
233
 
@@ -262,6 +244,12 @@ thug setup-env staging
262
244
  thug init-db staging
263
245
  thug setup staging
264
246
  thug deploy staging
247
+
248
+ # push the db and assets up to staging
249
+ thug sync-state pull-from-local development push-to-remote staging
250
+
251
+ # pull the db and assets up down to local
252
+ thug sync-state pull-from-remote staging push-to-local development
265
253
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266
254
 
267
255
 
@@ -291,45 +279,12 @@ What isn't implemented yet?
291
279
  ---------------------------
292
280
 
293
281
 
294
-
295
- ### Setup an existing project and mirror a remote environment (WIP)
296
-
297
-
298
-
299
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
- # clone the repo and install the gems
301
- git clone git@git.domain.com:namespace/project-name.git .
302
- bundle install --path vendor
303
-
304
- # setup local db
305
- thug init-local-db staging
306
-
307
- # add ssh key
308
- thug auth staging
309
-
310
- # do file sync
311
- thug sync-from staging
312
-
313
- # do db sync
314
- thug sync-local-db staging development
315
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316
-
317
-
318
-
319
- ### Push local assets etc to a remote (WIP)
320
-
321
-
322
-
323
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324
- # add ssh key
325
- thug auth staging
326
-
327
- # do file sync
328
- thug sync-to staging
329
-
330
- # do db sync
331
- thug sync-remote-db development staging
332
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
282
+ - sync of just db between envs
283
+ - sync of just files between envs
284
+ - remove a deployment from a target
285
+ - support for more project types
286
+ - support for other OSes
287
+ - support for nginx
333
288
 
334
289
 
335
290
 
data/TODO.txt CHANGED
@@ -1,5 +1,6 @@
1
1
  - Create front end skeleton
2
2
  - Need to have project specific cnf.yml files
3
- - Local sync for assets
4
3
  - thug auth {staging|production} - this would inject your ssh pub key into the authorized_keys file
5
- - need to allow support for other environment types
4
+ - need to allow support for other environment types
5
+ - have some sort of composer.json merge
6
+ - thug update needs stil needs to be run twice because the current version gets loaded into memory - need to run some sort of two phase update
data/config/deploy.rb CHANGED
@@ -24,8 +24,14 @@ require 'mina/whenever'
24
24
  # Config
25
25
  # ---------------------------------------------------------------
26
26
 
27
- # load the conf
28
- conf = Bonethug::Conf.new
27
+ # exec env
28
+ exec_path = File.expand_path(File.dirname(__FILE__) + '/..')
29
+
30
+ # load config
31
+ conf = Bonethug::Conf.new.add(exec_path + '/config/cnf.yml')
32
+ conf.add(exec_path + '/config/database.yml' => { root: 'dbs.default' }) if File.exist? exec_path + '/config/database.yml'
33
+
34
+ # generate a hash
29
35
  cnf = conf.to_hash
30
36
 
31
37
  # pull config from environment vars
@@ -146,15 +152,16 @@ end
146
152
 
147
153
  desc "init a db based on the settings in your cnf file"
148
154
  task :init_db => :environment do
149
-
150
- conf.get('dbs').each do |name,envs|
151
-
152
- db = envs.get env
153
- cmd = Bonethug::Installer.init_mysql_db_script db, deploy_to + 'current', ENV['admin_user']
154
- queue! %[#{cmd}]
155
-
155
+ dbs = conf.get 'dbs'
156
+ if dbs
157
+ dbs.each do |name,envs|
158
+ if envs
159
+ db = envs.get env
160
+ cmd = Bonethug::Installer.init_mysql_db_script db, deploy_to + '/current', ENV['admin_user']
161
+ queue! %[#{cmd}]
162
+ end
163
+ end
156
164
  end
157
-
158
165
  end
159
166
 
160
167
  desc "Initialises the db"
@@ -163,12 +170,17 @@ task :setup_db => :environment do
163
170
  #rails
164
171
  queue! %[cd #{deploy_to}/current && bundle exec rake db:reset RAILS_ENV="#{env}"] if deploy.get('project_type') =~ /rails[0-9]?/
165
172
 
166
- # drpual
173
+ # drupal
167
174
  if deploy.get('project_type') =~ /drupal[0-9]?/
168
- conf.get('dbs').each do |name,envs|
169
- db = envs.get env
170
- db_url = "mysql://#{db.get('user')}:#{db.get('pass')}@#{db.get('host')}/#{db.get('name')}"
171
- queue! %[export APPLICATION_ENV=#{env} && cd #{deploy_to}/current/public && ../vendor/bin/drush site-install standard --account-name=admin --account-pass=admin --db-url=#{db_url}"]
175
+ dbs = conf.get 'dbs'
176
+ if dbs
177
+ dbs.each do |name,envs|
178
+ if envs
179
+ db = envs.get env
180
+ db_url = "mysql://#{db.get('user')}:#{db.get('pass')}@#{db.get('host')}/#{db.get('name')}"
181
+ queue! %[export APPLICATION_ENV=#{env} && cd #{deploy_to}/current/public && ../vendor/bin/drush site-install standard --account-name=admin --account-pass=admin --db-url=#{db_url}"]
182
+ end
183
+ end
172
184
  end
173
185
  end
174
186
 
@@ -180,7 +192,7 @@ task :backup => :environment do
180
192
  end
181
193
 
182
194
  desc "Syncs application state between two remote environments"
183
- task :sync_remote_from => :environment do
195
+ task :sync_state => :environment do
184
196
 
185
197
  remote_env = ENV['remote_env']
186
198
 
@@ -189,20 +201,9 @@ task :sync_remote_from => :environment do
189
201
  exit
190
202
  end
191
203
 
192
- queue! %[cd #{deploy_to}/current && bundle exec thug sync-local-from #{env} #{remote_env}]
193
- end
194
-
195
- desc "Syncs application state between two remote environments"
196
- task :sync_remote_to => :environment do
197
-
198
- remote_env = ENV['remote_env']
199
-
200
- unless conf.get('deploy.environments').has_key? remote_env
201
- puts 'could not find remote deployment environment'
202
- exit
203
- end
204
+ #queue! %[cd #{deploy_to}/current && ruby .bonethug/syncer.rb local #{env} remote #{remote_env}]
205
+ queue! %[cd #{deploy_to}/current && bundle exec thug sync-state pull-from-local #{env} push-to-remote #{remote_env}]
204
206
 
205
- queue! %[cd #{deploy_to}/current && bundle exec thug sync-local-to #{env} #{remote_env}]
206
207
  end
207
208
 
208
209
  desc "Syncs backup with a location"
@@ -413,7 +414,7 @@ task :deploy => :environment do
413
414
 
414
415
  # run cache flushes / manifest rebuilds
415
416
  queue! %[export APPLICATION_ENV=#{env} && php #{deploy_to}/current/public/framework/cli-script.php dev/build] if ['silverstripe','silverstripe3'].include? deploy.get('project_type')
416
- queue! %[export APPLICATION_ENV=#{env} && cd #{deploy_to}/current/lib && php flush_drupal_cache.php] if ['drupal','drupal6','drupal7','drupal8'].include? deploy.get('project_type')
417
+ queue! %[export APPLICATION_ENV=#{env} && cd #{deploy_to}/current/lib && php drupal_flush_cache.php] if ['drupal','drupal6','drupal7','drupal8'].include? deploy.get('project_type')
417
418
 
418
419
  # run any project scripts
419
420
  # purge combined files for ss
data/lib/bonethug/cli.rb CHANGED
@@ -158,31 +158,78 @@ module Bonethug
158
158
 
159
159
  end
160
160
 
161
- when 'sync-local-to',
162
- 'sync-local-from',
163
- 'sync-remote-to',
164
- 'sync-remote-from'
161
+ when 'sync-state'
162
+
163
+ # operation whitelist
164
+ operations = ['pull-from-local', 'push-to-local', 'pull-from-remote', 'push-to-remote']
165
165
 
166
166
  # args
167
- env_local = ARGV[1]
168
- env_remote = ARGV[2]
167
+ operation1 = ARGV[1]
168
+ env1 = ARGV[2]
169
+ operation2 = ARGV[3]
170
+ env2 = ARGV[4]
171
+
172
+ puts
173
+
174
+ # validate operation whitelist
175
+ valid_operation = operations.include?(operation1) and operations.include?(operation2)
176
+
177
+ # ensure there is both a pull and push operation
178
+ if valid_operation
179
+ has_pull = (operation1 == 'pull-from-local' or operation2 == 'pull-from-local' or operation1 == 'pull-from-remote' or operation2 == 'pull-from-remote')
180
+ has_push = (operation1 == 'push-to-local' or operation2 == 'push-to-local' or operation1 == 'push-to-remote' or operation2 == 'push-to-remote')
181
+ valid_operation = has_push and has_push
182
+ end
169
183
 
170
184
  # validate
171
- unless env_local and env_remote
172
- puts 'Usage: thug #{task} [local_environment] [remote_environment]'
173
- return
185
+ unless operation1 and operation2 and env1 and env2 and valid_operation
186
+ puts 'Usage: thug sync-state [pull-from-{local|remote}] [environment] [push-to-{local|remote}] [environment]'
187
+ exit
188
+ end
189
+
190
+ # process env data
191
+ pull_env = (operation1 == 'pull-from-remote' or operation1 =='pull-from-local') ? env1 : env2
192
+ push_env = (operation1 == 'push-to-remote' or operation1 =='push-to-local') ? env1 : env2
193
+
194
+ # process operation1
195
+ case operation1
196
+ when 'pull-from-local'
197
+ pull_operation = 'local'
198
+ when 'pull-from-remote'
199
+ pull_operation = 'remote'
200
+ when 'push-to-local'
201
+ push_operation = 'local'
202
+ when 'push-to-remote'
203
+ push_operation = 'remote'
204
+ end
205
+
206
+ # process operation2
207
+ case operation2
208
+ when 'pull-from-local'
209
+ pull_operation = 'local'
210
+ when 'pull-from-remote'
211
+ pull_operation = 'remote'
212
+ when 'push-to-local'
213
+ push_operation = 'local'
214
+ when 'push-to-remote'
215
+ push_operation = 'remote'
216
+ end
217
+
218
+ # stop here if its a local to local because we wont know the file system location of the non-calling local
219
+ if pull_operation == 'local' and push_operation == 'local'
220
+ puts 'local to local sync is not supported at this time'
221
+ exit
174
222
  end
175
223
 
176
224
  # Do Sync
177
- case task
178
- when 'sync-local-to', 'sync-local-from'
179
- exec "ruby .bonethug/syncer.rb #{task} #{env_local} #{env_remote}"
180
- when 'sync-remote-to'
181
- exec "export to=#{env_local} && export remote_env=#{env_remote} && bundle exec mina -f .bonethug/deploy.rb sync_remote_to --verbose"
182
- when 'sync-remote-from'
183
- exec "export to=#{env_local} && export remote_env=#{env_remote} && bundle exec mina -f .bonethug/deploy.rb sync_remote_from --verbose"
225
+ if pull_operation == 'local' or push_operation == 'local'
226
+ Syncer.sync pull_operation, pull_env, push_operation, push_env
227
+ else
228
+ # this will call ruby .bonethug/syncer.rb local #{pull_env} remote #{push_env}
229
+ exec "export to=#{pull_env} && export remote_env=#{push_env} && bundle exec mina -f .bonethug/deploy.rb sync_state --verbose"
184
230
  end
185
231
 
232
+
186
233
  when 'deploy',
187
234
  'setup',
188
235
  'remote-backup',
@@ -242,7 +289,7 @@ module Bonethug
242
289
  when 'clean'
243
290
 
244
291
  location = ARGV[1] || '.'
245
- Installer.clean location
292
+ Installer.clean location
246
293
 
247
294
  else
248
295
 
@@ -24,7 +24,7 @@ module Bonethug
24
24
  @@bonthug_gem_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
25
25
  @@skel_dir = @@bonthug_gem_dir + '/skel'
26
26
  @@conf = Conf.new.add(@@skel_dir + '/skel.yml')
27
- @@project_config_files = {editable: ['cnf.yml','schedule.rb'], generated: ['syncer.rb','backup.rb','deploy.rb']}
27
+ @@project_config_files = {editable: ['cnf.yml','schedule.rb'], generated: ['backup.rb','deploy.rb']}
28
28
 
29
29
  def self.install(type, target = '.')
30
30
 
@@ -137,7 +137,7 @@ module Bonethug
137
137
 
138
138
  script_content = "
139
139
  CREATE DATABASE IF NOT EXISTS " + db.get('name') + ";
140
- GRANT ALL ON " + db.get('name') + ".* TO " + db.get('user') + "@" + db.get('host') + (db.get('pass') ? " IDENTIFIED BY " + db.get('pass') : "") + ";
140
+ GRANT ALL ON " + db.get('name') + ".* TO " + db.get('user') + "@" + db.get('host') + (db.get('pass') ? " IDENTIFIED BY '" + db.get('pass') + "'" : "") + ";
141
141
  FLUSH PRIVILEGES;
142
142
  "
143
143
  cmd = 'cd ' + path + ' && ' +
@@ -335,7 +335,7 @@ module Bonethug
335
335
 
336
336
  if gem_reg =~ gemfile_contents
337
337
  puts 'Found '+gem_name+' in gem file.'
338
- if github
338
+ if github
339
339
  puts 'Requires github version, checking...'
340
340
  unless git_reg =~ gemfile_contents
341
341
  puts 'Couldn\'t find '+gem_name+' (github) in gem file adding...'
@@ -0,0 +1,113 @@
1
+
2
+ require 'rubygems'
3
+ require 'bonethug/conf'
4
+
5
+ module Bonethug
6
+
7
+ class Syncer
8
+
9
+ def self.sync(pull, pull_env, push, push_env)
10
+
11
+ # exec env
12
+ exec_path = File.expand_path('.')
13
+
14
+ # load config
15
+ conf = Bonethug::Conf.new.add(exec_path + '/config/cnf.yml')
16
+ conf.add(exec_path + '/config/database.yml' => { root: 'dbs.default' }) if File.exist? exec_path + '/config/database.yml'
17
+
18
+ # extract some data
19
+ cnf = conf.to_hash
20
+ envs = conf.get('deploy.environments').to_hash
21
+
22
+ # validate
23
+ unless pull and pull_env and push and push_env
24
+ puts 'Usage: syncer.rb [pull target] [pull environment] [push target] [push environment]'
25
+ exit
26
+ end
27
+
28
+ unless envs.has_key? pull_env
29
+ puts 'could not find pull environment'
30
+ exit
31
+ end
32
+
33
+ unless envs.has_key? push_env
34
+ puts 'could not find push environment'
35
+ exit
36
+ end
37
+
38
+ if pull == 'local' and push == 'local'
39
+ puts 'local to local sync is not supported at this time'
40
+ exit
41
+ end
42
+
43
+ if pull == 'remote' and push == 'remote'
44
+ puts 'remote to remote sync is not supported via this interface'
45
+ exit
46
+ end
47
+
48
+ # identify the local and the remote
49
+ env_local = pull == 'local' ? pull_env : push_env
50
+ env_remote = pull == 'local' ? push_env : pull_env
51
+
52
+ # build config
53
+ dbs = conf.get 'dbs'
54
+ remote_deploy = conf.node_merge 'deploy.common', 'deploy.environments.' + env_remote
55
+ local_deploy = conf.node_merge 'deploy.common', 'deploy.environments.' + env_local
56
+ resources = conf.get('resources','Array') || []
57
+ log_dirs = conf.get('log_dirs','Array') || []
58
+ remote_vhost = remote_deploy.get('project_slug') + '_' + env_remote
59
+
60
+ # directories we need to track
61
+ resources += ['backups']
62
+
63
+ # logs
64
+ log_dirs.push 'log' unless log_dirs.include? 'log'
65
+
66
+ # do the common work
67
+ remote_path = remote_deploy.get('base_dir') + '/' + remote_vhost
68
+ remote_ssh = "ssh -p #{remote_deploy.get 'port'} #{remote_deploy.get 'user'}@#{remote_deploy.get 'domain'}"
69
+
70
+ # output
71
+ puts "Cloning Databases... "
72
+
73
+ # output
74
+ dbs.each do |index, db|
75
+
76
+ db_remote = db.get env_remote
77
+ db_local = db.get env_local
78
+
79
+ if push == 'local' and pull == 'remote'
80
+ cmd = "#{remote_ssh} \"mysqldump -u #{db_remote.get 'user'} -p#{db_remote.get 'pass'} #{db_remote.get 'name'} --verbose | bzip2 -c\" | bunzip2 -c | mysql -u #{db_local.get 'user'} -p#{db_local.get 'pass'} #{db_local.get 'name'}"
81
+ elsif pull == 'local' and push == 'remote'
82
+ cmd = "mysqldump -u #{db_local.get 'user'} -p#{db_local.get 'pass'} #{db_local.get 'name'} --verbose | bzip2 -c | #{remote_ssh} \"bunzip2 -c | mysql -u #{db_remote.get 'user'} -p#{db_remote.get 'pass'} #{db_remote.get 'name'}\""
83
+ end
84
+
85
+ puts cmd
86
+ system cmd
87
+
88
+ end
89
+
90
+ puts "Done."
91
+ puts "Syncing Files... "
92
+
93
+ # sync the files
94
+ (resources + log_dirs).each do |item|
95
+
96
+ if push == 'local' and pull == 'remote'
97
+ cmd = "rsync -zrav -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --copy-dirlinks #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/ #{exec_path}/#{item}/"
98
+ elsif pull == 'local' and push == 'remote'
99
+ cmd = "rsync -zrav -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --copy-dirlinks #{exec_path}/#{item}/ #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/"
100
+ end
101
+
102
+ puts cmd
103
+ system cmd
104
+
105
+ end
106
+
107
+ puts "Done."
108
+
109
+ end
110
+
111
+ end
112
+
113
+ end
@@ -1,24 +1,24 @@
1
- require 'fileutils'
2
-
3
- module Bonethug
4
-
5
- #arguments can be for example db:migrate
6
- def self.call_rake(arguments)
7
- if RUBY_PLATFORM =~ /mswin/
8
- rake_cmd = "rake.bat" #very important because windows will break with just "rake"
9
- else
10
- rake_cmd = "rake"
11
- end
12
- puts "calling #{rake_cmd} " + arguments
13
- puts system("#{rake_cmd} " + arguments)
14
- puts $?
15
- end
16
-
17
- def self.setup_gitpull(target = '.')
18
-
19
- path = File.expand_path target
20
- `chown www-data #{path}`
21
-
22
- end
23
-
1
+ require 'fileutils'
2
+
3
+ module Bonethug
4
+
5
+ #arguments can be for example db:migrate
6
+ def self.call_rake(arguments)
7
+ if RUBY_PLATFORM =~ /mswin/
8
+ rake_cmd = "rake.bat" #very important because windows will break with just "rake"
9
+ else
10
+ rake_cmd = "rake"
11
+ end
12
+ puts "calling #{rake_cmd} " + arguments
13
+ puts system("#{rake_cmd} " + arguments)
14
+ puts $?
15
+ end
16
+
17
+ def self.setup_gitpull(target = '.')
18
+
19
+ path = File.expand_path target
20
+ `chown www-data #{path}`
21
+
22
+ end
23
+
24
24
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Bonethug
3
- VERSION = "0.0.73"
4
- BUILD_DATE = "2014-03-17 13:26:15 +1300"
3
+ VERSION = "0.0.75"
4
+ BUILD_DATE = "2014-04-01 11:10:26 +1300"
5
5
  end
6
6
 
data/lib/bonethug.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "bonethug/version"
2
2
  require "bonethug/installer"
3
3
  require "bonethug/watcher"
4
+ require "bonethug/syncer"
4
5
  require "bonethug/cli"
5
6
 
6
7
  module Bonethug