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.

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



13
14
15
16
17
18
19
20
# File 'lib/sevgi/binaries/rake.rb', line 13

def sevgi(file, *args, **kwargs)
  Sevgi.execute_file(F.existing!(file, [EXTENSION])) do |mod|
    include(Sevgi)

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