Sha256: 465e224081d40513b48c8c651571bf026b641e6719ee75070aee1073094650d0

Contents?: true

Size: 932 Bytes

Versions: 7

Compression:

Stored size: 932 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

require 'fileutils'

module RubyApp
  require 'ruby_app/mixins'

  class Application
    extend RubyApp::Mixins::ConfigurationMixin
    extend RubyApp::Mixins::DelegateMixin

    attr_reader :options, :environment

    def initialize
      @environment = {}
    end

    def self.get
      @@_application ||= nil
    end

    def self.create!
      @@_application = ( Kernel.eval(RubyApp::Application.configuration._class) ).new
    end

    def self.destroy!
      @@_application = nil
    end

    def self.create_context!(configuration_paths = [File.join(RubyApp::ROOT, %w[configuration.yml])])
      RubyApp::Configuration.load!(configuration_paths)
      RubyApp::Log.open!
      RubyApp::Application.create!
      begin
        yield
      ensure
        RubyApp::Application.destroy!
        RubyApp::Log.close!
        RubyApp::Configuration.unload!
      end
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
RubyApp-0.2.7 lib/ruby_app/application.rb
RubyApp-0.2.6 lib/ruby_app/application.rb
RubyApp-0.2.5 lib/ruby_app/application.rb
RubyApp-0.2.4 lib/ruby_app/application.rb
RubyApp-0.2.3 lib/ruby_app/application.rb
RubyApp-0.2.2 lib/ruby_app/application.rb
RubyApp-0.2.1 lib/ruby_app/application.rb