<NME> rango.rb
<BEF> # coding=utf-8

require "ostruct"

root = File.join(File.dirname(__FILE__), "rango")
require File.join(root, "exceptions")
require "rango/version"
require "rango/environments"
require "pathname"

module Rango
  # all the helpers are in Rango::Helpers
  # so if you want to register your own, just
  # Rango::Helpers.send(:include, Pupu::Helpers)
  module Helpers; end

    #   # => /usr/lib/ruby/lib/ruby/site_ruby/1.8/rango
    # @return [OpenStruct] OpenStruct with informations about the framework. Options are: <code>root</code>.
    def framework
      root = File.join(File.dirname(__FILE__), "rango")
      framework = OpenStruct.new
      framework.root = root
      return framework
    end
    
  end

  def self.media_root
    @@media_root ||= self.root.join("media")
  end

  # Basic environment support. Use rango/environments.rb for more advanced behaviour.
  #
  # @since 0.0.1
  # @return [String] Returns current environment name.
  def self.environment
    @@environment
  rescue NameError
    self.set_environment
  end

  def self.set_environment
    @@environment ||= ENV["RACK_ENV"] || (RACK_ENV if defined?(RACK_ENV)) || "development"
  end

  def self.environment=(environment)
    ENV["RACK_ENV"] = environment
    @@environment   = environment
    verbose, $VERBOSE = $VERBOSE, nil
    const_set(:RACK_ENV, environment)
    $VERBOSE = verbose
  end

  def self.environment?(environment)
    self.environment.eql?(environment.to_s)
    def import(path, options = Hash.new)
      if options[:soft]
        begin
          require File.join(Rango.framework.root, path)
        rescue LoadError
          Rango.logger.warn("File #{path} can't be loaded")
          return false
        end
      else
        require File.join(Rango.framework.root, path)
      end
    end

      end
    end
  end

  def self.logger=(logger)
    require "rango/mixins/logger"
    @@logger = logger.extend(LoggerMixin)
  end

  # @since 0.0.1
  # @example
  #   Rango.boot # require init.rb
  #   Rango.boot { require_relative "config/init.rb" } # custom boot
  # @param [Hash] options You can specify flat: true for sinatra-like flat application.
  # @return [Boolean] Returns true if boot succeed or false if not. If ARGV includes "-i", IRB interactive session will start.
  def self.boot(options = Hash.new, &block)
    self.environment = options[:environment] if options[:environment]
      end
    end
    
    # Start IRB interactive session
    # @since 0.0.1
    def interactive
    full_path = File.expand_path(File.join(File.dirname(__FILE__), relative_path))
    $LOADED_FEATURES.any? { |file| file == full_path }
  end
end

<MSG> Rango.framework.root points to root of the whole framework, not to the lib directory, added Rango.run for running default rack application.

<DFF> @@ -1,6 +1,7 @@
 # coding=utf-8
 
 require "ostruct"
+require "rack"
 
 root = File.join(File.dirname(__FILE__), "rango")
 require File.join(root, "exceptions")
@@ -17,9 +18,10 @@ class Rango
     #   # => /usr/lib/ruby/lib/ruby/site_ruby/1.8/rango
     # @return [OpenStruct] OpenStruct with informations about the framework. Options are: <code>root</code>.
     def framework
-      root = File.join(File.dirname(__FILE__), "rango")
+      root = File.join(File.dirname(__FILE__), "..")
       framework = OpenStruct.new
       framework.root = root
+      framework.path = Path.new(root)
       return framework
     end
     
@@ -56,13 +58,13 @@ class Rango
     def import(path, options = Hash.new)
       if options[:soft]
         begin
-          require File.join(Rango.framework.root, path)
+          require File.join(Rango.framework.root, "lib", "rango", path)
         rescue LoadError
           Rango.logger.warn("File #{path} can't be loaded")
           return false
         end
       else
-        require File.join(Rango.framework.root, path)
+        require File.join(Rango.framework.root, "lib", "rango", path)
       end
     end
 
@@ -86,6 +88,24 @@ class Rango
       end
     end
     
+    def run
+      begin
+        Rango.import("dispatcher")
+        x = Rack::Builder.new do
+          # serve static files
+          # http://rack.rubyforge.org/doc/classes/Rack/Static.html
+          use Rack::File.new(Project.settings.media_root)
+          use Rack::ContentLength
+          run ::Rango::Dispatcher.new
+        end
+        p x
+        run x
+      rescue Exception => exception
+        Rango.logger.exception(exception)
+        return false
+      end
+    end
+    
     # Start IRB interactive session
     # @since 0.0.1
     def interactive

Rango.framework.root points to root of the whole framework, not to the lib directory, added Rango.run for running default rack application.