Class: DTK::Client::TestModule

Inherits:
CommandBaseThor show all
Defined in:
lib/commands/thor/test_module.rb

Constant Summary collapse

PushCatalogs =
["origin", "dtkn"]

Constants inherited from CommandBaseThor

CommandBaseThor::ALT_IDENTIFIER_SEPARATOR, CommandBaseThor::EXTENDED_TIMEOUT, CommandBaseThor::HIDE_FROM_BASE_CONTEXT, CommandBaseThor::TIME_DIFF

Constants included from CommandHelperMixin

CommandHelperMixin::Loaded

Constants included from ReparseMixin

ReparseMixin::YamlDTKMetaFiles

Constants included from Poller

Poller::PERIOD_WAIT_TIME

Constants inherited from Thor

Thor::HIDE_FROM_BASE_CONTEXT_HELP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBaseThor

action_on_revalidation_response, basename, create_context_arguments, execute_from_cli, generate_cached_id, get_cached_response, get_identifiers, get_usage_info, #help, #initialize, invalidate_entities, invisible_context_list, list_method_supported?, task_names, tiered_task_names, valid_id?

Methods included from CommandBase

#get, #get_connection, handle_argument_error, #post, #post_file, #rest_url, #rotate_args

Methods included from TaskStatusMixin

#list_task_info_aux, #task_status_aux, #task_status_stream

Methods included from Console

confirmation_prompt, confirmation_prompt_additional_options, confirmation_prompt_multiple_choice, confirmation_prompt_simple, unix_shell, wait_animation

Methods included from CommandHelperMixin

#Helper

Methods included from ReparseMixin

#reparse_aux

Methods included from PushCloneChangesMixin

#push_clone_changes_aux

Methods included from CommandBaseThor::CommonOptionDefs::ClassMixin

#version_method_option

Methods included from Poller

#poller_response, #print_response, #resolve_type

Methods inherited from Thor

get_alternative_identifiers, help, match_help_item_changes, overriden_help, printable_tasks, replace_if_matched!, set_context

Constructor Details

This class inherits a constructor from DTK::Client::CommandBaseThor

Class Method Details

.all_childrenObject

this includes children of children - has to be sorted by n-level access



34
35
36
37
38
# File 'lib/commands/thor/test_module.rb', line 34

def self.all_children()
  # [:"component-template", :attribute] # Amar: attribute context commented out per Rich suggeston
  # [:"component-template"]
  [:component]
end

.multi_context_childrenObject



40
41
42
# File 'lib/commands/thor/test_module.rb', line 40

def self.multi_context_children()
  [[:component], [:remotes], [:component, :remotes]]
end

.override_allowed_methodsObject



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/commands/thor/test_module.rb', line 56

def self.override_allowed_methods()
  return DTK::Shell::OverrideTasks.new(
    {
      :command_only => {
        :remotes => [
          ["push-remote",  "push-remote [REMOTE-NAME] [--force]",  "# Push local changes to remote git repository"],
          ["list-remotes",  "list-remotes",  "# List git remotes for given module"],
          ["add-remote",    "add-remote REMOTE-NAME REMOTE-URL", "# Add git remote for given module"],
          ["remove-remote", "remove-remote REPO-NAME [-y]", "# Remove git remote for given module"]            ]
      }
  })
end

.valid_child?(name_of_sub_context) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/commands/thor/test_module.rb', line 44

def self.valid_child?(name_of_sub_context)
  return TestModule.valid_children().include?(name_of_sub_context.to_sym)
end

.valid_childrenObject



28
29
30
31
# File 'lib/commands/thor/test_module.rb', line 28

def self.valid_children()
  # [:"component-template"]
  [:component, :remotes]
end

.validation_list(context_params) ⇒ Object



48
49
50
# File 'lib/commands/thor/test_module.rb', line 48

def self.validation_list(context_params)
  get_cached_response(:test_module, "test_module/list", {})
end

.whoamiObject



52
53
54
# File 'lib/commands/thor/test_module.rb', line 52

def self.whoami()
  return :test_module, "test_module/list", nil
end

Instance Method Details

#add_collaborators(context_params) ⇒ Object



205
206
207
# File 'lib/commands/thor/test_module.rb', line 205

def add_collaborators(context_params)
  add_collaborators_module_aux(context_params)
end

#add_remote(context_params) ⇒ Object



285
286
287
# File 'lib/commands/thor/test_module.rb', line 285

def add_remote(context_params)
  remote_add_aux(context_params)
end

#chmod(context_params) ⇒ Object



185
186
187
# File 'lib/commands/thor/test_module.rb', line 185

def chmod(context_params)
  chmod_module_aux(context_params)
end

#clone(context_params, internal_trigger = false) ⇒ Object



225
226
227
# File 'lib/commands/thor/test_module.rb', line 225

def clone(context_params, internal_trigger=false)
  clone_module_aux(context_params, internal_trigger)
end

#create(context_params) ⇒ Object



154
155
156
# File 'lib/commands/thor/test_module.rb', line 154

def create(context_params)
  create_test_module_aux(context_params)
end

#delete(context_params, method_opts = {}) ⇒ Object



72
73
74
75
76
77
# File 'lib/commands/thor/test_module.rb', line 72

def delete(context_params,method_opts={})
  response = delete_module_aux(context_params, method_opts)
  @@invalidate_map << :test_module if response && response.ok?

  response
end

#delete_all(context_params) ⇒ Object



300
301
302
303
304
305
306
307
# File 'lib/commands/thor/test_module.rb', line 300

def delete_all(context_params)
  return unless Console.confirmation_prompt("This will DELETE ALL test modules, are you sure"+'?')
  response = list(context_params)

  response.data().each do |e|
    run_shell_command("delete #{e['display_name']} -y -p")
  end
end

#delete_from_catalog(context_params) ⇒ Object



161
162
163
# File 'lib/commands/thor/test_module.rb', line 161

def delete_from_catalog(context_params)
  delete_from_catalog_aux(context_params)
end

#edit(context_params) ⇒ Object



230
231
232
# File 'lib/commands/thor/test_module.rb', line 230

def edit(context_params)
  edit_module_aux(context_params)
end

#import(context_params) ⇒ Object



124
125
126
127
128
129
# File 'lib/commands/thor/test_module.rb', line 124

def import(context_params)
  response = import_module_aux(context_params)
  @@invalidate_map << :test_module

  response
end

#import_git(context_params) ⇒ Object



135
136
137
138
139
# File 'lib/commands/thor/test_module.rb', line 135

def import_git(context_params)
  response = import_git_module_aux(context_params)
  @@invalidate_map << :test_module
  response
end

#install(context_params) ⇒ Object



146
147
148
149
150
151
# File 'lib/commands/thor/test_module.rb', line 146

def install(context_params)
  response = install_module_aux(context_params)
  @@invalidate_map << :test_module if response && response.ok?

  response
end

#list(context_params) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/commands/thor/test_module.rb', line 91

def list(context_params)
  return module_info_about(context_params, :components, :component) if context_params.is_there_command?(:"component")

  forwarded_remote = context_params.get_forwarded_options()["remote"] if context_params.get_forwarded_options()
  remote           = options.remote? || forwarded_remote
  action           = (remote ? "list_remote" : "list")

  post_body        = (remote ? { :rsa_pub_key => SSHUtil.rsa_pub_key_content() } : {:detail_to_include => ["remotes"]})
  post_body[:diff] = options.diff? ? options.diff : {}
  post_body.merge!(:module_namespace => options.namespace)

  response         = post rest_url("test_module/#{action}"),post_body

  return response unless response.ok?
  response.render_table()
end

#list_attributes(context_params) ⇒ Object



114
115
116
# File 'lib/commands/thor/test_module.rb', line 114

def list_attributes(context_params)
  module_info_about(context_params, :attributes, :attribute_without_link)
end

#list_collaborators(context_params) ⇒ Object



219
220
221
# File 'lib/commands/thor/test_module.rb', line 219

def list_collaborators(context_params)
  list_collaborators_module_aux(context_params)
end

#list_components(context_params) ⇒ Object



109
110
111
# File 'lib/commands/thor/test_module.rb', line 109

def list_components(context_params)
  module_info_about(context_params, :components, :component)
end

#list_diffs(context_params) ⇒ Object



266
267
268
269
# File 'lib/commands/thor/test_module.rb', line 266

def list_diffs(context_params)
  list_remote_module_diffs(context_params)
  # list_diffs_module_aux(context_params)
end

#list_instances(context_params) ⇒ Object



119
120
121
# File 'lib/commands/thor/test_module.rb', line 119

def list_instances(context_params)
  module_info_about(context_params, :instances, :component)
end

#list_remotes(context_params) ⇒ Object



280
281
282
# File 'lib/commands/thor/test_module.rb', line 280

def list_remotes(context_params)
  remote_list_aux(context_params)
end

#make_private(context_params) ⇒ Object



197
198
199
# File 'lib/commands/thor/test_module.rb', line 197

def make_private(context_params)
  make_private_module_aux(context_params)
end

#make_public(context_params) ⇒ Object



191
192
193
# File 'lib/commands/thor/test_module.rb', line 191

def make_public(context_params)
  make_public_module_aux(context_params)
end

#publish(context_params) ⇒ Object



166
167
168
# File 'lib/commands/thor/test_module.rb', line 166

def publish(context_params)
  publish_module_aux(context_params)
end

#push(context_params, internal_trigger = false) ⇒ Object



244
245
246
# File 'lib/commands/thor/test_module.rb', line 244

def push(context_params, internal_trigger=false)
  push_module_aux(context_params, internal_trigger)
end

#push_dtkn(context_params, internal_trigger = false) ⇒ Object



259
260
261
# File 'lib/commands/thor/test_module.rb', line 259

def push_dtkn(context_params, internal_trigger=false)
  push_dtkn_module_aux(context_params, internal_trigger)
end

#push_remote(context_params) ⇒ Object



275
276
277
# File 'lib/commands/thor/test_module.rb', line 275

def push_remote(context_params)
  push_remote_module_aux(context_params)
end

#remove_collaborators(context_params) ⇒ Object



213
214
215
# File 'lib/commands/thor/test_module.rb', line 213

def remove_collaborators(context_params)
  remove_collaborators_module_aux(context_params)
end

#remove_remote(context_params) ⇒ Object



291
292
293
# File 'lib/commands/thor/test_module.rb', line 291

def remove_remote(context_params)
  remote_remove_aux(context_params)
end

#set_attribute(context_params) ⇒ Object



80
81
82
# File 'lib/commands/thor/test_module.rb', line 80

def set_attribute(context_params)
  set_attribute_module_aux(context_params)
end

#update(context_params) ⇒ Object



179
180
181
# File 'lib/commands/thor/test_module.rb', line 179

def update(context_params)
  update_aux(context_params)
end