Class: TeutonCommand

Inherits:
Thor
  • Object
show all
Defined in:
lib/teuton/command.rb,
lib/teuton/command/play.rb,
lib/teuton/command/test.rb,
lib/teuton/command/readme.rb,
lib/teuton/command/update.rb,
lib/teuton/command/version.rb

Overview

Class method Teuton#version

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *_args, &_block) ⇒ Object



12
13
14
# File 'lib/teuton/command.rb', line 12

def method_missing(method, *_args, &_block)
  play(method.to_s)
end

Instance Method Details

#create(path_to_new_dir) ⇒ Object

Command create new Teuton project



31
32
33
# File 'lib/teuton/command.rb', line 31

def create(path_to_new_dir)
  ProjectCreator.create(path_to_new_dir)
end

#play(path_to_rb_file) ⇒ Object

Execute Teuton test unit

Parameters:

  • path_to_rb_file (String) —

    Route to main rb Teuton file



34
35
36
# File 'lib/teuton/command/play.rb', line 34

def play(path_to_rb_file)
  Project.play(path_to_rb_file, options)
end

#readme(path_to_rb_file) ⇒ Object

Create README from teuton test

Parameters:

  • path_to_rb_file (String) —

    Route to main rb Teuton file



23
24
25
# File 'lib/teuton/command/readme.rb', line 23

def readme(path_to_rb_file)
  Project.readme(path_to_rb_file, options)
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/teuton/command.rb', line 16

def respond_to_missing?(method_name, include_private = false)
  super
end

#test(path_to_rb_file) ⇒ Object

Verify or test Teuton test units syntax

Parameters:

  • path_to_rb_file (String) —

    Route to main rb Teuton file



35
36
37
# File 'lib/teuton/command/test.rb', line 35

def test(path_to_rb_file)
  Project.test(path_to_rb_file, options)
end

#update ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/teuton/command/update.rb', line 16

def update
  dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..'))
  ok = system("cd #{dir} && git pull")
  if ok
    puts Rainbow('[ OK ] teuton update').green.bright
    exit(0)
  else
    puts Rainbow('[FAIL] teuton update').red.bright
    exit(1)
  end
end

#version ⇒ Object



9
10
11
12
# File 'lib/teuton/command/version.rb', line 9

def version
  print Rainbow(Application::NAME).bright.blue
  puts  ' (version ' + Rainbow(Application::VERSION).green + ')'
end