Module: FileUtils

Defined in:
lib/sevgi/binaries/rake.rb

Overview

Extends FileUtils with Sevgi script helpers for Rake tasks.

Instance Method Summary collapse

Instance Method Details

#sevgi(file, *args, **kwargs) ⇒ Sevgi::Executor::Scope?

Thin DSL wrapper to call a script without spawning a shell.

The script receives positional arguments through ARGA and keyword arguments through ARGH.

Examples:

Run a Sevgi script from a Rake task

sevgi "drawings/card", "front", theme: :dark

Parameters:

  • file (String)

    Sevgi script file, with or without .sevgi extension

  • args (Array)

    positional arguments exposed to the script as ARGA

  • kwargs (Hash)

    keyword arguments exposed to the script as ARGH

Returns:

Raises:

  • (Sevgi::ArgumentError)

    when the script file cannot be found

See Also:



20
21
22
23
24
25
26
27
# File 'lib/sevgi/binaries/rake.rb', line 20

def sevgi(file, *args, **kwargs)
  Sevgi::Executor.execute_file(Sevgi::F.existing!(file, [Sevgi::EXTENSION])) do
    extend(Sevgi)

    const_set(:ARGA, args).freeze
    const_set(:ARGH, kwargs).freeze
  end
end