Class: Jets::Code::Copy::Rsync

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/code/copy/rsync.rb

Instance Method Summary collapse

Methods inherited from Base

#always_keep, #always_remove, #extract_code, #git_info, #gitconfig, #remove_temp_files, #run, run, #save_gitinfo

Methods included from Util::Sh

#capture, #quiet_sh, #sh

Methods included from Util::Logging

#log

Methods included from Util::Git

#git?, #git_installed?

Instance Method Details

#check_zip_installed!Object



14
15
16
17
# File 'lib/jets/code/copy/rsync.rb', line 14

def check_zip_installed!
  return if system("type zip > /dev/null 2>&1")
  abort "ERROR: zip command is required. Please install zip command."
end

#create_temp_zipObject

interface method



4
5
6
7
8
9
10
11
12
# File 'lib/jets/code/copy/rsync.rb', line 4

def create_temp_zip
  FileUtils.mkdir_p("#{build_root}/stage/code-temp")
  excludes = " --exclude .git"
  excludes << " --exclude-from=#{Jets.root}/.gitignore" if File.exist?("#{Jets.root}/.gitignore")
  quiet_sh "rsync -aq#{excludes} #{Jets.root}/ #{build_root}/stage/code-temp"
  # Create zip file
  check_zip_installed!
  quiet_sh "cd #{build_root}/stage/code-temp && zip -q -r #{build_root}/stage/code-temp.zip ."
end