Module: Integra

Defined in:
lib/integra.rb,
lib/integra/config.rb,
lib/integra/logger.rb,
lib/integra/version.rb,
lib/integra/commands.rb

Defined Under Namespace

Modules: Commands, Drivers Classes: Config, Logger

Constant Summary collapse

NAME =
'integra'
VERSION =
"0.0.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



11
12
13
# File 'lib/integra.rb', line 11

def config
  @config
end

.loggerObject

Returns the value of attribute logger.



11
12
13
# File 'lib/integra.rb', line 11

def logger
  @logger
end

Class Method Details

.command!(options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/integra.rb', line 14

def self.command!(options={})
  @logger = Logger.new
  @config = Config.new(options)

  #
  # When user enters with a path or file as argument, just run it.
  #
  unless Commands.respond_to?(options[:command])
    options[:args] << options[:command]
    options[:command] = :run
  end

  Commands.send(options[:command], options)
end

.gem_libdirObject

Return a directory with the project libraries.



30
31
32
33
34
35
# File 'lib/integra.rb', line 30

def self.gem_libdir
  t = ["#{File.dirname(File.expand_path($0))}/../lib/#{Integra::NAME}",
       "#{Gem.dir}/gems/#{Integra::NAME}-#{Integra::VERSION}/lib/#{Integra::NAME}"]
  t.each {|i| return i if File.readable?(i) }
  raise "both paths are invalid: #{t}"
end