module DTK::Client::RemoteDependency
Public Class Methods
check_permission_warnings(response)
click to toggle source
# File lib/client/util/remote_dependency.rb, line 43 def check_permission_warnings(response) errors = '' dependency_warnings = response.data['dependency_warnings'] if dependency_warnings && !dependency_warnings.empty? no_permissions = dependency_warnings.select { |warning| warning['error_type'].eql?('no_permission') } unless no_permissions.empty? errors << "\n\nYou do not have (R) permissions for modules:\n\n" no_permissions.each { |np| errors << " - #{np['module_namespace']}:#{np['module_name']} (owner: #{np['module_owner']})\n" } errors << "\nPlease contact owner(s) to change permissions for those modules." end end raise Error::Usage, errors unless errors.empty? end
print_dependency_warnings(response, success_msg = nil, opts = {})
click to toggle source
# File lib/client/util/remote_dependency.rb, line 24 def print_dependency_warnings(response, success_msg = nil, opts = {}) are_there_warnings = false return are_there_warnings if response.nil? || response.data.nil? warnings = response.data['dependency_warnings'] if warnings && !warnings.empty? if opts[:ignore_permission_warnings] warnings.delete_if { |warning| warning['error_type'].eql?('no_permission') } return if warnings.empty? end print_out "Following warnings have been detected for current module by Repo Manager:\n" warnings.each { |w| print_out(" - #{w['message']}") } puts are_there_warnings = true end print_out success_msg, :green if success_msg are_there_warnings end
Private Class Methods
print_out(message, color=:yellow)
click to toggle source
# File lib/client/util/remote_dependency.rb, line 62 def print_out(message, color=:yellow) DTK::Client::OsUtil.print(message, color) end