Sha256: 5b1ccfb956ede3ce5bd980984cbf8087c378377e9bb3a3bba1c172ec8ccdd81e

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path('../boot', __FILE__)

module <%= @name.camelcase %>
  class Application < Sinatra::Base

    set :root, File.dirname(__FILE__)
    set :public_dir, File.expand_path('../public', __FILE__)
    set :raise_errors, true
    set :app_file, __FILE__

    AUTOLOAD_PATHS = ["#{root}/app/models", "#{root}/app/routes", "#{root}/lib"]

    def self.require_autoload_paths(paths)
      paths.each do |path|
        Dir[File.join(path, "*.rb")].each do |file|
          require file
        end
      end
    end

    def self.initialize!
      settings_file = File.expand_path('../config/settings.yml', __FILE__)

      if File.exist? settings_file
        YAML::load(open(settings_file))[self.environment.to_s]
      else
        raise Errno::ENOENT
      end
    end

  end
end

$app_settings ||= <%= @name.camelcase %>::Application.initialize!
require File.expand_path('../config/initializer', __FILE__)
<%= @name.camelcase %>::Application.require_autoload_paths(<%= @name.camelcase %>::Application::AUTOLOAD_PATHS)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
aetherg-0.2.2 lib/templates/application.rb
aetherg-0.2.1 lib/templates/application.rb
aetherg-0.2.0 lib/templates/application.rb
aetherg-0.1.8 lib/templates/application.rb
aetherg-0.1.7 lib/templates/application.rb
aetherg-0.1.5 lib/templates/application.rb
aetherg-0.1.4 lib/templates/application.rb
aetherg-0.1.3 lib/templates/application.rb
aetherg-0.1.2 lib/templates/application.rb
aetherg-0.1.1 lib/templates/application.rb
aetherg-0.1.0 lib/templates/application.rb