Class: Jets::Code::Copy::GitCopy

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/code/copy/git_copy.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

#copy_to_code_tempObject

Copy project to stage/code-temp to use git add and archive without affecting up the current git repo. interface method. overriden by GitRsync



21
22
23
24
# File 'lib/jets/code/copy/git_copy.rb', line 21

def copy_to_code_temp
  FileUtils.mkdir_p("#{build_root}/stage")
  FileUtils.cp_r(Jets.root, "#{build_root}/stage/code-temp")
end

#create_temp_zipObject

interface method



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jets/code/copy/git_copy.rb', line 4

def create_temp_zip
  copy_to_code_temp # interface method

  # We leverage git archive for gitignore settings.
  Dir.chdir("#{build_root}/stage/code-temp") do
    if git_info.params[:git_dirty]
      quiet_sh "git add ."
      gitconfig
      quiet_sh "git commit -m 'add working tree files' > /dev/null || true"
    end
    quiet_sh "git archive -o #{build_root}/stage/code-temp.zip HEAD"
  end
end