Class: Sem::Views::SharedConfigs

Inherits:
Base
  • Object
show all
Defined in:
lib/sem/views/shared_configs.rb

Class Method Summary collapse

Methods inherited from Base

org_names_not_matching, print_table

Class Method Details

.add_first_env_var(shared_config) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/sem/views/shared_configs.rb', line 42

def self.add_first_env_var(shared_config)
  puts "You don't have any environment variable in this shared configuration."
  puts ""
  puts "Add your first environment variable:"
  puts ""
  puts "  sem shared-config:env-vars:add #{shared_config.full_name} --local-path <file> --path-on-semaphore <path>"
  puts ""
end

.add_first_file(shared_config) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/sem/views/shared_configs.rb', line 33

def self.add_first_file(shared_config)
  puts "You don't have any files in this shared configuration."
  puts ""
  puts "Add your first file:"
  puts ""
  puts "  sem shared-config:files:add #{shared_config.full_name} --local-path <file> --path-on-semaphore <path>"
  puts ""
end

.info(config) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/sem/views/shared_configs.rb', line 22

def self.info(config)
  print_table [
    ["ID", config.id],
    ["Name", config.full_name],
    ["Config Files", config.files.count.to_s],
    ["Environment Variables", config.env_vars.count.to_s],
    ["Created", config.created_at],
    ["Updated", config.updated_at]
  ]
end

.list(configs) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/sem/views/shared_configs.rb', line 12

def self.list(configs)
  header = ["ID", "NAME", "CONFIG FILES", "ENV VARS"]

  body = configs.map do |config|
    [config.id, config.full_name, config.files.count, config.env_vars.count]
  end

  print_table [header, *body]
end

.setup_first_shared_configObject



3
4
5
6
7
8
9
10
# File 'lib/sem/views/shared_configs.rb', line 3

def self.setup_first_shared_config
  puts "You don't have any shared configurations on Semaphore."
  puts ""
  puts "Create your first shared configuration:"
  puts ""
  puts "  sem shared-config:create SHARED_CONFIG_NAME"
  puts ""
end