Class: Ki::VersionStatus

Inherits:
Object show all
Defined in:
lib/cmd/version_cmd.rb

Overview

Sets status for version

Instance Method Summary collapse

Instance Method Details

#execute(ctx, args) ⇒ Object



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/cmd/version_cmd.rb', line 296

def execute(ctx, args)
  @repository = "local"
  command = args.delete_at(0)
  case command
    when "add"
      version, key_value, *rest = args
      key, value = key_value.split("=")
      flags = rest.to_h("=")
      repository = ctx.ki_home.repository(@repository)
      repository.version(version).statuses.add_status(key, value, flags)
    when "order"
      component, key, values_str = args
      repository = ctx.ki_home.repository(@repository)
      repository.component(component).status_info.edit_data do |info|
        info.cached_data[key]=values_str.split(",")
      end
    else
      raise "Not supported '#{command}'"
  end
end

#helpObject



321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/cmd/version_cmd.rb', line 321

def help
  <<EOF
"#{shell_command}" sets status values to versions and sets status value order to component.

Status value order is used to determine which statuses match version queries:

my/component:maturity>alpha

### Examples

#{shell_command} add my/component/1.2.3 Smoke=Green action=path/123
#{shell_command} order my/component maturity alpha,beta,gamma
EOF
end

#summaryObject



317
318
319
# File 'lib/cmd/version_cmd.rb', line 317

def summary
  "Add status values to version"
end