Class: Bard::CLI::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bard/config.rb

Defined Under Namespace

Classes: Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_name, path) ⇒ Config

Returns a new instance of Config.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bard/config.rb', line 5

def initialize project_name, path
  @project_name = project_name
  @servers = {
    local: Server.new(
      project_name,
      :local,
      false,
      "./",
      false,
    ),
    theia: Server.new(
      project_name,
      :theia,
      "[email protected]",
      "Sites/#{project_name}",
      false,
    ),
    gubs: Server.new(
      project_name,
      :gubs,
      "[email protected]:22022",
      "Sites/#{project_name}",
      false,
    ),
    ci: Server.new(
      project_name,
      :ci,
      "[email protected]:22022",
      "jobs/#{project_name}/workspace",
      false,
    ),
    staging: Server.new(
      project_name,
      :staging,
      "www@#{project_name}.botandrose.com:22022",
    ),
  }
  load_local_config! path
end

Instance Attribute Details

#serversObject (readonly)

Returns the value of attribute servers.



45
46
47
# File 'lib/bard/config.rb', line 45

def servers
  @servers
end

Instance Method Details

#data(*paths) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/bard/config.rb', line 53

def data *paths
  if paths.length == 0
    Array(@data)
  else
    @data = paths
  end
end

#server(key, &block) ⇒ Object



47
48
49
50
51
# File 'lib/bard/config.rb', line 47

def server key, &block
  @servers[key] ||= Server.new(@project_name, key)
  @servers[key].instance_eval &block if block_given?
  @servers[key]
end