dtk-client 0.7.4 → 0.7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/command_helpers/service_importer.rb +23 -4
- data/lib/commands/common/thor/module.rb +1 -0
- data/lib/commands/thor/service_module.rb +1 -0
- data/lib/dtk-client/version.rb +1 -1
- data/lib/util/console.rb +24 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7875186712bb106f9fbbf11458c702e66041ae
|
4
|
+
data.tar.gz: 23996874f5fb73b451fab137e6157252addb9224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b938efca3539c8ba284580cfc4f747c179e45939abe5025f479c696fa227618c4c98731e8b493f77834ed396c31b63f81230b3e324b8618be907da363efd3ea
|
7
|
+
data.tar.gz: f428e0857dbea981c780d12bc8e4fb7cf31d2a249282302d29d358917364a52230426c9dcf6802e85289b9859c7cf15f223b194a7a7a6dbb2a21b2aacf0292f8
|
@@ -18,9 +18,10 @@ module DTK::Client
|
|
18
18
|
##
|
19
19
|
# Method will trigger pull from dtkn for each existing module
|
20
20
|
#
|
21
|
+
def trigger_module_auto_pull(required_modules, force = false)
|
22
|
+
return if required_modules.empty?
|
21
23
|
|
22
|
-
|
23
|
-
if !required_modules.empty? && Console.confirmation_prompt("Do you want to update in addition to this module its dependent modules from the catalog?")
|
24
|
+
if force || Console.confirmation_prompt("Do you want to update in addition to this module its dependent modules from the catalog?")
|
24
25
|
required_modules.each do |r_module|
|
25
26
|
module_name = full_module_name(r_module)
|
26
27
|
module_type = r_module['type']
|
@@ -37,7 +38,7 @@ module DTK::Client
|
|
37
38
|
raise DTK::Client::DtkError, response.error_message unless response.ok?
|
38
39
|
end
|
39
40
|
|
40
|
-
print "Resuming pull ... "
|
41
|
+
print "Resuming pull ... " unless force
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -47,13 +48,31 @@ module DTK::Client
|
|
47
48
|
#
|
48
49
|
def trigger_module_auto_import(modules_to_import, required_modules, opts={})
|
49
50
|
puts "Auto-importing missing module(s)"
|
51
|
+
update_all, update_none = false, false
|
50
52
|
|
51
|
-
# Print out installed modules
|
53
|
+
# Print out or update installed modules from catalog
|
52
54
|
required_modules.each do |r_module|
|
53
55
|
module_name = full_module_name(r_module)
|
54
56
|
module_type = r_module['type']
|
55
57
|
|
56
58
|
print "Using #{module_type.gsub('_',' ')} '#{module_name}'\n"
|
59
|
+
next if update_none || opts[:update_none]
|
60
|
+
|
61
|
+
if update_all
|
62
|
+
trigger_module_auto_pull([r_module], true)
|
63
|
+
else
|
64
|
+
update = Console.confirmation_prompt_additional_options("Do you want to update dependent #{module_type.gsub('_',' ')} '#{module_name}' from the catalog?", ['all', 'none'])
|
65
|
+
next unless update
|
66
|
+
|
67
|
+
if update.to_s.eql?('all')
|
68
|
+
update_all = true
|
69
|
+
trigger_module_auto_pull([r_module], true)
|
70
|
+
elsif update.to_s.eql?('none')
|
71
|
+
update_none = true
|
72
|
+
else
|
73
|
+
trigger_module_auto_pull([r_module], true)
|
74
|
+
end
|
75
|
+
end
|
57
76
|
end
|
58
77
|
|
59
78
|
# Trigger import/install for missing modules
|
@@ -275,6 +275,7 @@ module DTK::Client
|
|
275
275
|
required_components = response.data(:required_modules)
|
276
276
|
opts = {:do_not_raise=>true}
|
277
277
|
module_opts = ignore_component_error ? opts.merge(:ignore_component_error => true) : opts.merge(:additional_message=>true)
|
278
|
+
module_opts.merge!(:update_none => true) if options.update_none?
|
278
279
|
|
279
280
|
continue = trigger_module_auto_import(missing_components, required_components, module_opts)
|
280
281
|
return unless continue
|
@@ -184,6 +184,7 @@ module DTK::Client
|
|
184
184
|
desc "install NAMESPACE/REMOTE-SERVICE-MODULE-NAME [-y] [-i]", "Install remote service module into local environment. -y will automatically clone component modules. -i will ignore component import error."
|
185
185
|
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
186
186
|
method_option :ignore, :aliases => '-i', :type => :boolean, :default => false
|
187
|
+
method_option :update_none, :type => :boolean, :default => false
|
187
188
|
def install(context_params)
|
188
189
|
response = install_module_aux(context_params)
|
189
190
|
@@invalidate_map << :service_module if response && response.ok?
|
data/lib/dtk-client/version.rb
CHANGED
data/lib/util/console.rb
CHANGED
@@ -52,6 +52,30 @@ module DTK::Client
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
#
|
56
|
+
# Display confirmation prompt and repeat message until expected answer is given
|
57
|
+
# options should be sent as array ['all', 'none']
|
58
|
+
def confirmation_prompt_additional_options(message, options = [])
|
59
|
+
raise DTK::Client::DtkValidationError, "Options should be sent as array: ['all', 'none']" unless options.is_a?(Array)
|
60
|
+
|
61
|
+
# used to disable skip with ctrl+c
|
62
|
+
trap("INT", "SIG_IGN")
|
63
|
+
message += " (yes/no#{options.empty? ? '' : ('/' + options.join('/'))})"
|
64
|
+
|
65
|
+
while line = Readline.readline("#{message}: ", true)
|
66
|
+
if line.eql?("yes") || line.eql?("y")
|
67
|
+
trap("INT",false)
|
68
|
+
return true
|
69
|
+
elsif line.eql?("no") || line.eql?("n")
|
70
|
+
trap("INT",false)
|
71
|
+
return false
|
72
|
+
elsif options.include?(line)
|
73
|
+
trap("INT",false)
|
74
|
+
return line
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
55
79
|
# Loading output used to display waiting status
|
56
80
|
def wait_animation(message, time_seconds)
|
57
81
|
print message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.4
|
4
|
+
version: 0.7.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich PELAVIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -367,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
367
367
|
version: '0'
|
368
368
|
requirements: []
|
369
369
|
rubyforge_project:
|
370
|
-
rubygems_version: 2.4.
|
370
|
+
rubygems_version: 2.4.6
|
371
371
|
signing_key:
|
372
372
|
specification_version: 4
|
373
373
|
summary: DTK CLI client for DTK server interaction.
|