class Blimpy::Livery::Base
Public Instance Methods
can_rsync?(box)
click to toggle source
# File lib/blimpy/livery/base.rb, line 32 def can_rsync?(box) @can_rsync ||= box.ssh_into('-q', 'which rsync > /dev/null') end
dir_name()
click to toggle source
# File lib/blimpy/livery/base.rb, line 55 def dir_name File.basename(livery_root) end
flight(*args)
click to toggle source
# File lib/blimpy/livery/base.rb, line 8 def flight(*args) raise NotImplementedError end
livery_root()
click to toggle source
# File lib/blimpy/livery/base.rb, line 51 def livery_root Dir.pwd end
postflight(*args)
click to toggle source
# File lib/blimpy/livery/base.rb, line 12 def postflight(*args) end
preflight(*args)
click to toggle source
# File lib/blimpy/livery/base.rb, line 5 def preflight(*args) end
rsync_command()
click to toggle source
# File lib/blimpy/livery/base.rb, line 19 def rsync_command excludes = rsync_excludes.map { |x| "--exclude=#{x}" } if File.exists? '.blimpignore' excludes << '--exclude-from=.blimpignore' end ['rsync', '-avL', '-e', 'ssh -o StrictHostKeyChecking=no'] + excludes end
rsync_excludes()
click to toggle source
# File lib/blimpy/livery/base.rb, line 15 def rsync_excludes ['.git', '.svn', '.blimpy.d'] end
setup_on(box)
click to toggle source
# File lib/blimpy/livery/base.rb, line 59 def setup_on(box) sync_to(box) end
sync_to(box)
click to toggle source
# File lib/blimpy/livery/base.rb, line 36 def sync_to(box) if can_rsync? box command = rsync_command + ['.', "#{box.username}@#{box.dns}:#{dir_name}/"] box.run_command(*command) else puts "Remote host has no rsync(1), falling back to copying a full tarball over" tarball = Blimpy::Livery.tarball_directory(livery_root) box.scp_file(tarball) # HAXX basename = File.basename(tarball) box.ssh_into("tar -zxf #{basename} && cd #{dir_name}") end end