Sha256: fa9ae2d80c2e71a50eb52a4c426cfaebd93d37d69f2af6a6e4317413d0aa9c97

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

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

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

    set :root, File.dirname(__FILE__)
    <%- unless @no_views -%>
    set :public_dir, File.expand_path('../public', __FILE__)
    <%- end -%>
    set :raise_errors, true
    set :app_file, __FILE__

    AUTOLOAD_PATHS = ["#{root}/app/*", "#{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

10 entries across 10 versions & 1 rubygems

Version Path
aetherg-0.5.1 lib/templates/application.rb
aetherg-0.5.0 lib/templates/application.rb
aetherg-0.5.0.beta3 lib/templates/application.rb
aetherg-0.5.0.beta2 lib/templates/application.rb
aetherg-0.5.0.beta lib/templates/application.rb
aetherg-0.3.4 lib/templates/application.rb
aetherg-0.3.3 lib/templates/application.rb
aetherg-0.3.2 lib/templates/application.rb
aetherg-0.3.1 lib/templates/application.rb
aetherg-0.2.7 lib/templates/application.rb