module Project

Project functions invoked by CLI project tool

Public Class Methods

check(projectpath, options) click to toggle source

Check teuton test syntax @param projectpath (String) Path to teuton test @param options (Array) Array of input options

# File lib/teuton/project/project.rb, line 17
def self.check(projectpath, options)
  Application.instance.options.merge! options
  NameFileFinder.find_filenames_for(projectpath)
  NameFileFinder.puts_input_info_on_screen
  require_dsl_and_script('laboratory/laboratory') # Define DSL keywords

  app = Application.instance
  lab = Laboratory.new(app.script_path, app.config_path)
  # lab.show_requests if options[:r]
  lab.show_config if options[:c]
  lab.show_dsl unless options[:r] || options[:c]
end
play(projectpath, options) click to toggle source

Run test @param projectpath (String) Path to teuton test @param options (Array) Array of input options

# File lib/teuton/project/project.rb, line 34
def self.play(projectpath, options)
  Application.instance.options.merge! options
  process_input_options
  NameFileFinder.find_filenames_for(projectpath)
  NameFileFinder.puts_input_info_on_screen
  require_dsl_and_script('../case_manager/dsl') # Define DSL keywords
end
process_input_options() click to toggle source

Preprocess input options:

  • Convert input case options String to an Array of integers

  • Read color input option

# File lib/teuton/project/project.rb, line 46
def self.process_input_options
  options = Application.instance.options
  options['color'] = true if options['color'].nil?
  Rainbow.enabled = options['color']
  return if options['case'].nil?

  a = options['case'].split(',')
  options['case'] = a.collect!(&:to_i)
end
readme(projectpath, options) click to toggle source

Create Readme file for a test @param projectpath (String) Path to teuton test @param options (Array) Array of input options

# File lib/teuton/project/project.rb, line 60
def self.readme(projectpath, options)
  Application.instance.options.merge! options
  NameFileFinder.find_filenames_for(projectpath)
  require_dsl_and_script('readme/readme') # Define DSL keywords

  app = Application.instance
  readme = Readme.new(app.script_path, app.config_path)
  readme.show
end
require_dsl_and_script(dslpath) click to toggle source
# File lib/teuton/project/project.rb, line 70
def self.require_dsl_and_script(dslpath)
  app = Application.instance
  require_relative dslpath
  begin
    require_relative app.script_path
  rescue SyntaxError => e
    puts e.to_s
    puts Rainbow.new("[ERROR] SyntaxError into file #{app.script_path}").red
  end
end