Module: DataPipe2

Defined in:
lib/jobs.rb,
lib/host.rb,
lib/datapipe2.rb,
lib/helper_functions.rb

Overview

DataPipe2 Helpers

Defined Under Namespace

Classes: DataPipe2lineError, EnvironmentVariableNotFoundError, Host, Job, Jobs

Class Method Summary collapse

Class Method Details

.get_env_var(name) ⇒ Object



17
18
19
20
# File 'lib/helper_functions.rb', line 17

def self.get_env_var(name)
  fail EnvironmentVariableNotFoundError, name if ENV[name].nil?
  ENV[name]
end

.get_fluid_db(env_name) ⇒ Object



22
23
24
25
26
# File 'lib/helper_functions.rb', line 22

def self.get_fluid_db(env_name)
  uri_string = get_env_var(env_name)
  log "uri: #{uri_string}", true
  FluidDb::Db(uri_string)
end

.log(string, verbose = false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/helper_functions.rb', line 5

def self.log(string, verbose = false)
  type = verbose ? 'VERB' : 'INFO'
  if !ENV['VERBOSE'].nil? || !verbose
    timestamp = Time.new.strftime('%Y-%m-%d %H:%M:%S')
    puts "[#{type}] #{timestamp} :: #{string}"
  end
end

.log_dsl(name, string, verbose = false) ⇒ Object



13
14
15
# File 'lib/helper_functions.rb', line 13

def self.log_dsl(name, string, verbose = false)
  log "name: #{name}, #{string}", verbose
end