Class: Dply::Strategy::Git

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

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

Constructor Details

#initialize(config, options) ⇒ Git

Returns a new instance of Git.



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

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



15
16
17
# File 'lib/dply/strategy/git.rb', line 15

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/dply/strategy/git.rb', line 15

def options
  @options
end

Instance Method Details

#deployObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dply/strategy/git.rb', line 25

def deploy
  deploy_target = (target || :git)
  setup.git
  download_configs if config_download_url
  Dir.chdir current_dir do
    previous_version = git.commit_id
    git_step
    current_version = git.commit_id
    link_all
    install_pkgs
    bundle.install
    bundle.clean
    util.run "deploy:#{deploy_target}"
    util.report_changes(previous_version, current_version)
  end
end

#reloadObject



42
43
44
45
46
47
48
# File 'lib/dply/strategy/git.rb', line 42

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