dory 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2932482ce53a36eeed36a29f88c864d849bd415
4
- data.tar.gz: 64b1db166bceb3747abd0ee36945c3fffd955206
3
+ metadata.gz: 53c6457eeee8b8c77ee2373629fec053be1a38af
4
+ data.tar.gz: c58d1b2cc83521c5c708b7e3acaa6039fb201687
5
5
  SHA512:
6
- metadata.gz: 0f50c59d0b6511df98592f419110399515282190c5fd6aec9755cefd4eadf84ecefde9d03a8c2f9dd70855c765e98417d7589bed39ff7ccb51f6c84f7ae2a92e
7
- data.tar.gz: 65b7ed1f699bd2a7156606f530a35468c2fd841eb3516b438339c478e69de2408d8aef3e381113729f5d1fad0062b9e60eea52c38f22d2ae7d23676575a92d6d
6
+ metadata.gz: 0f9ce5a80dcc586ff1e274537ad6b92aa8ca8b70280d64ee16e03111dcd7bfed107b87c6ca25e1db75a2f623ac91ccb5af7687c48923cbcf55a9670adbea6265
7
+ data.tar.gz: 49bb7575f2d686660a5b0d9affa7d05e1c1b312097bf6a1ab3013674ce5ba1761bda705148e040a2913c2854a9b4b6ae724ddbf9e3f80722200814f950925632
@@ -2,6 +2,10 @@ require 'shellwords'
2
2
 
3
3
  module Dory
4
4
  module DockerService
5
+ def docker_installed?
6
+ Sh.run_command('which docker').success?
7
+ end
8
+
5
9
  def run_preconditions
6
10
  # Override if preconditions are needed
7
11
  return true
@@ -18,28 +22,35 @@ module Dory
18
22
  puts "[DEBUG] Container '#{self.container_name}' is already running. Doing nothing"
19
23
  end
20
24
  else
21
- self.run_preconditions
22
- if self.container_exists?
23
- puts "[DEBUG] Container '#{self.container_name}' exists. Deleting" if Dory::Config.debug?
24
- self.delete
25
- end
26
- if Dory::Config.debug?
27
- puts "[DEBUG] '#{self.container_name} does not exist. Creating/starting " \
28
- "'#{self.container_name}' with '#{self.run_command}'"
29
- end
30
- status = Sh.run_command(self.run_command)
31
- unless status.success?
32
- if !handle_error || !self.handle_error(status)
33
- raise RuntimeError.new(
34
- "Failed to run #{self.container_name}. Command #{self.run_command} failed"
35
- )
25
+ if docker_installed?
26
+ self.run_preconditions
27
+ if self.container_exists?
28
+ puts "[DEBUG] Container '#{self.container_name}' exists. Deleting" if Dory::Config.debug?
29
+ self.delete
30
+ end
31
+ if Dory::Config.debug?
32
+ puts "[DEBUG] '#{self.container_name}' does not exist. Creating/starting " \
33
+ "'#{self.container_name}' with '#{self.run_command}'"
34
+ end
35
+ status = Sh.run_command(self.run_command)
36
+ unless status.success?
37
+ if !handle_error || !self.handle_error(status)
38
+ puts "Failed to start docker container '#{self.container_name}' " \
39
+ ". Command '#{self.run_command}' failed".red
40
+ end
36
41
  end
42
+ else
43
+ err_msg = "Docker does not appear to be installed /o\\\n" \
44
+ "Docker is required for DNS and Nginx proxy. These can be " \
45
+ "disabled in the config file if you don't need them."
46
+ puts err_msg.red
37
47
  end
38
48
  end
39
49
  self.running?
40
50
  end
41
51
 
42
52
  def running?(container_name = self.container_name)
53
+ return false unless docker_installed?
43
54
  !!(self.ps =~ /#{container_name}/)
44
55
  end
45
56
 
@@ -7,14 +7,6 @@ module Dory
7
7
  Dory::Resolv::Linux
8
8
  end
9
9
 
10
- # def self.method_missing(method_sym, *arguments, &block)
11
- # self.get_module.send(method_sym, arguments, &block)
12
- # end
13
-
14
- # def self.respond_to?(method_sym, include_private = false)
15
- # self.get_module.respond_to?(method_sym, include_private)
16
- # end
17
-
18
10
  def self.has_our_nameserver?
19
11
  self.get_module.has_our_nameserver?
20
12
  end
@@ -1,4 +1,4 @@
1
1
  module Dory
2
- VERSION = '0.3.2'
3
- DATE = '2016-06-30'
2
+ VERSION = '0.3.3'
3
+ DATE = '2016-07-10'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -174,4 +174,3 @@ specification_version: 4
174
174
  summary: slackbot_frd provides a dirt-simple framework for implementing one or more
175
175
  slack bots
176
176
  test_files: []
177
- has_rdoc: