class Scintilla::Runnable

Attributes

file_name[RW]

Public Instance Methods

do_the_stuff() click to toggle source
# File lib/scintilla/runnable.rb, line 22
def do_the_stuff
  raise 'Implement this in every Scintilla::Runner subclass...'
end
run() click to toggle source

Runs the script, unless already ran.

@return [<Scintilla::ScintillaScript>] the created ScintillaScript on DB, only if

script has ran successfully.
# File lib/scintilla/runnable.rb, line 12
def run
  if ScintillaScript.exists?(filename: file_name)
    puts "#{file_name} already ran, skipping..."
  else
    puts "Running #{file_name}..."
    do_the_stuff
    ScintillaScript.create(filename: file_name, ran_at: Time.zone.now)
  end
end