From ced35b65f87e2b32dd9bb79ec0d1d6c6cf9d6504 Mon Sep 17 00:00:00 2001 From: IWAMOTO Takashi Date: Sun, 3 Aug 2008 15:11:23 +0900 Subject: [PATCH] use activesupport for autoloading --- lib/pinto.rb | 78 +++++++---------------------------------- lib/pinto/dispatcher.rb | 1 - 2 files changed, 12 insertions(+), 67 deletions(-) diff --git a/lib/pinto.rb b/lib/pinto.rb index 0907e98..1c0d396 100755 --- a/lib/pinto.rb +++ b/lib/pinto.rb @@ -5,9 +5,21 @@ require 'pinto/string' require 'rubygems' +module Pinto + VERSION = [0, 0, 1] + + def self.version + return VERSION.join('.') + end +end + autoload :DBI, 'dbi' autoload :YAML, 'yaml' +gem 'activesupport' +require 'active_support' +Dependencies.load_paths << 'lib' + gem 'addressable' module Addressable autoload :URI, 'addressable/uri' @@ -27,71 +39,5 @@ module Store end end -module Pinto - autoload :Config, 'pinto/config' - autoload :Dispatcher, 'pinto/dispatcher' - autoload :Language, 'pinto/language' - autoload :OpenID, 'pinto/open_id' - autoload :Request, 'pinto/request' - autoload :Translate, 'pinto/translate' - autoload :View, 'pinto/view' - - module Controller -=begin - autoload :Index, 'pinto/controller/index' - autoload :SignupAccount, 'pinto/controller/signup_account' - autoload :SignupAuth, 'pinto/controller/signup_auth' - autoload :SignupOpenid, 'pinto/controller/signup_openid' -=end - - module Private - autoload :Base, 'pinto/controller/private/base' - autoload :Error, 'pinto/controller/private/error' - autoload :Multiple, 'pinto/controller/private/multiple' - end - end - - module Encoding - autoload :UTF8, 'pinto/encoding/utf8' - end - - module Helper - autoload :HTML, 'pinto/helper/html' - autoload :Translate, 'pinto/helper/translate' - autoload :URI, 'pinto/helper/uri' - end - - module Model - autoload :SignupReservation, 'pinto/model/signup_reservation' - autoload :User, 'pinto/model/user' - end - - module Type - autoload :ClaimedID, 'pinto/type/claimed_id' - autoload :ConfigKey, 'pinto/type/config_key' - autoload :ControllerName, 'pinto/type/controller_name' - autoload :EscapeChars, 'pinto/type/escape_chars' - autoload :ErrorMessage, 'pinto/type/error_message' - autoload :HttpStatusCode, 'pinto/type/http_status_code' - autoload :Language, 'pinto/type/language' - autoload :QueryStrings, 'pinto/type/query_strings' - autoload :URI, 'pinto/type/uri' - autoload :UriMap, 'pinto/type/uri_map' - autoload :UserName, 'pinto/type/user_name' - autoload :UserSuppliedID, 'pinto/type/user_supplied_id' - autoload :ViewName, 'pinto/type/view_name' - autoload :ViewParam, 'pinto/type/view_param' - end - - module URI - autoload :ExpandProcessor, 'pinto/uri/expand_processor' - autoload :ExtractProcessor, 'pinto/uri/extract_processor' - end - - class View - autoload :XHTML, 'pinto/view/xhtml' - end -end - gem 'rack' autoload :Rack, 'rack' diff --git a/lib/pinto/dispatcher.rb b/lib/pinto/dispatcher.rb index c488236..3b5f469 100755 --- a/lib/pinto/dispatcher.rb +++ b/lib/pinto/dispatcher.rb @@ -30,7 +30,6 @@ def call(env) controller_name = request.get_controller_name.to_s path = Pathname.new("pinto/controller/#{controller_name}") - require path return path.get_class.new.run(request) =begin