Sha256: 98e5911339fc327ada1b545dbbd109b93ab3d0dc8f555e17cfdfc7795d44803e
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
require 'rubygems' require 'sinatra' require 'forwardable' require File.expand_path( File.join( File.dirname(__FILE__), 'mongo3.rb' ) ) require 'mongo' gem 'agnostic-will_paginate' require 'will_paginate' require 'mongo_rack' set :public_folder, File.join( File.dirname(__FILE__), %w[public] ) set :views , File.join( File.dirname(__FILE__), %w[views] ) # ----------------------------------------------------------------------------- # Configurations configure :production do set :logging, false end configure do Mongo3.load_all_libs_relative_to(__FILE__, 'helpers' ) Mongo3.load_all_libs_relative_to(__FILE__, 'controllers' ) # Pick up command line args if any? if defined? @@options and @@options if @@options[:protocol] == 'mongo' use Rack::Session::Mongo, :server => "%s:%d/%s/%s" % [@@options[:host], @@options[:port], @@options[:db_name], @@options[:cltn_name]] else use Rack::Session::Memcache, :memcache_server => "%s:%d" % [@@options[:host], @@options[:port]], :namespace => @@options[:namespace] end else # Default is a mongo session store use Rack::Session::Mongo end set :config_file, File.join( ENV['HOME'], %w[.mongo3 landscape.yml] ) 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.1.5 | lib/app.rb |
mongo3-0.1.4 | lib/app.rb |