dtk-client 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,7 +93,7 @@ module DTK::Client
93
93
  method_option :security_group, :type => :string, :aliases => '--security-groups'
94
94
  def create_target_ec2_classic(context_params)
95
95
  option_list = [:provider!, :region!, :keypair, :security_group]
96
- response = Common::CreateTarget.new(self,context_params).execute(:ec2_classic,option_list)
96
+ response = Common::CreateTarget.new(self, context_params).execute(:ec2_classic,option_list)
97
97
  @@invalidate_map << :target
98
98
  response
99
99
  end
@@ -106,7 +106,7 @@ module DTK::Client
106
106
  method_option :security_group, :type => :string, :aliases => '--security-groups'
107
107
  def create_target_ec2_vpc(context_params)
108
108
  option_list = [:provider!, :subnet!, :region!, :keypair, :security_group]
109
- response = Common::CreateTarget.new(self,context_params).execute(:ec2_vpc,option_list)
109
+ response = Common::CreateTarget.new(self, context_params).execute(:ec2_vpc,option_list)
110
110
  @@invalidate_map << :target
111
111
  response
112
112
  end
@@ -150,7 +150,7 @@ module DTK::Client
150
150
  publish_module_aux(context_params)
151
151
  end
152
152
 
153
- desc "TEST-MODULE-NAME/ID pull-dtkn [-n NAMESPACE] [--force]", "Update local test module from remote repository."
153
+ desc "TEST-MODULE-NAME/ID update [-n NAMESPACE] [--force]", "Update local test module from remote repository."
154
154
  method_option :namespace,:aliases => '-n',
155
155
  :type => :string,
156
156
  :banner => "NAMESPACE",
@@ -159,8 +159,8 @@ module DTK::Client
159
159
  :type => :boolean,
160
160
  :desc => "Force pull",
161
161
  :default => false
162
- def pull_dtkn(context_params)
163
- pull_dtkn_aux(context_params)
162
+ def update(context_params)
163
+ update_aux(context_params)
164
164
  end
165
165
 
166
166
  desc "TEST-MODULE-NAME/ID chmod PERMISSION-SELECTOR", "Update remote permissions e.g. ug+rw , user and group get RW permissions"
@@ -187,6 +187,14 @@ module DTK
187
187
  end
188
188
  end
189
189
 
190
+ def delete_branch(branch, opts = {})
191
+ @git_repo.branch(branch).delete
192
+ end
193
+
194
+ def checkout(branch, opts = {})
195
+ @git_repo.checkout(branch, opts)
196
+ end
197
+
190
198
  def push(remote_branch_ref, opts={})
191
199
  remote, remote_branch = remote_branch_ref.split('/')
192
200
  push_with_remote(remote, remote_branch, opts)
@@ -1,3 +1,3 @@
1
1
  module DtkClient
2
- VERSION="0.7.7"
2
+ VERSION="0.7.8"
3
3
  end
data/lib/util/console.rb CHANGED
@@ -76,6 +76,33 @@ module DTK::Client
76
76
  end
77
77
  end
78
78
 
79
+ # multiple choice
80
+ # e.g.
81
+ # Select version to delete:
82
+ # 1. base
83
+ # 2. 0.0.1
84
+ # 3. 0.0.2
85
+ # 4. all
86
+ # > 2
87
+ def confirmation_prompt_multiple_choice(message, opts_array)
88
+ indexes = opts_array.map{ |opt| "#{opts_array.index(opt)+1}" }
89
+
90
+ trap("INT", "SIG_IGN")
91
+
92
+ message << "\n"
93
+ opts_array.each {|opt| message << "#{opts_array.index(opt)+1}. #{opt}\n" }
94
+ message << "> "
95
+
96
+ while line = Readline.readline("#{message}", true)
97
+ if indexes.include?(line)
98
+ trap("INT",false)
99
+ return opts_array[line.to_i-1]
100
+ elsif line.eql?('exit')
101
+ return nil
102
+ end
103
+ end
104
+ end
105
+
79
106
  # Loading output used to display waiting status
80
107
  def wait_animation(message, time_seconds)
81
108
  print message
data/lib/util/os_util.rb CHANGED
@@ -127,9 +127,10 @@ module DTK
127
127
  end
128
128
 
129
129
  def module_version_locations(module_type,module_name,version=nil,opts={})
130
- base_path = module_location_parts(module_type,module_name,version,opts).first
131
- module_versions = Dir.entries(base_path).select{|a| a.match(/^#{module_name}-\d.\d.\d$/)}
132
- module_versions.map{|version|"#{base_path}/#{version}"}
130
+ base_path, namespace, name = module_location_parts(module_type,module_name,version,opts) #.first
131
+ namespace_path = "#{base_path}/#{namespace}"
132
+ module_versions = Dir.entries(namespace_path).select{|a| a.match(/^#{name}-\d{1,2}.\d{1,2}.\d{1,2}$/)}
133
+ module_versions.map{ |version|"#{namespace_path}/#{version}" }
133
134
  end
134
135
 
135
136
  def module_clone_location(module_type)
@@ -33,14 +33,24 @@ module DTK
33
33
  if dependency_warnings && !dependency_warnings.empty?
34
34
  no_permissions = dependency_warnings.select { |warning| warning['error_type'].eql?('no_permission') }
35
35
 
36
- errors << "\n\nYou do not have (R) permissions for modules:\n\n"
37
- no_permissions.each { |np| errors << " - #{np['module_namespace']}:#{np['module_name']} (owner: #{np['module_owner']})\n" }
38
- errors << "\nPlease contact owner(s) to change permissions for those modules."
36
+ unless no_permissions.empty?
37
+ errors << "\n\nYou do not have (R) permissions for modules:\n\n"
38
+ no_permissions.each { |np| errors << " - #{np['module_namespace']}:#{np['module_name']} (owner: #{np['module_owner']})\n" }
39
+ errors << "\nPlease contact owner(s) to change permissions for those modules."
40
+ end
39
41
  end
40
42
 
41
43
  raise DtkError, errors unless errors.empty?
42
44
  end
43
45
 
46
+ # check if all dependent modules are frozen; if they are don't display prompt for update
47
+ def check_for_frozen_modules(required_modules)
48
+ return true if required_modules.nil? || required_modules.empty?
49
+
50
+ modules_to_update = required_modules.select{ |md| (md['frozen'].nil? || md['frozen'] == false)}
51
+ return modules_to_update.empty?
52
+ end
53
+
44
54
  def module_ref_content(location)
45
55
  abs_location = File.join(location, MODULE_REF_FILE)
46
56
  File.exists?(abs_location) ? File.read(abs_location) : nil
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.7
4
+ version: 0.7.8
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-18 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.2.8
131
+ version: 1.2.9
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.2.8
138
+ version: 1.2.9
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: colorize
141
141
  requirement: !ruby/object:Gem::Requirement