dory 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dory +31 -9
- data/lib/dory/config.rb +1 -0
- data/lib/dory/docker_service.rb +12 -14
- data/lib/dory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32d77f426394ec85bbbe2bab82c51827a606b5f3
|
4
|
+
data.tar.gz: 3c1f263e12aeb27daa447956eafd76cb8d2784af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b6628655fa991c06bf885fac5e5e51a9e8529d0cf2e7ab89e9ac71d0ce4770f37e34ace70b03697f5c909b707e84bab711305387a31c62d2a62c6fe857fcb93
|
7
|
+
data.tar.gz: 32bcb7f13b507fb798f6e4882f4a4640edd31630e5a3b7578a3416273650001ffbe9d9f57850bcf56566f9a8e66e001158bcb74c558190b7540453daeb4fea26
|
data/bin/dory
CHANGED
@@ -69,23 +69,45 @@ class DoryBin < Thor
|
|
69
69
|
containing the default settings. This can then be configured
|
70
70
|
as preferred.
|
71
71
|
LONGDESC
|
72
|
+
option :upgrade, type: :boolean, aliases: 'u', default: false
|
73
|
+
option :force, type: :boolean, aliases: 'f', default: false
|
72
74
|
def config_file
|
73
75
|
exec_config_file(options)
|
74
76
|
end
|
75
77
|
|
76
78
|
private
|
77
79
|
|
78
|
-
def
|
80
|
+
def config_file_action(options)
|
81
|
+
if options[:upgrade]
|
82
|
+
'u'
|
83
|
+
elsif options[:force]
|
84
|
+
'o'
|
85
|
+
else
|
86
|
+
print "A config file already exists at #{Dory::Config.filename}. [U]pgrade, [O]verwrite with default settings, or do [N]othing? (U/O/N): ".yellow
|
87
|
+
STDIN.gets.chomp
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def take_action(action)
|
92
|
+
if action =~ /u/i
|
93
|
+
puts "Upgrading config file at #{Dory::Config.filename}".green
|
94
|
+
Dory::Config.upgrade_settings_file
|
95
|
+
elsif action =~ /o/i
|
96
|
+
puts "Overwriting config file with new version at #{Dory::Config.filename}".green
|
97
|
+
Dory::Config.write_default_settings_file
|
98
|
+
else
|
99
|
+
puts "User declined. Not writing config file".red
|
100
|
+
return
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def exec_config_file(options)
|
79
105
|
if File.exist?(Dory::Config.filename)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
return
|
85
|
-
end
|
106
|
+
take_action(config_file_action(options))
|
107
|
+
else
|
108
|
+
puts "Writing new config file to #{Dory::Config.filename}".green
|
109
|
+
Dory::Config.write_default_settings_file
|
86
110
|
end
|
87
|
-
puts "Writing config file to #{Dory::Config.filename}".green
|
88
|
-
Dory::Config.write_default_settings_file
|
89
111
|
end
|
90
112
|
|
91
113
|
def exec_up(options)
|
data/lib/dory/config.rb
CHANGED
@@ -57,6 +57,7 @@ module Dory
|
|
57
57
|
|
58
58
|
def self.write_settings(settings, filename = self.filename, is_yaml: false)
|
59
59
|
settings = settings.to_yaml unless is_yaml
|
60
|
+
settings.gsub!(/\s*!ruby\/hash:ActiveSupport::HashWithIndifferentAccess/, '')
|
60
61
|
File.write(filename, settings)
|
61
62
|
end
|
62
63
|
|
data/lib/dory/docker_service.rb
CHANGED
@@ -13,21 +13,19 @@ module Dory
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def start(handle_error: true)
|
16
|
-
|
16
|
+
if self.running?
|
17
|
+
puts "Container '#{self.container_name}' is already running"
|
18
|
+
else
|
17
19
|
self.run_preconditions
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"Creating/starting with '#{self.run_command}'"
|
28
|
-
end
|
29
|
-
Sh.run_command(self.run_command)
|
30
|
-
end
|
20
|
+
if self.container_exists?
|
21
|
+
puts "[DEBUG] Container '#{self.container_name}' exists. Deleting"
|
22
|
+
self.delete
|
23
|
+
end
|
24
|
+
if Dory::Config.debug?
|
25
|
+
puts "[DEBUG] does not exist. Creating/starting " \
|
26
|
+
"'#{self.container_name}' with '#{self.run_command}'"
|
27
|
+
end
|
28
|
+
status = Sh.run_command(self.run_command)
|
31
29
|
unless status.success?
|
32
30
|
if !handle_error || !self.handle_error(status)
|
33
31
|
raise RuntimeError.new(
|
data/lib/dory/version.rb
CHANGED