Class: Capistrano::BundleRsync::SCM Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/capistrano/bundle_rsync/scm.rb

Overview

This class is abstract.

Base class for SCM strategy providers.

Direct Known Subclasses

Git, LocalGit

Instance Method Summary collapse

Methods inherited from Base

#config, #initialize

Constructor Details

This class inherits a constructor from Capistrano::BundleRsync::Base

Instance Method Details

#checkBoolean

This method is abstract.

Your implementation should check if the specified remote-repository is available.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


27
28
29
30
31
# File 'lib/capistrano/bundle_rsync/scm.rb', line 27

def check
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #check method"
  )
end

#cloneObject

This method is abstract.

Create a (new) clone of the remote-repository on the deployment target

Returns:

  • void

Raises:

  • (NotImplementedError)


39
40
41
42
43
# File 'lib/capistrano/bundle_rsync/scm.rb', line 39

def clone
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #clone method"
  )
end

#create_releaseObject

This method is abstract.

Copy the contents of the cache-repository onto the release path

Returns:

  • void

Raises:

  • (NotImplementedError)


63
64
65
66
67
# File 'lib/capistrano/bundle_rsync/scm.rb', line 63

def create_release
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #create_release method"
  )
end

#rsync_releaseObject

This method is abstract.

Rsync the contents of the release path

This is an additional task endpoint provided by capistrano-bundle_rsync

Returns:

  • void

Raises:

  • (NotImplementedError)


77
78
79
80
81
# File 'lib/capistrano/bundle_rsync/scm.rb', line 77

def rsync_release
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #rsync_release method"
  )
end

#rsync_sharedObject

This method is abstract.

Rsync arbitrary contents to shared directory

This is an additional task endpoint provided by capistrano-bundle_rsync

Returns:

  • void



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/capistrano/bundle_rsync/scm.rb', line 90

def rsync_shared
  hosts = release_roles(:all)
  rsync_options = config.rsync_options

  if config_files = config.config_files
    Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host|
      ssh = config.build_ssh_command(host)
      config_files.each do |config_file|
        basename = File.basename(config_file)
        execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{config_file} #{host}:#{release_path}/config/#{basename}"
      end
    end
  end

  if shared_dirs = config.shared_dirs
    Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host|
      ssh = config.build_ssh_command(host)
      shared_dirs.each do |shared_dir|
        basename = File.basename(shared_dir)
        execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{shared_dir}/ #{host}:#{shared_path}/#{basename}/"
      end
    end
  end
end

#set_current_revisionObject

This method is abstract.

Identify the SHA of the commit that will be deployed. This will most likely involve SshKit’s capture method.

Returns:

  • void

Raises:

  • (NotImplementedError)


121
122
123
124
125
# File 'lib/capistrano/bundle_rsync/scm.rb', line 121

def set_current_revision
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #set_current_revision method"
  )
end

#testBoolean

This method is abstract.

Your implementation should check the existence of a cache repository on the deployment target

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


14
15
16
17
18
# File 'lib/capistrano/bundle_rsync/scm.rb', line 14

def test
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #test method"
  )
end

#updateObject

This method is abstract.

Update the clone on the deployment target

Returns:

  • void

Raises:

  • (NotImplementedError)


51
52
53
54
55
# File 'lib/capistrano/bundle_rsync/scm.rb', line 51

def update
  raise NotImplementedError.new(
    "Your SCM strategy module should provide a #update method"
  )
end