Class: Capistrano::Redmine::Deployment::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/redmine/deployment/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, logging: true) ⇒ Client

Returns a new instance of Client.



28
29
30
31
# File 'lib/capistrano/redmine/deployment/client.rb', line 28

def initialize(config, logging: true)
  @config = config
  @logging = logging
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/capistrano/redmine/deployment/client.rb', line 12

def config
  @config
end

Class Method Details

.deploy_fail!(config, deployment) ⇒ Object



21
22
23
24
25
# File 'lib/capistrano/redmine/deployment/client.rb', line 21

def deploy_fail!(config, deployment)
  deployment[:result] = 'fail'

  new(config).deploy!(deployment)
end

.deploy_success!(config, deployment) ⇒ Object



15
16
17
18
19
# File 'lib/capistrano/redmine/deployment/client.rb', line 15

def deploy_success!(config, deployment)
  deployment[:result] = 'success'

  new(config).deploy!(deployment)
end

Instance Method Details

#deploy!(deployment) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/capistrano/redmine/deployment/client.rb', line 41

def deploy!(deployment)
  log_deploy(deployment) if log?

  response = send_deployment(deployment)

  if response['deployment']
    log_deploy_done(response) if log?

    true
  else
    log_deploy_errors(response) if log?

    false
  end
end

#log?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/capistrano/redmine/deployment/client.rb', line 37

def log?
  @logging
end

#silent!Object



33
34
35
# File 'lib/capistrano/redmine/deployment/client.rb', line 33

def silent!
  @logging = false
end