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.
499 500 501 502 503 |
# File 'lib/hiptest-publisher/options_parser.rb', line 499 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
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/hiptest-publisher/options_parser.rb', line 505 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
527 528 529 530 531 532 533 |
# File 'lib/hiptest-publisher/options_parser.rb', line 527 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
521 522 523 524 525 |
# File 'lib/hiptest-publisher/options_parser.rb', line 521 def group_names @config.groups.reject {|group_name| group_name.start_with?('_') } end |
#include_group?(group_name) ⇒ Boolean
535 536 537 |
# File 'lib/hiptest-publisher/options_parser.rb', line 535 def include_group?(group_name) filtered_group_names.include?(group_name) end |
#language_group_configs ⇒ Object
539 540 541 |
# File 'lib/hiptest-publisher/options_parser.rb', line 539 def language_group_configs filtered_group_names.map { |group_name| make_language_group_config(group_name) } end |
#name_action_word(name) ⇒ Object
543 544 545 |
# File 'lib/hiptest-publisher/options_parser.rb', line 543 def name_action_word(name) name.send(@config['actionwords']['naming_convention']) end |