Sha256: ea23bb0c7596331f5953f266e0491424d49d685351422eb853effaa982ebf25a

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'rubygems'
require 'sinatra'
require 'forwardable'
require File.join( File.dirname(__FILE__), 'mongo3.rb' )
require 'mongo'
gem 'agnostic-will_paginate'
require 'will_paginate'

set :public, File.join( File.dirname(__FILE__), %w[public] )
set :views , File.join( File.dirname(__FILE__), %w[views] )

# -----------------------------------------------------------------------------
# Configuration
configure do
  Mongo3.load_all_libs_relative_to(__FILE__, 'helpers' )
  Mongo3.load_all_libs_relative_to(__FILE__, 'controllers' )
  
  set :sessions  , true
  set :connection, Mongo3::Connection.new( File.join( ENV['HOME'], %w[.mongo3 landscape.yml] ) )
end

# -----------------------------------------------------------------------------
# Before filters
before do
  unless request.path =~ /\.[css gif png js]/
    @crumbs = session[:crumbs]
    unless @crumbs
      @crumbs = [ ['home', '/explore/center/home'] ]
      session[:crumbs] = @crumbs
    end
  end
end

# =============================================================================
# Helpers
helpers do
        
  # Convert size to mb
  def to_mb( val )
    return val if val < 1_000_000
    "#{val/1_000_000}Mb"
  end  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo3-0.0.3 lib/main.rb
mongo3-0.0.2 lib/main.rb