Sha256: 03653bab9fd75fc3e8e6f75f944524aec042d4e672e29dcbd309847bdde997e4

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 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 SinatraMore::MarkupPlugin
  register SinatraMore::RenderPlugin
  register SinatraMore::MailerPlugin
  register SinatraMore::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').classify
    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 SinatraMore::WardenPlugin
    
  # Required helpers
  helpers ViewHelpers
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sinatra_more-0.3.29 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.28 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.27 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.26 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.25 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.24 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.23 generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.22 generators/base_app/config/dependencies.rb.tt
padrino-gen-0.1.0 lib/generators/base_app/config/dependencies.rb.tt
sinatra_more-0.3.21 generators/base_app/config/dependencies.rb.tt