Class: Inferno::CLI::Suite

Inherits:
Thor
  • Object
show all
Defined in:
lib/inferno/apps/cli/suite.rb

Instance Method Summary collapse

Instance Method Details

#describe(suite_id) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/inferno/apps/cli/suite.rb', line 28

def describe(suite_id)
  ENV['NO_DB'] = 'true'

  require_relative '../../../inferno'

  Inferno::Application.start(:suites)

  suite = Inferno::Repositories::TestSuites.new.find(suite_id)

  if suite.blank?
    message = "No suite found with id `#{suite_id}`. Run `inferno suites` to see a list of available suites"

    puts TTY::Markdown.parse(message)
    return
  end

  description = ''
  description += "# #{suite.title}\n"
  description += "#{suite.description}\n" if suite.description

  if suite.suite_options.present?
    description += "***\n\n"
    description += "# Suite Options\n\n"
    suite.suite_options.each do |option|
      description += "* `#{option.id}`: #{option.title}\n"
      option.list_options.each do |list_option|
        description += "  * `#{list_option[:value]}`: #{list_option[:label]}\n"
      end
    end
  end

  puts TTY::Markdown.parse(description)
end

#input_template(suite_id) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/inferno/apps/cli/suite.rb', line 16

def input_template(suite_id)
  ENV['NO_DB'] = 'true'

  require_relative '../../../inferno'

  SuiteInputTemplate.new.run(suite_id, options)
end

#lock_short_ids(suite_id) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/inferno/apps/cli/suite.rb', line 66

def lock_short_ids(suite_id)
  ENV['NO_DB'] = 'true'

  require_relative '../../../inferno'

  Inferno::Application.start(:suites)

  suite = Inferno::Repositories::TestSuites.new.find(suite_id)

  if suite.blank?
    message = "No suite found with id `#{suite_id}`. Run `inferno suites` to see a list of available suites"

    puts TTY::Markdown.parse(message)
    return
  end

  File.write(suite.short_id_file_path, suite.current_short_id_map.to_yaml)
  puts "Short ID map saved to #{suite.short_id_file_path}"
end