Sha256: bc2d3008f759991e2fa20cd9c4ac72586f6508fed11eb3048a8ca1d98104cd06

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require "vault-tools/version"

require 'sinatra/base'
require 'scrolls'
require 'rack/ssl-enforcer'
require 'heroku-api'
require 'honeybadger'

Honeybadger.configure do |config|
  config.api_key = ENV['HONEYBADGER_API_KEY']
end

module Vault
  #require bundler and the proper gems for the ENV
  def self.require
    Kernel.require 'bundler'
    $stderr.puts "Loading #{ENV['RACK_ENV']} environment..."
    Bundler.require :default, ENV['RACK_ENV'].to_sym
  end

  # adds ./lib dir to the load path
  def self.load_path
    $stderr.puts "Adding './lib' to path..."
    $LOAD_PATH.unshift(File.expand_path('./lib'))
  end

  # sets TZ to UTC and Sequel timezone to :utc
  def self.set_timezones
    $stderr.puts "Setting timezones to UTC..."
    Sequel.default_timezone = :utc if defined? Sequel
    ENV['TZ'] = 'UTC'
  end

  def self.hack_time_class
    $stderr.puts "Modifying Time#to_s to use #iso8601..."
    # use send to call private method
    Time.send(:define_method, :to_s) do
      self.iso8601
    end
  end

  def self.override_global_config
    $stderr.puts "Set Config to Vault::Config..."
    Object.send(:remove_const, :Config)
    Object.const_set(:Config, Vault::Config)
  end

  # all in one go
  def self.setup
    self.require
    self.load_path
    self.set_timezones
    self.hack_time_class
    self.override_global_config
  end
end

require 'vault-tools/app'
require 'vault-tools/config'
require 'vault-tools/hid'
require 'vault-tools/log'
require 'vault-tools/product'
require 'vault-tools/sinatra_helpers/html_serializer'
require 'vault-tools/user'
require 'vault-tools/web'
require 'vault-tools/pipeline'
require 'vault-tools/text_processor'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vault-tools-0.4.3 lib/vault-tools.rb
vault-tools-0.4.2 lib/vault-tools.rb
vault-tools-0.4.1 lib/vault-tools.rb
vault-tools-0.4.0 lib/vault-tools.rb