module Kernel

Public Instance Methods

dbg(data, label = '') click to toggle source
# File lib/nucleon_base.rb, line 173
def dbg(data, label = '')
  # Invocations of this function should NOT be committed to the project
  require 'pp'
  puts '>>----------------------'
  unless ! label || label.empty?
    puts label
    puts '---'
  end
  pp data
  puts '<<'
end
nucleon_locate(command) click to toggle source
# File lib/nucleon_base.rb, line 16
def nucleon_locate(command)
  command = command.to_s
  exts    = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{command}#{ext}")
      return exe if File.executable?(exe)
    end
  end
  return nil
end
nucleon_require(base_dir, name) click to toggle source
# File lib/nucleon_base.rb, line 30
def nucleon_require(base_dir, name)
  name = name.to_s
  top_level_file = File.join(base_dir, "#{name}.rb")
  
  require top_level_file if File.exists?(top_level_file) 
   
  directory = File.join(base_dir, name)
    
  if File.directory?(directory)
    Dir.glob(File.join(directory, '**', '*.rb')).each do |sub_file|
      require sub_file
    end
  end  
end