Sha256: 81cd10b646a584030092e92ced0120d93a8f150a21687095a1bd199c0adc39f7

Contents?: true

Size: 1.55 KB

Versions: 48

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby

# Requires
# ---------------------------------------------------------------
require 'rubygems'
require 'bonethug/conf'

# Config
# ---------------------------------------------------------------

# load the conf
conf = Bonethug::Conf.new
cnf = conf.to_hash

# args
env = ARGV[1]
type = ARGV[0]

# pull config from environment vars
raise 'could not find deployment environment' unless conf.get('deploy.environments').has_key? env

# build config
deploy    = conf.node_merge('deploy.common','deploy.environments.'+env)
resources = conf.get('resources','Array') || []
log_dirs  = conf.get('log_dirs','Array') || []
vendor  = conf.get('vendor','Array') || []

# vhost name
vhost = deploy.get('project_slug') + '_' + env

# composer?
use_composer = ['silverstripe','silverstripe3','drupal','php'].include? deploy.get('project_type')

# directories we need to track
resources += ['backups']

# logs
log_dirs.push 'log' unless log_dirs.include? 'log'

# do the common work
path = deploy.get('base_dir') + '/' + vhost
ssh_pass = rsync.get('pass') ? "sshpass -p #{rsync.get('pass')}" : ""
queue! %[#{ssh_pass} ssh #{rsync.get('user')}@#{rsync.get('host')} mkdir -p #{path}]

(resources + log_dirs).each do |item|
  case type
  when "sync-local-from"
    exec "rsync -r -a -v -e \"#{ssh_pass} ssh -l #{rsync.get('user')}\" --delete --copy-dirlinks #{rsync.get('host')}:#{path}/current/#{item} ./"
  when "sync-local-to"
    exec "rsync -r -a -v -e \"#{ssh_pass} ssh -l #{rsync.get('user')}\" --delete --copy-dirlinks ./#{item} #{rsync.get('host')}:#{path}/current/"
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
bonethug-0.0.69 config/syncer.rb
bonethug-0.0.68 config/syncer.rb
bonethug-0.0.67 config/syncer.rb
bonethug-0.0.66 config/syncer.rb
bonethug-0.0.63 config/syncer.rb
bonethug-0.0.62 config/syncer.rb
bonethug-0.0.61 config/syncer.rb
bonethug-0.0.60 config/syncer.rb
bonethug-0.0.59 config/syncer.rb
bonethug-0.0.55 config/syncer.rb
bonethug-0.0.54.17 config/syncer.rb
bonethug-0.0.54.16 config/syncer.rb
bonethug-0.0.54.15 config/syncer.rb
bonethug-0.0.54.14 config/syncer.rb
bonethug-0.0.54.13 config/syncer.rb
bonethug-0.0.54.11 config/syncer.rb
bonethug-0.0.54.10 config/syncer.rb
bonethug-0.0.54.8 config/syncer.rb
bonethug-0.0.54.7 config/syncer.rb
bonethug-0.0.54.6 config/syncer.rb