Module: BugHunter

Defined in:
lib/bug_hunter.rb,
lib/bug_hunter/app.rb,
lib/bug_hunter/config.rb,
lib/bug_hunter/models.rb,
lib/bug_hunter/ui_helper.rb,
lib/bug_hunter/middleware.rb,
lib/bug_hunter/routes_helper.rb

Defined Under Namespace

Modules: RoutesHelper, UiHelper Classes: App, Error, Middleware, Project

Class Method Summary collapse

Class Method Details

.appObject



27
28
29
# File 'lib/bug_hunter.rb', line 27

def self.app
  BugHunter::App
end

.configObject



6
7
8
# File 'lib/bug_hunter/config.rb', line 6

def self.config
  @config ||= YAML.load_file(self.config_path)
end

.config_pathObject



2
3
4
# File 'lib/bug_hunter/config.rb', line 2

def self.config_path
  Dir.home+"/.bughunterrc"
end

.connectObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bug_hunter.rb', line 31

def self.connect
  return unless Mongoid.config.databases.empty?

  ENV["RACK_ENV"] ||= ENV["RAILS_ENV"]
  if !ENV["RACK_ENV"]
    raise ArgumentError, "please define the env var RACK_ENV"
  end

  if File.exist?("/etc/mongoid.yml")
    Mongoid.load("/etc/mongoid.yml")
  elsif File.exist?("config/mongoid.yml")
    Mongoid.load!("config/mongoid.yml")
  elsif File.exist?("mongoid.yml")
    Mongoid.load!("mongoid.yml")
  else
    raise ArgumentError, "/etc/mongoid.yml, ./config/mongoid.yml or ./mongoid.yml were not found"
  end
end