Sha256: ff18fce4fdaafb5d0c953bd8733e52a20ac4431e6cb617cf57d94444868489de

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

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

module Changchangchang
  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/*", "#{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 ||= Changchangchang::Application.initialize!
require File.expand_path('../config/initializer', __FILE__)
Changchangchang::Application.require_autoload_paths(Changchangchang::Application::AUTOLOAD_PATHS)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aetherg-0.5.0.beta2 changchangchang/application.rb