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
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ramaze'
|
3
|
+
|
4
|
+
Ramaze.contrib :facebook
|
5
|
+
|
6
|
+
# Settings for your facebook app
|
7
|
+
# SERVER: where this ramaze app is running
|
8
|
+
# URL: the apps.facebook.com url to your app
|
9
|
+
# KEY: API key for your app
|
10
|
+
# SECRET: Secret key for your app
|
11
|
+
# ID: Your app's ID (from the about page url)
|
12
|
+
# ADMINS: uids of facebook users that are admins
|
13
|
+
# SESSION: an admin's session key
|
14
|
+
#
|
15
|
+
# These vars are used by the Facebook Helper are are also useful
|
16
|
+
# within your controller and templates. For example,
|
17
|
+
# <a href="#{Facebook::URL}/search">click here to search</a>
|
18
|
+
#
|
19
|
+
# In addition, set the following options on your app's 'Edit Settings' page:
|
20
|
+
# Callback URL: http://myapp.domain.com:7000/ (trailing slash required)
|
21
|
+
# Canvas Page URL: ramazing
|
22
|
+
# Can your app be added on Facebook: Yes
|
23
|
+
# Who can add your app: Users
|
24
|
+
# Post-Add URL: http://apps.facebook.com/ramazing/install
|
25
|
+
# Post-Remove URL: http://myapp.domain.com:7000/uninstall
|
26
|
+
# Side Nav URL: http://apps.facebook.com/ramazing
|
27
|
+
|
28
|
+
module Facebook
|
29
|
+
SERVER = 'http://myapp.domain.com:7000'
|
30
|
+
URL = 'http://apps.facebook.com/ramazing'
|
31
|
+
KEY = 'b32f58685c06a7f8107bc7915354bd89'
|
32
|
+
SECRET = 'e0f9........................9429'
|
33
|
+
ID = 2502696782
|
34
|
+
ADMINS = [ 15601088 ]
|
35
|
+
SESSION = ''
|
36
|
+
end unless defined? Facebook::ID
|
37
|
+
|
38
|
+
# The facebook helper (included your controller using +helper :facebook+)
|
39
|
+
# defines a +facebook+ object, which is also aliased to +fb+.
|
40
|
+
#
|
41
|
+
# POST parameters sent by the facebook servers can be accessed via fb.params
|
42
|
+
# and also fb[]. Wherever possible, values will be converted to native ruby
|
43
|
+
# types (Time objects, true/false, arrays)
|
44
|
+
#
|
45
|
+
# fb.params = { :api_key => "b32f58685c06a7f8107bc7915354bd89",
|
46
|
+
# :added => true,
|
47
|
+
# :profile_update_time => Mon Oct 15 15:07:28 -0400 2007,
|
48
|
+
# :friends => [1,2,3],
|
49
|
+
# :session_key => "f7bed6aefaa5467b3a6344f2-15601088",
|
50
|
+
# :time => Sat Dec 01 02:02:50 -0500 2007,
|
51
|
+
# :user => 15601088,
|
52
|
+
# :position_fix => false,
|
53
|
+
# :expires => 0,
|
54
|
+
# :in_canvas => true }
|
55
|
+
#
|
56
|
+
# fb[:user] == facebook[:user] == facebook.params[:user]
|
57
|
+
#
|
58
|
+
# The facebook object can also be used to make API calls. Native ruby types (true, false, strings, hashes and arrays)
|
59
|
+
# will be returned. If facebook returns an array with only one element, that element will be returned instead.
|
60
|
+
#
|
61
|
+
# facebook.auth.createToken # => "41b5dc65792ba4bf405faf857a17267c"
|
62
|
+
# fb.users.getInfo :uids => 15601088, :fields => [:name] # => {"name"=>"Aman Gupta", "uid"=>15601088}
|
63
|
+
# fb.profile.setFBML :uid => 15601088, :markup => 'Hi!' # => true
|
64
|
+
#
|
65
|
+
# API calls will use the current viewing users' session key (from fb[:session_key]) if present,
|
66
|
+
# or Facebook::SESSION, which should be set to one of the admin's keys. You can also provide another
|
67
|
+
# session key yourself from your users database:
|
68
|
+
#
|
69
|
+
# fb.feed.publishActionOfUser :session_key => "the user's session key", :title => 'is using Ramaze!'
|
70
|
+
#
|
71
|
+
# Finally, you can use the following facebook object methods:
|
72
|
+
#
|
73
|
+
# facebook.valid? # verify fb_sig, if invalid fb.params will return {}
|
74
|
+
# facebook.redirect '/url' # redirect to /url using <fb:redirect/>
|
75
|
+
# facebook.addurl # return the add url for the current app
|
76
|
+
# facebook.addurl '/url' # add url for app that redirects to /url after successful install
|
77
|
+
|
78
|
+
class MainController < Ramaze::Controller
|
79
|
+
helper :formatting
|
80
|
+
helper :facebook
|
81
|
+
|
82
|
+
before {
|
83
|
+
# show some information about current user in logs
|
84
|
+
# INFO Facebook {:user=>15601088, :in_canvas=>true, :added=>true}
|
85
|
+
if fb[:user]
|
86
|
+
# use facebook session_key as session cookie
|
87
|
+
session.session_id = fb[:session_key] if fb[:session_key]
|
88
|
+
|
89
|
+
Ramaze::Log.info "Facebook " + fb.params.reject{|k,v| k.to_s !~ /^(in|is|user|added|locale|request)/}.inspect
|
90
|
+
else
|
91
|
+
# require_add: redirect to add url
|
92
|
+
# fb.redirect fb.addurl
|
93
|
+
end
|
94
|
+
|
95
|
+
# suggest setting SESSION key if one is not set, and current user is an admin
|
96
|
+
# INFO Set a default session key: SESSION = 'b3638446fa02466210c49f42-15601088'
|
97
|
+
if Facebook::SESSION.empty? and Facebook::ADMINS.include? fb[:user]
|
98
|
+
Ramaze::Log.info "Set a default session key: SESSION = '#{fb[:session_key]}'"
|
99
|
+
end
|
100
|
+
}
|
101
|
+
|
102
|
+
def install
|
103
|
+
Ramaze::Log.info "#{fb[:user]} installed app" if request['installed'] == '1'
|
104
|
+
facebook.profile.setFBML :uid => fb[:user], :markup => "Isn't this a great surprise!?"
|
105
|
+
facebook.redirect request['next'] || '/'
|
106
|
+
end
|
107
|
+
|
108
|
+
def uninstall
|
109
|
+
Ramaze::Log.info "#{fb[:user]} uninstalled app"
|
110
|
+
end
|
111
|
+
|
112
|
+
def main
|
113
|
+
fb.redirect '/index' unless fb[:user]
|
114
|
+
@userinfo = facebook.users.getInfo :uids => facebook[:user], :fields => [:name, :pic_square]
|
115
|
+
%q(
|
116
|
+
Hey there #{@userinfo['name']}. You look like this: <img src="#{@userinfo['pic_square']}"/>. <br/>
|
117
|
+
You updated your profile #{time_diff fb[:profile_update_time]} ago. You have #{fb[:friends].size} friends. <br/>
|
118
|
+
<p>
|
119
|
+
<?r unless fb[:added] ?>
|
120
|
+
I know you already logged in, but you should really <a href="#{facebook.addurl}">add this app</a>.
|
121
|
+
You'll get a real nifty surprise on your profile if you do.
|
122
|
+
<?r else ?>
|
123
|
+
Now that you added this app, I can access your profile and news feed. <br/>
|
124
|
+
Did you see the cool surprise I left on <a href="http://www.facebook.com/profile.php?id=#{fb[:user]}">your profile</a>?
|
125
|
+
<?r end ?>
|
126
|
+
</p>
|
127
|
+
)
|
128
|
+
end
|
129
|
+
|
130
|
+
def index
|
131
|
+
facebook.redirect '/main' if facebook[:user]
|
132
|
+
%q(
|
133
|
+
This is a great app. Here are some reasons you'll like it:
|
134
|
+
<ul>
|
135
|
+
<li>It's on facebook</li>
|
136
|
+
<li>It's written in Ramaze</li>
|
137
|
+
</ul>
|
138
|
+
<a href="#{Facebook::URL}/main" requirelogin="true">Login</a> to start using it. Or, to
|
139
|
+
get the full benefit, you should <a href="#{facebook.addurl '/main'}">add it</a> so we have
|
140
|
+
access to your newsfeed and can add a box to your profile.
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
def layout
|
145
|
+
%q(
|
146
|
+
<fb:dashboard>
|
147
|
+
<?r unless fb[:added] ?>
|
148
|
+
<fb:create-button href="#{facebook.addurl '/main'}">Add App</fb:create-button>
|
149
|
+
<?r end ?>
|
150
|
+
</fb:dashboard>
|
151
|
+
<div id="content" style="margin: 0 2em 2em 2em">
|
152
|
+
#@content
|
153
|
+
</div>
|
154
|
+
)
|
155
|
+
end
|
156
|
+
layout :layout
|
157
|
+
end
|
158
|
+
|
159
|
+
Ramaze.start :adapter => :mongrel
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'ramaze'
|
6
|
+
|
7
|
+
# you can access it now with http://localhost:7000/
|
8
|
+
# This should output
|
9
|
+
# Hello, World!
|
10
|
+
# in your browser
|
11
|
+
|
12
|
+
class MainController < Ramaze::Controller
|
13
|
+
def index
|
14
|
+
"Hello, World!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def check
|
19
|
+
os = []
|
20
|
+
ObjectSpace.each_object{|o| os << o }
|
21
|
+
p os.inject(Hash.new(0)){|s,v| s[v.class] += 1; s}.sort_by{|k,v| v}
|
22
|
+
end
|
23
|
+
|
24
|
+
Thread.new do
|
25
|
+
loop do
|
26
|
+
check
|
27
|
+
sleep 5
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Ramaze::Log.loggers.clear
|
32
|
+
Ramaze.start :adapter => :mongrel, :sourcereload => false
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ramaze'
|
3
|
+
|
4
|
+
class MainController < Ramaze::Controller
|
5
|
+
map '/'
|
6
|
+
|
7
|
+
engine :Nagoro
|
8
|
+
|
9
|
+
def index
|
10
|
+
%{
|
11
|
+
<Page title="Test">
|
12
|
+
<SideBar />
|
13
|
+
<p>
|
14
|
+
Hello, World!
|
15
|
+
</p>
|
16
|
+
</Page>
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Nagoro.element 'Page' do |content, attrs|
|
22
|
+
%{
|
23
|
+
<html>
|
24
|
+
<head>
|
25
|
+
<title>examples/element</title>
|
26
|
+
</head>
|
27
|
+
<body>
|
28
|
+
<h1>#{attrs['title']}</h1>
|
29
|
+
#{content}
|
30
|
+
</body>
|
31
|
+
</html>
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
Nagoro.element 'SideBar' do |content, attrs|
|
36
|
+
%{
|
37
|
+
<div class="sidebar">
|
38
|
+
<a href="http://something.com">something</a>
|
39
|
+
</div>
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
Ramaze.start
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# Ramaise, the Ramaze version of Reprise, a minimal hAtom blog
|
2
|
+
#
|
3
|
+
# http://redflavor.com/reprise.rb
|
4
|
+
# http://www.rubyinside.com/reprise-a-ruby-powered-blogging-app-in-
|
5
|
+
# 100-lines-including-templates-646.html
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
#
|
9
|
+
# 1. gem install ramaze haml bluecloth rubypants -y
|
10
|
+
# 2. wget http://darcs.ramaze.net/ramaze/examples/ramaise.rb
|
11
|
+
# 3. mkdir entries
|
12
|
+
# 4. vi entries/YYYY.MM.DD.Title.Goes.Here
|
13
|
+
# 5. ruby ramaise.rb
|
14
|
+
|
15
|
+
%w(rubygems ramaze bluecloth rubypants haml).each{|lib| require lib }
|
16
|
+
|
17
|
+
class BlogPost
|
18
|
+
DIR = __DIR__/:entries
|
19
|
+
|
20
|
+
def initialize filename
|
21
|
+
raise 'Invalid BlogPost filename' unless File.exists?(filename)
|
22
|
+
@filename, filename = filename, File.basename(filename)
|
23
|
+
@date = Date.strptime(filename, '%Y.%m.%d').to_s
|
24
|
+
@title = filename[11..-1].tr('.', ' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
def body
|
28
|
+
RubyPants.new(BlueCloth.new(File.read(@filename)).to_html).to_html
|
29
|
+
end
|
30
|
+
|
31
|
+
def slug
|
32
|
+
@slug ||= title.gsub(/[^\w\s-]/, '').gsub(/\s+/, '-').downcase
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_reader :date, :title
|
36
|
+
|
37
|
+
class << self
|
38
|
+
include Enumerable
|
39
|
+
|
40
|
+
def each
|
41
|
+
Dir[DIR/'*'].sort.reverse.each do |file| yield BlogPost.new(file) end
|
42
|
+
end
|
43
|
+
|
44
|
+
def [] key
|
45
|
+
BlogPost.find{|post| post.slug == key }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class MainController < Ramaze::Controller
|
51
|
+
|
52
|
+
TITLE = 'Ramaise'
|
53
|
+
AUTHOR = { :name => 'Aman Gupta', :url => 'http://ramaze.net' }
|
54
|
+
|
55
|
+
engine :Haml
|
56
|
+
|
57
|
+
def index slug = nil
|
58
|
+
if slug.nil?
|
59
|
+
@posts = BlogPost.collect
|
60
|
+
raise Ramaze::Error::NoAction,
|
61
|
+
'No blog posts found, create
|
62
|
+
entries/YYYY.MM.DD.My.First.Blog.Post' unless @posts.any?
|
63
|
+
else
|
64
|
+
raise Ramaze::Error::NoAction,
|
65
|
+
'Invalid blog post' unless post = BlogPost[slug]
|
66
|
+
@title = post.title
|
67
|
+
@posts = [ post ]
|
68
|
+
end
|
69
|
+
|
70
|
+
%(
|
71
|
+
%h1
|
72
|
+
- if @title
|
73
|
+
%a{ :href => '/' } #{TITLE}
|
74
|
+
- else
|
75
|
+
#{TITLE}
|
76
|
+
|
77
|
+
- @posts.each do |post|
|
78
|
+
.hentry
|
79
|
+
%h2
|
80
|
+
%abbr.updated{ :title => Time.parse(post.date).iso8601 }= post.date
|
81
|
+
%a.entry-title{ :href => '/'+post.slug, :rel => 'bookmark' }= post.title
|
82
|
+
.entry-content= post.body
|
83
|
+
).unindent
|
84
|
+
end
|
85
|
+
|
86
|
+
def error
|
87
|
+
%(
|
88
|
+
%h1 #{TITLE}: Resource not found
|
89
|
+
%h2= Ramaze::Dispatcher::Error.current.message + '.'
|
90
|
+
|
91
|
+
Go back to the
|
92
|
+
%a{ :href => '/' } the front
|
93
|
+
page.
|
94
|
+
).unindent
|
95
|
+
end
|
96
|
+
|
97
|
+
def layout
|
98
|
+
%(
|
99
|
+
!!!
|
100
|
+
%html
|
101
|
+
%head
|
102
|
+
%title
|
103
|
+
#{TITLE}
|
104
|
+
- if @title
|
105
|
+
= ': ' + @title
|
106
|
+
%style{ :type => 'text/css' }
|
107
|
+
:sass
|
108
|
+
body
|
109
|
+
font-size: 90%
|
110
|
+
line-height: 1.4
|
111
|
+
width: 94%
|
112
|
+
margin: auto
|
113
|
+
abbr
|
114
|
+
border: 0
|
115
|
+
.entry-content
|
116
|
+
-moz-column-width: 30em
|
117
|
+
-moz-column-gap: 1.5em
|
118
|
+
-webkit-column-width: 30em
|
119
|
+
-webkit-column-gap: 1.5em
|
120
|
+
h2
|
121
|
+
border-bottom: 0.05em solid #999
|
122
|
+
%body
|
123
|
+
= @content
|
124
|
+
%address.author.vcard
|
125
|
+
%a.url.fn{ :href => '#{AUTHOR[:url]}' } #{AUTHOR[:name]}
|
126
|
+
).unindent
|
127
|
+
end
|
128
|
+
layout :layout
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
Ramaze.start :sessions => false #, :adapter => :mongrel, :port => 3000
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Ramaze version of the merb tutorial
|
2
|
+
# http://www.socialface.com/slapp/
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'ramaze'
|
6
|
+
require 'sequel'
|
7
|
+
|
8
|
+
DB = Sequel.sqlite :logger => Ramaze::Log
|
9
|
+
|
10
|
+
class Post < Sequel::Model
|
11
|
+
set_schema{ primary_key :id; time :created_at; text :text }
|
12
|
+
before_create{ self.created_at ||= Time.now }
|
13
|
+
create_table
|
14
|
+
end
|
15
|
+
|
16
|
+
%w[Ramaze Rocks].abbrev.keys.sort.each{|text| Post.create(:text => text) }
|
17
|
+
|
18
|
+
class MainController < Ramaze::Controller
|
19
|
+
def index
|
20
|
+
@posts = Post.order(:created_at.desc).first(10)
|
21
|
+
%q(<h1>Welcome to Rapp</h1>
|
22
|
+
<h2>A minimal chat wall</h2>
|
23
|
+
<p>Recent Posts:</p>
|
24
|
+
<div id="posts" class="container">
|
25
|
+
<?r @posts.each do |post| ?>
|
26
|
+
<div id="post-#{post.id}" class="post">
|
27
|
+
<p class="text">#{post.text}</p>
|
28
|
+
<p class="created">#{post.created_at}</p>
|
29
|
+
</div>
|
30
|
+
<?r end ?>
|
31
|
+
</div>
|
32
|
+
<p>Post Something:</p>
|
33
|
+
<form action="#{Rs(:create)}" method="POST">
|
34
|
+
<input type="text" size="40" name="text" />
|
35
|
+
<input type="submit" value="Post Message!" />
|
36
|
+
</form>)
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
Post.create(:text => request[:text])
|
41
|
+
redirect Rs(:/)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Ramaze.start
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ramaze'
|
3
|
+
require 'sequel'
|
4
|
+
require 'scaffolding_extensions'
|
5
|
+
|
6
|
+
DB = Sequel.sqlite
|
7
|
+
|
8
|
+
class User < Sequel::Model(:user)
|
9
|
+
set_schema do
|
10
|
+
primary_key :id
|
11
|
+
varchar :name
|
12
|
+
text :description
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table unless User.table_exists?
|
16
|
+
end
|
17
|
+
|
18
|
+
ScaffoldingExtensions.all_models = [User]
|
19
|
+
|
20
|
+
class UserController < Ramaze::Controller
|
21
|
+
scaffold_all_models :only => [User]
|
22
|
+
end
|
23
|
+
|
24
|
+
class MainController < Ramaze::Controller
|
25
|
+
def index
|
26
|
+
%{Scaffolding extension enabled for
|
27
|
+
<a href="http://sequel.rubyforge.org/classes/Sequel/Model.html">
|
28
|
+
Sequel::Model
|
29
|
+
</a> User.
|
30
|
+
You can access the scaffolded Model at #{A('/user')}}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Ramaze.start
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ramaze'
|
3
|
+
|
4
|
+
class MainController < Ramaze::Controller
|
5
|
+
trait :logins => {
|
6
|
+
'jill' => 'password1',
|
7
|
+
'jack' => 'password2',
|
8
|
+
}.map{|k,v| ["#{k}:#{v}"].pack('m').strip }
|
9
|
+
|
10
|
+
helper :aspect
|
11
|
+
|
12
|
+
before_all do
|
13
|
+
check_auth
|
14
|
+
end
|
15
|
+
|
16
|
+
def index
|
17
|
+
'Secret Info'
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def check_auth
|
23
|
+
response['WWW-Authenticate'] = 'Basic realm="Login Required"'
|
24
|
+
|
25
|
+
if auth = request.env['HTTP_AUTHORIZATION']
|
26
|
+
if class_trait[:logins].include?(auth.split.last)
|
27
|
+
return true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
respond 'Unauthorized', 401
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Ramaze.start :adapter => :mongrel
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Template::Amrita2 external</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h1 am:src="title" />
|
7
|
+
<%= link_home %>
|
8
|
+
<p>
|
9
|
+
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
+
<%= link_one %><br />
|
11
|
+
<%= link_two %><br />
|
12
|
+
<%= link_three %>
|
13
|
+
</p>
|
14
|
+
<<div<
|
15
|
+
<<:args<
|
16
|
+
<span><%= $_ %></span>
|
17
|
+
<%= inspect_parameters %>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
%html
|
2
|
+
%head
|
3
|
+
%title= "Template::Haml #@place"
|
4
|
+
%body
|
5
|
+
%h1= @title
|
6
|
+
= A('Home', :href => :/)
|
7
|
+
%p
|
8
|
+
Here you can pass some stuff if you like, parameters are just passed like this:
|
9
|
+
%br/
|
10
|
+
= A("#@place/one")
|
11
|
+
%br/
|
12
|
+
= A("#@place/one/two/three")
|
13
|
+
%br/
|
14
|
+
= A("#@place/one?foo=bar")
|
15
|
+
%div
|
16
|
+
The arguments you have passed to this action are:
|
17
|
+
- if @args.empty?
|
18
|
+
none
|
19
|
+
- else
|
20
|
+
- @args.each do |arg|
|
21
|
+
%span= arg
|
22
|
+
%div= request.params.inspect
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Template::Liquid external</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h1>{{header}}</h1>
|
7
|
+
{{homelink}}
|
8
|
+
<p>
|
9
|
+
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
+
{{link_one}}<br />
|
11
|
+
{{link_two}}<br />
|
12
|
+
{{link_three}}
|
13
|
+
</p>
|
14
|
+
<div>
|
15
|
+
The arguments you have passed to this action are:
|
16
|
+
{% if args_empty %}
|
17
|
+
none
|
18
|
+
{% else %}
|
19
|
+
{% for arg in args %}
|
20
|
+
<span>{{arg}}</span>
|
21
|
+
{% endfor %}
|
22
|
+
{% endif %}
|
23
|
+
</div>
|
24
|
+
<div>
|
25
|
+
{{params}}
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
html do
|
2
|
+
head do
|
3
|
+
title "Template::Markaby #@place"
|
4
|
+
end
|
5
|
+
body do
|
6
|
+
h1 "The #@place Template for Markaby"
|
7
|
+
a("Home", :href => R(@this))
|
8
|
+
p do
|
9
|
+
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
10
|
+
br
|
11
|
+
a("#@place/one", :href => R(@this, @place, :one))
|
12
|
+
br
|
13
|
+
a("#@place/one/two/three", :href => R(@this, @place, :one, :two, :three))
|
14
|
+
br
|
15
|
+
a("#@place/one?foo=bar", :href => R(@this, @place, :one, :foo => :bar))
|
16
|
+
br
|
17
|
+
end
|
18
|
+
div do
|
19
|
+
text "The arguments you have passed to this action are:"
|
20
|
+
if @args.empty?
|
21
|
+
text "none"
|
22
|
+
else
|
23
|
+
args.each do |arg|
|
24
|
+
span arg
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
div @request.params.inspect
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Template::Nagoro external</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h1>The external Template for Nagoro</h1>
|
7
|
+
#{A 'Home', :href => :/}
|
8
|
+
<p>
|
9
|
+
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
10
|
+
#{A("external/one")}<br />
|
11
|
+
#{A("external/one/two/three")}<br />
|
12
|
+
#{A("external/one?foo=bar")}<br />
|
13
|
+
</p>
|
14
|
+
<div>
|
15
|
+
The arguments you have passed to this action are:
|
16
|
+
<?r if @args.empty? ?>
|
17
|
+
none
|
18
|
+
<?r else ?>
|
19
|
+
<?r @args.each do |arg| ?>
|
20
|
+
<span>#{arg}</span>
|
21
|
+
<?r end ?>
|
22
|
+
<?r end ?>
|
23
|
+
</div>
|
24
|
+
<div>
|
25
|
+
#{request.params.inspect}
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
h1. The <%= @place %> Template for RedCloth
|
2
|
+
|
3
|
+
"Home":<%= Rs(:/) %>
|
4
|
+
|
5
|
+
Here you can pass some stuff if you like, parameters are just passed like this:<br />
|
6
|
+
"<%= @place %>/one":<%= Rs(@place, :one) %><br />
|
7
|
+
"<%= @place %>/two/three":<%= Rs(@place, :two, :three) %><br />
|
8
|
+
"<%= @place %>/one?foo=bar":<%= Rs(@place, :foo => :bar) %>
|
9
|
+
|
10
|
+
The arguments you have passed to this action are:<br />
|
11
|
+
<% if @args.empty? %>
|
12
|
+
none
|
13
|
+
<% else %>
|
14
|
+
<% @args.each do |arg| %>
|
15
|
+
<span><%= arg %></span>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= request.params.inspect %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
html do
|
2
|
+
head do
|
3
|
+
title "Template::Remarkably #@place"
|
4
|
+
end
|
5
|
+
body do
|
6
|
+
h1 "The #@place Template for Remarkably"
|
7
|
+
a("Home", :href => R(@place))
|
8
|
+
P do
|
9
|
+
text "Here you can pass some stuff if you like, parameters are just passed like this:"
|
10
|
+
br
|
11
|
+
a("#@place/one", :href => Rs( @place, :one))
|
12
|
+
br
|
13
|
+
a("#@place/one/two/three", :href => Rs( @place, :one, :two, :three))
|
14
|
+
br
|
15
|
+
a("#@place/one?foo=bar", :href => Rs( @place, :one, :foo => :bar))
|
16
|
+
br
|
17
|
+
end
|
18
|
+
div do
|
19
|
+
text "The arguments you have passed to this action are:"
|
20
|
+
if @args.empty?
|
21
|
+
text "none"
|
22
|
+
else
|
23
|
+
args.each do |arg|
|
24
|
+
span arg
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
div @request.params.inspect
|
29
|
+
end
|
30
|
+
end
|