Class: ScriptRunner::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/script-runner/main.rb

Instance Method Summary collapse

Instance Method Details

#run(paths, env_vars, error_handler = nil, &block) ⇒ Object

Run a set of scripts

Note: non executable files are skipped and a warning is sent to the console



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/script-runner/main.rb', line 13

def run( paths, env_vars, error_handler = nil, &block)
  set_env(env_vars)
  all_paths = all_files(paths).select{ |p| File.file? p }
  runnable = all_paths.select{ |p| File.executable? p }
  non_runnable = all_paths - runnable

  non_runnable.each{ |nr|
    puts "warning: #{nr} is not runnable - skipping"
  }

  all_paths.each{ |p|
    exec(p, error_handler, &block)
  }
end