Class: Dply::Strategy::Archive

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Helper
Defined in:
lib/dply/strategy/archive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #sh, #symlink

Constructor Details

#initialize(config, options) ⇒ Archive

Returns a new instance of Archive.



22
23
24
25
# File 'lib/dply/strategy/archive.rb', line 22

def initialize(config, options)
  @config = config
  @options = options || {}
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



17
18
19
# File 'lib/dply/strategy/archive.rb', line 17

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



17
18
19
# File 'lib/dply/strategy/archive.rb', line 17

def options
  @options
end

Instance Method Details

#deployObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/dply/strategy/archive.rb', line 27

def deploy
  error "revision not specified( use -r)" if not revision
  setup.archive
  if release.already_deployed? && release.current?
    logger.info "revision #{revision} is currently deployed"
    current_version = previous_version = get_release
    prune_releases
    util.report_changes(current_version, previous_version)
    return
  end
  download_configs if config_download_url
  install_release
  previous_version = get_release
  release.make_current
  Dir.chdir current_dir do
    util.run "deploy:#{deploy_target}"
  end
  release.record_deployment
  current_version = get_release
  prune_releases
  util.report_changes(previous_version, current_version)
end

#reloadObject



50
51
52
53
54
55
56
# File 'lib/dply/strategy/archive.rb', line 50

def reload
  download_configs if config_download_url
  Dir.chdir current_dir do
    link_all
    util.run :reload
  end
end