Module: Project

Defined in:
lib/teuton/project/project.rb

Overview

Project functions invoked by CLI project tool

  • test
  • play
  • process_input_case_option
  • readme
  • require_dsl_and_script

Class Method Summary collapse

Class Method Details

.play(pathtofile, options) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/teuton/project/project.rb', line 26

def self.play(pathtofile, options)
  Application.instance.options.merge! options
  process_input_case_option
  NameFileFinder.find_filenames_for(pathtofile)
  NameFileFinder.puts_input_info_on_screen
  require_dsl_and_script('../case_manager/dsl') # Define DSL keywords
end

.process_input_case_option ⇒ Object



34
35
36
37
38
39
40
# File 'lib/teuton/project/project.rb', line 34

def self.process_input_case_option
  options = Application.instance.options
  unless options['case'].nil?
    a = options['case'].split(',')
    options['case'] = a.collect! { |i| i.to_i }
  end
end

.readme(pathtofile, options) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/teuton/project/project.rb', line 42

def self.readme(pathtofile, options)
  Application.instance.options.merge! options
  NameFileFinder.find_filenames_for(pathtofile)
  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) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/teuton/project/project.rb', line 52

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

.test(pathtofile, options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/teuton/project/project.rb', line 13

def self.test(pathtofile, options)
  Application.instance.options.merge! options
  NameFileFinder.find_filenames_for(pathtofile)
  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