Module: Tid::Boot2docker
- Defined in:
- lib/tid/boot2docker.rb
Class Method Summary collapse
- .env ⇒ Object
- .env! ⇒ Object
- .env_keys ⇒ Object
- .have? ⇒ Boolean
- .ip ⇒ Object
- .prepare ⇒ Object
- .running? ⇒ Boolean
- .status ⇒ Object
- .up ⇒ Object
Class Method Details
.env ⇒ Object
12 13 14 |
# File 'lib/tid/boot2docker.rb', line 12 def env @env ||= env! end |
.env! ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/tid/boot2docker.rb', line 16 def env! out = `boot2docker shellinit 2>/dev/null` env_keys.each.with_object({}) do |key, memo| out.match(/#{key}=(.*)/) memo[key] = $1.chomp end end |
.env_keys ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/tid/boot2docker.rb', line 4 def env_keys %w( DOCKER_HOST DOCKER_CERT_PATH DOCKER_TLS_VERIFY ) end |
.have? ⇒ Boolean
32 33 34 |
# File 'lib/tid/boot2docker.rb', line 32 def have? !`which boot2docker`.empty? end |
.ip ⇒ Object
40 41 42 43 |
# File 'lib/tid/boot2docker.rb', line 40 def ip out, _, _ = Console.cmd 'boot2docker ip' out.to_s.chomp end |
.prepare ⇒ Object
24 25 26 |
# File 'lib/tid/boot2docker.rb', line 24 def prepare up unless running? end |
.running? ⇒ Boolean
36 37 38 |
# File 'lib/tid/boot2docker.rb', line 36 def running? status == 'running' end |
.status ⇒ Object
28 29 30 |
# File 'lib/tid/boot2docker.rb', line 28 def status Console.cmd 'boot2docker status' end |
.up ⇒ Object
45 46 47 |
# File 'lib/tid/boot2docker.rb', line 45 def up Console.cmd 'boot2docker up' end |