Sha256: b436be364f5dd10bd2db6236a0cc3dc7128801528a08641c51a10e74c71d59af

Contents?: true

Size: 1.27 KB

Versions: 25

Compression:

Stored size: 1.27 KB

Contents

module Mack
  module Utils
    module Server
    
      # This method wraps all the necessary components of the Rack system around
      # Mack::Runner. This can be used build your own server around the Mack framework.
      def self.build_app
        # Mack framework:
        app = Mack::Runner.new
        # Any urls listed will go straight to the public directly and will not be served up via the app:
        app = Rack::Static.new(app, :urls => ["/css", "/images", "/files", "/images", "/stylesheets", "/javascripts", "/media"], :root => "public")
        app = Rack::Lint.new(app) if app_config.mack.use_lint 
        app = Rack::ShowStatus.new(app) 
        app = Rack::ShowExceptions.new(app) if app_config.mack.show_exceptions
        app = Rack::Recursive.new(app)
        # This will reload any edited classes if the cache_classes config setting is set to true.
        app = Rack::Reloader.new(app, 1) unless app_config.mack.cache_classes
        # TODO: Not sure about this logger, investigate better ones.
        # TODO: Depends on MACK_DEFAULT_LOGGER already being configured.
        # This makes it a drag run this 'standalone' in another Ruby program.
        # app = Rack::CommonLogger.new(app, MACK_DEFAULT_LOGGER)
        app
      end
    
    end # Server
  end # Utils
end # Mack

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mack-0.0.3 lib/utils/server.rb
mack-0.0.5 lib/utils/server.rb
mack-0.0.6.1 lib/utils/server.rb
mack-0.0.6.2 lib/utils/server.rb
mack-0.0.4 lib/utils/server.rb
mack-0.1.0 lib/utils/server.rb
mack-0.2.0 lib/utils/server.rb
mack-0.0.6 lib/utils/server.rb
mack-0.0.7.0 lib/utils/server.rb
mack-0.2.0.1 lib/utils/server.rb
mack-0.4.0 lib/utils/server.rb
mack-0.3.0 lib/utils/server.rb
mack-0.4.0.1 lib/utils/server.rb
mack-0.4.1 lib/utils/server.rb
mack-0.4.2.1 lib/utils/server.rb
mack-0.4.7 lib/utils/server.rb
mack-0.4.2 lib/utils/server.rb
mack-0.4.5 lib/utils/server.rb
mack-0.4.6 lib/utils/server.rb
mack-0.5.0 lib/utils/server.rb