ramaze 0.3.9.1 → 2008.06
Sign up to get free protection for your applications and to get access to all the features.
- data/{doc/README → README.markdown} +78 -32
- data/Rakefile +53 -50
- data/benchmark/results.txt +131 -0
- data/benchmark/run.rb +362 -0
- data/benchmark/suite/minimal.rb +13 -0
- data/benchmark/suite/no_informer.rb +9 -0
- data/benchmark/suite/no_sessions.rb +10 -0
- data/benchmark/suite/no_template.rb +9 -0
- data/benchmark/suite/simple.rb +7 -0
- data/benchmark/suite/template_amrita2.rb +17 -0
- data/benchmark/suite/template_builder.rb +12 -0
- data/benchmark/suite/template_erubis.rb +10 -0
- data/benchmark/suite/template_ezamar.rb +10 -0
- data/benchmark/suite/template_haml.rb +15 -0
- data/benchmark/suite/template_liquid.rb +13 -0
- data/benchmark/suite/template_markaby.rb +11 -0
- data/benchmark/suite/template_nagoro.rb +10 -0
- data/benchmark/suite/template_redcloth.rb +15 -0
- data/benchmark/suite/template_tenjin.rb +10 -0
- data/benchmark/test.rb +35 -0
- data/bin/ramaze +32 -122
- data/cache.yaml +7 -0
- data/doc/AUTHORS +26 -22
- data/doc/CHANGELOG +16720 -3907
- data/doc/INSTALL +77 -19
- data/doc/LEGAL +0 -4
- data/doc/meta/announcement.txt +43 -54
- data/doc/meta/configuration.txt +3 -2
- data/doc/readme_chunks/examples.txt +2 -2
- data/doc/readme_chunks/installing.txt +66 -20
- data/doc/tutorial/todolist.html +338 -520
- data/doc/tutorial/todolist.mkd +36 -2
- data/examples/{auth → app/auth}/auth.rb +0 -0
- data/examples/{auth → app/auth}/template/layout.haml +0 -0
- data/examples/{auth → app/auth}/template/login.haml +0 -0
- data/examples/{blog → app/blog}/README +0 -0
- data/examples/{blog → app/blog}/controller/main.rb +1 -1
- data/examples/{blog → app/blog}/model/entry.rb +1 -1
- data/examples/{blog → app/blog}/public/styles/blog.css +0 -0
- data/examples/{blog → app/blog}/spec/blog.rb +2 -2
- data/examples/{blog → app/blog}/start.rb +0 -0
- data/examples/{blog → app/blog}/view/edit.xhtml +0 -0
- data/examples/{blog → app/blog}/view/index.xhtml +0 -0
- data/examples/{blog → app/blog}/view/layout.xhtml +0 -0
- data/examples/{blog → app/blog}/view/new.xhtml +0 -0
- data/examples/app/chat/model/history.rb +36 -0
- data/examples/app/chat/model/message.rb +7 -0
- data/examples/app/chat/public/css/chat.css +13 -0
- data/examples/app/chat/public/js/chat.js +22 -0
- data/examples/app/chat/public/js/jquery.js +3436 -0
- data/examples/app/chat/start.rb +40 -0
- data/examples/app/chat/view/chat.xhtml +9 -0
- data/examples/app/chat/view/index.xhtml +7 -0
- data/examples/app/chat/view/layout.xhtml +13 -0
- data/examples/app/localization/start.rb +35 -0
- data/examples/{rammit → app/rammit}/spec/rammit.rb +2 -1
- data/examples/{rammit → app/rammit}/src/controller/main.rb +0 -0
- data/examples/{rammit → app/rammit}/src/controller/page.rb +0 -0
- data/examples/{rammit → app/rammit}/src/model.rb +0 -0
- data/examples/{rammit → app/rammit}/start.rb +0 -0
- data/examples/{rammit → app/rammit}/template/index.xhtml +0 -0
- data/examples/{rammit → app/rammit}/template/page/view.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/Rakefile +0 -1
- data/examples/{rapaste → app/rapaste}/controller/paste.rb +3 -3
- data/examples/{rapaste → app/rapaste}/model/paste.rb +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/active4d.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/all_hallows_eve.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/amy.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/blackboard.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/brilliance_black.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/brilliance_dull.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/cobalt.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/dawn.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/display.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/eiffel.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/espresso_libre.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/idle.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/iplastic.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/lazy.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/mac_classic.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/magicwb_amiga.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/pastels_on_dark.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/slush_poppies.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/spacecadet.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/sunburst.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/twilight.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/css/zenburnesque.css +0 -0
- data/examples/{rapaste → app/rapaste}/public/js/jquery.js +0 -0
- data/examples/{rapaste → app/rapaste}/spec/rapaste.rb +2 -2
- data/examples/{rapaste → app/rapaste}/start.rb +0 -0
- data/examples/{rapaste → app/rapaste}/view/copy.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/index.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/layout.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/list.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/search.xhtml +0 -0
- data/examples/{rapaste → app/rapaste}/view/view.xhtml +0 -0
- data/examples/{sourceview → app/sourceview}/public/coderay.css +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/file.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/folder.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-expandable-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-expandable.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-item-last.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/images/tv-item.gif +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.js +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.treeview.css +0 -0
- data/examples/{sourceview → app/sourceview}/public/jquery.treeview.js +0 -0
- data/examples/{sourceview → app/sourceview}/public/sourceview.js +0 -0
- data/examples/{sourceview → app/sourceview}/sourceview.rb +1 -1
- data/examples/{sourceview → app/sourceview}/template/index.haml +0 -0
- data/examples/{todolist → app/todolist}/README +0 -0
- data/examples/{todolist → app/todolist}/public/favicon.ico +0 -0
- data/examples/{todolist → app/todolist}/public/js/jquery.js +0 -0
- data/examples/{todolist → app/todolist}/public/ramaze.png +0 -0
- data/examples/{todolist → app/todolist}/spec/todolist.rb +2 -2
- data/examples/{todolist → app/todolist}/src/controller/main.rb +0 -0
- data/examples/{todolist → app/todolist}/src/element/page.rb +0 -0
- data/examples/{todolist → app/todolist}/src/model.rb +0 -0
- data/examples/{todolist → app/todolist}/start.rb +0 -0
- data/examples/{todolist → app/todolist}/template/index.xhtml +0 -0
- data/examples/{todolist → app/todolist}/template/new.xhtml +0 -0
- data/examples/{upload → app/upload}/start.rb +0 -0
- data/examples/{upload → app/upload}/view/index.xhtml +0 -0
- data/examples/{whywiki → app/whywiki}/spec/whywiki.rb +3 -3
- data/examples/{whywiki → app/whywiki}/start.rb +0 -0
- data/examples/{whywiki → app/whywiki}/template/edit.xhtml +0 -0
- data/examples/{whywiki → app/whywiki}/template/show.xhtml +0 -0
- data/examples/{wikore → app/wikore}/spec/wikore.rb +2 -2
- data/examples/{wikore → app/wikore}/src/controller.rb +0 -0
- data/examples/{wikore → app/wikore}/src/model.rb +0 -0
- data/examples/{wikore → app/wikore}/start.rb +0 -0
- data/examples/{wikore → app/wikore}/template/index.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/README +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/link/2007-07-20_19-45-51.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/link/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_16-31-33.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-21-12.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-23-10.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-45-07.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/main/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/markdown/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_16-43-46.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_19-43-50.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-01.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-32.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-08.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-54.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/mkd/testing/current.mkd +0 -0
- data/examples/{wiktacular → app/wiktacular}/public/favicon.ico +0 -0
- data/examples/{wiktacular → app/wiktacular}/public/screen.css +0 -0
- data/examples/{wiktacular → app/wiktacular}/spec/wiktacular.rb +4 -5
- data/examples/{wiktacular → app/wiktacular}/src/controller.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/src/model.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/start.rb +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/edit.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/html_layout.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/index.xhtml +0 -0
- data/examples/{wiktacular → app/wiktacular}/template/new.xhtml +0 -0
- data/examples/{element.rb → basic/element.rb} +0 -0
- data/examples/basic/gestalt.rb +27 -0
- data/examples/{hello.rb → basic/hello.rb} +0 -0
- data/examples/{layout.rb → basic/layout.rb} +0 -0
- data/examples/{linking.rb → basic/linking.rb} +0 -0
- data/examples/{simple.rb → basic/simple.rb} +3 -3
- data/examples/{caching.rb → helpers/cache.rb} +0 -0
- data/examples/helpers/form_with_sequel.rb +24 -0
- data/examples/helpers/httpdigest.rb +50 -0
- data/examples/{identity.rb → helpers/identity.rb} +0 -0
- data/examples/{nitro_form.rb → helpers/nitro_form.rb} +0 -0
- data/examples/helpers/provide.rb +23 -0
- data/examples/helpers/rest.rb +28 -0
- data/examples/helpers/simple_captcha.rb +29 -0
- data/examples/{css.rb → misc/css.rb} +0 -0
- data/examples/{facebook.rb → misc/facebook.rb} +0 -0
- data/examples/{memleak_detector.rb → misc/memleak_detector.rb} +0 -0
- data/examples/misc/nagoro_element.rb +43 -0
- data/examples/{ramaise.rb → misc/ramaise.rb} +0 -0
- data/examples/misc/rapp.rb +45 -0
- data/examples/misc/sequel_scaffolding.rb +34 -0
- data/examples/{simple_auth.rb → misc/simple_auth.rb} +0 -0
- data/examples/templates/template_amrita2.rb +1 -1
- data/examples/templates/template_erubis.rb +2 -2
- data/examples/templates/template_ezamar.rb +1 -1
- data/examples/templates/template_haml.rb +2 -2
- data/examples/templates/template_liquid.rb +2 -2
- data/examples/templates/template_markaby.rb +1 -1
- data/examples/templates/template_nagoro.rb +1 -1
- data/examples/templates/template_redcloth.rb +2 -2
- data/examples/templates/template_remarkably.rb +1 -1
- data/examples/templates/template_tenjin.rb +5 -9
- data/examples/templates/template_xslt.rb +1 -1
- data/lib/proto/public/dispatch.fcgi +0 -0
- data/lib/proto/public/js/jquery.js +750 -577
- data/lib/proto/spec/main.rb +1 -1
- data/lib/proto/start.ru +8 -0
- data/lib/proto/view/page.xhtml +13 -1
- data/lib/ramaze.rb +32 -15
- data/lib/ramaze/action.rb +18 -1
- data/lib/ramaze/action/render.rb +45 -17
- data/lib/ramaze/adapter.rb +8 -7
- data/lib/ramaze/adapter/base.rb +79 -13
- data/lib/ramaze/adapter/cgi.rb +5 -10
- data/lib/ramaze/adapter/ebb.rb +6 -20
- data/lib/ramaze/adapter/fake.rb +12 -0
- data/lib/ramaze/adapter/fcgi.rb +5 -11
- data/lib/ramaze/adapter/lsws.rb +5 -9
- data/lib/ramaze/adapter/mongrel.rb +5 -9
- data/lib/ramaze/adapter/scgi.rb +4 -8
- data/lib/ramaze/adapter/thin.rb +6 -11
- data/lib/ramaze/adapter/webrick.rb +13 -22
- data/lib/ramaze/cache.rb +36 -10
- data/lib/ramaze/cache/memcached.rb +3 -2
- data/lib/ramaze/contrib.rb +1 -1
- data/lib/ramaze/contrib/email.rb +1 -1
- data/lib/ramaze/contrib/file_cache.rb +1 -1
- data/lib/ramaze/contrib/gems.rb +79 -0
- data/lib/ramaze/contrib/gettext/po.rb +0 -0
- data/lib/ramaze/contrib/profiling.rb +1 -1
- data/lib/ramaze/contrib/rest.rb +14 -0
- data/lib/ramaze/controller.rb +45 -12
- data/lib/ramaze/controller/error.rb +4 -4
- data/lib/ramaze/controller/resolve.rb +61 -42
- data/lib/ramaze/current.rb +2 -2
- data/lib/ramaze/current/request.rb +25 -2
- data/lib/ramaze/current/response.rb +8 -0
- data/lib/ramaze/current/session.rb +64 -36
- data/lib/ramaze/current/session/flash.rb +14 -2
- data/lib/ramaze/current/session/hash.rb +3 -2
- data/lib/ramaze/dispatcher.rb +25 -12
- data/lib/ramaze/dispatcher/action.rb +12 -3
- data/lib/ramaze/dispatcher/directory.rb +4 -1
- data/lib/ramaze/dispatcher/error.rb +3 -3
- data/lib/ramaze/dispatcher/file.rb +11 -3
- data/lib/ramaze/gestalt.rb +1 -1
- data/lib/ramaze/helper.rb +17 -21
- data/lib/ramaze/helper/aspect.rb +20 -14
- data/lib/ramaze/helper/auth.rb +1 -1
- data/lib/ramaze/helper/cache.rb +3 -6
- data/lib/ramaze/helper/cgi.rb +6 -2
- data/lib/ramaze/helper/flash.rb +7 -7
- data/lib/ramaze/helper/form.rb +281 -0
- data/lib/ramaze/helper/formatting.rb +76 -0
- data/lib/ramaze/helper/gestalt.rb +15 -0
- data/lib/ramaze/helper/gravatar.rb +15 -0
- data/lib/ramaze/helper/httpdigest.rb +48 -0
- data/lib/ramaze/helper/identity.rb +87 -62
- data/lib/ramaze/helper/partial.rb +11 -2
- data/lib/ramaze/helper/redirect.rb +12 -3
- data/lib/ramaze/helper/rest.rb +43 -0
- data/lib/ramaze/helper/sendfile.rb +1 -3
- data/lib/ramaze/helper/sequel.rb +3 -0
- data/lib/ramaze/helper/simple_captcha.rb +31 -0
- data/lib/ramaze/helper/stack.rb +14 -5
- data/lib/ramaze/helper/user.rb +86 -34
- data/lib/ramaze/helper/xhtml.rb +23 -0
- data/lib/ramaze/log.rb +1 -2
- data/lib/ramaze/log/analogger.rb +24 -19
- data/lib/ramaze/log/growl.rb +24 -19
- data/lib/ramaze/log/hub.rb +25 -22
- data/lib/ramaze/log/informer.rb +104 -99
- data/lib/ramaze/log/knotify.rb +17 -12
- data/lib/ramaze/log/logger.rb +14 -8
- data/lib/ramaze/log/logging.rb +63 -60
- data/lib/ramaze/log/syslog.rb +24 -19
- data/lib/ramaze/log/xosd.rb +77 -71
- data/lib/ramaze/option.rb +153 -0
- data/lib/ramaze/option/dsl.rb +45 -0
- data/lib/ramaze/option/holder.rb +153 -0
- data/lib/ramaze/option/merger.rb +108 -0
- data/lib/ramaze/route.rb +15 -2
- data/lib/ramaze/setup.rb +50 -0
- data/lib/ramaze/snippets/binding/locals.rb +1 -1
- data/lib/ramaze/snippets/dictionary.rb +3 -3
- data/lib/ramaze/snippets/divide.rb +7 -7
- data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
- data/lib/ramaze/snippets/kernel/acquire.rb +0 -5
- data/lib/ramaze/snippets/metaid.rb +1 -1
- data/lib/ramaze/snippets/numeric/filesize_format.rb +11 -5
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +8 -0
- data/lib/ramaze/snippets/object/scope.rb +1 -1
- data/lib/ramaze/snippets/object/thread_accessor.rb +1 -1
- data/lib/ramaze/snippets/ordered_set.rb +5 -1
- data/lib/ramaze/snippets/ramaze/deprecated.rb +7 -0
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +15 -1
- data/lib/ramaze/snippets/string/esc.rb +2 -2
- data/lib/ramaze/snippets/string/start_with.rb +1 -0
- data/lib/ramaze/snippets/string/unindent.rb +9 -1
- data/lib/ramaze/snippets/struct/values_at.rb +17 -1
- data/lib/ramaze/snippets/thread/into.rb +1 -1
- data/lib/ramaze/sourcereload.rb +83 -76
- data/lib/ramaze/spec/helper.rb +39 -26
- data/lib/ramaze/spec/helper/bacon.rb +5 -5
- data/lib/ramaze/spec/helper/mock_http.rb +1 -7
- data/lib/ramaze/spec/helper/pretty_output.rb +10 -2
- data/lib/ramaze/spec/helper/requester.rb +14 -0
- data/lib/ramaze/template.rb +6 -3
- data/lib/ramaze/template/amrita2.rb +1 -0
- data/lib/ramaze/template/erubis.rb +7 -1
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/nagoro.rb +1 -0
- data/lib/ramaze/template/redcloth.rb +1 -0
- data/lib/ramaze/template/tagz.rb +8 -8
- data/lib/ramaze/template/tenjin.rb +42 -2
- data/lib/ramaze/template/xslt.rb +4 -0
- data/lib/ramaze/tool/daemonize.rb +37 -0
- data/lib/ramaze/tool/localize.rb +142 -106
- data/lib/ramaze/version.rb +2 -10
- data/rake_tasks/conf.rake +11 -13
- data/rake_tasks/gem.rake +59 -37
- data/rake_tasks/git.rake +41 -0
- data/rake_tasks/maintenance.rake +263 -299
- data/rake_tasks/release.rake +63 -0
- data/rake_tasks/spec.rake +1 -1
- data/ramaze.gemspec +731 -0
- data/spec/contrib/profiling.rb +5 -2
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/css.rb +1 -1
- data/spec/examples/element.rb +1 -1
- data/spec/examples/hello.rb +1 -1
- data/spec/examples/linking.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/simple_auth.rb +1 -1
- data/spec/ramaze/action/cache.rb +58 -14
- data/spec/ramaze/action/file_cache.rb +48 -0
- data/spec/ramaze/action/layout.rb +2 -2
- data/spec/ramaze/action/render.rb +1 -2
- data/spec/ramaze/action/{template → view}/bar.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/instancevars/layout.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/other_wrapper.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/single_wrapper.xhtml +0 -0
- data/spec/ramaze/action/{template → view}/sub/sub_wrapper.xhtml +0 -0
- data/spec/ramaze/adapter.rb +29 -2
- data/spec/ramaze/adapter/ebb.rb +12 -0
- data/spec/ramaze/cache.rb +82 -15
- data/spec/ramaze/controller.rb +6 -3
- data/spec/ramaze/controller/actionless_templates.rb +2 -2
- data/spec/ramaze/controller/resolve.rb +1 -1
- data/spec/ramaze/controller/template_resolving.rb +4 -6
- data/spec/ramaze/controller/{template → view}/greet.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/list.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/other/greet/other.xhtml +0 -0
- data/spec/ramaze/controller/{template → view}/other_wrapper.xhtml +0 -0
- data/spec/ramaze/error.rb +1 -1
- data/spec/ramaze/helper/aspect.rb +4 -4
- data/spec/ramaze/helper/cache.rb +56 -39
- data/spec/ramaze/helper/flash.rb +14 -1
- data/spec/ramaze/helper/form.rb +118 -0
- data/spec/ramaze/helper/formatting.rb +21 -0
- data/spec/ramaze/helper/link.rb +2 -2
- data/spec/ramaze/helper/pager.rb +2 -2
- data/spec/ramaze/helper/partial.rb +13 -1
- data/spec/ramaze/helper/simple_captcha.rb +22 -0
- data/spec/ramaze/helper/user.rb +7 -10
- data/spec/ramaze/helper/{template → view}/locals.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/loop.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/num.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/partial.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive_local_ivars.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/recursive_locals.xhtml +0 -0
- data/spec/ramaze/helper/{template → view}/test_template.xhtml +0 -0
- data/spec/ramaze/localize.rb +22 -0
- data/spec/ramaze/log/informer.rb +10 -10
- data/spec/ramaze/log/syslog.rb +1 -1
- data/spec/ramaze/request.rb +13 -1
- data/spec/ramaze/request/ebb.rb +9 -0
- data/spec/ramaze/rewrite.rb +36 -0
- data/spec/ramaze/rewrite/file.css +1 -0
- data/spec/ramaze/route.rb +1 -0
- data/spec/ramaze/template.rb +5 -5
- data/spec/ramaze/template/amrita2.rb +1 -1
- data/spec/ramaze/template/builder.rb +18 -22
- data/spec/ramaze/template/erubis.rb +1 -1
- data/spec/ramaze/template/ezamar.rb +1 -1
- data/spec/ramaze/template/haml.rb +2 -2
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/nagoro.rb +1 -1
- data/spec/ramaze/template/redcloth.rb +1 -1
- data/spec/ramaze/template/remarkably.rb +1 -1
- data/spec/ramaze/template/sass.rb +1 -1
- data/spec/ramaze/template/tagz.rb +1 -1
- data/spec/ramaze/template/tenjin.rb +4 -6
- data/spec/ramaze/template/xslt.rb +1 -1
- data/spec/snippets/string/unindent.rb +6 -0
- data/spec/snippets/struct/values_at.rb +8 -0
- metadata +522 -487
- data/doc/ProjectInfo +0 -53
- data/doc/migrate/1110_to_1111.txt +0 -131
- data/lib/ramaze/contrib/route.rb +0 -22
- data/lib/ramaze/global.rb +0 -116
- data/lib/ramaze/global/dsl.rb +0 -39
- data/lib/ramaze/global/globalstruct.rb +0 -147
- data/lib/ramaze/helper/inform.rb +0 -40
- data/lib/ramaze/inform.rb +0 -4
- data/lib/ramaze/snippets/kernel/aquire.rb +0 -1
- data/lib/vendor/bacon.rb +0 -323
- data/rake_tasks/darcs.rake +0 -5
- data/spec/contrib/route.rb +0 -36
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'openid'
|
5
5
|
require 'openid/store/filesystem'
|
6
6
|
require 'openid/extensions/pape'
|
7
|
+
require 'openid/extensions/sreg'
|
7
8
|
|
8
9
|
module Ramaze
|
9
10
|
|
@@ -16,79 +17,103 @@ module Ramaze
|
|
16
17
|
# It provides a nice and simple way to provide and control access over the
|
17
18
|
# OpenID authentication model.
|
18
19
|
|
19
|
-
module Helper
|
20
|
+
module Helper
|
21
|
+
module Identity
|
22
|
+
LOOKUP << self
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
# Simple form for use or overwriting.
|
25
|
+
# Has to provide the same functionality when overwritten or directly
|
26
|
+
# embedded into a page.
|
27
|
+
def openid_login_form(caption="login")
|
28
|
+
%{
|
26
29
|
<form method="GET" action="#{Rs(:openid_begin)}">
|
27
30
|
Identity URL: <input type="text" name="url" />
|
28
31
|
<input type="submit" value="#{caption}"/>
|
29
32
|
</form>
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
# We land here from the openid_login_form and if we can find a matching
|
34
|
-
# OpenID server we redirect the user to it, the browser will return to
|
35
|
-
# openid_complete when the authentication is complete.
|
36
|
-
def openid_begin
|
37
|
-
url = request['url']
|
38
|
-
redirect_referrer if url.to_s.empty?
|
39
|
-
session[:openid_entry] = request.referrer
|
40
|
-
|
41
|
-
openid_request = openid_consumer.begin(url)
|
42
|
-
|
43
|
-
papereq = OpenID::PAPE::Request.new
|
44
|
-
papereq.add_policy_uri(OpenID::PAPE::AUTH_PHISHING_RESISTANT)
|
45
|
-
papereq.max_auth_age = 2*60*60
|
46
|
-
openid_request.add_extension(papereq)
|
47
|
-
openid_request.return_to_args['did_pape'] = 'y'
|
48
|
-
|
49
|
-
root = "http://#{request.http_host}/"
|
50
|
-
return_to = root[0..-2] + Rs(:openid_complete)
|
51
|
-
immediate = false
|
52
|
-
if openid_request.send_redirect?(root, return_to, immediate)
|
53
|
-
redirect_url = openid_request.redirect_url(root, return_to, immediate)
|
54
|
-
raw_redirect redirect_url
|
55
|
-
else
|
56
|
-
# what the hell is @form_text ?
|
33
|
+
}
|
57
34
|
end
|
58
35
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
36
|
+
# We land here from the openid_login_form and if we can find a matching
|
37
|
+
# OpenID server we redirect the user to it, the browser will return to
|
38
|
+
# openid_complete when the authentication is complete.
|
39
|
+
def openid_begin
|
40
|
+
# The OpenID URL pointing to a user's OpenID page,
|
41
|
+
# for example: http://username.myopenid.com)
|
42
|
+
url = request['url']
|
43
|
+
redirect_referrer if url.to_s.empty?
|
44
|
+
session[:openid] ||= {}
|
45
|
+
session[:openid][:entry] = request.referrer
|
46
|
+
|
47
|
+
openid_request = openid_consumer.begin(url)
|
48
|
+
|
49
|
+
# We want these communications to be a secure as the server can
|
50
|
+
# support!
|
51
|
+
papereq = OpenID::PAPE::Request.new
|
52
|
+
papereq.add_policy_uri(OpenID::PAPE::AUTH_PHISHING_RESISTANT)
|
53
|
+
papereq.max_auth_age = 2*60*60
|
54
|
+
openid_request.add_extension(papereq)
|
55
|
+
|
56
|
+
# Request information about the person
|
57
|
+
sregreq = OpenID::SReg::Request.new
|
58
|
+
sregreq.request_fields(['fullname', 'nickname', 'dob', 'email',
|
59
|
+
'gender', 'postcode', 'country', 'language',
|
60
|
+
'timezone'])
|
61
|
+
openid_request.add_extension(sregreq)
|
62
|
+
openid_request.return_to_args['did_pape'] = 'y'
|
63
|
+
|
64
|
+
root = "http://#{request.http_host}/"
|
65
|
+
return_to = request.domain(Rs(:openid_complete)).to_s
|
66
|
+
immediate = false
|
67
|
+
|
68
|
+
if openid_request.send_redirect?(root, return_to, immediate)
|
69
|
+
redirect_url =
|
70
|
+
openid_request.redirect_url(root, return_to, immediate)
|
71
|
+
raw_redirect redirect_url
|
72
|
+
else
|
73
|
+
# what the hell is @form_text ?
|
74
|
+
end
|
75
|
+
|
76
|
+
rescue OpenID::OpenIDError => ex
|
77
|
+
flash[:error] = "Discovery failed for #{url}: #{ex}"
|
78
|
+
raw_redirect Rs(:/)
|
80
79
|
end
|
81
80
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
81
|
+
# After having authenticated at the OpenID server browsers are redirected
|
82
|
+
# back here and on success we set the session[:openid][:identity] and a little
|
83
|
+
# default flash message. Then we redirect to wherever session[:openid][:entry]
|
84
|
+
# points us to, which was set on openid_begin to the referrer
|
85
|
+
#
|
86
|
+
# TODO:
|
87
|
+
# - maybe using StackHelper, but this is a really minimal overlap?
|
88
|
+
def openid_complete
|
89
|
+
openid_response = openid_consumer.complete(request.params, request.url)
|
90
|
+
|
91
|
+
case openid_response.status
|
92
|
+
when OpenID::Consumer::FAILURE
|
93
|
+
flash[:error] = "OpenID - Verification failed: #{openid_response.message}"
|
94
|
+
when OpenID::Consumer::SUCCESS
|
95
|
+
# Backwards compatibility
|
96
|
+
session[:openid][:identity] = openid_response.identity_url
|
97
|
+
session[:openid][:sreg] = OpenID::SReg::Response.from_success_response(openid_response)
|
98
|
+
|
99
|
+
# Forward compatibility :)
|
100
|
+
session[:openid_identity] = openid_response.identity_url
|
101
|
+
session[:openid_sreg] = OpenID::SReg::Response.from_success_response(openid_response)
|
102
|
+
|
103
|
+
flash[:success] = 'OpenID - Verification done.'
|
104
|
+
end
|
105
|
+
|
106
|
+
session.delete(:_openid_consumer_service)
|
107
|
+
|
108
|
+
raw_redirect session[:openid][:entry]
|
109
|
+
end
|
86
110
|
|
87
|
-
|
111
|
+
private
|
88
112
|
|
89
|
-
|
90
|
-
|
91
|
-
|
113
|
+
# Fetch/Create a OpenID::Consumer for current session.
|
114
|
+
def openid_consumer
|
115
|
+
OpenID::Consumer.new(session, Ramaze::OpenIDStore)
|
116
|
+
end
|
92
117
|
end
|
93
118
|
end
|
94
119
|
end
|
@@ -33,17 +33,23 @@ module Ramaze
|
|
33
33
|
# options: optional, will be used as request parameters.
|
34
34
|
|
35
35
|
def render_partial(url, options = {})
|
36
|
+
# Save any request params that clash with the ones we're about to add in.
|
36
37
|
saved = {}
|
37
38
|
options.keys.each {|x| saved[x] = Request.current.params[x] }
|
38
39
|
|
39
|
-
|
40
|
+
# Add/overwrite with the specified params. Ensure keys are strings since
|
41
|
+
# request[:foo] converts key to string when performing lookup.
|
42
|
+
options.each do |key, value|
|
43
|
+
Request.current.params[key.to_s] = value
|
44
|
+
end
|
40
45
|
|
41
46
|
Controller.handle(url)
|
42
47
|
ensure
|
48
|
+
# Always reinstate the original
|
43
49
|
options.keys.each {|x| Request.current.params[x] = saved[x] }
|
44
50
|
end
|
45
51
|
|
46
|
-
# Render the template file in
|
52
|
+
# Render the template file in view_root of the
|
47
53
|
# current controller.
|
48
54
|
|
49
55
|
def render_template(file, vars = {})
|
@@ -72,6 +78,9 @@ module Ramaze
|
|
72
78
|
end
|
73
79
|
|
74
80
|
binding = options[:instance].scope
|
81
|
+
|
82
|
+
# For Ruby 1.9/1.8.7
|
83
|
+
binding = binding.binding if binding.respond_to?(:binding)
|
75
84
|
|
76
85
|
vars.each do |name, value|
|
77
86
|
options[:instance].instance_variable_set("@#{name}", value)
|
@@ -23,9 +23,15 @@ module Ramaze
|
|
23
23
|
module Helper::Redirect
|
24
24
|
|
25
25
|
# render to the browser directly, ignoring any templates
|
26
|
-
|
26
|
+
#
|
27
|
+
# Usage:
|
28
|
+
# respond 'Page not found', 404
|
29
|
+
# respond render_template('forbidden.erb'), 403
|
30
|
+
# respond File.open('file.jpg'), 200, 'Content-Type' => 'image/jpeg'
|
31
|
+
|
32
|
+
def respond(*args)
|
27
33
|
response.build(*args)
|
28
|
-
throw
|
34
|
+
throw(:respond)
|
29
35
|
end
|
30
36
|
|
31
37
|
# Usage:
|
@@ -35,7 +41,7 @@ module Ramaze
|
|
35
41
|
# redirect 'foo/bar'
|
36
42
|
# redirect 'foo/bar', :status => 301
|
37
43
|
|
38
|
-
def redirect
|
44
|
+
def redirect(target, opts = {})
|
39
45
|
target = target.to_s
|
40
46
|
|
41
47
|
unless target =~ %r!^https?://!
|
@@ -48,6 +54,8 @@ module Ramaze
|
|
48
54
|
raw_redirect(target, opts)
|
49
55
|
end
|
50
56
|
|
57
|
+
# Do not perform any mutations on the target like #redirect does.
|
58
|
+
# Suitable if you have to redirect to a different subdomain or host.
|
51
59
|
def raw_redirect(target, opts = {})
|
52
60
|
target = target.to_s
|
53
61
|
header = {'Location' => target}
|
@@ -59,6 +67,7 @@ module Ramaze
|
|
59
67
|
throw(:redirect, [body, status, header])
|
60
68
|
end
|
61
69
|
|
70
|
+
# Are we being redirected?
|
62
71
|
def redirected?
|
63
72
|
request[:redirected]
|
64
73
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Ramaze
|
2
|
+
module Helper
|
3
|
+
module REST
|
4
|
+
def self.included(klass)
|
5
|
+
klass.class_eval do
|
6
|
+
trait :REST => {
|
7
|
+
'GET' => [], 'PUT' => [],
|
8
|
+
'POST' => [], 'DELETE' => [],
|
9
|
+
:any => [],
|
10
|
+
}
|
11
|
+
extend Indicate
|
12
|
+
|
13
|
+
def self.method_added(name)
|
14
|
+
name = name.to_s
|
15
|
+
active = trait[:REST][:active] ||= :any
|
16
|
+
trait[:REST][active] << name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Indicate
|
22
|
+
def on(http_method)
|
23
|
+
hm = http_method.to_s.upcase
|
24
|
+
trait[:REST][hm] = []
|
25
|
+
trait[:REST][:active] = hm
|
26
|
+
end
|
27
|
+
|
28
|
+
(%w[GET PUT POST DELETE] << :any).each do |http_method|
|
29
|
+
define_method("on_#{http_method.downcase}") do |*args|
|
30
|
+
if args.empty?
|
31
|
+
on(http_method)
|
32
|
+
else
|
33
|
+
trait[:REST][http_method] += args.flatten
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# POST /foo/bar
|
43
|
+
# methods_on_post[/foo/bar]
|
@@ -10,9 +10,7 @@ module Ramaze
|
|
10
10
|
# it, then throws :respond to finish off the request.
|
11
11
|
|
12
12
|
def send_file(file, mime_type = Tool::MIME.type_for(file))
|
13
|
-
|
14
|
-
response.body = File.open(file)
|
15
|
-
throw(:respond)
|
13
|
+
respond File.open(file, 'rb'), 200, 'Content-Type' => mime_type
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
data/lib/ramaze/helper/sequel.rb
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
module Ramaze
|
5
5
|
module Helper::Sequel
|
6
|
+
|
7
|
+
# Very crude paginator, may contain serious bugs, please fix :)
|
8
|
+
# pass it the result of YourModel.paginate, target is where links point to.
|
6
9
|
def paginator(paginated, target)
|
7
10
|
page_count = paginated.page_count
|
8
11
|
prev_page = paginated.prev_page
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Ramaze
|
2
|
+
module Helper
|
3
|
+
module SimpleCaptcha
|
4
|
+
def simple_captcha
|
5
|
+
question, answer = generate_captcha
|
6
|
+
session[:CAPTCHA] = {
|
7
|
+
:question => question, :answer => answer.to_s
|
8
|
+
}
|
9
|
+
question
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_captcha(answer)
|
13
|
+
if captcha = session[:CAPTCHA]
|
14
|
+
should = captcha[:answer].to_s
|
15
|
+
should == answer.to_s.strip
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate_captcha
|
20
|
+
n = [5, 10, 15, 20]
|
21
|
+
ns = Array.new(2){ n.sort_by{rand}.first }.sort
|
22
|
+
op = rand > 0.42 ? [ns[0], :+, ns[1]] : [ns[1], :-, ns[0]]
|
23
|
+
|
24
|
+
question = op.join(' ')
|
25
|
+
answer = op[0].send(op[1], op[2])
|
26
|
+
|
27
|
+
[question, answer]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/ramaze/helper/stack.rb
CHANGED
@@ -18,8 +18,7 @@ module Ramaze
|
|
18
18
|
# def login pass
|
19
19
|
# if pass == 'password'
|
20
20
|
# session[:logged_in] = true
|
21
|
-
# answer
|
22
|
-
# redirect '/'
|
21
|
+
# answer '/'
|
23
22
|
# else
|
24
23
|
# "failed"
|
25
24
|
# end
|
@@ -43,19 +42,29 @@ module Ramaze
|
|
43
42
|
# redirect to another location and pushing the current location
|
44
43
|
# on the session[:STACK]
|
45
44
|
|
46
|
-
def
|
47
|
-
(session[:STACK] ||= []) <<
|
45
|
+
def push(frame)
|
46
|
+
(session[:STACK] ||= []) << frame
|
47
|
+
end
|
48
|
+
|
49
|
+
def call(this)
|
50
|
+
push request.fullpath
|
48
51
|
redirect this
|
49
52
|
end
|
50
53
|
|
51
54
|
# return to the last location on session[:STACK]
|
55
|
+
# The optional alternative paramter will be used to redirect in case you
|
56
|
+
# are not inside_stack?
|
57
|
+
# If the session has no stack and no alternative is given this won't do
|
58
|
+
# anything
|
52
59
|
|
53
|
-
def answer
|
60
|
+
def answer(alternative = nil)
|
54
61
|
if inside_stack?
|
55
62
|
stack = session[:STACK]
|
56
63
|
target = stack.pop
|
57
64
|
session.delete(:STACK) if stack.empty?
|
58
65
|
redirect target
|
66
|
+
elsif alternative
|
67
|
+
redirect alternative
|
59
68
|
end
|
60
69
|
end
|
61
70
|
|
data/lib/ramaze/helper/user.rb
CHANGED
@@ -1,61 +1,113 @@
|
|
1
1
|
module Ramaze
|
2
2
|
module Helper
|
3
|
+
|
4
|
+
# This helper provides a convenience wrapper for handling authentication
|
5
|
+
# and persistence of users.
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
#
|
9
|
+
# class MainController < Ramaze::Controller
|
10
|
+
# def index
|
11
|
+
# if user?
|
12
|
+
# A('login', :href => Rs(:login))
|
13
|
+
# else
|
14
|
+
# "Hello #{user.name}"
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# def login
|
19
|
+
# user_login if reuqest.post?
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
|
3
23
|
module User
|
4
|
-
|
5
|
-
|
24
|
+
# return existing or instantiate User::Wrapper
|
25
|
+
def user
|
26
|
+
model = ancestral_trait[:user_model] ||= ::User
|
27
|
+
callback = ancestral_trait[:user_callback] ||= nil
|
28
|
+
Thread.current[:user] ||= Wrapper.new(model, callback)
|
6
29
|
end
|
7
30
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
31
|
+
# shortcut for user.user_login but default argument are request.params
|
32
|
+
|
33
|
+
def user_login(creds = request.params)
|
34
|
+
user._login(creds)
|
35
|
+
end
|
36
|
+
|
37
|
+
# shortcut for user.user_logout
|
38
|
+
|
39
|
+
def user_logout
|
40
|
+
user._logout
|
41
|
+
end
|
42
|
+
|
43
|
+
def logged_in?
|
44
|
+
user._logged_in?
|
14
45
|
end
|
15
46
|
|
47
|
+
# Wrapper for the ever-present "user" in your application.
|
48
|
+
# It wraps around an arbitrary instance and worries about authentication
|
49
|
+
# and storing information about the user in the session.
|
50
|
+
#
|
51
|
+
# In order to not interfere with the wrapped instance/model we start our
|
52
|
+
# methods with an underscore.
|
53
|
+
# Suggestions on improvements as usual welcome.
|
16
54
|
class Wrapper
|
17
|
-
|
18
|
-
|
55
|
+
# make it a BlankSlate
|
56
|
+
instance_methods.each do |meth|
|
57
|
+
undef_method(meth) unless meth.to_s =~ /^__.+__$/
|
58
|
+
end
|
19
59
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@
|
24
|
-
|
60
|
+
attr_accessor :_model, :_callback, :_user
|
61
|
+
|
62
|
+
def initialize(model, callback)
|
63
|
+
@_model, @_callback = model, callback
|
64
|
+
@_user = nil
|
65
|
+
_login
|
25
66
|
end
|
26
67
|
|
27
|
-
def
|
28
|
-
|
68
|
+
def _login(creds = _persistence)
|
69
|
+
if @_user = _would_login?(creds)
|
70
|
+
self._persistence = creds
|
71
|
+
end
|
29
72
|
end
|
30
73
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
74
|
+
# The callback should return an instance of the user, otherwise it
|
75
|
+
# should answer with nil.
|
76
|
+
#
|
77
|
+
# This will not actually login, just check whether the credentials
|
78
|
+
# would result in a user.
|
79
|
+
def _would_login?(creds)
|
80
|
+
if c = @_callback
|
81
|
+
c.call(creds)
|
82
|
+
elsif _model.respond_to?(:authenticate)
|
83
|
+
_model.authenticate(creds)
|
84
|
+
else
|
85
|
+
Log.warn("Helper::User has no callback and model doesn't respond to #authenticate")
|
86
|
+
nil
|
87
|
+
end
|
35
88
|
end
|
36
89
|
|
37
|
-
def
|
38
|
-
|
90
|
+
def _logout
|
91
|
+
_persistence.clear
|
92
|
+
Thread.current[:user] = nil
|
39
93
|
end
|
40
94
|
|
41
|
-
def
|
42
|
-
|
95
|
+
def _logged_in?
|
96
|
+
!!_user
|
43
97
|
end
|
44
98
|
|
45
|
-
def
|
46
|
-
|
47
|
-
if found = login?(hash)
|
48
|
-
@user = found
|
49
|
-
self.persist = hash
|
50
|
-
end
|
99
|
+
def _persistence=(creds)
|
100
|
+
Current.session[:USER] = creds
|
51
101
|
end
|
52
102
|
|
53
|
-
def
|
54
|
-
|
103
|
+
def _persistence
|
104
|
+
Current.session[:USER] || {}
|
55
105
|
end
|
56
106
|
|
107
|
+
# Refer everything not known
|
57
108
|
def method_missing(meth, *args, &block)
|
58
|
-
|
109
|
+
return unless _user
|
110
|
+
_user.send(meth, *args, &block)
|
59
111
|
end
|
60
112
|
end
|
61
113
|
end
|