Module: Kitchen::Transport::SpeedyConnectionBase
- Included in:
- Kitchen::Transport::SpeedySsh::Connection
- Defined in:
- lib/kitchen/transport/speedy.rb
Instance Method Summary collapse
- #archive_locally(path, archive_path) ⇒ Object
- #dearchive_remotely(archive_basename, remote) ⇒ Object
- #upload(locals, remote) ⇒ Object
- #valid_local_requirements? ⇒ Boolean
- #valid_remote_requirements? ⇒ Boolean
Instance Method Details
#archive_locally(path, archive_path) ⇒ Object
34 35 36 |
# File 'lib/kitchen/transport/speedy.rb', line 34 def archive_locally(path, archive_path) raise NotImplementedError end |
#dearchive_remotely(archive_basename, remote) ⇒ Object
38 39 40 |
# File 'lib/kitchen/transport/speedy.rb', line 38 def dearchive_remotely(archive_basename, remote) raise NotImplementedError end |
#upload(locals, remote) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/kitchen/transport/speedy.rb', line 42 def upload(locals, remote) unless valid_local_requirements? && valid_remote_requirements? logger.debug("Calling back default implementation since requirements cannot be validate locally and in the box") return super end Array(locals).each do |local| if ::File.directory?(local) file_count = ::Dir.glob(::File.join(local, '**/*')).size logger.debug("#{local} contains #{file_count}") archive_basename = ::File.basename(local) + '.tgz' archive = ::File.join(::File.dirname(local), archive_basename) Mixlib::ShellOut.new(archive_locally(local, archive)).run_command.error! execute(ensure_remotedir_exists(remote)) logger.debug("Calling regular upload for #{archive} to #{remote}") super(archive, remote) execute(dearchive_remotely(archive_basename, remote)) else logger.debug("Calling regular upload for #{local} since it is a simple file") super(local, remote) end end end |
#valid_local_requirements? ⇒ Boolean
26 27 28 |
# File 'lib/kitchen/transport/speedy.rb', line 26 def valid_local_requirements? raise NotImplementedError end |
#valid_remote_requirements? ⇒ Boolean
30 31 32 |
# File 'lib/kitchen/transport/speedy.rb', line 30 def valid_remote_requirements? raise NotImplementedError end |