Class: Moku::Release

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Bundleable
Defined in:
lib/moku/release.rb

Overview

Uniquely identifies a deployed instance at a point in time. All deployment operations first create a release, and then attempt to deploy it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Bundleable

#with_env

Constructor Details

#initialize(artifact:, deploy_config:, remote_runner: nil, release_dir: nil) ⇒ Release


17
18
19
20
21
22
23
# File 'lib/moku/release.rb', line 17

def initialize(artifact:, deploy_config:, remote_runner: nil, release_dir: nil)
  @artifact = artifact
  @deploy_config = deploy_config
  @remote_runner = remote_runner || Moku.remote_runner
  @id = Time.now.strftime(Moku.release_time_format)
  @release_dir = release_dir || id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id


25
26
27
# File 'lib/moku/release.rb', line 25

def id
  @id
end

Instance Method Details

#app_pathObject


37
38
39
# File 'lib/moku/release.rb', line 37

def app_path
  deploy_config.deploy_dir/"current"
end

#deploy_pathObject


33
34
35
# File 'lib/moku/release.rb', line 33

def deploy_path
  releases_path/release_dir
end

#releases_pathObject


29
30
31
# File 'lib/moku/release.rb', line 29

def releases_path
  deploy_config.deploy_dir/"releases"
end

#run(scope, command) ⇒ Object


41
42
43
44
45
46
# File 'lib/moku/release.rb', line 41

def run(scope, command)
  run_on_hosts(
    scope.apply(deploy_config.sites),
    command
  )
end