Class: CTT::Cli::Configs

Inherits:
Object show all
Defined in:
lib/cli/configs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigs

Returns a new instance of Configs.



9
10
11
12
# File 'lib/cli/configs.rb', line 9

def initialize
  @suites = Suites.new.suites
  load_commands
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



7
8
9
# File 'lib/cli/configs.rb', line 7

def commands
  @commands
end

#configsObject

Returns the value of attribute configs.



5
6
7
# File 'lib/cli/configs.rb', line 5

def configs
  @configs
end

#suitesObject

Returns the value of attribute suites.



5
6
7
# File 'lib/cli/configs.rb', line 5

def suites
  @suites
end

Instance Method Details

#load_commandsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cli/configs.rb', line 14

def load_commands
  @commands = STATIC_COMMANDS.dup
  commands = {}
  @suites["suites"].each do |suite, _|
    # for each suite, three commands should be added.
    # - configure suite
    # - suite [subcommand]
    # - list suite
    commands[suite] = {"usage" => "#{suite} [subcommand]",
                       "desc"  => "run default test for test suite: #{suite}," +
                                  " if no subcommand is specified"}

    key = "list #{suite}"
    commands[key] = {"usage" => key,
                     "desc"  => "list all available subcommands for test suite: #{suite}"}
  end

  @commands.merge!(commands)
end