Class: LanguageConfigParser

Inherits:
Object
  • Object
show all
Defined in:
lib/hiptest-publisher/options_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LanguageConfigParser

Returns a new instance of LanguageConfigParser.



166
167
168
169
# File 'lib/hiptest-publisher/options_parser.rb', line 166

def initialize(options)
  @options = options
  @config = ParseConfig.new(find_config_file(options))
end

Instance Method Details

#actionword_render_contextObject



204
205
206
# File 'lib/hiptest-publisher/options_parser.rb', line 204

def actionword_render_context
  make_context('actionwords')
end

#aw_output_dirObject



196
197
198
# File 'lib/hiptest-publisher/options_parser.rb', line 196

def aw_output_dir
  "#{@options.output_directory}/#{@config['actionwords']['filename']}"
end

#find_config_file(options) ⇒ Object



171
172
173
174
175
176
# File 'lib/hiptest-publisher/options_parser.rb', line 171

def find_config_file(options)
  ["#{options.language}/#{options.framework}", "#{options.language}"].map do |p|
    path = "#{hiptest_publisher_path}/lib/templates/#{p}/output_config"
    path if File.file?(path)
  end.compact.first
end

#scenario_output_dir(scenario_name) ⇒ Object



188
189
190
# File 'lib/hiptest-publisher/options_parser.rb', line 188

def scenario_output_dir(scenario_name)
  "#{@options.output_directory}/#{scenario_output_file(scenario_name)}"
end

#scenario_output_file(scenario_name) ⇒ Object



178
179
180
181
182
183
184
185
186
# File 'lib/hiptest-publisher/options_parser.rb', line 178

def scenario_output_file(scenario_name)
  if make_context('tests').has_key? :class_name_convention
    scenario_name = scenario_name.send(make_context('tests')[:class_name_convention])
  else
    scenario_name = scenario_name.normalize
  end

  @config['tests']['scenario_filename'].gsub('%s', scenario_name)
end

#tests_output_dirObject



192
193
194
# File 'lib/hiptest-publisher/options_parser.rb', line 192

def tests_output_dir
  "#{@options.output_directory}/#{@config['tests']['filename']}"
end

#tests_render_contextObject



200
201
202
# File 'lib/hiptest-publisher/options_parser.rb', line 200

def tests_render_context
  make_context('tests')
end