Class: Sevgi::Showcase::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



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

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



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

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)


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

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)


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

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)


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

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

#run(*args) ⇒ Sevgi::Showcase::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:



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

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

#run_passive(*args) ⇒ Sevgi::Showcase::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:



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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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