Class: LanguageConfigParser
- Inherits:
-
Object
- Object
- LanguageConfigParser
- Defined in:
- lib/hiptest-publisher/options_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #filtered_group_names ⇒ Object
- #group_names ⇒ Object
- #include_group?(group_name) ⇒ Boolean
-
#initialize(cli_options, language_config_path = nil) ⇒ LanguageConfigParser
constructor
A new instance of LanguageConfigParser.
- #language_group_configs ⇒ Object
- #name_action_word(name) ⇒ Object
Constructor Details
#initialize(cli_options, language_config_path = nil) ⇒ LanguageConfigParser
Returns a new instance of LanguageConfigParser.
520 521 522 523 524 |
# File 'lib/hiptest-publisher/options_parser.rb', line 520 def initialize(, language_config_path = nil) @cli_options = language_config_path ||= LanguageConfigParser.config_path_for() @config = ParseConfig.new(language_config_path) end |
Class Method Details
.config_path_for(cli_options) ⇒ Object
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/hiptest-publisher/options_parser.rb', line 526 def self.config_path_for() config_name = if .framework.empty? "#{.language}.conf" else "#{.language}-#{.framework}.conf" end config_path = File.("#{hiptest_publisher_path}/lib/config/#{config_name.downcase}") if !File.file?(config_path) = "cannot find configuration file in \"#{hiptest_publisher_path}/lib/config\"" << " for language #{.language.inspect}" << " and framework #{.framework.inspect}" unless .framework.to_s.empty? raise ArgumentError.new() end File.(config_path) end |
Instance Method Details
#filtered_group_names ⇒ Object
548 549 550 551 552 553 554 |
# File 'lib/hiptest-publisher/options_parser.rb', line 548 def filtered_group_names if @cli_options.groups_to_keep group_names.select {|group_name| @cli_options.groups_to_keep.include?(group_name)} else group_names end end |
#group_names ⇒ Object
542 543 544 545 546 |
# File 'lib/hiptest-publisher/options_parser.rb', line 542 def group_names @config.groups.reject {|group_name| group_name.start_with?('_') } end |
#include_group?(group_name) ⇒ Boolean
556 557 558 |
# File 'lib/hiptest-publisher/options_parser.rb', line 556 def include_group?(group_name) filtered_group_names.include?(group_name) end |
#language_group_configs ⇒ Object
560 561 562 |
# File 'lib/hiptest-publisher/options_parser.rb', line 560 def language_group_configs filtered_group_names.map { |group_name| make_language_group_config(group_name) } end |
#name_action_word(name) ⇒ Object
564 565 566 |
# File 'lib/hiptest-publisher/options_parser.rb', line 564 def name_action_word(name) name.send(@config['actionwords']['naming_convention']) end |