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.



20
21
22
23
# File 'lib/dply/strategy/archive.rb', line 20

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#deployObject



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

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
  generate_meta_config
  install_release
  previous_version = get_release
  release.make_current
  Dir.chdir current_dir do
    util.run "deploy:#{deploy_target}", render_config: true
  end
  release.record_deployment
  current_version = get_release
  prune_releases
  util.report_changes(previous_version, current_version)
end

#reloadObject



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

def reload
  generate_meta_config
  Dir.chdir current_dir do
    link_all
    util.run :reload, render_config: true
  end
end