Sha256: f2973e1dffff13f399f4f2c19cf09cf4cfd8a2606aa2de3b83e99d54bf0a42a5
Contents?: true
Size: 1.45 KB
Versions: 17
Compression:
Stored size: 1.45 KB
Contents
# This file is merely for beginning the boot process, check dependencies.rb for more information require 'rubygems' require 'sinatra/base' RACK_ENV = ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV ROOT_DIR = File.dirname(__FILE__) + '/../' unless defined? ROOT_DIR # Helper method for file references. # root_path("config", "settings.yml") def root_path(*args) File.join(ROOT_DIR, *args) end # Returns the full path to the public folder along with any given additions # public_path("images") def public_path(*args) root_path('public', *args) end class <%= @class_name %> < Sinatra::Application # Defines basic application settings set :root, root_path set :views, root_path("app", "views") set :images_path, public_path("images") set :default_builder, 'StandardFormBuilder' set :environment, RACK_ENV.to_sym if defined?(RACK_ENV) # Attempts to require all dependencies with bundler, if this fails, bundle and then try again def self.bundler_require_dependencies(environment=nil) require 'bundler' require File.expand_path(File.join(File.dirname(__FILE__), '/../vendor', 'gems', 'environment')) Bundler.require_env(environment) rescue LoadError => e puts "Bundler must be run to resolve dependencies!" system("cd #{ROOT_DIR}; gem bundle") puts "Retrying with dependencies resolved..." retry end # Dependencies contains all required gems and core configuration require File.dirname(__FILE__) + '/dependencies.rb' end
Version data entries
17 entries across 17 versions & 2 rubygems