Class: Dkdeploy::SCM::Copy

Inherits:
Capistrano::SCM::Plugin
  • Object
show all
Defined in:
lib/dkdeploy/scm/copy.rb

Overview

Class for the capistrano copy

Instance Method Summary collapse

Instance Method Details

#archive_filenameString

Archive filename as singleton Note: if the archive filename doesn’t already exist it will be generated

Returns:

  • (String)


44
45
46
# File 'lib/dkdeploy/scm/copy.rb', line 44

def archive_filename
  @archive_filename ||= Dir::Tmpname.make_tmpname [application + '_', '.tar.gz'], nil
end

#define_tasksObject



36
37
38
# File 'lib/dkdeploy/scm/copy.rb', line 36

def define_tasks
  eval_rakefile File.expand_path('../copy.rake', __FILE__)
end

#local_archive_pathString

Archive path in a local temporary directory

Returns:

  • (String)


66
67
68
# File 'lib/dkdeploy/scm/copy.rb', line 66

def local_archive_path
  File.join local_tmp_dir, archive_filename
end

#local_exclude_pathString

Archive path in a local temporary directory

Returns:

  • (String)


59
60
61
# File 'lib/dkdeploy/scm/copy.rb', line 59

def local_exclude_path
  File.join local_tmp_dir, 'exclude.txt'
end

#local_tmp_dirString

Local temporary directory path as singleton Note: if the directory doesn’t already exist it will be created

Returns:

  • (String)


52
53
54
# File 'lib/dkdeploy/scm/copy.rb', line 52

def local_tmp_dir
  @local_tmp_dir ||= Dir.mktmpdir
end

#register_hooksObject



30
31
32
33
34
# File 'lib/dkdeploy/scm/copy.rb', line 30

def register_hooks
  after 'deploy:new_release_path', 'copy:create_release'
  before 'deploy:check', 'copy:check'
  before 'deploy:set_current_revision', 'copy:set_current_revision'
end

#remote_archive_pathString

Archive path in a remote temporary directory

Returns:

  • (String)


80
81
82
# File 'lib/dkdeploy/scm/copy.rb', line 80

def remote_archive_path
  File.join remote_tmp_dir, archive_filename
end

#remote_tmp_dirString

Remote temporary directory path

Returns:

  • (String)


73
74
75
# File 'lib/dkdeploy/scm/copy.rb', line 73

def remote_tmp_dir
  File.join fetch(:tmp_dir), application
end

#set_defaultsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dkdeploy/scm/copy.rb', line 13

def set_defaults
  set_if_empty :copy_source, 'htdocs'
  set_if_empty :copy_exclude, Array[
    'vendor/bundle/**',
    'Gemfile*',
    '**/.git',
    '**/.svn',
    '**/.DS_Store',
    '.settings',
    '.project',
    '.buildpath',
    'Capfile',
    'Thumbs.db',
    'composer.lock'
  ]
end