Sha256: 98cec54e9c2c0e42aa92d7dbf1acf18832fab9b3b1f47984dd6c75a359a093fd

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require_relative "teuton/application"

module Teuton
  def self.create(path_to_new_dir)
    require_relative "teuton/skeleton"
    Skeleton.create(path_to_new_dir)
  end

  def self.run(projectpath, options = {})
    Application.instance.add_input_params(projectpath, options)
    require_dsl_and_script("teuton/case_manager/dsl") # Define DSL keywords
  end

  def self.readme(projectpath, options = {})
    # Create Readme file for a teuton test
    Application.instance.add_input_params(projectpath, options)
    require_dsl_and_script("teuton/readme/readme") # Define DSL keywords

    app = Application.instance
    readme = Readme.new(app.script_path, app.config_path)
    readme.show
  end

  def self.check(projectpath, options = {})
    Application.instance.add_input_params(projectpath, options)
    require_dsl_and_script("teuton/check/laboratory") # Define DSL keywords

    app = Application.instance
    lab = Laboratory.new(app.script_path, app.config_path)
    if options[:onlyconfig]
      lab.show_onlyconfig
    else
      lab.show
    end
  end

  private_class_method def self.require_dsl_and_script(dslpath)
    app = Application.instance
    require_relative dslpath
    begin
      require_relative app.script_path
    rescue
      warn e.to_s
      warn Rainbow.new("[FAIL ] Reading file #{app.script_path}").red
      warn Rainbow.new("[ERROR] Syntax Error!").red
      exit 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teuton-2.5.0 lib/teuton.rb