Sha256: 0451e23f70e8b39ac1a088d8cdcc830c7e01f8bb52e474cff9d1bf6106540b80

Contents?: true

Size: 1.98 KB

Versions: 2

Compression:

Stored size: 1.98 KB

Contents

# = Nitro 
#
# Copyright (c) 2004-2006, George Moschovitis (http://www.gmosx.com)
#
# Nitro (http://www.nitroproject.org) is copyrighted free software 
# created and maintained by George Moschovitis 
# (mailto:george.moschovitis@gmail.com) and released under the 
# standard BSD Licence. For details consult the file doc/LICENCE.

require 'glue'
require 'glue/logger'
require 'glue/configuration'

require 'nitro/version'

module Nitro
  # Library path.

  LibPath = File.dirname(__FILE__)
  
  # The path to the prototype application.
  
  setting :proto_path, :default => File.join(LibPath, '..', 'proto'), :doc => 'The path to the prototype application'

  # The adapter used to serve nitro applications.
  
  setting :adapter, :default => :webrick, :doc => 'The web adapter'

  # Add standard dirs in the path.

  $LOAD_PATH.unshift Dir.pwd
  $LOAD_PATH.unshift File.join(Dir.pwd, 'lib')

  # Include the Glue namespace in Nitro.
  
  include Glue
end

#--
# gmosx: leave them here.
#++

require 'nitro/global'
require 'nitro/context'
require 'nitro/controller'
require 'nitro/dispatcher'
require 'nitro/render'
require 'nitro/server'
require 'nitro/part'

unless $NITRO_NO_ENVIRONMENT
  # Setup up the proposed environment. You are free
  # to skip this if you dont like it. Just set
  #
  # $NITRO_NO_ENVIRONMENT = true 
  #
  # before requiring nitro.
  
  # Put the start file dir in the path. 

  Dir.chdir(File.dirname($0))

  # Library code come here.

  $LOAD_PATH.unshift 'lib'
end

module Nitro

  class << self
  
    attr_accessor :server
    
    # A helper method to start a Nitro application.
    
    def run(controller = nil)
      @server = Server.run(controller)
    end
    alias_method :start, :run
    
    # A helper method. Will be deprecated, use 
    # Configuration.mode instead.
    
    def live?
      Configuration.mode == :live
    end
    alias_method :production?, :live?

    # Deprecated, use Configuration.mode instead.
    
    def mode
      Configuration.mode
    end
        
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro.rb
nitro-0.40.0 lib/nitro.rb