Module: TT

Extended by:
TT
Included in:
TT
Defined in:
lib/tt.rb

Constant Summary collapse

Version =
'0.0.1'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.homeObject



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/tt.rb', line 62

def TT.home
  home =
    catch :home do
      ["HOME", "USERPROFILE"].each do |key|
        throw(:home, ENV[key]) if ENV[key]
      end
      if ENV["HOMEDRIVE"] and ENV["HOMEPATH"]
        throw(:home, "#{ ENV['HOMEDRIVE'] }:#{ ENV['HOMEPATH'] }")
      end
      File.expand_path("~") rescue(File::ALT_SEPARATOR ? "C:/" : "/")
    end
  File.expand_path(home)
end

Instance Method Details

#dependenciesObject



17
18
19
20
21
22
23
# File 'lib/tt.rb', line 17

def dependencies
  {
    'main'    => [ 'main'    , ' >= 4.8.1' ] ,
    'map'     => [ 'map'     , ' >= 5.1.0' ] ,
    'chronic' => [ 'chronic' , ' >= 0.6.6' ]
  }
end

#libdir(*args, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/tt.rb', line 25

def libdir(*args, &block)
  @libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
  args.empty? ? @libdir : File.join(@libdir, *args)
ensure
  if block
    begin
      $LOAD_PATH.unshift(@libdir)
      block.call()
    ensure
      $LOAD_PATH.shift()
    end
  end
end

#load(*libs) ⇒ Object



39
40
41
42
# File 'lib/tt.rb', line 39

def load(*libs)
  libs = libs.join(' ').scan(/[^\s+]+/)
  TT.libdir{ libs.each{|lib| Kernel.load(lib) } }
end

#versionObject



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

def version
  TT::Version
end