Module: MyScripts

Defined in:
lib/my_scripts.rb,
lib/my_scripts/cli.rb,
lib/my_scripts/script.rb,
lib/my_scripts/scripts/bon.rb,
lib/my_scripts/scripts/jew.rb,
lib/my_scripts/scripts/ansi.rb,
lib/my_scripts/scripts/citi.rb,
lib/my_scripts/scripts/msdn.rb,
lib/my_scripts/scripts/wake.rb,
lib/my_scripts/scripts/gitto.rb,
lib/my_scripts/scripts/rabbit.rb,
lib/my_scripts/scripts/msdn/msdn_helper.rb

Overview

Top level namespace

Defined Under Namespace

Modules: MsdnHelper Classes: Ansi, Bon, CLI, Citi, Gitto, Jew, Msdn, Rabbit, Script, Wake

Constant Summary collapse

VERSION_FILE =

:nodoc:

Pathname.new(__FILE__).dirname + '../VERSION'
VERSION =
VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil

Class Method Summary collapse

Class Method Details

.require_libs(libs, opts = {}) ⇒ Object

Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs. Accepts following options:

:file

Lib(s) required relative to this file - defaults to __FILE__

:dir

Required lib(s) located under this dir name - defaults to gem name



14
15
16
17
18
19
20
# File 'lib/my_scripts.rb', line 14

def self.require_libs( libs, opts={} )
  file = Pathname.new(opts[:file] || __FILE__)
  [libs].flatten.each do |lib|
    name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
    Pathname.glob(name.to_s).sort.each {|rb| require rb}
  end
end