Class: Pups::Docker

Inherits:
Object
  • Object
show all
Defined in:
lib/pups/docker.rb

Class Method Summary collapse

Class Method Details

.generate_env_arguments(config) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/pups/docker.rb', line 6

def generate_env_arguments(config)
  output = []
  config&.each do |k, v|
    if !v.to_s.empty?
      output << "--env #{k}=#{escape_user_string_literal(v)}"
    end
  end
  normalize_output(output)
end

.generate_expose_arguments(config) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pups/docker.rb', line 24

def generate_expose_arguments(config)
  output = []
  config&.each do |c|
    if c.to_s.include?(":")
      output << "--publish #{c}"
    else
      output << "--expose #{c}"
    end
  end
  normalize_output(output)
end

.generate_label_arguments(config) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/pups/docker.rb', line 44

def generate_label_arguments(config)
  output = []
  config&.each do |k, v|
    output << "--label #{k}=#{escape_user_string_literal(v)}"
  end
  normalize_output(output)
end


16
17
18
19
20
21
22
# File 'lib/pups/docker.rb', line 16

def generate_link_arguments(config)
  output = []
  config&.each do |c|
    output << "--link #{c['link']['name']}:#{c['link']['alias']}"
  end
  normalize_output(output)
end

.generate_volume_arguments(config) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/pups/docker.rb', line 36

def generate_volume_arguments(config)
  output = []
  config&.each do |c|
    output << "--volume #{c['volume']['host']}:#{c['volume']['guest']}"
  end
  normalize_output(output)
end