rjspotter-ramaze 2009.06.29
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/.gitignore +3 -0
- data/.mailmap +25 -0
- data/MANIFEST +502 -0
- data/README.md +457 -0
- data/Rakefile +88 -0
- data/benchmark/bench_templates/bench.rb +67 -0
- data/benchmark/bench_templates/view/large.erb +79 -0
- data/benchmark/bench_templates/view/large.haml +41 -0
- data/benchmark/bench_templates/view/large.xhtml +79 -0
- data/benchmark/bench_templates/view/small.erb +21 -0
- data/benchmark/bench_templates/view/small.haml +12 -0
- data/benchmark/bench_templates/view/small.xhtml +21 -0
- data/benchmark/results.txt +131 -0
- data/benchmark/run.rb +355 -0
- data/benchmark/suite/minimal.rb +11 -0
- data/benchmark/suite/no_informer.rb +7 -0
- data/benchmark/suite/no_sessions.rb +9 -0
- data/benchmark/suite/no_template.rb +7 -0
- data/benchmark/suite/simple.rb +5 -0
- data/benchmark/suite/template_erubis.rb +8 -0
- data/benchmark/suite/template_etanni.rb +8 -0
- data/benchmark/suite/template_ezamar.rb +8 -0
- data/benchmark/suite/template_haml.rb +13 -0
- data/benchmark/suite/template_liquid.rb +11 -0
- data/benchmark/suite/template_markaby.rb +9 -0
- data/benchmark/suite/template_nagoro.rb +8 -0
- data/benchmark/suite/template_redcloth.rb +13 -0
- data/benchmark/suite/template_tenjin.rb +8 -0
- data/benchmark/test.rb +35 -0
- data/bin/ramaze +15 -0
- data/doc/AUTHORS +44 -0
- data/doc/CHANGELOG +17362 -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 +146 -0
- data/doc/meta/configuration.txt +163 -0
- data/doc/meta/internals.txt +278 -0
- data/doc/meta/users.kml +64 -0
- data/doc/tutorial/todolist.html +1379 -0
- data/doc/tutorial/todolist.txt +920 -0
- data/examples/app/auth/layout/auth.xhtml +25 -0
- data/examples/app/auth/start.rb +23 -0
- data/examples/app/auth/view/index.xhtml +4 -0
- data/examples/app/auth/view/login.xhtml +20 -0
- data/examples/app/auth/view/secret.xhtml +1 -0
- data/examples/app/blog/README +3 -0
- data/examples/app/blog/app.rb +69 -0
- data/examples/app/blog/config.ru +17 -0
- data/examples/app/blog/controller/comment.rb +45 -0
- data/examples/app/blog/controller/entry.rb +85 -0
- data/examples/app/blog/controller/init.rb +86 -0
- data/examples/app/blog/controller/main.rb +20 -0
- data/examples/app/blog/controller/tag.rb +9 -0
- data/examples/app/blog/layout/default.nag +31 -0
- data/examples/app/blog/model/comment.rb +58 -0
- data/examples/app/blog/model/entry.rb +89 -0
- data/examples/app/blog/model/init.rb +15 -0
- data/examples/app/blog/model/tag.rb +36 -0
- data/examples/app/blog/public/css/screen.css +273 -0
- data/examples/app/blog/spec/blog.rb +87 -0
- data/examples/app/blog/start.rb +5 -0
- data/examples/app/blog/view/comment/form.nag +10 -0
- data/examples/app/blog/view/comment/show.nag +16 -0
- data/examples/app/blog/view/entry/edit.nag +14 -0
- data/examples/app/blog/view/entry/feed.atom.nag +8 -0
- data/examples/app/blog/view/entry/feed.rss.nag +7 -0
- data/examples/app/blog/view/entry/index.nag +7 -0
- data/examples/app/blog/view/entry/new.nag +13 -0
- data/examples/app/blog/view/entry/show.nag +36 -0
- data/examples/app/blog/view/feed.atom.nag +18 -0
- data/examples/app/blog/view/feed.rss.nag +25 -0
- data/examples/app/blog/view/index.nag +6 -0
- data/examples/app/blog/view/tag/index.nag +5 -0
- data/examples/app/chat/layout/default.xhtml +13 -0
- data/examples/app/chat/model/history.rb +38 -0
- data/examples/app/chat/model/message.rb +7 -0
- data/examples/app/chat/public/css/chat.css +9 -0
- data/examples/app/chat/public/js/chat.js +28 -0
- data/examples/app/chat/public/js/jquery.js +3436 -0
- data/examples/app/chat/start.rb +39 -0
- data/examples/app/chat/view/chat.xhtml +9 -0
- data/examples/app/chat/view/index.xhtml +7 -0
- data/examples/app/localization/locale/de.yaml +5 -0
- data/examples/app/localization/locale/en.yaml +5 -0
- data/examples/app/localization/locale/ja.yaml +5 -0
- data/examples/app/localization/start.rb +48 -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/start.rb +79 -0
- data/examples/app/sourceview/view/index.haml +59 -0
- data/examples/app/todolist/controller/init.rb +10 -0
- data/examples/app/todolist/controller/task.rb +39 -0
- data/examples/app/todolist/layout/default.xhtml +14 -0
- data/examples/app/todolist/model/init.rb +14 -0
- data/examples/app/todolist/model/task.rb +39 -0
- data/examples/app/todolist/public/css/screen.css +63 -0
- data/examples/app/todolist/public/favicon.ico +0 -0
- data/examples/app/todolist/start.rb +11 -0
- data/examples/app/todolist/view/index.xhtml +29 -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 +109 -0
- data/examples/app/wikore/src/controller.rb +78 -0
- data/examples/app/wikore/src/model.rb +56 -0
- data/examples/app/wikore/start.rb +9 -0
- data/examples/app/wikore/view/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 +47 -0
- data/examples/basic/gestalt.rb +26 -0
- data/examples/basic/hello.rb +14 -0
- data/examples/basic/layout.rb +28 -0
- data/examples/basic/linking.rb +29 -0
- data/examples/basic/partial.rb +26 -0
- data/examples/basic/simple.rb +52 -0
- data/examples/helpers/cache.rb +33 -0
- data/examples/helpers/form_with_sequel.rb +24 -0
- data/examples/helpers/httpdigest.rb +107 -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/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 +37 -0
- data/examples/misc/nagoro_element.rb +43 -0
- data/examples/misc/ramaise.rb +132 -0
- data/examples/misc/rapp.rb +56 -0
- data/examples/misc/sequel_scaffolding.rb +34 -0
- data/examples/misc/serve_directory.rb +6 -0
- data/examples/templates/template_erubis.rb +52 -0
- data/examples/templates/template_ezamar.rb +51 -0
- data/examples/templates/template_haml.rb +49 -0
- data/examples/templates/template_liquid.rb +66 -0
- data/examples/templates/template_markaby.rb +57 -0
- data/examples/templates/template_nagoro.rb +50 -0
- data/examples/templates/template_redcloth.rb +58 -0
- data/examples/templates/template_remarkably.rb +54 -0
- data/examples/templates/template_tenjin.rb +52 -0
- data/examples/templates/view/external.haml +22 -0
- data/examples/templates/view/external.liquid +28 -0
- data/examples/templates/view/external.mab +30 -0
- data/examples/templates/view/external.nag +28 -0
- data/examples/templates/view/external.redcloth +19 -0
- data/examples/templates/view/external.rem +30 -0
- data/examples/templates/view/external.rhtml +28 -0
- data/examples/templates/view/external.tenjin +28 -0
- data/examples/templates/view/external.zmr +28 -0
- data/lib/proto/app.rb +14 -0
- data/lib/proto/config.ru +20 -0
- data/lib/proto/controller/init.rb +11 -0
- data/lib/proto/controller/main.rb +20 -0
- data/lib/proto/layout/default.xhtml +24 -0
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/.htaccess +24 -0
- data/lib/proto/public/css/screen.css +30 -0
- data/lib/proto/public/dispatch.fcgi +11 -0
- data/lib/proto/public/favicon.ico +0 -0
- data/lib/proto/public/js/jquery.js +4376 -0
- data/lib/proto/public/ramaze.png +0 -0
- data/lib/proto/spec/main.rb +20 -0
- data/lib/proto/start.rb +8 -0
- data/lib/proto/view/index.xhtml +41 -0
- data/lib/ramaze.rb +87 -0
- data/lib/ramaze/app.rb +124 -0
- data/lib/ramaze/cache.rb +19 -0
- data/lib/ramaze/cache/localmemcache.rb +56 -0
- data/lib/ramaze/cache/memcache.rb +124 -0
- data/lib/ramaze/cache/sequel.rb +82 -0
- data/lib/ramaze/contrib/addressable_route.rb +55 -0
- data/lib/ramaze/contrib/app_graph.rb +64 -0
- data/lib/ramaze/contrib/email.rb +88 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +171 -0
- data/lib/ramaze/contrib/gettext.rb +113 -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/gzip_filter.rb +1 -0
- data/lib/ramaze/contrib/maruku_uv.rb +59 -0
- data/lib/ramaze/contrib/profiling.rb +36 -0
- data/lib/ramaze/contrib/rest.rb +22 -0
- data/lib/ramaze/contrib/sequel/create_join.rb +26 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
- data/lib/ramaze/contrib/sequel/image.rb +196 -0
- data/lib/ramaze/contrib/sequel/relation.rb +98 -0
- data/lib/ramaze/controller.rb +104 -0
- data/lib/ramaze/controller/default.rb +12 -0
- data/lib/ramaze/current.rb +7 -0
- data/lib/ramaze/files.rb +24 -0
- data/lib/ramaze/gestalt.rb +132 -0
- data/lib/ramaze/helper.rb +13 -0
- data/lib/ramaze/helper/auth.rb +84 -0
- data/lib/ramaze/helper/bench.rb +41 -0
- data/lib/ramaze/helper/cache.rb +117 -0
- data/lib/ramaze/helper/disqus.rb +26 -0
- data/lib/ramaze/helper/flash.rb +62 -0
- data/lib/ramaze/helper/form.rb +127 -0
- data/lib/ramaze/helper/formatting.rb +189 -0
- data/lib/ramaze/helper/gestalt.rb +47 -0
- data/lib/ramaze/helper/gravatar.rb +79 -0
- data/lib/ramaze/helper/httpdigest.rb +97 -0
- data/lib/ramaze/helper/identity.rb +119 -0
- data/lib/ramaze/helper/layout.rb +97 -0
- data/lib/ramaze/helper/link.rb +56 -0
- data/lib/ramaze/helper/localize.rb +138 -0
- data/lib/ramaze/helper/markaby.rb +31 -0
- data/lib/ramaze/helper/maruku.rb +16 -0
- data/lib/ramaze/helper/nitroform.rb +14 -0
- data/lib/ramaze/helper/pager.rb +367 -0
- data/lib/ramaze/helper/paginate.rb +242 -0
- data/lib/ramaze/helper/partial.rb +100 -0
- data/lib/ramaze/helper/remarkably.rb +14 -0
- data/lib/ramaze/helper/request_accessor.rb +16 -0
- data/lib/ramaze/helper/sequel.rb +55 -0
- data/lib/ramaze/helper/sequel_form.rb +284 -0
- data/lib/ramaze/helper/simple_captcha.rb +61 -0
- data/lib/ramaze/helper/stack.rb +75 -0
- data/lib/ramaze/helper/tagz.rb +19 -0
- data/lib/ramaze/helper/thread.rb +17 -0
- data/lib/ramaze/helper/ultraviolet.rb +46 -0
- data/lib/ramaze/helper/user.rb +229 -0
- data/lib/ramaze/helper/xhtml.rb +34 -0
- data/lib/ramaze/log.rb +39 -0
- data/lib/ramaze/log/analogger.rb +39 -0
- data/lib/ramaze/log/growl.rb +38 -0
- data/lib/ramaze/log/hub.rb +41 -0
- data/lib/ramaze/log/informer.rb +129 -0
- data/lib/ramaze/log/knotify.rb +28 -0
- data/lib/ramaze/log/logger.rb +26 -0
- data/lib/ramaze/log/logging.rb +83 -0
- data/lib/ramaze/log/rotatinginformer.rb +168 -0
- data/lib/ramaze/log/syslog.rb +51 -0
- data/lib/ramaze/log/xosd.rb +92 -0
- data/lib/ramaze/middleware_compiler.rb +13 -0
- data/lib/ramaze/plugin.rb +69 -0
- data/lib/ramaze/reloader.rb +172 -0
- data/lib/ramaze/reloader/watch_inotify.rb +85 -0
- data/lib/ramaze/reloader/watch_stat.rb +58 -0
- data/lib/ramaze/request.rb +115 -0
- data/lib/ramaze/response.rb +36 -0
- data/lib/ramaze/setup.rb +123 -0
- data/lib/ramaze/snippets.rb +22 -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/fiber.rb +63 -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/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/ordered_set.rb +51 -0
- data/lib/ramaze/snippets/proc/locals.rb +19 -0
- data/lib/ramaze/snippets/ramaze/acquire.rb +31 -0
- data/lib/ramaze/snippets/ramaze/deprecated.rb +23 -0
- data/lib/ramaze/snippets/ramaze/dictionary.rb +400 -0
- data/lib/ramaze/snippets/ramaze/fiber.rb +24 -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/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/spec.rb +33 -0
- data/lib/ramaze/spec/bacon.rb +34 -0
- data/lib/ramaze/spec/helper/bacon.rb +8 -0
- data/lib/ramaze/spec/helper/pretty_output.rb +82 -0
- data/lib/ramaze/spec/helper/snippets.rb +16 -0
- data/lib/ramaze/spec/helper/template_examples.rb +19 -0
- data/lib/ramaze/tool/bin.rb +340 -0
- data/lib/ramaze/tool/create.rb +48 -0
- data/lib/ramaze/tool/project_creator.rb +111 -0
- data/lib/ramaze/version.rb +3 -0
- data/lib/ramaze/view.rb +39 -0
- data/lib/ramaze/view/erubis.rb +23 -0
- data/lib/ramaze/view/ezamar.rb +23 -0
- data/lib/ramaze/view/gestalt.rb +14 -0
- data/lib/ramaze/view/haml.rb +16 -0
- data/lib/ramaze/view/liquid.rb +100 -0
- data/lib/ramaze/view/maruku.rb +15 -0
- data/lib/ramaze/view/nagoro.rb +44 -0
- data/lib/ramaze/view/nagoro/render_partial.rb +32 -0
- data/lib/ramaze/view/redcloth.rb +21 -0
- data/lib/ramaze/view/remarkably.rb +21 -0
- data/lib/ramaze/view/sass.rb +21 -0
- data/lib/ramaze/view/tagz.rb +63 -0
- data/lib/ramaze/view/tenjin.rb +32 -0
- data/lib/vendor/etag.rb +22 -0
- data/lib/vendor/route_exceptions.rb +42 -0
- data/ramaze.gemspec +85 -0
- data/spec/contrib/addressable_route.rb +32 -0
- data/spec/contrib/rest.rb +28 -0
- data/spec/examples/caching.rb +16 -0
- data/spec/examples/css.rb +14 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +10 -0
- data/spec/examples/helpers/httpdigest.rb +64 -0
- data/spec/examples/linking.rb +17 -0
- data/spec/examples/simple.rb +40 -0
- data/spec/examples/templates/template_erubis.rb +10 -0
- data/spec/examples/templates/template_ezamar.rb +10 -0
- data/spec/examples/templates/template_haml.rb +10 -0
- data/spec/examples/templates/template_liquid.rb +10 -0
- data/spec/examples/templates/template_markaby.rb +11 -0
- data/spec/examples/templates/template_nagoro.rb +10 -0
- data/spec/examples/templates/template_redcloth.rb +10 -0
- data/spec/examples/templates/template_remarkably.rb +10 -0
- data/spec/examples/templates/template_tenjin.rb +10 -0
- data/spec/helper.rb +9 -0
- data/spec/ramaze/action/render.rb +21 -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.erb +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.erb +1 -0
- data/spec/ramaze/action/view/sub/sub_wrapper.xhtml +1 -0
- data/spec/ramaze/app.rb +47 -0
- data/spec/ramaze/bin/ramaze.rb +91 -0
- data/spec/ramaze/cache/localmemcache.rb +49 -0
- data/spec/ramaze/cache/memcache.rb +60 -0
- data/spec/ramaze/cache/sequel.rb +51 -0
- data/spec/ramaze/controller/actionless_templates.rb +36 -0
- data/spec/ramaze/controller/lonely_mapping.rb +16 -0
- data/spec/ramaze/controller/mapping.rb +43 -0
- data/spec/ramaze/controller/provide_inheritance.rb +47 -0
- data/spec/ramaze/controller/resolve.rb +30 -0
- data/spec/ramaze/controller/subclass.rb +36 -0
- data/spec/ramaze/controller/template_resolving.rb +77 -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/dispatcher/directory.rb +69 -0
- data/spec/ramaze/dispatcher/file.rb +71 -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/error.rb +88 -0
- data/spec/ramaze/files.rb +29 -0
- data/spec/ramaze/files/public_1/plain.txt +1 -0
- data/spec/ramaze/files/public_2/rich.txt +1 -0
- data/spec/ramaze/gestalt.rb +135 -0
- data/spec/ramaze/helper/auth.rb +83 -0
- data/spec/ramaze/helper/bench.rb +18 -0
- data/spec/ramaze/helper/cache.rb +124 -0
- data/spec/ramaze/helper/flash.rb +41 -0
- data/spec/ramaze/helper/form.rb +356 -0
- data/spec/ramaze/helper/formatting.rb +111 -0
- data/spec/ramaze/helper/gestalt.rb +15 -0
- data/spec/ramaze/helper/gravatar.rb +40 -0
- data/spec/ramaze/helper/httpdigest.rb +144 -0
- data/spec/ramaze/helper/layout.rb +79 -0
- data/spec/ramaze/helper/layout/default.xhtml +5 -0
- data/spec/ramaze/helper/link.rb +70 -0
- data/spec/ramaze/helper/localize.rb +62 -0
- data/spec/ramaze/helper/maruku.rb +19 -0
- data/spec/ramaze/helper/pager.rb +96 -0
- data/spec/ramaze/helper/paginate.rb +68 -0
- data/spec/ramaze/helper/request_accessor.rb +19 -0
- data/spec/ramaze/helper/sequel_form.rb +91 -0
- data/spec/ramaze/helper/simple_captcha.rb +45 -0
- data/spec/ramaze/helper/stack.rb +86 -0
- data/spec/ramaze/helper/user.rb +72 -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/helper/xhtml.rb +32 -0
- data/spec/ramaze/log/informer.rb +73 -0
- data/spec/ramaze/log/logging.rb +63 -0
- data/spec/ramaze/log/syslog.rb +73 -0
- data/spec/ramaze/params.rb +153 -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.rb +61 -0
- data/spec/ramaze/rewrite/file.css +1 -0
- data/spec/ramaze/session/memcache.rb +66 -0
- data/spec/ramaze/struct.rb +47 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/ramaze/view.rb +36 -0
- data/spec/ramaze/view/erubis.rb +73 -0
- data/spec/ramaze/view/erubis/external.rhtml +8 -0
- data/spec/ramaze/view/erubis/sum.rhtml +1 -0
- data/spec/ramaze/view/ezamar.rb +73 -0
- data/spec/ramaze/view/ezamar/external.zmr +8 -0
- data/spec/ramaze/view/ezamar/sum.zmr +1 -0
- data/spec/ramaze/view/gestalt.rb +94 -0
- data/spec/ramaze/view/gestalt/external.ges +8 -0
- data/spec/ramaze/view/haml.rb +86 -0
- data/spec/ramaze/view/haml/external.haml +5 -0
- data/spec/ramaze/view/haml/sum.haml +2 -0
- data/spec/ramaze/view/liquid.rb +73 -0
- data/spec/ramaze/view/liquid/external.liquid +8 -0
- data/spec/ramaze/view/liquid/sum.liquid +1 -0
- data/spec/ramaze/view/nagoro.rb +73 -0
- data/spec/ramaze/view/nagoro/external.nag +8 -0
- data/spec/ramaze/view/nagoro/sum.nag +1 -0
- data/spec/ramaze/view/redcloth.rb +66 -0
- data/spec/ramaze/view/redcloth/external.redcloth +8 -0
- data/spec/ramaze/view/remarkably.rb +49 -0
- data/spec/ramaze/view/remarkably/external.rem +8 -0
- data/spec/ramaze/view/remarkably/sum.rem +1 -0
- data/spec/ramaze/view/sass.rb +73 -0
- data/spec/ramaze/view/sass/file.css.sass +5 -0
- data/spec/ramaze/view/tagz.rb +51 -0
- data/spec/ramaze/view/tagz/external.tagz +8 -0
- data/spec/ramaze/view/tagz/sum.tagz +1 -0
- data/spec/ramaze/view/tenjin.rb +57 -0
- data/spec/ramaze/view/tenjin/external.rbhtml +8 -0
- data/spec/ramaze/view/tenjin/sum.rbhtml +1 -0
- data/spec/snippets/array/put_within.rb +33 -0
- data/spec/snippets/binding/locals.rb +9 -0
- data/spec/snippets/numeric/filesize_format.rb +12 -0
- data/spec/snippets/numeric/time.rb +12 -0
- data/spec/snippets/object/__dir__.rb +14 -0
- data/spec/snippets/ordered_set.rb +63 -0
- data/spec/snippets/ramaze/acquire.rb +77 -0
- data/spec/snippets/ramaze/dictionary.rb +110 -0
- data/spec/snippets/ramaze/struct.rb +12 -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 +9 -0
- data/tasks/authors.rake +30 -0
- data/tasks/bacon.rake +66 -0
- data/tasks/changelog.rake +20 -0
- data/tasks/copyright.rake +21 -0
- data/tasks/gem.rake +22 -0
- data/tasks/gem_setup.rake +99 -0
- data/tasks/git.rake +46 -0
- data/tasks/grancher.rake +12 -0
- data/tasks/jquery.rake +15 -0
- data/tasks/manifest.rake +4 -0
- data/tasks/metric_changes.rake +24 -0
- data/tasks/rcov.rake +23 -0
- data/tasks/release.rake +54 -0
- data/tasks/reversion.rake +8 -0
- data/tasks/setup.rake +6 -0
- data/tasks/todo.rake +27 -0
- data/tasks/traits.rake +21 -0
- data/tasks/yard.rake +4 -0
- metadata +720 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
module Ramaze
|
2
|
+
module Helper
|
3
|
+
|
4
|
+
# Helps you building Gravatar URIs from an email address.
|
5
|
+
#
|
6
|
+
# For more information about gravatars, please see: http://gravatar.com
|
7
|
+
#
|
8
|
+
# The implementation of the gravatar method changed significantly, it does
|
9
|
+
# less hand-holding but is more flexible so you can simply put your own
|
10
|
+
# helper on top.
|
11
|
+
#
|
12
|
+
# It might not know about all the secret parameters (like 'force'), if you
|
13
|
+
# find out more of these please consider contributing a patch.
|
14
|
+
module Gravatar
|
15
|
+
|
16
|
+
# API to build gravatar URIs from an email address (or any other String).
|
17
|
+
#
|
18
|
+
# @example Simple usage
|
19
|
+
#
|
20
|
+
# class Gravatars < Ramaze::Controller
|
21
|
+
# helper :gravatar
|
22
|
+
#
|
23
|
+
# def index
|
24
|
+
# %q(
|
25
|
+
# Input your email address and I'll show you your Gravatar
|
26
|
+
# <form>
|
27
|
+
# <input type="text" name="email" />
|
28
|
+
# <input type="submit" />
|
29
|
+
# </form>
|
30
|
+
# <?r if email = request[:email] ?>
|
31
|
+
# Your gravatar is:
|
32
|
+
# <img src="#{gravatar(email)}" />
|
33
|
+
# <?r end ?>
|
34
|
+
# )
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# @option opts [#to_s] :ext (nil)
|
39
|
+
# append a filename extension for the image, like '.jpg'
|
40
|
+
#
|
41
|
+
# @option opts [#to_i] :size (80)
|
42
|
+
# The size of the gravatar, square, so 80 is 80x80.
|
43
|
+
# Allowed range is from 1 to 512.
|
44
|
+
#
|
45
|
+
# @option opts [#to_s] :rating ('g')
|
46
|
+
# Only serve a gravatar if it has a content rating equal or below the
|
47
|
+
# one specified. Ratings, in order are: 'g', 'pg', 'r', or 'x'
|
48
|
+
#
|
49
|
+
# @option opts [#to_s] :default (nil)
|
50
|
+
# Fall back to default if the given +email+ doesn't have an gravatar;
|
51
|
+
# may be an absolute url, 'identicon', 'monsterid', or 'wavatar'
|
52
|
+
#
|
53
|
+
# @options opts [true, false] :force (false)
|
54
|
+
# Force use of the default avatar, useful if you want to use only
|
55
|
+
# identicons or the like
|
56
|
+
#
|
57
|
+
# @param [#to_str] email
|
58
|
+
#
|
59
|
+
# @return [URI]
|
60
|
+
#
|
61
|
+
# @see http://en.gravatar.com/site/implement/url
|
62
|
+
# @author manveru
|
63
|
+
def gravatar(email, opts = {})
|
64
|
+
uri = URI("http://www.gravatar.com/")
|
65
|
+
ext = opts[:ext]
|
66
|
+
uri.path = "/avatar/#{Digest::MD5.hexdigest(email.to_str)}#{ext}"
|
67
|
+
|
68
|
+
query = {}
|
69
|
+
query[:size] = opts[:size].to_i.to_s if opts.key?(:size)
|
70
|
+
query[:rating] = opts[:rating].to_s if opts.key?(:rating)
|
71
|
+
query[:default] = opts[:default].to_s if opts.key?(:default)
|
72
|
+
query[:force] = '1' if opts[:force]
|
73
|
+
|
74
|
+
uri.query = Rack::Utils.build_query(query) if query.any?
|
75
|
+
uri
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
begin
|
2
|
+
require 'securerandom' # Ruby >= 1.8.7
|
3
|
+
rescue LoadError
|
4
|
+
require 'uuidtools'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'digest/md5'
|
8
|
+
|
9
|
+
module Ramaze
|
10
|
+
module Helper
|
11
|
+
# Authorization using HTTP Digest.
|
12
|
+
#
|
13
|
+
# For custom authorization failure handling add an {httpdigest_failure}
|
14
|
+
# method in your controller.
|
15
|
+
module HttpDigest
|
16
|
+
|
17
|
+
SESSION_NONCE = 'httpdigest_authentication_nonce'
|
18
|
+
SESSION_OPAQUE = 'httpdigest_authentication_opaque'
|
19
|
+
DIGEST_HEADER = %|Digest realm="%s", qop="auth,auth-int", nonce="%s", opaque="%s"|
|
20
|
+
|
21
|
+
# Delete the nonce and opaque from session to log out.
|
22
|
+
def httpdigest_logout
|
23
|
+
session.delete(SESSION_NONCE)
|
24
|
+
session.delete(SESSION_OPAQUE)
|
25
|
+
end
|
26
|
+
|
27
|
+
def httpdigest_uuid
|
28
|
+
::SecureRandom.hex(32)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set the WWW-Authenticate header and store relevant data in the session.
|
32
|
+
#
|
33
|
+
# @param [String] uid
|
34
|
+
# @param [String] realm
|
35
|
+
def httpdigest_headers(uid, realm)
|
36
|
+
nonce = session[SESSION_NONCE] = httpdigest_uuid
|
37
|
+
opaque = session[SESSION_OPAQUE][realm][uid] = httpdigest_uuid
|
38
|
+
response['WWW-Authenticate'] = DIGEST_HEADER % [realm, nonce, opaque]
|
39
|
+
end
|
40
|
+
|
41
|
+
def httpdigest_failure
|
42
|
+
respond 'Unauthorized', 401
|
43
|
+
end
|
44
|
+
|
45
|
+
def httpdigest_http_authorization(uid, realm)
|
46
|
+
http_authorization = request.env['HTTP_AUTHORIZATION']
|
47
|
+
return http_authorization if http_authorization
|
48
|
+
|
49
|
+
httpdigest_headers(uid, realm)
|
50
|
+
httpdigest_failure
|
51
|
+
end
|
52
|
+
|
53
|
+
def httpdigest_lookup(username, realm)
|
54
|
+
if block_given?
|
55
|
+
yield(username)
|
56
|
+
elsif respond_to?(:httpdigest_lookup_password)
|
57
|
+
httpdigest_lookup_password(username)
|
58
|
+
elsif respond_to?(:httpdigest_lookup_plaintext_password)
|
59
|
+
plain = httpdigest_lookup_plaintext_password(username)
|
60
|
+
Digest::MD5.hexdigest([username, realm, plain].join(':'))
|
61
|
+
else
|
62
|
+
raise "No password lookup handler found"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def httpdigest(uid, realm, &block)
|
67
|
+
session[SESSION_OPAQUE] ||= {}
|
68
|
+
session[SESSION_OPAQUE][realm] ||= {}
|
69
|
+
|
70
|
+
http_authorization = httpdigest_http_authorization(uid, realm)
|
71
|
+
|
72
|
+
httpdigest_failure unless session_nonce = session[SESSION_NONCE]
|
73
|
+
httpdigest_failure unless session_opaque = session[SESSION_OPAQUE][realm][uid]
|
74
|
+
|
75
|
+
auth_type, auth_raw = http_authorization.split(' ', 2)
|
76
|
+
httpdigest_failure unless auth_type == 'Digest'
|
77
|
+
|
78
|
+
authorization = Rack::Auth::Digest::Params.parse(auth_raw)
|
79
|
+
|
80
|
+
digest_response, username, nonce, nc, cnonce, qop, opaque =
|
81
|
+
authorization.values_at(*%w[response username nonce nc cnonce qop opaque])
|
82
|
+
|
83
|
+
httpdigest_failure unless nonce == session_nonce and opaque == session_opaque
|
84
|
+
|
85
|
+
ha1 = httpdigest_lookup(username, realm, &block)
|
86
|
+
a2 = [request.request_method,request.request_uri]
|
87
|
+
a2 << Digest::MD5.hexdigest(request.body.read) if qop == "auth-int"
|
88
|
+
ha2 = Digest::MD5.hexdigest( a2.join(':') )
|
89
|
+
md5 = Digest::MD5.hexdigest([ha1, nonce, nc, cnonce, qop, ha2].join(':'))
|
90
|
+
|
91
|
+
httpdigest_failure unless digest_response == md5
|
92
|
+
|
93
|
+
return username
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,119 @@
|
|
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
|
+
require 'openid'
|
5
|
+
require 'openid/store/filesystem'
|
6
|
+
require 'openid/extensions/pape'
|
7
|
+
require 'openid/extensions/sreg'
|
8
|
+
|
9
|
+
module Ramaze
|
10
|
+
|
11
|
+
openid_store_file = ::File.join(Dir.tmpdir, 'openid-store')
|
12
|
+
|
13
|
+
# Constant for storing meta-information persistent
|
14
|
+
OpenIDStore = OpenID::Store::Filesystem.new(openid_store_file)
|
15
|
+
|
16
|
+
# This is called Identity to avoid collisions with the original openid.rb
|
17
|
+
# It provides a nice and simple way to provide and control access over the
|
18
|
+
# OpenID authentication model.
|
19
|
+
|
20
|
+
module Helper
|
21
|
+
module Identity
|
22
|
+
LOOKUP << self
|
23
|
+
|
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
|
+
%{
|
29
|
+
<form method="GET" action="#{rs(:openid_begin)}">
|
30
|
+
Identity URL: <input type="text" name="url" />
|
31
|
+
<input type="submit" value="#{caption}"/>
|
32
|
+
</form>
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
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(:/)
|
79
|
+
end
|
80
|
+
|
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
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
# Fetch/Create a OpenID::Consumer for current session.
|
114
|
+
def openid_consumer
|
115
|
+
OpenID::Consumer.new(session, Ramaze::OpenIDStore)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Ramaze
|
2
|
+
module Helper
|
3
|
+
|
4
|
+
# Provides wrapper methods for a higher-level approach than the core layout
|
5
|
+
# method. These are useful for simpler layout needs, particularly:
|
6
|
+
#
|
7
|
+
# * layout all actions
|
8
|
+
# * layout a whitelist of actions
|
9
|
+
# * layout all but a blacklist of actions
|
10
|
+
#
|
11
|
+
# As with the core layout method, the layout rules apply only to the
|
12
|
+
# controller on which they are applied. Furthermore, multiple layout
|
13
|
+
# definitions are not combined; only the last definition will be used.
|
14
|
+
#
|
15
|
+
# This helper is one of the default helpers, so no explicit helper call
|
16
|
+
# is necessary before using it in your controllers.
|
17
|
+
#
|
18
|
+
# Usage:
|
19
|
+
#
|
20
|
+
# class MainController < Controller
|
21
|
+
# # Apply the default layout (e.g. ./layout/default.xhtml) to all
|
22
|
+
# # three actions.
|
23
|
+
# set_layout 'default'
|
24
|
+
# def action1; end
|
25
|
+
# def action2; end
|
26
|
+
# def action3; end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# class MainController < Controller
|
30
|
+
# # These two layout definitions accomplish the same thing. The
|
31
|
+
# # first uses a whitelist, the second uses a blacklist.
|
32
|
+
# set_layout 'default' => [:laid_out1, :laid_out2]
|
33
|
+
# set_layout_except 'default' => [:not_laid_out1, :not_laid_out2]
|
34
|
+
#
|
35
|
+
# def laid_out1; end
|
36
|
+
# def laid_out2; end
|
37
|
+
#
|
38
|
+
# def not_laid_out1; end
|
39
|
+
# def not_laid_out2; end
|
40
|
+
# end
|
41
|
+
module Layout
|
42
|
+
def self.included(into)
|
43
|
+
into.extend SingletonMethods
|
44
|
+
end
|
45
|
+
|
46
|
+
module SingletonMethods
|
47
|
+
# @param [String Hash] Either a layout name, or a single-element Hash
|
48
|
+
# which maps a layout name to an Array containing a whitelist of
|
49
|
+
# action names
|
50
|
+
# @see set_layout_except Innate::Node::layout
|
51
|
+
# @author Pistos, manveru
|
52
|
+
# @example Use a layout named 'default' on all actions of the controller:
|
53
|
+
# set_layout 'default'
|
54
|
+
# @example Use a layout named 'default' on just the index and admin actions:
|
55
|
+
# set_layout 'default' => [ :index, :admin ]
|
56
|
+
def set_layout(hash_or_the_layout)
|
57
|
+
if hash_or_the_layout.respond_to?(:to_hash)
|
58
|
+
f = hash_or_the_layout.first
|
59
|
+
the_layout = f[0]
|
60
|
+
whitelist = f[1].map{|action| action.to_s }
|
61
|
+
else
|
62
|
+
the_layout = hash_or_the_layout
|
63
|
+
end
|
64
|
+
|
65
|
+
layout do |path, wish|
|
66
|
+
if whitelist.nil? || whitelist.include?(path.to_s)
|
67
|
+
the_layout
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param [String Hash] Either a layout name, or a single-element Hash
|
73
|
+
# which maps a layout name to an Array containing a blacklist of
|
74
|
+
# action names
|
75
|
+
# @see set_layout Innate::Node::layout
|
76
|
+
# @author Pistos, manveru
|
77
|
+
# @example Use a layout named 'default' on all actions except the user_data action:
|
78
|
+
# set_layout_except 'default' => [ :user_data ]
|
79
|
+
def set_layout_except(hash_or_the_layout)
|
80
|
+
if hash_or_the_layout.respond_to?(:to_hash)
|
81
|
+
f = hash_or_the_layout.to_hash.first
|
82
|
+
the_layout = f[0]
|
83
|
+
blacklist = f[1].map{|action| action.to_s }
|
84
|
+
else
|
85
|
+
the_layout = hash_or_the_layout
|
86
|
+
end
|
87
|
+
|
88
|
+
layout do |path, wish|
|
89
|
+
if blacklist.nil? || !blacklist.include?(path.to_s)
|
90
|
+
the_layout
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'innate/helper/link'
|
5
|
+
|
6
|
+
module Ramaze
|
7
|
+
module Helper
|
8
|
+
# This is a modification of Innate::Helper::Link to respect the routing of
|
9
|
+
# Ramaze
|
10
|
+
#
|
11
|
+
# NOTE: The A/R/Rs methods have been deprecated.
|
12
|
+
module Link
|
13
|
+
def route_location(klass)
|
14
|
+
prefix = Ramaze.options.prefix
|
15
|
+
location = Ramaze.to(klass) || Ramaze.to(klass.class)
|
16
|
+
[prefix, location].join('/')
|
17
|
+
end
|
18
|
+
|
19
|
+
# Give it a path with character to split at and one to join the crumbs with.
|
20
|
+
# It will generate a list of links that act as pointers to previous pages on
|
21
|
+
# this path.
|
22
|
+
#
|
23
|
+
# @example usage
|
24
|
+
# breadcrumbs('/path/to/somewhere')
|
25
|
+
#
|
26
|
+
# # results in this, newlines added for readability:
|
27
|
+
#
|
28
|
+
# <a href="/path">path</a>/
|
29
|
+
# <a href="/path/to">to</a>/
|
30
|
+
# <a href="/path/to/somewhere">somewhere</a>
|
31
|
+
#
|
32
|
+
# Optionally a href prefix can be specified which generate link
|
33
|
+
# names a above, but with the prefix prepended to the href path.
|
34
|
+
#
|
35
|
+
# @example usage
|
36
|
+
# breadcrumbs('/path/to/somewhere', '/', '/', '/mycontroller/action')
|
37
|
+
#
|
38
|
+
# # results in this, newlines added for readability:
|
39
|
+
#
|
40
|
+
# <a href="/mycontroller/action/path">path</a>/
|
41
|
+
# <a href="/mycontroller/action/path/to">to</a>/
|
42
|
+
# <a href="/mycontroller/action/path/to/somewhere">somewhere</a>
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
def breadcrumbs(path, split = '/', join = '/', href_prefix = '')
|
46
|
+
atoms = path.split(split).reject{|a| a.empty?}
|
47
|
+
crumbs = atoms.inject([]){|s,v| s << [s.last,v]}
|
48
|
+
bread = crumbs.map do |a|
|
49
|
+
href_path = href_prefix + a*'/'
|
50
|
+
a(a[-1], href_path)
|
51
|
+
end
|
52
|
+
bread.join(join)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|