Class: Sevgi::Test::Script Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sevgi/showcase/minitest/script.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Executable showcase script descriptor.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a script descriptor.

Parameters:

  • file (String)

    executable .sevgi file

Raises:

  • (Sevgi::ArgumentError)

    when the file is missing or not executable



17
# File 'lib/sevgi/showcase/minitest/script.rb', line 17

def initialize(file) = @file = ::File.expand_path(sanitize(file))

Instance Attribute Details

#fileString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns absolute script path.

Returns:

  • (String)

    absolute script path



11
12
13
# File 'lib/sevgi/showcase/minitest/script.rb', line 11

def file
  @file
end

Instance Method Details

#dirString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the script directory.

Returns:

  • (String)


21
# File 'lib/sevgi/showcase/minitest/script.rb', line 21

def dir = @dir ||= ::File.dirname(file)

#file!String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the script basename.

Returns:

  • (String)


25
# File 'lib/sevgi/showcase/minitest/script.rb', line 25

def file! = ::File.basename(file)

#nameString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the script name without extension.

Returns:

  • (String)


29
# File 'lib/sevgi/showcase/minitest/script.rb', line 29

def name = @name ||= ::File.basename(file, ".*")

#run(*args) ⇒ Sevgi::Test::Shell::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the script directly.

Parameters:

  • args (Array<String>)

    extra command arguments

Returns:



35
# File 'lib/sevgi/showcase/minitest/script.rb', line 35

def run(*) = Shell.run(file, *)

#run_passive(*args) ⇒ Sevgi::Test::Shell::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the script without writing Save output to files.

Parameters:

  • args (Array<String>)

    extra command arguments

Returns:



65
66
67
68
# File 'lib/sevgi/showcase/minitest/script.rb', line 65

def run_passive(*)
  warn("...#{name}")
  Shell.run("sevgi", "-r", "sevgi/showcase/passive", file, *)
end

#suiteString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the script suite name.

Returns:

  • (String)


39
# File 'lib/sevgi/showcase/minitest/script.rb', line 39

def suite = @suite ||= ::File.basename(dir)

#svgString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the expected SVG output path.

Returns:

  • (String)


47
# File 'lib/sevgi/showcase/minitest/script.rb', line 47

def svg = @svg ||= ::File.expand_path("#{dir}/#{name}.svg")

#svg!String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the expected SVG output basename.

Returns:

  • (String)


51
# File 'lib/sevgi/showcase/minitest/script.rb', line 51

def svg! = ::File.basename(svg)

#svg?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reports whether the expected SVG output exists.

Returns:

  • (Boolean)


43
# File 'lib/sevgi/showcase/minitest/script.rb', line 43

def svg? = ::File.exist?(svg)

#ymlString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the optional YAML metadata path.

Returns:

  • (String)


55
# File 'lib/sevgi/showcase/minitest/script.rb', line 55

def yml = @yml ||= ::File.expand_path("#{dir}/#{name}.yml")

#yml!String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the optional YAML metadata basename.

Returns:

  • (String)


59
# File 'lib/sevgi/showcase/minitest/script.rb', line 59

def yml! = ::File.basename(yml)