Module: Kamal::Commands::Builder::Clone

Included in:
Kamal::Commands::Builder
Defined in:
lib/kamal/commands/builder/clone.rb

Instance Method Summary collapse

Instance Method Details

#cloneObject



2
3
4
# File 'lib/kamal/commands/builder/clone.rb', line 2

def clone
  git :clone, escaped_root, "--recurse-submodules", path: config.builder.clone_directory.shellescape
end

#clone_reset_stepsObject



6
7
8
9
10
11
12
13
14
# File 'lib/kamal/commands/builder/clone.rb', line 6

def clone_reset_steps
  [
    git(:remote, "set-url", :origin, escaped_root, path: escaped_build_directory),
    git(:fetch, :origin, path: escaped_build_directory),
    git(:reset, "--hard", Kamal::Git.revision, path: escaped_build_directory),
    git(:clean, "-fdx", path: escaped_build_directory),
    git(:submodule, :update, "--init", path: escaped_build_directory)
  ]
end

#clone_revisionObject



20
21
22
# File 'lib/kamal/commands/builder/clone.rb', line 20

def clone_revision
  git :"rev-parse", :HEAD, path: escaped_build_directory
end

#clone_statusObject



16
17
18
# File 'lib/kamal/commands/builder/clone.rb', line 16

def clone_status
  git :status, "--porcelain", path: escaped_build_directory
end

#escaped_build_directoryObject



28
29
30
# File 'lib/kamal/commands/builder/clone.rb', line 28

def escaped_build_directory
  config.builder.build_directory.shellescape
end

#escaped_rootObject



24
25
26
# File 'lib/kamal/commands/builder/clone.rb', line 24

def escaped_root
  Kamal::Git.root.shellescape
end