Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (28 sloc) 0.787 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
require "rubygems"
require "bundler"

module Printer
  class Application
    def self.root(path = nil)
      @_root ||= File.expand_path(File.dirname(__FILE__))
      path ? File.join(@_root, path.to_s) : @_root
    end

    def self.views
      self.root 'app/views'
    end

    def self.env
      @_env ||= ENV['RACK_ENV'] || 'development'
    end

    def self.routes
      @_routes ||= eval(File.read('./conf/routes.rb'))
    end

    # Initialize the application
    def self.initialize!
      Mongoid.load! "#{self.root}/conf/mongoid.yml"
      Mongoid.logger = nil if self.env == 'production'
    end
  end
end

Bundler.require(:default, Printer::Application.env)

# Preload application classes
Dir['./app/**/*.rb'].each {|f| require f}
Dir['./lib/**/*.rb'].each {|f| require f}
Something went wrong with that request. Please try again.