ptomato-ramaze 2009.02
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.md +481 -0
- data/Rakefile +248 -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 +40 -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/partial.rb +28 -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 +108 -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 +11 -0
- data/lib/proto/controller/main.rb +20 -0
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/.htaccess +24 -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 +12 -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 +192 -0
- data/lib/ramaze/action.rb +159 -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/file.rb +71 -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 +114 -0
- data/lib/ramaze/contrib/email.rb +86 -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 +3 -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 +278 -0
- data/lib/ramaze/controller.rb +288 -0
- data/lib/ramaze/current/request.rb +231 -0
- data/lib/ramaze/current/response.rb +37 -0
- data/lib/ramaze/current/session/flash.rb +88 -0
- data/lib/ramaze/current/session/hash.rb +62 -0
- data/lib/ramaze/current/session.rb +179 -0
- data/lib/ramaze/current.rb +51 -0
- data/lib/ramaze/dispatcher/action.rb +50 -0
- data/lib/ramaze/dispatcher/directory.rb +119 -0
- data/lib/ramaze/dispatcher/error.rb +108 -0
- data/lib/ramaze/dispatcher/file.rb +100 -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/bench.rb +43 -0
- data/lib/ramaze/helper/cache.rb +140 -0
- data/lib/ramaze/helper/cgi.rb +39 -0
- data/lib/ramaze/helper/flash.rb +74 -0
- data/lib/ramaze/helper/form.rb +284 -0
- data/lib/ramaze/helper/formatting.rb +162 -0
- data/lib/ramaze/helper/gestalt.rb +15 -0
- data/lib/ramaze/helper/gravatar.rb +32 -0
- data/lib/ramaze/helper/httpdigest.rb +88 -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 +9 -0
- data/lib/ramaze/helper/nitroform.rb +14 -0
- data/lib/ramaze/helper/pager.rb +366 -0
- data/lib/ramaze/helper/paginate.rb +233 -0
- data/lib/ramaze/helper/partial.rb +105 -0
- data/lib/ramaze/helper/redirect.rb +100 -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 +87 -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/rotatinginformer.rb +168 -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/watch_inotify.rb +85 -0
- data/lib/ramaze/reloader/watch_stat.rb +58 -0
- data/lib/ramaze/reloader.rb +170 -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 +22 -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 +37 -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/acquire.rb +31 -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 +21 -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 +64 -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 +49 -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 +39 -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 +38 -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 +111 -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 +139 -0
- data/lib/vendor/bacon.rb +323 -0
- data/rake_tasks/conf.rake +71 -0
- data/rake_tasks/coverage.rake +45 -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 +611 -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 +76 -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 +70 -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/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 +14 -0
- data/spec/snippets/ordered_set.rb +63 -0
- data/spec/snippets/ramaze/acquire.rb +77 -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 +661 -0
|
@@ -0,0 +1,111 @@
|
|
|
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 'fileutils'
|
|
5
|
+
require 'find'
|
|
6
|
+
|
|
7
|
+
class ProjectCreator
|
|
8
|
+
PROTO = []
|
|
9
|
+
PROTO << '~/.proto/' if ENV["HOME"] # Guard against Windows
|
|
10
|
+
attr_accessor :name, :options
|
|
11
|
+
|
|
12
|
+
def initialize(name, options = {})
|
|
13
|
+
@name, @options = name, options
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def target
|
|
17
|
+
File.expand_path(name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def proto
|
|
21
|
+
PROTO.map!{|pr| File.expand_path(pr) }
|
|
22
|
+
proto = options[:proto] ||= PROTO.find{|f| File.directory?(f) }
|
|
23
|
+
layout = options[:layout] ||= '/'
|
|
24
|
+
File.expand_path(File.join(proto, layout))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def create_root?
|
|
28
|
+
return true unless File.directory?(target)
|
|
29
|
+
return true if amend? or force?
|
|
30
|
+
fatal "%p is a directory, choose different project name or use --amend/--force" % target
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def got_proto?
|
|
34
|
+
return true if File.directory?(proto)
|
|
35
|
+
fatal "Cannot create, %p doesn't exist, use --proto or create the proto directory" % proto
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def create
|
|
39
|
+
got_proto?
|
|
40
|
+
|
|
41
|
+
puts "Found proto at: %p, proceeding...\n\n" % proto
|
|
42
|
+
mkdir(relate('/')) if create_root?
|
|
43
|
+
proceed
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def proceed
|
|
47
|
+
files, directories = partition{|path| File.file?(path) }
|
|
48
|
+
proceed_directories(directories)
|
|
49
|
+
proceed_files(files)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def proceed_files(files)
|
|
53
|
+
files.each{|file| copy(file, relate(file)) }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def proceed_directories(dirs)
|
|
57
|
+
dirs.each{|dir| mkdir(relate(dir)) }
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def mkdir(dir)
|
|
61
|
+
exists = File.directory?(dir)
|
|
62
|
+
return if exists and amend?
|
|
63
|
+
return if exists and not force?
|
|
64
|
+
puts "mkdir(%p)" % dir
|
|
65
|
+
FileUtils.mkdir_p(dir)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def copy(from, to)
|
|
69
|
+
return unless copy_check(to)
|
|
70
|
+
puts "copy(%p, %p)" % [from, to]
|
|
71
|
+
FileUtils.cp(from, to)
|
|
72
|
+
post_process(to)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def copy_check(to)
|
|
76
|
+
exists = File.file?(to)
|
|
77
|
+
return if exists and amend?
|
|
78
|
+
return if exists and not force?
|
|
79
|
+
return true
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Think about a useful way to process the generated files it should be
|
|
83
|
+
# possible to substitute some things like the project name in the
|
|
84
|
+
# configuration
|
|
85
|
+
|
|
86
|
+
def post_process(file)
|
|
87
|
+
return
|
|
88
|
+
source = File.read(file)
|
|
89
|
+
File.open(file, 'w+') do |io|
|
|
90
|
+
io.write(source.gsub('$project', "'#@name'"))
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def relate(path)
|
|
95
|
+
File.join(target, path.to_s.sub(proto, ''))
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def amend?; options[:amend] end
|
|
99
|
+
def force?; options[:force] end
|
|
100
|
+
|
|
101
|
+
def fatal(message)
|
|
102
|
+
warn message
|
|
103
|
+
exit 1
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def each
|
|
107
|
+
Dir["#{proto}/**/*"].each{|path| yield(path) }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
include Enumerable
|
|
111
|
+
end
|
data/lib/ramaze/tool.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
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::Tool
|
|
5
|
+
autoload :Create, 'ramaze/tool/create'
|
|
6
|
+
autoload :Localize, 'ramaze/tool/localize'
|
|
7
|
+
autoload :Mime, 'ramaze/tool/mime'
|
|
8
|
+
autoload :Record, 'ramaze/tool/record'
|
|
9
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
STATE = State.new
|
|
6
|
+
|
|
7
|
+
# The module to be included into the Controller it basically just provides
|
|
8
|
+
# #request, #response and #session, each accessing Thread.current to
|
|
9
|
+
# retrieve the demanded object
|
|
10
|
+
|
|
11
|
+
module Trinity
|
|
12
|
+
extend StateAccessor
|
|
13
|
+
|
|
14
|
+
state_accessor :request, :response, :session
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/ramaze.rb
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
# StdLib
|
|
5
|
+
require 'abbrev'
|
|
6
|
+
require 'cgi'
|
|
7
|
+
require 'digest/md5'
|
|
8
|
+
require 'fileutils'
|
|
9
|
+
require 'ipaddr'
|
|
10
|
+
require 'optparse'
|
|
11
|
+
require 'ostruct'
|
|
12
|
+
require 'pathname'
|
|
13
|
+
require 'pp'
|
|
14
|
+
require 'set'
|
|
15
|
+
require 'socket'
|
|
16
|
+
require 'timeout'
|
|
17
|
+
require 'tmpdir'
|
|
18
|
+
require 'yaml'
|
|
19
|
+
|
|
20
|
+
begin
|
|
21
|
+
require 'rubygems'
|
|
22
|
+
rescue LoadError
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Rack
|
|
26
|
+
require 'rack'
|
|
27
|
+
require 'rack/utils'
|
|
28
|
+
require 'rack/request'
|
|
29
|
+
require 'rack/response'
|
|
30
|
+
|
|
31
|
+
# The main namespace for Ramaze
|
|
32
|
+
module Ramaze
|
|
33
|
+
BASEDIR = File.dirname(File.expand_path(__FILE__))
|
|
34
|
+
$LOAD_PATH.unshift BASEDIR
|
|
35
|
+
$LOAD_PATH.uniq!
|
|
36
|
+
|
|
37
|
+
# Shortcut to the HTTP_STATUS_CODES of Rack::Utils
|
|
38
|
+
# inverted for easier access
|
|
39
|
+
|
|
40
|
+
STATUS_CODE = Rack::Utils::HTTP_STATUS_CODES.invert
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Thread.abort_on_exception = true
|
|
44
|
+
|
|
45
|
+
# Bootstrap
|
|
46
|
+
require 'ramaze/version'
|
|
47
|
+
require 'ramaze/reloader'
|
|
48
|
+
require 'ramaze/snippets'
|
|
49
|
+
require 'ramaze/log'
|
|
50
|
+
require 'ramaze/trinity'
|
|
51
|
+
require 'ramaze/dispatcher'
|
|
52
|
+
require 'ramaze/current'
|
|
53
|
+
require 'ramaze/adapter'
|
|
54
|
+
require 'ramaze/option'
|
|
55
|
+
require 'ramaze/cache'
|
|
56
|
+
require 'ramaze/tool'
|
|
57
|
+
|
|
58
|
+
# Startup
|
|
59
|
+
require 'ramaze/controller'
|
|
60
|
+
|
|
61
|
+
# Complete
|
|
62
|
+
require 'ramaze/template/ezamar'
|
|
63
|
+
require 'ramaze/contrib'
|
|
64
|
+
require 'ramaze/route'
|
|
65
|
+
|
|
66
|
+
module Ramaze
|
|
67
|
+
|
|
68
|
+
# Each of these classes will be called ::startup upon Ramaze.startup
|
|
69
|
+
|
|
70
|
+
trait :essentials => [
|
|
71
|
+
Global, Cache, Contrib, Controller, Session, Adapter
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
trait :started => false
|
|
75
|
+
|
|
76
|
+
class << self
|
|
77
|
+
|
|
78
|
+
# The one place to start Ramaze, takes an Hash of options to pass on to
|
|
79
|
+
# each class in trait[:essentials] by calling ::startup on them.
|
|
80
|
+
|
|
81
|
+
def startup options = {}
|
|
82
|
+
options = options.to_hash
|
|
83
|
+
|
|
84
|
+
force = options.delete(:force)
|
|
85
|
+
force ||= !trait[:started]
|
|
86
|
+
|
|
87
|
+
options[:runner] ||= caller[0][/^(.*?):\d+/, 1]
|
|
88
|
+
Global.merge!(options)
|
|
89
|
+
|
|
90
|
+
if force
|
|
91
|
+
Log.info("Starting up Ramaze (Version #{VERSION})")
|
|
92
|
+
trait[:started] = true
|
|
93
|
+
|
|
94
|
+
trait[:essentials].each do |obj|
|
|
95
|
+
obj.startup(options)
|
|
96
|
+
end
|
|
97
|
+
else
|
|
98
|
+
Log.info "Ramaze already started, skipped start."
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# A shortcut for setting Ramaze.trait[:started] = true.
|
|
103
|
+
|
|
104
|
+
def skip_start
|
|
105
|
+
trait[:started] = true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Forces the startup of Ramaze regardless if trait[:started] is set.
|
|
109
|
+
|
|
110
|
+
def start!(options = {})
|
|
111
|
+
trait[:started] = false
|
|
112
|
+
startup(options)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# This will be called when you hit ^C or send SIGINT.
|
|
116
|
+
# It sends ::shutdown to every class in trait[:essentials] and informs you
|
|
117
|
+
# when it is done
|
|
118
|
+
|
|
119
|
+
def shutdown
|
|
120
|
+
Log.info "Initiate shutdown"
|
|
121
|
+
|
|
122
|
+
Timeout.timeout(5) do
|
|
123
|
+
trait[:essentials].each do |obj|
|
|
124
|
+
obj.shutdown if obj.respond_to?(:shutdown)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
puts "Ramazement is over, have a nice day."
|
|
128
|
+
|
|
129
|
+
exit
|
|
130
|
+
end
|
|
131
|
+
rescue Timeout::Error
|
|
132
|
+
puts "Shutdown timed out, issuing exit!"
|
|
133
|
+
exit!
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
alias start startup
|
|
137
|
+
alias stop shutdown
|
|
138
|
+
end
|
|
139
|
+
end
|
data/lib/vendor/bacon.rb
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Bacon -- small RSpec clone.
|
|
2
|
+
#
|
|
3
|
+
# "Truth will sooner come out from error than from confusion." ---Francis Bacon
|
|
4
|
+
|
|
5
|
+
# Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
|
6
|
+
#
|
|
7
|
+
# Bacon is freely distributable under the terms of an MIT-style license.
|
|
8
|
+
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
9
|
+
|
|
10
|
+
module Bacon
|
|
11
|
+
VERSION = "0.9"
|
|
12
|
+
|
|
13
|
+
Counter = Hash.new(0)
|
|
14
|
+
ErrorLog = ""
|
|
15
|
+
Shared = Hash.new { |_, name|
|
|
16
|
+
raise NameError, "no such context: #{name.inspect}"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
RestrictName = // unless defined? RestrictName
|
|
20
|
+
RestrictContext = // unless defined? RestrictContext
|
|
21
|
+
|
|
22
|
+
def self.summary_on_exit
|
|
23
|
+
return if Counter[:installed_summary] > 0
|
|
24
|
+
at_exit {
|
|
25
|
+
handle_summary
|
|
26
|
+
if $!
|
|
27
|
+
raise $!
|
|
28
|
+
elsif Counter[:errors] + Counter[:failed] > 0
|
|
29
|
+
exit 1
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
Counter[:installed_summary] += 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
module SpecDoxOutput
|
|
36
|
+
def handle_specification(name)
|
|
37
|
+
puts name
|
|
38
|
+
yield
|
|
39
|
+
puts
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def handle_requirement(description)
|
|
43
|
+
print "- #{description}"
|
|
44
|
+
error = yield
|
|
45
|
+
puts error.empty? ? "" : " [#{error}]"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def handle_summary
|
|
49
|
+
print ErrorLog
|
|
50
|
+
puts "%d specifications (%d requirements), %d failures, %d errors" %
|
|
51
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
module TestUnitOutput
|
|
56
|
+
def handle_specification(name) yield end
|
|
57
|
+
|
|
58
|
+
def handle_requirement(description)
|
|
59
|
+
error = yield
|
|
60
|
+
if error.empty?
|
|
61
|
+
print "."
|
|
62
|
+
else
|
|
63
|
+
print error[0..0]
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def handle_summary
|
|
68
|
+
puts "", ErrorLog
|
|
69
|
+
puts "%d tests, %d assertions, %d failures, %d errors" %
|
|
70
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
module TapOutput
|
|
75
|
+
def handle_specification(name) yield end
|
|
76
|
+
|
|
77
|
+
def handle_requirement(description)
|
|
78
|
+
ErrorLog.replace ""
|
|
79
|
+
error = yield
|
|
80
|
+
if error.empty?
|
|
81
|
+
printf "ok %-3d - %s\n" % [Counter[:specifications], description]
|
|
82
|
+
else
|
|
83
|
+
printf "not ok %d - %s: %s\n" %
|
|
84
|
+
[Counter[:specifications], description, error]
|
|
85
|
+
puts ErrorLog.strip.gsub(/^/, '# ')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def handle_summary
|
|
90
|
+
puts "1..#{Counter[:specifications]}"
|
|
91
|
+
puts "# %d tests, %d assertions, %d failures, %d errors" %
|
|
92
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
extend SpecDoxOutput # default
|
|
97
|
+
|
|
98
|
+
class Error < RuntimeError
|
|
99
|
+
attr_accessor :count_as
|
|
100
|
+
|
|
101
|
+
def initialize(count_as, message)
|
|
102
|
+
@count_as = count_as
|
|
103
|
+
super message
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class Context
|
|
108
|
+
def initialize(name, &block)
|
|
109
|
+
@name = name
|
|
110
|
+
@before, @after = [], []
|
|
111
|
+
|
|
112
|
+
return unless name =~ RestrictContext
|
|
113
|
+
Bacon.handle_specification(name) { instance_eval(&block) }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def before(&block); @before << block; end
|
|
117
|
+
def after(&block); @after << block; end
|
|
118
|
+
|
|
119
|
+
def behaves_like(*names)
|
|
120
|
+
names.each { |name| instance_eval(&Shared[name]) }
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def it(description, &block)
|
|
124
|
+
return unless description =~ RestrictName
|
|
125
|
+
block ||= lambda { should.flunk "not implemented" }
|
|
126
|
+
Counter[:specifications] += 1
|
|
127
|
+
run_requirement description, block
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def should(*args, &block)
|
|
131
|
+
if Counter[:depth]==0
|
|
132
|
+
it('should '+args.first,&block)
|
|
133
|
+
else
|
|
134
|
+
super(*args,&block)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def run_requirement(description, spec)
|
|
139
|
+
Bacon.handle_requirement description do
|
|
140
|
+
begin
|
|
141
|
+
Counter[:depth] += 1
|
|
142
|
+
rescued = false
|
|
143
|
+
begin
|
|
144
|
+
@before.each { |block| instance_eval(&block) }
|
|
145
|
+
prev_req = Counter[:requirements]
|
|
146
|
+
instance_eval(&spec)
|
|
147
|
+
rescue Object => e
|
|
148
|
+
rescued = true
|
|
149
|
+
raise e
|
|
150
|
+
ensure
|
|
151
|
+
if Counter[:requirements] == prev_req and not rescued
|
|
152
|
+
raise Error.new(:missing,
|
|
153
|
+
"empty specification: #{@name} #{description}")
|
|
154
|
+
end
|
|
155
|
+
begin
|
|
156
|
+
@after.each { |block| instance_eval(&block) }
|
|
157
|
+
rescue Object => e
|
|
158
|
+
raise e unless rescued
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
rescue Object => e
|
|
162
|
+
ErrorLog << "#{e.class}: #{e.message}\n"
|
|
163
|
+
e.backtrace.find_all { |line| line !~ /bin\/bacon|\/bacon\.rb:\d+/ }.
|
|
164
|
+
each_with_index { |line, i|
|
|
165
|
+
ErrorLog << "\t#{line}#{i==0 ? ": #@name - #{description}" : ""}\n"
|
|
166
|
+
}
|
|
167
|
+
ErrorLog << "\n"
|
|
168
|
+
|
|
169
|
+
if e.kind_of? Error
|
|
170
|
+
Counter[e.count_as] += 1
|
|
171
|
+
e.count_as.to_s.upcase
|
|
172
|
+
else
|
|
173
|
+
Counter[:errors] += 1
|
|
174
|
+
"ERROR: #{e.class}"
|
|
175
|
+
end
|
|
176
|
+
else
|
|
177
|
+
""
|
|
178
|
+
ensure
|
|
179
|
+
Counter[:depth] -= 1
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def raise?(*args, &block); block.raise?(*args); end
|
|
185
|
+
def throw?(*args, &block); block.throw?(*args); end
|
|
186
|
+
def change?(*args, &block); block.change?(*args); end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class Object
|
|
192
|
+
def true?; false; end
|
|
193
|
+
def false?; false; end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
class TrueClass
|
|
197
|
+
def true?; true; end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class FalseClass
|
|
201
|
+
def false?; true; end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
class Proc
|
|
205
|
+
def raise?(*exceptions)
|
|
206
|
+
exceptions = [RuntimeError] if exceptions.empty?
|
|
207
|
+
call
|
|
208
|
+
|
|
209
|
+
# Only to work in 1.9.0, rescue with splat doesn't work there right now
|
|
210
|
+
rescue Object => e
|
|
211
|
+
case e
|
|
212
|
+
when *exceptions
|
|
213
|
+
e
|
|
214
|
+
else
|
|
215
|
+
raise e
|
|
216
|
+
end
|
|
217
|
+
else
|
|
218
|
+
false
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def throw?(sym)
|
|
222
|
+
catch(sym) {
|
|
223
|
+
call
|
|
224
|
+
return false
|
|
225
|
+
}
|
|
226
|
+
return true
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def change?
|
|
230
|
+
pre_result = yield
|
|
231
|
+
called = call
|
|
232
|
+
post_result = yield
|
|
233
|
+
pre_result != post_result
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class Numeric
|
|
238
|
+
def close?(to, delta)
|
|
239
|
+
(to.to_f - self).abs <= delta.to_f rescue false
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class Object
|
|
245
|
+
def should(*args, &block) Should.new(self).be(*args, &block) end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
module Kernel
|
|
249
|
+
private
|
|
250
|
+
|
|
251
|
+
def describe(*args, &block) Bacon::Context.new(args.join(' '), &block) end
|
|
252
|
+
def shared(name, &block) Bacon::Shared[name] = block end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class Should
|
|
257
|
+
# Kills ==, ===, =~, eql?, equal?, frozen?, instance_of?, is_a?,
|
|
258
|
+
# kind_of?, nil?, respond_to?, tainted?
|
|
259
|
+
instance_methods.each { |method|
|
|
260
|
+
undef_method method if method =~ /\?|^\W+$/
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
def initialize(object)
|
|
264
|
+
@object = object
|
|
265
|
+
@negated = false
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def not(*args, &block)
|
|
269
|
+
@negated = !@negated
|
|
270
|
+
|
|
271
|
+
if args.empty?
|
|
272
|
+
self
|
|
273
|
+
else
|
|
274
|
+
be(*args, &block)
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def be(*args, &block)
|
|
279
|
+
if args.empty?
|
|
280
|
+
self
|
|
281
|
+
else
|
|
282
|
+
block = args.shift unless block_given?
|
|
283
|
+
satisfy(*args, &block)
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
alias a be
|
|
288
|
+
alias an be
|
|
289
|
+
|
|
290
|
+
def satisfy(*args, &block)
|
|
291
|
+
if args.size == 1 && String === args.first
|
|
292
|
+
description = args.shift
|
|
293
|
+
else
|
|
294
|
+
description = ""
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
r = yield(@object, *args)
|
|
298
|
+
if Bacon::Counter[:depth] > 0
|
|
299
|
+
Bacon::Counter[:requirements] += 1
|
|
300
|
+
raise Bacon::Error.new(:failed, description) unless @negated ^ r
|
|
301
|
+
end
|
|
302
|
+
@negated ^ r ? r : false
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def method_missing(name, *args, &block)
|
|
306
|
+
name = "#{name}?" if name.to_s =~ /\w[^?]\z/
|
|
307
|
+
|
|
308
|
+
desc = @negated ? "not " : ""
|
|
309
|
+
desc << @object.inspect << "." << name.to_s
|
|
310
|
+
desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed"
|
|
311
|
+
|
|
312
|
+
satisfy(desc) { |x| x.__send__(name, *args, &block) }
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def equal(value) self == value end
|
|
316
|
+
def match(value) self =~ value end
|
|
317
|
+
def identical_to(value) self.equal? value end
|
|
318
|
+
alias same_as identical_to
|
|
319
|
+
|
|
320
|
+
def flunk(reason="Flunked")
|
|
321
|
+
raise Bacon::Error.new(:failed, reason)
|
|
322
|
+
end
|
|
323
|
+
end
|