Class: Dplyr::Stage

Inherits:
Object
  • Object
show all
Includes:
Dply::Helper
Defined in:
lib/dplyr/stage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dply::Helper

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

Constructor Details

#initialize(name) ⇒ Stage

Returns a new instance of Stage.



11
12
13
14
15
16
17
# File 'lib/dplyr/stage.rb', line 11

def initialize(name)
  @name = name.to_sym
  @hosts = []
  @parallel_runs = 1
  @dir = nil
  @user = nil
end

Instance Attribute Details

#config_procObject

Returns the value of attribute config_proc.



9
10
11
# File 'lib/dplyr/stage.rb', line 9

def config_proc
  @config_proc
end

Instance Method Details

#consul(app_name, service: "app") ⇒ Object



50
51
52
53
54
55
# File 'lib/dplyr/stage.rb', line 50

def consul(app_name, service: "app")
  consul = Consul.new
  consul.hosts(app_name, service: service).each do |i|
    host(i[:addr], user: i[:user], dir: i[:dir], id: i[:id])
  end
end

#dataObject



19
20
21
22
23
24
25
26
# File 'lib/dplyr/stage.rb', line 19

def data
  finalize
  return ({
    parallel_runs: @parallel_runs,
    hosts: @hosts,
    env: {}
  })
end

#dir(dir) ⇒ Object Also known as: deploy_dir



38
39
40
# File 'lib/dplyr/stage.rb', line 38

def dir(dir)
  @dir = dir
end

#host(addr, user: nil, dir: nil, id: nil, roles: []) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/dplyr/stage.rb', line 28

def host(addr, user: nil, dir: nil, id: nil, roles: [])
  @hosts << ({
    addr: addr,
    user: user,
    dir: dir,
    id: id || addr,
    roles: cleaned_roles(roles)
  })
end

#parallel_runs(parallel_runs) ⇒ Object



46
47
48
# File 'lib/dplyr/stage.rb', line 46

def parallel_runs(parallel_runs)
  @parallel_runs = parallel_runs
end

#user(user) ⇒ Object



42
43
44
# File 'lib/dplyr/stage.rb', line 42

def user(user)
  @user = user
end