Pistos-ramaze 2008.09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +481 -0
- data/Rakefile +228 -0
- 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 +80 -0
- data/doc/AUTHORS +29 -0
- data/doc/CHANGELOG +19530 -0
- data/doc/COPYING +56 -0
- data/doc/FAQ +92 -0
- data/doc/GPL +339 -0
- data/doc/INSTALL +92 -0
- data/doc/LEGAL +26 -0
- data/doc/TODO +29 -0
- data/doc/meta/announcement.txt +99 -0
- data/doc/meta/configuration.txt +163 -0
- data/doc/meta/internals.txt +278 -0
- data/doc/meta/users.kml +64 -0
- data/doc/readme_chunks/appendix.txt +10 -0
- data/doc/readme_chunks/examples.txt +38 -0
- data/doc/readme_chunks/features.txt +148 -0
- data/doc/readme_chunks/getting_help.txt +5 -0
- data/doc/readme_chunks/getting_started.txt +18 -0
- data/doc/readme_chunks/installing.txt +92 -0
- data/doc/readme_chunks/introduction.txt +18 -0
- data/doc/readme_chunks/principles.txt +56 -0
- data/doc/readme_chunks/thanks.txt +59 -0
- data/doc/tutorial/todolist.html +742 -0
- data/doc/tutorial/todolist.mkd +787 -0
- data/examples/app/auth/auth.rb +54 -0
- data/examples/app/auth/template/layout.haml +20 -0
- data/examples/app/auth/template/login.haml +16 -0
- data/examples/app/blog/README +3 -0
- data/examples/app/blog/controller/main.rb +29 -0
- data/examples/app/blog/model/entry.rb +30 -0
- data/examples/app/blog/public/styles/blog.css +132 -0
- data/examples/app/blog/spec/blog.rb +87 -0
- data/examples/app/blog/start.rb +7 -0
- data/examples/app/blog/view/edit.xhtml +17 -0
- data/examples/app/blog/view/index.xhtml +17 -0
- data/examples/app/blog/view/layout.xhtml +11 -0
- data/examples/app/blog/view/new.xhtml +16 -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/app/rapaste/Rakefile +34 -0
- data/examples/app/rapaste/controller/paste.rb +101 -0
- data/examples/app/rapaste/model/paste.rb +58 -0
- data/examples/app/rapaste/public/css/active4d.css +114 -0
- data/examples/app/rapaste/public/css/all_hallows_eve.css +72 -0
- data/examples/app/rapaste/public/css/amy.css +147 -0
- data/examples/app/rapaste/public/css/blackboard.css +88 -0
- data/examples/app/rapaste/public/css/brilliance_black.css +605 -0
- data/examples/app/rapaste/public/css/brilliance_dull.css +599 -0
- data/examples/app/rapaste/public/css/cobalt.css +149 -0
- data/examples/app/rapaste/public/css/dawn.css +121 -0
- data/examples/app/rapaste/public/css/display.css +197 -0
- data/examples/app/rapaste/public/css/eiffel.css +121 -0
- data/examples/app/rapaste/public/css/espresso_libre.css +109 -0
- data/examples/app/rapaste/public/css/idle.css +62 -0
- data/examples/app/rapaste/public/css/iplastic.css +80 -0
- data/examples/app/rapaste/public/css/lazy.css +73 -0
- data/examples/app/rapaste/public/css/mac_classic.css +123 -0
- data/examples/app/rapaste/public/css/magicwb_amiga.css +104 -0
- data/examples/app/rapaste/public/css/pastels_on_dark.css +188 -0
- data/examples/app/rapaste/public/css/slush_poppies.css +85 -0
- data/examples/app/rapaste/public/css/spacecadet.css +51 -0
- data/examples/app/rapaste/public/css/sunburst.css +180 -0
- data/examples/app/rapaste/public/css/twilight.css +137 -0
- data/examples/app/rapaste/public/css/zenburnesque.css +91 -0
- data/examples/app/rapaste/public/js/jquery.js +11 -0
- data/examples/app/rapaste/spec/rapaste.rb +51 -0
- data/examples/app/rapaste/start.rb +25 -0
- data/examples/app/rapaste/view/copy.xhtml +10 -0
- data/examples/app/rapaste/view/index.xhtml +9 -0
- data/examples/app/rapaste/view/layout.xhtml +25 -0
- data/examples/app/rapaste/view/list.xhtml +29 -0
- data/examples/app/rapaste/view/search.xhtml +41 -0
- data/examples/app/rapaste/view/view.xhtml +37 -0
- data/examples/app/sourceview/public/coderay.css +104 -0
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +11 -0
- data/examples/app/sourceview/public/jquery.treeview.css +48 -0
- data/examples/app/sourceview/public/jquery.treeview.js +223 -0
- data/examples/app/sourceview/public/sourceview.js +52 -0
- data/examples/app/sourceview/sourceview.rb +77 -0
- data/examples/app/sourceview/template/index.haml +59 -0
- data/examples/app/todolist/README +1 -0
- data/examples/app/todolist/public/favicon.ico +0 -0
- data/examples/app/todolist/public/js/jquery.js +1923 -0
- data/examples/app/todolist/public/ramaze.png +0 -0
- data/examples/app/todolist/spec/todolist.rb +132 -0
- data/examples/app/todolist/src/controller/main.rb +70 -0
- data/examples/app/todolist/src/element/page.rb +31 -0
- data/examples/app/todolist/src/model.rb +14 -0
- data/examples/app/todolist/start.rb +11 -0
- data/examples/app/todolist/template/index.xhtml +17 -0
- data/examples/app/todolist/template/new.xhtml +7 -0
- data/examples/app/upload/start.rb +19 -0
- data/examples/app/upload/view/index.xhtml +25 -0
- data/examples/app/whywiki/spec/whywiki.rb +58 -0
- data/examples/app/whywiki/start.rb +46 -0
- data/examples/app/whywiki/template/edit.xhtml +14 -0
- data/examples/app/whywiki/template/show.xhtml +18 -0
- data/examples/app/wikore/spec/wikore.rb +111 -0
- data/examples/app/wikore/src/controller.rb +80 -0
- data/examples/app/wikore/src/model.rb +53 -0
- data/examples/app/wikore/start.rb +9 -0
- data/examples/app/wikore/template/index.xhtml +8 -0
- data/examples/app/wiktacular/README +2 -0
- data/examples/app/wiktacular/mkd/link/2007-07-20_19-45-51.mkd +1 -0
- data/examples/app/wiktacular/mkd/link/current.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_16-31-33.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-21-12.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-23-10.mkd +2 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-45-07.mkd +2 -0
- data/examples/app/wiktacular/mkd/main/current.mkd +2 -0
- data/examples/app/wiktacular/mkd/markdown/current.mkd +3 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-20_16-43-46.mkd +2 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-20_19-43-50.mkd +3 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-01.mkd +11 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-32.mkd +13 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-08.mkd +17 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-54.mkd +17 -0
- data/examples/app/wiktacular/mkd/testing/current.mkd +17 -0
- data/examples/app/wiktacular/public/favicon.ico +0 -0
- data/examples/app/wiktacular/public/screen.css +72 -0
- data/examples/app/wiktacular/spec/wiktacular.rb +157 -0
- data/examples/app/wiktacular/src/controller.rb +55 -0
- data/examples/app/wiktacular/src/model.rb +102 -0
- data/examples/app/wiktacular/start.rb +8 -0
- data/examples/app/wiktacular/template/edit.xhtml +6 -0
- data/examples/app/wiktacular/template/html_layout.xhtml +27 -0
- data/examples/app/wiktacular/template/index.xhtml +9 -0
- data/examples/app/wiktacular/template/new.xhtml +6 -0
- data/examples/basic/element.rb +45 -0
- data/examples/basic/gestalt.rb +27 -0
- data/examples/basic/hello.rb +15 -0
- data/examples/basic/layout.rb +28 -0
- data/examples/basic/linking.rb +29 -0
- data/examples/basic/simple.rb +56 -0
- data/examples/helpers/cache.rb +31 -0
- data/examples/helpers/form_with_sequel.rb +24 -0
- data/examples/helpers/httpdigest.rb +50 -0
- data/examples/helpers/identity.rb +18 -0
- data/examples/helpers/nitro_form.rb +23 -0
- data/examples/helpers/paginate.rb +71 -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/misc/css.rb +37 -0
- data/examples/misc/facebook.rb +159 -0
- data/examples/misc/memleak_detector.rb +32 -0
- data/examples/misc/nagoro_element.rb +43 -0
- data/examples/misc/ramaise.rb +132 -0
- data/examples/misc/rapp.rb +45 -0
- data/examples/misc/sequel_scaffolding.rb +34 -0
- data/examples/misc/simple_auth.rb +35 -0
- data/examples/templates/template/external.amrita +19 -0
- data/examples/templates/template/external.haml +22 -0
- data/examples/templates/template/external.liquid +28 -0
- data/examples/templates/template/external.mab +30 -0
- data/examples/templates/template/external.nag +28 -0
- data/examples/templates/template/external.redcloth +19 -0
- data/examples/templates/template/external.rem +30 -0
- data/examples/templates/template/external.rhtml +28 -0
- data/examples/templates/template/external.tenjin +28 -0
- data/examples/templates/template/external.xsl +57 -0
- data/examples/templates/template/external.zmr +28 -0
- data/examples/templates/template_amrita2.rb +74 -0
- data/examples/templates/template_erubis.rb +53 -0
- data/examples/templates/template_ezamar.rb +50 -0
- data/examples/templates/template_haml.rb +50 -0
- data/examples/templates/template_liquid.rb +65 -0
- data/examples/templates/template_markaby.rb +58 -0
- data/examples/templates/template_nagoro.rb +51 -0
- data/examples/templates/template_redcloth.rb +59 -0
- data/examples/templates/template_remarkably.rb +55 -0
- data/examples/templates/template_tenjin.rb +53 -0
- data/examples/templates/template_xslt.rb +49 -0
- data/lib/proto/controller/init.rb +10 -0
- data/lib/proto/controller/main.rb +20 -0
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/css/ramaze_error.css +90 -0
- data/lib/proto/public/dispatch.fcgi +11 -0
- data/lib/proto/public/favicon.ico +0 -0
- data/lib/proto/public/js/jquery.js +3549 -0
- data/lib/proto/public/ramaze.png +0 -0
- data/lib/proto/spec/main.rb +25 -0
- data/lib/proto/start.rb +8 -0
- data/lib/proto/start.ru +16 -0
- data/lib/proto/view/error.xhtml +64 -0
- data/lib/proto/view/index.xhtml +34 -0
- data/lib/proto/view/page.xhtml +27 -0
- data/lib/ramaze/action/render.rb +191 -0
- data/lib/ramaze/action.rb +153 -0
- data/lib/ramaze/adapter/base.rb +128 -0
- data/lib/ramaze/adapter/cgi.rb +20 -0
- data/lib/ramaze/adapter/ebb.rb +18 -0
- data/lib/ramaze/adapter/evented_mongrel.rb +7 -0
- data/lib/ramaze/adapter/fake.rb +12 -0
- data/lib/ramaze/adapter/fcgi.rb +18 -0
- data/lib/ramaze/adapter/lsws.rb +19 -0
- data/lib/ramaze/adapter/mongrel.rb +21 -0
- data/lib/ramaze/adapter/scgi.rb +18 -0
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +7 -0
- data/lib/ramaze/adapter/thin.rb +17 -0
- data/lib/ramaze/adapter/webrick.rb +43 -0
- data/lib/ramaze/adapter.rb +97 -0
- data/lib/ramaze/cache/memcached.rb +69 -0
- data/lib/ramaze/cache/memory.rb +6 -0
- data/lib/ramaze/cache/yaml_store.rb +68 -0
- data/lib/ramaze/cache.rb +113 -0
- data/lib/ramaze/contrib/auto_params/get_args.rb +58 -0
- data/lib/ramaze/contrib/auto_params.rb +135 -0
- data/lib/ramaze/contrib/email.rb +84 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +171 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/file_cache.rb +65 -0
- data/lib/ramaze/contrib/gems.rb +78 -0
- data/lib/ramaze/contrib/gettext/mo.rb +155 -0
- data/lib/ramaze/contrib/gettext/parser.rb +46 -0
- data/lib/ramaze/contrib/gettext/po.rb +109 -0
- data/lib/ramaze/contrib/gettext.rb +113 -0
- data/lib/ramaze/contrib/gzip_filter.rb +69 -0
- data/lib/ramaze/contrib/maruku_uv.rb +59 -0
- data/lib/ramaze/contrib/profiling.rb +36 -0
- data/lib/ramaze/contrib/rest.rb +17 -0
- data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
- data/lib/ramaze/contrib/sequel/fill.rb +12 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
- data/lib/ramaze/contrib/sequel/image.rb +198 -0
- data/lib/ramaze/contrib/sequel/relation.rb +82 -0
- data/lib/ramaze/contrib/sequel_cache.rb +92 -0
- data/lib/ramaze/contrib.rb +82 -0
- data/lib/ramaze/controller/error.rb +46 -0
- data/lib/ramaze/controller/main.rb +2 -0
- data/lib/ramaze/controller/resolve.rb +273 -0
- data/lib/ramaze/controller.rb +280 -0
- data/lib/ramaze/current/request.rb +205 -0
- data/lib/ramaze/current/response.rb +39 -0
- data/lib/ramaze/current/session/flash.rb +87 -0
- data/lib/ramaze/current/session/hash.rb +66 -0
- data/lib/ramaze/current/session.rb +181 -0
- data/lib/ramaze/current.rb +110 -0
- data/lib/ramaze/dispatcher/action.rb +48 -0
- data/lib/ramaze/dispatcher/directory.rb +119 -0
- data/lib/ramaze/dispatcher/error.rb +108 -0
- data/lib/ramaze/dispatcher/file.rb +95 -0
- data/lib/ramaze/dispatcher.rb +145 -0
- data/lib/ramaze/error.rb +24 -0
- data/lib/ramaze/gestalt.rb +124 -0
- data/lib/ramaze/helper/aspect.rb +106 -0
- data/lib/ramaze/helper/auth.rb +125 -0
- data/lib/ramaze/helper/cache.rb +140 -0
- data/lib/ramaze/helper/cgi.rb +39 -0
- data/lib/ramaze/helper/flash.rb +59 -0
- data/lib/ramaze/helper/form.rb +281 -0
- data/lib/ramaze/helper/formatting.rb +158 -0
- data/lib/ramaze/helper/gestalt.rb +15 -0
- data/lib/ramaze/helper/gravatar.rb +15 -0
- data/lib/ramaze/helper/httpdigest.rb +59 -0
- data/lib/ramaze/helper/identity.rb +119 -0
- data/lib/ramaze/helper/link.rb +122 -0
- data/lib/ramaze/helper/markaby.rb +31 -0
- data/lib/ramaze/helper/maruku.rb +7 -0
- data/lib/ramaze/helper/nitroform.rb +14 -0
- data/lib/ramaze/helper/pager.rb +366 -0
- data/lib/ramaze/helper/paginate.rb +234 -0
- data/lib/ramaze/helper/partial.rb +105 -0
- data/lib/ramaze/helper/redirect.rb +82 -0
- data/lib/ramaze/helper/rest.rb +43 -0
- data/lib/ramaze/helper/sendfile.rb +16 -0
- data/lib/ramaze/helper/sequel.rb +55 -0
- data/lib/ramaze/helper/simple_captcha.rb +31 -0
- data/lib/ramaze/helper/stack.rb +77 -0
- data/lib/ramaze/helper/tagz.rb +19 -0
- data/lib/ramaze/helper/thread.rb +17 -0
- data/lib/ramaze/helper/ultraviolet.rb +44 -0
- data/lib/ramaze/helper/user.rb +110 -0
- data/lib/ramaze/helper/xhtml.rb +23 -0
- data/lib/ramaze/helper.rb +79 -0
- data/lib/ramaze/log/analogger.rb +40 -0
- data/lib/ramaze/log/growl.rb +38 -0
- data/lib/ramaze/log/hub.rb +41 -0
- data/lib/ramaze/log/informer.rb +128 -0
- data/lib/ramaze/log/knotify.rb +28 -0
- data/lib/ramaze/log/logger.rb +26 -0
- data/lib/ramaze/log/logging.rb +89 -0
- data/lib/ramaze/log/syslog.rb +51 -0
- data/lib/ramaze/log/xosd.rb +92 -0
- data/lib/ramaze/log.rb +27 -0
- data/lib/ramaze/option/dsl.rb +45 -0
- data/lib/ramaze/option/holder.rb +131 -0
- data/lib/ramaze/option/merger.rb +108 -0
- data/lib/ramaze/option.rb +156 -0
- data/lib/ramaze/reloader.rb +186 -0
- data/lib/ramaze/route.rb +97 -0
- data/lib/ramaze/setup.rb +50 -0
- data/lib/ramaze/snippets/array/put_within.rb +44 -0
- data/lib/ramaze/snippets/binding/locals.rb +25 -0
- data/lib/ramaze/snippets/blankslate.rb +7 -0
- data/lib/ramaze/snippets/dictionary.rb +504 -0
- data/lib/ramaze/snippets/divide.rb +20 -0
- data/lib/ramaze/snippets/fiber.rb +63 -0
- data/lib/ramaze/snippets/kernel/constant.rb +41 -0
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +21 -0
- data/lib/ramaze/snippets/metaid.rb +17 -0
- data/lib/ramaze/snippets/numeric/filesize_format.rb +32 -0
- data/lib/ramaze/snippets/numeric/time.rb +63 -0
- data/lib/ramaze/snippets/object/__dir__.rb +29 -0
- data/lib/ramaze/snippets/object/acquire.rb +40 -0
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +19 -0
- data/lib/ramaze/snippets/object/pretty.rb +16 -0
- data/lib/ramaze/snippets/object/scope.rb +18 -0
- data/lib/ramaze/snippets/object/traits.rb +76 -0
- data/lib/ramaze/snippets/ordered_set.rb +51 -0
- data/lib/ramaze/snippets/proc/locals.rb +19 -0
- data/lib/ramaze/snippets/ramaze/caller_info.rb +30 -0
- data/lib/ramaze/snippets/ramaze/caller_lines.rb +51 -0
- data/lib/ramaze/snippets/ramaze/deprecated.rb +20 -0
- data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
- data/lib/ramaze/snippets/ramaze/state.rb +86 -0
- data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
- data/lib/ramaze/snippets/string/camel_case.rb +21 -0
- data/lib/ramaze/snippets/string/color.rb +31 -0
- data/lib/ramaze/snippets/string/each.rb +19 -0
- data/lib/ramaze/snippets/string/end_with.rb +20 -0
- data/lib/ramaze/snippets/string/esc.rb +34 -0
- data/lib/ramaze/snippets/string/ord.rb +21 -0
- data/lib/ramaze/snippets/string/snake_case.rb +21 -0
- data/lib/ramaze/snippets/string/start_with.rb +19 -0
- data/lib/ramaze/snippets/string/unindent.rb +28 -0
- data/lib/ramaze/snippets/thread/into.rb +18 -0
- data/lib/ramaze/snippets.rb +22 -0
- data/lib/ramaze/spec/helper/bacon.rb +7 -0
- data/lib/ramaze/spec/helper/browser.rb +88 -0
- data/lib/ramaze/spec/helper/mock_http.rb +63 -0
- data/lib/ramaze/spec/helper/pretty_output.rb +82 -0
- data/lib/ramaze/spec/helper/requester.rb +63 -0
- data/lib/ramaze/spec/helper/simple_http.rb +434 -0
- data/lib/ramaze/spec/helper/snippets.rb +14 -0
- data/lib/ramaze/spec/helper.rb +135 -0
- data/lib/ramaze/spec.rb +1 -0
- data/lib/ramaze/store/default.rb +109 -0
- data/lib/ramaze/template/amrita2.rb +45 -0
- data/lib/ramaze/template/builder.rb +28 -0
- data/lib/ramaze/template/erubis.rb +41 -0
- data/lib/ramaze/template/ezamar/element.rb +169 -0
- data/lib/ramaze/template/ezamar/engine.rb +76 -0
- data/lib/ramaze/template/ezamar/morpher.rb +135 -0
- data/lib/ramaze/template/ezamar/render_partial.rb +31 -0
- data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
- data/lib/ramaze/template/ezamar.rb +42 -0
- data/lib/ramaze/template/haml.rb +37 -0
- data/lib/ramaze/template/liquid.rb +36 -0
- data/lib/ramaze/template/markaby.rb +52 -0
- data/lib/ramaze/template/maruku.rb +34 -0
- data/lib/ramaze/template/nagoro.rb +52 -0
- data/lib/ramaze/template/none.rb +14 -0
- data/lib/ramaze/template/redcloth.rb +25 -0
- data/lib/ramaze/template/remarkably.rb +38 -0
- data/lib/ramaze/template/sass.rb +37 -0
- data/lib/ramaze/template/tagz.rb +79 -0
- data/lib/ramaze/template/tenjin.rb +74 -0
- data/lib/ramaze/template/xslt.rb +100 -0
- data/lib/ramaze/template.rb +87 -0
- data/lib/ramaze/tool/create.rb +48 -0
- data/lib/ramaze/tool/daemonize.rb +37 -0
- data/lib/ramaze/tool/localize.rb +202 -0
- data/lib/ramaze/tool/mime.rb +35 -0
- data/lib/ramaze/tool/mime_types.yaml +615 -0
- data/lib/ramaze/tool/project_creator.rb +110 -0
- data/lib/ramaze/tool/record.rb +6 -0
- data/lib/ramaze/tool.rb +9 -0
- data/lib/ramaze/trinity.rb +16 -0
- data/lib/ramaze/version.rb +6 -0
- data/lib/ramaze.rb +133 -0
- data/lib/vendor/bacon.rb +323 -0
- data/rake_tasks/conf.rake +71 -0
- data/rake_tasks/coverage.rake +46 -0
- data/rake_tasks/gem.rake +74 -0
- data/rake_tasks/git.rake +41 -0
- data/rake_tasks/maintenance.rake +386 -0
- data/rake_tasks/metric.rake +24 -0
- data/rake_tasks/release.rake +76 -0
- data/rake_tasks/spec.rake +61 -0
- data/ramaze.gemspec +773 -0
- data/spec/contrib/auto_params.rb +121 -0
- data/spec/contrib/profiling.rb +29 -0
- data/spec/contrib/sequel/fill.rb +47 -0
- data/spec/examples/caching.rb +19 -0
- data/spec/examples/css.rb +15 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +11 -0
- data/spec/examples/linking.rb +18 -0
- data/spec/examples/simple.rb +45 -0
- data/spec/examples/simple_auth.rb +32 -0
- data/spec/examples/templates/template_amrita2.rb +16 -0
- data/spec/examples/templates/template_erubis.rb +23 -0
- data/spec/examples/templates/template_ezamar.rb +23 -0
- data/spec/examples/templates/template_haml.rb +23 -0
- data/spec/examples/templates/template_liquid.rb +29 -0
- data/spec/examples/templates/template_markaby.rb +23 -0
- data/spec/examples/templates/template_redcloth.rb +28 -0
- data/spec/examples/templates/template_remarkably.rb +23 -0
- data/spec/examples/templates/template_tenjin.rb +28 -0
- data/spec/helper.rb +3 -0
- data/spec/ramaze/action/basics.rb +36 -0
- data/spec/ramaze/action/cache.rb +87 -0
- data/spec/ramaze/action/file_cache.rb +70 -0
- data/spec/ramaze/action/layout.rb +190 -0
- data/spec/ramaze/action/render.rb +31 -0
- data/spec/ramaze/action/view/bar.xhtml +1 -0
- data/spec/ramaze/action/view/instancevars/layout.xhtml +1 -0
- data/spec/ramaze/action/view/other_wrapper.xhtml +1 -0
- data/spec/ramaze/action/view/single_wrapper.xhtml +1 -0
- data/spec/ramaze/action/view/sub/sub_wrapper.xhtml +1 -0
- data/spec/ramaze/adapter/ebb.rb +12 -0
- data/spec/ramaze/adapter/mongrel.rb +12 -0
- data/spec/ramaze/adapter/record.rb +31 -0
- data/spec/ramaze/adapter/webrick.rb +12 -0
- data/spec/ramaze/adapter.rb +49 -0
- data/spec/ramaze/cache.rb +140 -0
- data/spec/ramaze/controller/actionless_templates.rb +32 -0
- data/spec/ramaze/controller/resolve.rb +32 -0
- data/spec/ramaze/controller/subclass.rb +36 -0
- data/spec/ramaze/controller/template_resolving.rb +113 -0
- data/spec/ramaze/controller/view/bar.xhtml +1 -0
- data/spec/ramaze/controller/view/base/another.xhtml +1 -0
- data/spec/ramaze/controller/view/greet.xhtml +1 -0
- data/spec/ramaze/controller/view/list.xhtml +1 -0
- data/spec/ramaze/controller/view/other/greet/other.xhtml +1 -0
- data/spec/ramaze/controller/view/other_wrapper.xhtml +1 -0
- data/spec/ramaze/controller.rb +180 -0
- data/spec/ramaze/current/request.rb +30 -0
- data/spec/ramaze/current/session.rb +97 -0
- data/spec/ramaze/dispatcher/directory.rb +55 -0
- data/spec/ramaze/dispatcher/file.rb +60 -0
- data/spec/ramaze/dispatcher/public/favicon.ico +0 -0
- data/spec/ramaze/dispatcher/public/file name.txt +1 -0
- data/spec/ramaze/dispatcher/public/test_download.css +141 -0
- data/spec/ramaze/dispatcher.rb +31 -0
- data/spec/ramaze/element.rb +107 -0
- data/spec/ramaze/error.rb +94 -0
- data/spec/ramaze/gestalt.rb +131 -0
- data/spec/ramaze/helper/aspect.rb +101 -0
- data/spec/ramaze/helper/auth.rb +66 -0
- data/spec/ramaze/helper/cache.rb +160 -0
- data/spec/ramaze/helper/cgi.rb +43 -0
- data/spec/ramaze/helper/file.rb +18 -0
- data/spec/ramaze/helper/flash.rb +133 -0
- data/spec/ramaze/helper/form.rb +118 -0
- data/spec/ramaze/helper/formatting.rb +54 -0
- data/spec/ramaze/helper/link.rb +124 -0
- data/spec/ramaze/helper/pager.rb +99 -0
- data/spec/ramaze/helper/partial.rb +88 -0
- data/spec/ramaze/helper/redirect.rb +112 -0
- data/spec/ramaze/helper/simple_captcha.rb +22 -0
- data/spec/ramaze/helper/stack.rb +73 -0
- data/spec/ramaze/helper/user.rb +43 -0
- data/spec/ramaze/helper/view/locals.xhtml +1 -0
- data/spec/ramaze/helper/view/loop.xhtml +4 -0
- data/spec/ramaze/helper/view/num.xhtml +1 -0
- data/spec/ramaze/helper/view/partial.xhtml +1 -0
- data/spec/ramaze/helper/view/recursive.xhtml +8 -0
- data/spec/ramaze/helper/view/recursive_local_ivars.xhtml +7 -0
- data/spec/ramaze/helper/view/recursive_locals.xhtml +7 -0
- data/spec/ramaze/helper/view/test_template.xhtml +1 -0
- data/spec/ramaze/localize.rb +89 -0
- data/spec/ramaze/log/informer.rb +72 -0
- data/spec/ramaze/log/syslog.rb +73 -0
- data/spec/ramaze/morpher.rb +111 -0
- data/spec/ramaze/params.rb +157 -0
- data/spec/ramaze/public/error404.xhtml +1 -0
- data/spec/ramaze/public/favicon.ico +0 -0
- data/spec/ramaze/public/ramaze.png +0 -0
- data/spec/ramaze/public/test_download.css +141 -0
- data/spec/ramaze/request/ebb.rb +9 -0
- data/spec/ramaze/request/mongrel.rb +9 -0
- data/spec/ramaze/request/thin.rb +9 -0
- data/spec/ramaze/request/webrick.rb +5 -0
- data/spec/ramaze/request.rb +185 -0
- data/spec/ramaze/rewrite/file.css +1 -0
- data/spec/ramaze/rewrite.rb +36 -0
- data/spec/ramaze/route.rb +131 -0
- data/spec/ramaze/session.rb +94 -0
- data/spec/ramaze/store/default.rb +71 -0
- data/spec/ramaze/struct.rb +47 -0
- data/spec/ramaze/template/amrita2/external.amrita +6 -0
- data/spec/ramaze/template/amrita2/sum.amrita +1 -0
- data/spec/ramaze/template/amrita2.rb +50 -0
- data/spec/ramaze/template/builder/external.rxml +3 -0
- data/spec/ramaze/template/builder.rb +51 -0
- data/spec/ramaze/template/erubis/sum.rhtml +1 -0
- data/spec/ramaze/template/erubis.rb +41 -0
- data/spec/ramaze/template/ezamar/another/long/action.zmr +1 -0
- data/spec/ramaze/template/ezamar/combined.zmr +1 -0
- data/spec/ramaze/template/ezamar/file_only.zmr +1 -0
- data/spec/ramaze/template/ezamar/index.zmr +1 -0
- data/spec/ramaze/template/ezamar/nested.zmr +1 -0
- data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
- data/spec/ramaze/template/ezamar/some__long__action.zmr +1 -0
- data/spec/ramaze/template/ezamar/sum.zmr +1 -0
- data/spec/ramaze/template/ezamar.rb +63 -0
- data/spec/ramaze/template/haml/index.haml +5 -0
- data/spec/ramaze/template/haml/locals.haml +2 -0
- data/spec/ramaze/template/haml/with_vars.haml +4 -0
- data/spec/ramaze/template/haml.rb +66 -0
- data/spec/ramaze/template/liquid/index.liquid +1 -0
- data/spec/ramaze/template/liquid/products.liquid +45 -0
- data/spec/ramaze/template/liquid.rb +99 -0
- data/spec/ramaze/template/markaby/external.mab +8 -0
- data/spec/ramaze/template/markaby/sum.mab +1 -0
- data/spec/ramaze/template/markaby.rb +61 -0
- data/spec/ramaze/template/nagoro/another/long/action.nag +1 -0
- data/spec/ramaze/template/nagoro/combined.nag +1 -0
- data/spec/ramaze/template/nagoro/file_only.nag +1 -0
- data/spec/ramaze/template/nagoro/index.nag +1 -0
- data/spec/ramaze/template/nagoro/nested.nag +1 -0
- data/spec/ramaze/template/nagoro/some__long__action.nag +1 -0
- data/spec/ramaze/template/nagoro/sum.nag +1 -0
- data/spec/ramaze/template/nagoro.rb +64 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/ramaze/template/redcloth/external.redcloth +1 -0
- data/spec/ramaze/template/redcloth.rb +38 -0
- data/spec/ramaze/template/remarkably/external.rem +8 -0
- data/spec/ramaze/template/remarkably/sum.rem +1 -0
- data/spec/ramaze/template/remarkably.rb +58 -0
- data/spec/ramaze/template/sass/file.css.sass +5 -0
- data/spec/ramaze/template/sass.rb +69 -0
- data/spec/ramaze/template/tagz/external.tagz +8 -0
- data/spec/ramaze/template/tagz/sum.tagz +1 -0
- data/spec/ramaze/template/tagz.rb +62 -0
- data/spec/ramaze/template/tenjin/external.tenjin +1 -0
- data/spec/ramaze/template/tenjin.rb +47 -0
- data/spec/ramaze/template/xslt/concat_words.xsl +16 -0
- data/spec/ramaze/template/xslt/index.xsl +14 -0
- data/spec/ramaze/template/xslt/products.xsl +32 -0
- data/spec/ramaze/template/xslt/ruby_version.xsl +14 -0
- data/spec/ramaze/template/xslt.rb +90 -0
- data/spec/ramaze/template.rb +128 -0
- data/spec/snippets/array/put_within.rb +33 -0
- data/spec/snippets/binding/locals.rb +9 -0
- data/spec/snippets/divide.rb +19 -0
- data/spec/snippets/kernel/constant.rb +23 -0
- data/spec/snippets/numeric/filesize_format.rb +12 -0
- data/spec/snippets/numeric/time.rb +12 -0
- data/spec/snippets/object/__dir__.rb +8 -0
- data/spec/snippets/object/acquire.rb +71 -0
- data/spec/snippets/ordered_set.rb +63 -0
- data/spec/snippets/ramaze/caller_info.rb +39 -0
- data/spec/snippets/ramaze/caller_lines.rb +30 -0
- data/spec/snippets/string/camel_case.rb +25 -0
- data/spec/snippets/string/color.rb +11 -0
- data/spec/snippets/string/snake_case.rb +24 -0
- data/spec/snippets/string/unindent.rb +43 -0
- data/spec/snippets/thread/into.rb +20 -0
- metadata +823 -0
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'ramaze'
|
2
|
+
require 'ramaze/spec/helper'
|
3
|
+
|
4
|
+
require __DIR__/'../start'
|
5
|
+
|
6
|
+
describe MainController do
|
7
|
+
behaves_like 'http', 'xpath'
|
8
|
+
ramaze :view_root => __DIR__/'../view',
|
9
|
+
:public_root => __DIR__/'../public'
|
10
|
+
|
11
|
+
it 'should show start page' do
|
12
|
+
got = get('/')
|
13
|
+
got.status.should == 200
|
14
|
+
puts got.body
|
15
|
+
got.at('//title').text.strip.should ==
|
16
|
+
MainController.new.index
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should show /notemplate' do
|
20
|
+
got = get('/notemplate')
|
21
|
+
got.status.should == 200
|
22
|
+
got.at('//div').text.strip.should ==
|
23
|
+
MainController.new.notemplate
|
24
|
+
end
|
25
|
+
end
|
data/lib/proto/start.rb
ADDED
data/lib/proto/start.ru
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env rackup
|
2
|
+
# start.ru for ramaze apps
|
3
|
+
# use thin>=0.6.3
|
4
|
+
# thin start -r start.ru
|
5
|
+
#
|
6
|
+
# rackup is a useful tool for running Rack applications, which uses the
|
7
|
+
# Rack::Builder DSL to configure middleware and build up applications easily.
|
8
|
+
#
|
9
|
+
# rackup automatically figures out the environment it is run in, and runs your
|
10
|
+
# application as FastCGI, CGI, or standalone with Mongrel or WEBrick—all from
|
11
|
+
# the same configuration.
|
12
|
+
|
13
|
+
require 'start'
|
14
|
+
Ramaze.trait[:essentials].delete Ramaze::Adapter
|
15
|
+
Ramaze.start!
|
16
|
+
run Ramaze::Adapter::Base
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<link rel="stylesheet" href="/css/ramaze_error.css" />
|
2
|
+
<script type="text/javascript" src="/js/jquery.js"></script>
|
3
|
+
|
4
|
+
<p>The backtrace gives filenames and line numbers for all parts of the call stack.<br />
|
5
|
+
Click on any of them to view the surrounding source code.</p>
|
6
|
+
|
7
|
+
<h3>#@title</h3>
|
8
|
+
|
9
|
+
<table class="main">
|
10
|
+
<tr class="head">
|
11
|
+
<td>File</td><td>Line</td><td>Method</td>
|
12
|
+
</tr>
|
13
|
+
<?r @backtrace.each do |lines, hash, file, lineno, meth| ?>
|
14
|
+
<tr class="line" id="#{hash}">
|
15
|
+
<td>#{file}</td><td class="lineno">#{lineno}</td><td><pre>#{meth}</pre></td>
|
16
|
+
</tr>
|
17
|
+
<tr id="source_#{hash}" style="display:none;">
|
18
|
+
<td colspan="3">
|
19
|
+
<div class="source">
|
20
|
+
<table style="width:100%;">
|
21
|
+
<tr>
|
22
|
+
<td class="editor" colspan="2">
|
23
|
+
#{@editor} #{file} +#{lineno}
|
24
|
+
<div style="float: right">
|
25
|
+
<a href="txmt://open?url=file://#{file}&line=#{lineno}">open in textmate</a>
|
26
|
+
</div>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<?r lines.each do |llineno, lcode, lcurrent| ?>
|
30
|
+
<tr class="source" #{'style="background:#faa;"' if lcurrent}>
|
31
|
+
<td class="lineno">#{llineno}</td>
|
32
|
+
<td class="code"><pre>#{lcode.to_s.rstrip}</pre></td>
|
33
|
+
</tr>
|
34
|
+
<?r end ?>
|
35
|
+
</table>
|
36
|
+
</div>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<?r end ?>
|
40
|
+
</table>
|
41
|
+
|
42
|
+
<?r
|
43
|
+
{ 'Session' => Ramaze::STATE[:session],
|
44
|
+
'Request' => Ramaze::STATE[:request],
|
45
|
+
'Response' => Ramaze::STATE[:response],
|
46
|
+
'Global' => Global,
|
47
|
+
}.each do |title, content|
|
48
|
+
hash = [title, content].object_id.abs
|
49
|
+
?>
|
50
|
+
<div class="additional">
|
51
|
+
<h3 id="#{hash}">#{title}</h3>
|
52
|
+
<pre style="display:none" id="is_#{hash}">#{Rack::Utils.escape_html(content.pretty_inspect)}</pre>
|
53
|
+
</div>
|
54
|
+
<?r end ?>
|
55
|
+
|
56
|
+
<script type="text/javascript">
|
57
|
+
$("tr.line").click(function(){
|
58
|
+
$("tr#source_"+this.id).toggle()
|
59
|
+
});
|
60
|
+
|
61
|
+
$("div.additional > h3").click(function(){
|
62
|
+
$("pre#is_"+this.id).toggle()
|
63
|
+
});
|
64
|
+
</script>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<p>Ramaze is working correctly with this application, now you can start
|
2
|
+
working.</p>
|
3
|
+
|
4
|
+
<p>To start you can modify:
|
5
|
+
<ol>
|
6
|
+
<li>
|
7
|
+
<code>view/index.xhtml</code>, this page.
|
8
|
+
</li>
|
9
|
+
<li>
|
10
|
+
<code>view/page.xhtml</code>, the layout for this page.
|
11
|
+
</li>
|
12
|
+
<li>
|
13
|
+
<code>controller/main.rb</code>, where you can change the header of this
|
14
|
+
page and the <a href="/notemplate">notemplate</a> action
|
15
|
+
</li>
|
16
|
+
</ol>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<p>For more documentation, check out <a href="http://ramaze.net">www.ramaze.net</a>, which includes:
|
20
|
+
<ul>
|
21
|
+
<li>a <a href="http://ramaze.net/getting-started">getting started</a> guide</li>
|
22
|
+
<li>some <a href="http://ramaze.net/screencasts">screencasts</a></li>
|
23
|
+
<li>and an <a href="http://ramaze.rubyforge.org/tutorial/todolist.html">introductory tutorial</a></li>
|
24
|
+
</ul>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>You can also read the
|
28
|
+
<a href="http://ramaze.rubyforge.org/rdoc/files/doc/README.html">rdocs</a> or browse
|
29
|
+
around the <a href="http://source.ramaze.net">Ramaze source code</a>.
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<p>For help with Ramaze, visit the <a href="irc://chat.freenode.net/ramaze">#ramaze on irc.freenode.net</a> (you can use <a href="http://java.freenode.net/?channel=ramaze">this browser-based frontend</a>),
|
33
|
+
or post on the <a href="http://groups.google.com/group/ramaze">Ramaze Google Group</a>.
|
34
|
+
</p>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
+
<head>
|
6
|
+
<title>#{@title}</title>
|
7
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
8
|
+
<meta http-equiv="Content-Style-Type" content="text/css" />
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="expires" content="0" />
|
11
|
+
<meta name="description" content="Description for search engines" />
|
12
|
+
<meta name="generator" content="Ramaze #{Ramaze::VERSION}" />
|
13
|
+
<meta name="keywords" content="Ramaze, Your own keywords" />
|
14
|
+
<meta name="author" content="Max Mustermann" />
|
15
|
+
<meta name="date" content="#{Time.now.iso8601}" />
|
16
|
+
<style type="text/css">
|
17
|
+
body { margin: 2em; }
|
18
|
+
#content { margin-left: 2em; }
|
19
|
+
</style>
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<h1>#{@title}</h1>
|
23
|
+
<div id="content">
|
24
|
+
#@content
|
25
|
+
</div>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
module Ramaze
|
5
|
+
class Action
|
6
|
+
|
7
|
+
# Use your block and jump into the Action::stack - this allows you to call
|
8
|
+
# nested actions.
|
9
|
+
def stack
|
10
|
+
Action.stack << self
|
11
|
+
yield self
|
12
|
+
rescue Object => ex
|
13
|
+
Log.error "#{ex} in: #{self}"
|
14
|
+
raise ex
|
15
|
+
ensure
|
16
|
+
Action.stack.pop
|
17
|
+
end
|
18
|
+
|
19
|
+
# Render this instance of Action, this will (eventually) pass itself to
|
20
|
+
# Action#engine.transform
|
21
|
+
# Usage, given that Foo is a Controller and has the method/template
|
22
|
+
# for index:
|
23
|
+
# > Action(:controller => Foo).render
|
24
|
+
# #> 'bar'
|
25
|
+
|
26
|
+
def render
|
27
|
+
Log.dev("Action: #{self}")
|
28
|
+
stack do
|
29
|
+
if should_cache?
|
30
|
+
# Ignore cache if there is flash session data as the response probably
|
31
|
+
# expects to include it, making it unique for this user and request.
|
32
|
+
if Global.no_cache_flash && !Current.session.flash.empty?
|
33
|
+
Log.debug("Action caching ignored as session flash data is present.")
|
34
|
+
uncached_render
|
35
|
+
else
|
36
|
+
cached_render
|
37
|
+
end
|
38
|
+
else
|
39
|
+
uncached_render
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
# Return the cached output of the action if it exists, otherwise do a
|
47
|
+
# normal Action#uncached_render and store the output in the Cache.actions.
|
48
|
+
# Action#cached_render is only called if Action#should_cache? returns
|
49
|
+
# true.
|
50
|
+
|
51
|
+
def cached_render
|
52
|
+
if Global.file_cache
|
53
|
+
cached_render_file
|
54
|
+
else
|
55
|
+
cached_render_memory
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Uses files in the Global.public_root to provide a static ressource on
|
60
|
+
# next request and returns the rendered action
|
61
|
+
|
62
|
+
def cached_render_file
|
63
|
+
rendered = uncached_render
|
64
|
+
|
65
|
+
global_epath = Global.public_root/self.controller.mapping/extended_path
|
66
|
+
FileUtils.mkdir_p(File.dirname(global_epath))
|
67
|
+
File.open(global_epath, 'w+') {|fp| fp.print(rendered) }
|
68
|
+
|
69
|
+
rendered
|
70
|
+
end
|
71
|
+
|
72
|
+
# Using memory to cache, more sophisticated in terms of control but limited
|
73
|
+
# in terms of your RAM.
|
74
|
+
|
75
|
+
def cached_render_memory
|
76
|
+
cache = Cache.actions
|
77
|
+
options = cache_options
|
78
|
+
store_options = {}
|
79
|
+
key = full_path
|
80
|
+
|
81
|
+
if options.respond_to?(:values_at)
|
82
|
+
block, ttl = options.values_at(:key, :ttl)
|
83
|
+
|
84
|
+
key = [full_path, block.call] if block
|
85
|
+
store_options[:ttl] = ttl if ttl
|
86
|
+
end
|
87
|
+
|
88
|
+
cached_memory_process(cache, key, store_options)
|
89
|
+
end
|
90
|
+
|
91
|
+
def cached_memory_process(cache, key, store_options)
|
92
|
+
stored = cache[key] || {}
|
93
|
+
|
94
|
+
if content = stored[:content]
|
95
|
+
Log.debug "Action already cached"
|
96
|
+
Response.current['Content-Type'] = stored[:type]
|
97
|
+
else
|
98
|
+
Log.debug "Action will be rendered for caching"
|
99
|
+
stored[:content] = uncached_render
|
100
|
+
stored[:type] = Response.current['Content-Type']
|
101
|
+
cache.store(key, stored, store_options)
|
102
|
+
end
|
103
|
+
|
104
|
+
stored[:content]
|
105
|
+
end
|
106
|
+
|
107
|
+
# The 'normal' rendering process. Passes the Action instance to
|
108
|
+
# Action#engine.transform, which returns the output of the action.
|
109
|
+
# Layout will be found and rendered in this step after self was rendered.
|
110
|
+
|
111
|
+
def uncached_render
|
112
|
+
before_process
|
113
|
+
|
114
|
+
content = engine.transform(self)
|
115
|
+
|
116
|
+
if path and tlayout = layout
|
117
|
+
[instance, tlayout.instance].each do |i|
|
118
|
+
i.instance_variable_set("@content", content)
|
119
|
+
end
|
120
|
+
|
121
|
+
content = tlayout.render
|
122
|
+
end
|
123
|
+
|
124
|
+
content
|
125
|
+
|
126
|
+
ensure
|
127
|
+
after_process unless $!
|
128
|
+
end
|
129
|
+
|
130
|
+
# Determine whether or not we have a layout to process and sets it up
|
131
|
+
# correctly to be rendered in the same context as current action. Will
|
132
|
+
# return false if the layout is the same as current action to avoid
|
133
|
+
# infinite recursion and also if no layout on this controller or its
|
134
|
+
# ancestors was found.
|
135
|
+
|
136
|
+
def layout
|
137
|
+
return false unless layouts = controller.ancestral_trait[:layout]
|
138
|
+
|
139
|
+
possible = [layouts[path], layouts[:all]].compact
|
140
|
+
denied = layouts[:deny].to_a
|
141
|
+
|
142
|
+
if layout = possible.first
|
143
|
+
if layout.to_s !~ /\A\// # late bind layout action to current controller
|
144
|
+
layout = R(controller, layout)
|
145
|
+
end
|
146
|
+
layout_action = Controller.resolve(layout)
|
147
|
+
|
148
|
+
return false if denied.any?{|deny| deny === path} or layout_action.path == path
|
149
|
+
|
150
|
+
if layout_action.controller != controller
|
151
|
+
instance.instance_variables.each do |x|
|
152
|
+
if layout_action.instance.instance_variable_defined?(x)
|
153
|
+
Log.warn "overwriting instance variable #{x} from layout controller with instance variable from action controller."
|
154
|
+
end
|
155
|
+
layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))
|
156
|
+
end
|
157
|
+
else
|
158
|
+
layout_action.binding = binding
|
159
|
+
layout_action.controller = controller
|
160
|
+
layout_action.instance = instance
|
161
|
+
end
|
162
|
+
|
163
|
+
layout_action.path = nil
|
164
|
+
layout_action
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# List the cached actions, just a shortcut really
|
169
|
+
|
170
|
+
def actions_cached
|
171
|
+
controller.trait[:actions_cached]
|
172
|
+
end
|
173
|
+
|
174
|
+
# backwards compat with trait :actions_cached => []
|
175
|
+
def cache_options
|
176
|
+
actions_cached.is_a?(Hash) ? actions_cached[path.to_sym] : {}
|
177
|
+
end
|
178
|
+
|
179
|
+
# return true if the action is flagged for caching. Called by
|
180
|
+
# Action#render.
|
181
|
+
|
182
|
+
def should_cache?
|
183
|
+
ctrait = controller.trait
|
184
|
+
|
185
|
+
[ Global.cache_all,
|
186
|
+
ctrait[:cache_all],
|
187
|
+
actions_cached.map{|k,v| k.to_s}.include?(method),
|
188
|
+
].any?
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
module Ramaze
|
5
|
+
|
6
|
+
unless defined?(Action) # prevent problems for SourceReload
|
7
|
+
|
8
|
+
members = %w[method params template controller path binding engine instance]
|
9
|
+
|
10
|
+
# The Action holds information that is essential to render the action for a
|
11
|
+
# request.
|
12
|
+
|
13
|
+
class Action < Ramaze::Struct.new('Action', *members)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'ramaze/action/render'
|
18
|
+
require 'ramaze/helper/link'
|
19
|
+
|
20
|
+
class Action
|
21
|
+
include Helper::Link
|
22
|
+
|
23
|
+
class << self
|
24
|
+
|
25
|
+
# Instantiate with given Hash, takes both string/symbol keys.
|
26
|
+
# Only keys that match members of the Action-Struct are used.
|
27
|
+
|
28
|
+
def create(hash = {})
|
29
|
+
i = new
|
30
|
+
members.each do |key|
|
31
|
+
i.send("#{key}=", (hash[key] || hash[key.to_sym]))
|
32
|
+
end
|
33
|
+
i
|
34
|
+
end
|
35
|
+
|
36
|
+
# alias for stack.last, returns the instance of Action you are currently in.
|
37
|
+
|
38
|
+
def current
|
39
|
+
stack.last
|
40
|
+
end
|
41
|
+
|
42
|
+
# Return the stacked actions for the current request
|
43
|
+
def stack
|
44
|
+
STATE[:action_stack] ||= []
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# nicer representation of the Action
|
49
|
+
|
50
|
+
def to_s
|
51
|
+
m, p, t = method.inspect, params.inspect, template.inspect
|
52
|
+
%{#<Action method=#{m}, params=#{p} template=#{t}>}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Set the method, will be converted to a string and set to nil if empty.
|
56
|
+
|
57
|
+
def method=(meth)
|
58
|
+
meth = meth.to_s
|
59
|
+
self[:method] = (meth.empty? ? nil : meth)
|
60
|
+
end
|
61
|
+
|
62
|
+
# runs all parameters assigned through flatten and unescape
|
63
|
+
|
64
|
+
def params=(*par)
|
65
|
+
self[:params] = par.flatten.compact.map{|pa| Rack::Utils.unescape(pa.to_s) }
|
66
|
+
end
|
67
|
+
|
68
|
+
# Use this as key for caches.
|
69
|
+
|
70
|
+
def relaxed_hash
|
71
|
+
[controller, method, params, template, path].hash
|
72
|
+
end
|
73
|
+
|
74
|
+
# A Hash representation of Action
|
75
|
+
|
76
|
+
def to_hash
|
77
|
+
hash = {}
|
78
|
+
members.each{|m| hash[m.to_sym] = send(m)}
|
79
|
+
hash
|
80
|
+
end
|
81
|
+
|
82
|
+
# Determines based on controller.trait[:engine] and the template extensions
|
83
|
+
# which engine has to be used.
|
84
|
+
# Defaults to Template::Ezamar
|
85
|
+
|
86
|
+
def engine
|
87
|
+
return self[:engine] if self[:engine]
|
88
|
+
default = controller.trait.fetch(:engine, Template::Ezamar)
|
89
|
+
return default unless template
|
90
|
+
|
91
|
+
Template::ENGINES.sort_by{|v| v.join}.each do |(engine, exts)|
|
92
|
+
if template =~ /\.(#{Regexp.union(*exts)})$/
|
93
|
+
return self[:engine] = engine
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
self[:engine] = default
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns an instance of controller, will be cached on first access.
|
101
|
+
|
102
|
+
def instance
|
103
|
+
self[:instance] ||= controller.new
|
104
|
+
end
|
105
|
+
|
106
|
+
# Returns a binding of the instance, will be cached on first access.
|
107
|
+
|
108
|
+
def binding
|
109
|
+
self[:binding] ||= instance.instance_eval{ binding }
|
110
|
+
end
|
111
|
+
|
112
|
+
# Try to figure out a sane name for current action.
|
113
|
+
def name
|
114
|
+
File.basename((self[:method] || self[:template]).to_s).split('.').first
|
115
|
+
end
|
116
|
+
|
117
|
+
# combined path to current action, from path and params
|
118
|
+
def extended_path
|
119
|
+
(path == "index" && !params.empty? ? params : Array[path, *params]).join('/')
|
120
|
+
end
|
121
|
+
|
122
|
+
def full_path
|
123
|
+
self.controller.mapping/extended_path
|
124
|
+
end
|
125
|
+
|
126
|
+
# Hook for AspectHelper
|
127
|
+
|
128
|
+
def before_process
|
129
|
+
end
|
130
|
+
|
131
|
+
# Hook for AspectHelper
|
132
|
+
|
133
|
+
def after_process
|
134
|
+
end
|
135
|
+
|
136
|
+
def valid_rest?
|
137
|
+
return true unless rest = controller.trait[:REST]
|
138
|
+
meth = Request.current.request_method
|
139
|
+
|
140
|
+
return true if rest[:any].include?(name)
|
141
|
+
|
142
|
+
if rest.has_key?(meth)
|
143
|
+
rest[meth].include?(name)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Shortcut to create new instances of Action
|
149
|
+
|
150
|
+
def self.Action(hash = {})
|
151
|
+
Action.create(hash)
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
module Ramaze
|
5
|
+
module Adapter
|
6
|
+
|
7
|
+
# (Rack) middleware injected around Adapter::Base::call
|
8
|
+
MIDDLEWARE = OrderedSet[
|
9
|
+
Rack::ShowExceptions,
|
10
|
+
Rack::ShowStatus,
|
11
|
+
# Rack::Deflater,
|
12
|
+
Ramaze::Reloader,
|
13
|
+
Ramaze::Current,
|
14
|
+
Ramaze::Dispatcher
|
15
|
+
] unless defined? MIDDLEWARE
|
16
|
+
|
17
|
+
def self.middleware(mws = MIDDLEWARE)
|
18
|
+
if @middleware and trait[:previous] == mws
|
19
|
+
@middleware
|
20
|
+
else
|
21
|
+
trait :previous => mws.dup
|
22
|
+
inner_app = mws.last
|
23
|
+
cascade = mws[0...-1].reverse
|
24
|
+
|
25
|
+
@middleware = cascade.inject(inner_app){|app, mw| mw.new(app) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
@middleware = nil
|
30
|
+
@middleware = middleware
|
31
|
+
|
32
|
+
# Helper to assign a new block to before_call
|
33
|
+
# Usage:
|
34
|
+
# Ramaze::Adapter.before do |env|
|
35
|
+
# if env['PATH_INFO'] =~ /superfast/
|
36
|
+
# [200, {'Content-Type' => 'text/plain'}, ['super fast!']]
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
|
40
|
+
def self.before(&block)
|
41
|
+
@before = block if block
|
42
|
+
@before
|
43
|
+
end
|
44
|
+
|
45
|
+
# This class is holding common behaviour for its subclasses.
|
46
|
+
|
47
|
+
class Base
|
48
|
+
class << self
|
49
|
+
|
50
|
+
attr_reader :thread
|
51
|
+
|
52
|
+
# Call ::startup with the given host and port.
|
53
|
+
# Sets Global.server to itself.
|
54
|
+
# Adds a trap that is triggered by the value of Global.shutdown_trap,
|
55
|
+
# which is SIGINT by default.
|
56
|
+
|
57
|
+
def start(host = nil, port = nil)
|
58
|
+
@thread = startup(host, port)
|
59
|
+
Global.server = self
|
60
|
+
|
61
|
+
trap(Global.shutdown_trap){
|
62
|
+
trap(Global.shutdown_trap){ exit! }
|
63
|
+
exit
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Does nothing by default
|
68
|
+
|
69
|
+
def shutdown
|
70
|
+
if @server.respond_to?(:stop)
|
71
|
+
Log.dev "Stopping @server"
|
72
|
+
@server.stop
|
73
|
+
else
|
74
|
+
Log.dev "Cannot stop @server, skipping this step."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def join
|
79
|
+
@thread.join
|
80
|
+
end
|
81
|
+
|
82
|
+
# Tries to find the block assigned by #before and calls it, logs and
|
83
|
+
# raises again any errors encountered during this process.
|
84
|
+
|
85
|
+
def before_call env
|
86
|
+
if Adapter.before
|
87
|
+
begin
|
88
|
+
Adapter.before.call(env)
|
89
|
+
rescue Object => e
|
90
|
+
Ramaze::Log.error e
|
91
|
+
raise e
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# This is called by Rack with the usual env, subsequently calls
|
97
|
+
# ::respond with it.
|
98
|
+
#
|
99
|
+
# The method itself acts just as a wrapper for benchmarking and then
|
100
|
+
# calls .finish on the current response after ::respond has finished.
|
101
|
+
|
102
|
+
def call(env)
|
103
|
+
if returned = before_call(env)
|
104
|
+
returned
|
105
|
+
elsif Global.benchmarking
|
106
|
+
require 'benchmark'
|
107
|
+
time = Benchmark.measure{ returned = respond(env) }
|
108
|
+
Log.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])
|
109
|
+
returned
|
110
|
+
else
|
111
|
+
respond(env)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Initializes Request with env and an empty Response. Records the
|
116
|
+
# request into Ramaze::Record if Global.record is true.
|
117
|
+
# Then goes on and calls Dispatcher::handle with request and response.
|
118
|
+
|
119
|
+
def respond(env)
|
120
|
+
Ramaze::STATE.wrap do
|
121
|
+
Adapter::middleware.call(env)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
module Ramaze
|
5
|
+
Global.test_connections = false
|
6
|
+
|
7
|
+
module Adapter
|
8
|
+
# Our CGI adapter acts as wrapper for the Rack::Handler::CGI.
|
9
|
+
class Cgi < Base
|
10
|
+
|
11
|
+
# start CGI in a new thread, host and port parameter are only taken
|
12
|
+
# to make it compatible with other adapters but have no influence and
|
13
|
+
# can be omitted
|
14
|
+
def self.startup(host = nil, port = nil)
|
15
|
+
Global.server=self
|
16
|
+
Thread.new{ Rack::Handler::CGI.run(self) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'ebb'
|
2
|
+
|
3
|
+
module Ramaze
|
4
|
+
module Adapter
|
5
|
+
class Ebb < Base
|
6
|
+
def self.startup(host, port)
|
7
|
+
::Ebb.log = StringIO.new
|
8
|
+
Thread.new do
|
9
|
+
::Ebb.start_server(self, :port => port)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.shutdown
|
14
|
+
::Ebb.stop_server
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|