Sha256: 8463754edb7cd06c8e27959de405fe83021cf1a89d28421b97f8622a60694406

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

# Dependencies contains all required gems, helpers and core configuration

def app(&block)
  <%= @class_name %>.class_eval(&block)
end

class <%= @class_name %> < Sinatra::Application
  bundler_require_dependencies
  
  # Required middleware
  use Rack::Session::Cookie
  use Rack::Flash
  
  # Includes all necessary sinatra_more helpers
  register Sinatra::MarkupPlugin
  register Sinatra::RenderPlugin
  register Sinatra::MailerPlugin
  register Sinatra::RoutingPlugin

  # Requires the initializer modules which configure specific components
  Dir[File.dirname(__FILE__) + '/initializers/*.rb'].each do |file|
    # Each initializer file contains a module called 'XxxxInitializer' (i.e HassleInitializer)
    require file
    file_class = File.basename(file, '.rb').camelize
    register "#{file_class}Initializer".constantize
  end
  
  # Returns the list of load paths for this sinatra application
  def self.file_loading_paths
    ["lib/**/*.rb", "app/helpers/**/*.rb", "app/routes/**/*.rb", "app/models/*.rb", "app/mailers/*.rb"]
  end
  
  # Require all the folders and files necessary to run the application
  file_loading_paths.each { |load_path| Dir[root_path(load_path)].each { |file| require file } }
  
  # Require Warden plugin below to allow User to be loaded
  register Sinatra::WardenPlugin
    
  # Required helpers
  helpers ViewHelpers
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
darkhelmet-sinatra_more-0.3.36 generators/base_app/config/dependencies.rb.tt
darkhelmet-sinatra_more-0.3.35 generators/base_app/config/dependencies.rb.tt
darkhelmet-sinatra_more-0.3.34 generators/base_app/config/dependencies.rb.tt
darkhelmet-sinatra_more-0.3.33 generators/base_app/config/dependencies.rb.tt