class MiGA::MiGA

Generic class used to handle system-wide information and methods, and parent of all other MiGA::* classes.

Public Class Methods

CITATION() click to toggle source

Reference of MiGA

# File lib/miga/version.rb, line 58
def self.CITATION
  CITATION
end
DEBUG(*args) click to toggle source

Send debug message

# File lib/miga/common/base.rb, line 31
def DEBUG(*args)
  $stderr.puts(*args) if @@DEBUG
  $stderr.puts(
    caller.map { |v| v.gsub(/^/, '     ') }.join("\n")
  ) if @@DEBUG_TRACE
end
DEBUG_OFF() click to toggle source

Turn off debugging

# File lib/miga/common/base.rb, line 12
def DEBUG_OFF
  @@DEBUG = false
end
DEBUG_ON() click to toggle source

Turn on debugging

# File lib/miga/common/base.rb, line 6
def DEBUG_ON
  @@DEBUG = true
end
DEBUG_TRACE_OFF() click to toggle source

Turn off debug tracing (but not debugging)

# File lib/miga/common/base.rb, line 25
def DEBUG_TRACE_OFF
  @@DEBUG_TRACE = false
end
DEBUG_TRACE_ON() click to toggle source

Turn on debug tracing (and debugging)

# File lib/miga/common/base.rb, line 18
def DEBUG_TRACE_ON
  @@DEBUG_TRACE = true
  DEBUG_ON()
end
FULL_VERSION() click to toggle source

Complete version as string

# File lib/miga/version.rb, line 40
def self.FULL_VERSION
  VERSION.join('.')
end
LONG_VERSION() click to toggle source

Complete version with nickname and date as string

# File lib/miga/version.rb, line 46
def self.LONG_VERSION
  "MiGA #{VERSION.join('.')} - #{VERSION_NAME} - #{VERSION_DATE}"
end
VERSION() click to toggle source

Major.minor version as Float

# File lib/miga/version.rb, line 34
def self.VERSION
  VERSION[0]
end
VERSION_DATE() click to toggle source

Date of the current gem release

# File lib/miga/version.rb, line 52
def self.VERSION_DATE
  VERSION_DATE
end
initialized?() click to toggle source

Has MiGA been initialized?

# File lib/miga/common.rb, line 23
def self.initialized?
  File.exist?(File.expand_path('.miga_rc', ENV['MIGA_HOME'])) and
    File.exist?(File.expand_path('.miga_daemon.json', ENV['MIGA_HOME']))
end

Public Instance Methods

result_files_exist?(base, ext) click to toggle source

Check if the result files exist with base name (String) followed by the ext values (Array of String).

# File lib/miga/common.rb, line 31
def result_files_exist?(base, ext)
  ext = [ext] unless ext.is_a? Array
  ext.all? do |f|
    File.exist?(base + f) or File.exist?("#{base}#{f}.gz")
  end
end
say(*par) click to toggle source

Print par ensuring new line at the end. Date/time-stamp each line. If the first parameter is IO, the output is sent there, otherwise it's sent to +$stderr+

# File lib/miga/common.rb, line 43
def say(*par)
  io = par.first.is_a?(IO) ? par.shift : $stderr
  io.puts(*par.map { |i| "[#{Time.now}] #{i}" })
end