qwik2md 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +36 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/qwik2md +17 -0
- data/lib/qwik2md/version.rb +3 -0
- data/lib/qwik2md.rb +39 -0
- data/qwik2md.gemspec +30 -0
- data/vendor/qwik/AUTHORS +10 -0
- data/vendor/qwik/COPYING +340 -0
- data/vendor/qwik/COPYRIGHT +346 -0
- data/vendor/qwik/lib/qwik/Makefile +63 -0
- data/vendor/qwik/lib/qwik/Rakefile +17 -0
- data/vendor/qwik/lib/qwik/act-aa.rb +83 -0
- data/vendor/qwik/lib/qwik/act-archive.rb +386 -0
- data/vendor/qwik/lib/qwik/act-attach.rb +304 -0
- data/vendor/qwik/lib/qwik/act-backup.rb +236 -0
- data/vendor/qwik/lib/qwik/act-basic.rb +325 -0
- data/vendor/qwik/lib/qwik/act-book.rb +161 -0
- data/vendor/qwik/lib/qwik/act-calc.rb +371 -0
- data/vendor/qwik/lib/qwik/act-charset.rb +251 -0
- data/vendor/qwik/lib/qwik/act-christel.rb +112 -0
- data/vendor/qwik/lib/qwik/act-chronology.rb +149 -0
- data/vendor/qwik/lib/qwik/act-code.rb +155 -0
- data/vendor/qwik/lib/qwik/act-comment.rb +554 -0
- data/vendor/qwik/lib/qwik/act-config.rb +49 -0
- data/vendor/qwik/lib/qwik/act-counter.rb +125 -0
- data/vendor/qwik/lib/qwik/act-day.rb +96 -0
- data/vendor/qwik/lib/qwik/act-describe.rb +135 -0
- data/vendor/qwik/lib/qwik/act-diary.rb +109 -0
- data/vendor/qwik/lib/qwik/act-edit.rb +317 -0
- data/vendor/qwik/lib/qwik/act-embed-html.rb +296 -0
- data/vendor/qwik/lib/qwik/act-emode.rb +150 -0
- data/vendor/qwik/lib/qwik/act-event.rb +187 -0
- data/vendor/qwik/lib/qwik/act-file.rb +303 -0
- data/vendor/qwik/lib/qwik/act-files.rb +771 -0
- data/vendor/qwik/lib/qwik/act-getpass.rb +295 -0
- data/vendor/qwik/lib/qwik/act-history.rb +136 -0
- data/vendor/qwik/lib/qwik/act-html.rb +204 -0
- data/vendor/qwik/lib/qwik/act-httpauth.rb +147 -0
- data/vendor/qwik/lib/qwik/act-include.rb +142 -0
- data/vendor/qwik/lib/qwik/act-interwiki.rb +189 -0
- data/vendor/qwik/lib/qwik/act-isearch.rb +109 -0
- data/vendor/qwik/lib/qwik/act-keywords.rb +137 -0
- data/vendor/qwik/lib/qwik/act-lang.rb +81 -0
- data/vendor/qwik/lib/qwik/act-license.rb +63 -0
- data/vendor/qwik/lib/qwik/act-list.rb +287 -0
- data/vendor/qwik/lib/qwik/act-login.rb +410 -0
- data/vendor/qwik/lib/qwik/act-logout.rb +60 -0
- data/vendor/qwik/lib/qwik/act-mail.rb +159 -0
- data/vendor/qwik/lib/qwik/act-map.rb +292 -0
- data/vendor/qwik/lib/qwik/act-md5.rb +42 -0
- data/vendor/qwik/lib/qwik/act-mdlb.rb +741 -0
- data/vendor/qwik/lib/qwik/act-media.rb +416 -0
- data/vendor/qwik/lib/qwik/act-member.rb +157 -0
- data/vendor/qwik/lib/qwik/act-menu.rb +142 -0
- data/vendor/qwik/lib/qwik/act-metadata.rb +323 -0
- data/vendor/qwik/lib/qwik/act-mlsubmitform.rb +49 -0
- data/vendor/qwik/lib/qwik/act-monitor.rb +167 -0
- data/vendor/qwik/lib/qwik/act-new.rb +418 -0
- data/vendor/qwik/lib/qwik/act-pagelist.rb +248 -0
- data/vendor/qwik/lib/qwik/act-password.rb +145 -0
- data/vendor/qwik/lib/qwik/act-plan.rb +210 -0
- data/vendor/qwik/lib/qwik/act-povray.rb +230 -0
- data/vendor/qwik/lib/qwik/act-presen.rb +380 -0
- data/vendor/qwik/lib/qwik/act-redirect.rb +133 -0
- data/vendor/qwik/lib/qwik/act-ring.rb +1071 -0
- data/vendor/qwik/lib/qwik/act-rrefs.rb +255 -0
- data/vendor/qwik/lib/qwik/act-ruby.rb +116 -0
- data/vendor/qwik/lib/qwik/act-sample.rb +170 -0
- data/vendor/qwik/lib/qwik/act-save.rb +295 -0
- data/vendor/qwik/lib/qwik/act-schedule.rb +374 -0
- data/vendor/qwik/lib/qwik/act-search.rb +180 -0
- data/vendor/qwik/lib/qwik/act-searchwords.rb +51 -0
- data/vendor/qwik/lib/qwik/act-sendpass.rb +83 -0
- data/vendor/qwik/lib/qwik/act-site.rb +89 -0
- data/vendor/qwik/lib/qwik/act-sitebackup.rb +419 -0
- data/vendor/qwik/lib/qwik/act-sitelog.rb +118 -0
- data/vendor/qwik/lib/qwik/act-smil.rb +299 -0
- data/vendor/qwik/lib/qwik/act-status.rb +220 -0
- data/vendor/qwik/lib/qwik/act-style.rb +608 -0
- data/vendor/qwik/lib/qwik/act-table.rb +263 -0
- data/vendor/qwik/lib/qwik/act-tableform.rb +241 -0
- data/vendor/qwik/lib/qwik/act-tag.rb +103 -0
- data/vendor/qwik/lib/qwik/act-text.rb +70 -0
- data/vendor/qwik/lib/qwik/act-textarea.rb +164 -0
- data/vendor/qwik/lib/qwik/act-theme.rb +346 -0
- data/vendor/qwik/lib/qwik/act-toc.rb +112 -0
- data/vendor/qwik/lib/qwik/act-typekey.rb +198 -0
- data/vendor/qwik/lib/qwik/act-under-const.rb +94 -0
- data/vendor/qwik/lib/qwik/act-webservice.rb +321 -0
- data/vendor/qwik/lib/qwik/act-wema.rb +558 -0
- data/vendor/qwik/lib/qwik/act-wysiwyg.rb +238 -0
- data/vendor/qwik/lib/qwik/action.rb +325 -0
- data/vendor/qwik/lib/qwik/autoreload.rb +98 -0
- data/vendor/qwik/lib/qwik/bench-bench.rb +28 -0
- data/vendor/qwik/lib/qwik/bench-emode.rb +47 -0
- data/vendor/qwik/lib/qwik/bench-format-xml.rb +70 -0
- data/vendor/qwik/lib/qwik/bench-large-table.rb +62 -0
- data/vendor/qwik/lib/qwik/bench-md5.rb +14 -0
- data/vendor/qwik/lib/qwik/bench-module-session.rb +19 -0
- data/vendor/qwik/lib/qwik/bench-page.rb +50 -0
- data/vendor/qwik/lib/qwik/bench-s-md5.rb +28 -0
- data/vendor/qwik/lib/qwik/bench-session.rb +25 -0
- data/vendor/qwik/lib/qwik/bench-textformat.rb +31 -0
- data/vendor/qwik/lib/qwik/catalog-factory.rb +91 -0
- data/vendor/qwik/lib/qwik/catalog-ja.rb +479 -0
- data/vendor/qwik/lib/qwik/catalog-ml-ja.rb +145 -0
- data/vendor/qwik/lib/qwik/check-act-monitor.rb +112 -0
- data/vendor/qwik/lib/qwik/check-act-monitor2.rb +46 -0
- data/vendor/qwik/lib/qwik/check-act-theme.rb +27 -0
- data/vendor/qwik/lib/qwik/check-event.rb +112 -0
- data/vendor/qwik/lib/qwik/check-event2.rb +55 -0
- data/vendor/qwik/lib/qwik/check-htree-rexml.rb +77 -0
- data/vendor/qwik/lib/qwik/check-htree.rb +51 -0
- data/vendor/qwik/lib/qwik/check-libxml.rb +135 -0
- data/vendor/qwik/lib/qwik/check-many-pages.rb +47 -0
- data/vendor/qwik/lib/qwik/check-monitor.rb +33 -0
- data/vendor/qwik/lib/qwik/check-observer.rb +67 -0
- data/vendor/qwik/lib/qwik/check-server.rb +61 -0
- data/vendor/qwik/lib/qwik/check-uuencode.rb +33 -0
- data/vendor/qwik/lib/qwik/check-webdav.rb +65 -0
- data/vendor/qwik/lib/qwik/check-xml-xpath.rb +27 -0
- data/vendor/qwik/lib/qwik/common-backtrace.rb +94 -0
- data/vendor/qwik/lib/qwik/common-basic.rb +111 -0
- data/vendor/qwik/lib/qwik/common-condition.rb +142 -0
- data/vendor/qwik/lib/qwik/common-error.rb +48 -0
- data/vendor/qwik/lib/qwik/common-gettext.rb +50 -0
- data/vendor/qwik/lib/qwik/common-javascript.rb +45 -0
- data/vendor/qwik/lib/qwik/common-notice.rb +132 -0
- data/vendor/qwik/lib/qwik/common-plain.rb +105 -0
- data/vendor/qwik/lib/qwik/common-plugin.rb +111 -0
- data/vendor/qwik/lib/qwik/common-res.rb +76 -0
- data/vendor/qwik/lib/qwik/common-resolve.rb +92 -0
- data/vendor/qwik/lib/qwik/common-send.rb +171 -0
- data/vendor/qwik/lib/qwik/common-session.rb +139 -0
- data/vendor/qwik/lib/qwik/common-surface.rb +261 -0
- data/vendor/qwik/lib/qwik/common-url.rb +90 -0
- data/vendor/qwik/lib/qwik/compat/Makefile +12 -0
- data/vendor/qwik/lib/qwik/compat/add_load_path.rb +1 -0
- data/vendor/qwik/lib/qwik/config.rb +299 -0
- data/vendor/qwik/lib/qwik/db-b-backup.rb +142 -0
- data/vendor/qwik/lib/qwik/db-backup.rb +184 -0
- data/vendor/qwik/lib/qwik/db-berkeley.rb +306 -0
- data/vendor/qwik/lib/qwik/db-filesystem.rb +305 -0
- data/vendor/qwik/lib/qwik/db-indexer.rb +154 -0
- data/vendor/qwik/lib/qwik/db-searchwords.rb +238 -0
- data/vendor/qwik/lib/qwik/description-ja.rb +267 -0
- data/vendor/qwik/lib/qwik/description.rb +256 -0
- data/vendor/qwik/lib/qwik/dev-add-copyright.rb +23 -0
- data/vendor/qwik/lib/qwik/dev-backup.rb +24 -0
- data/vendor/qwik/lib/qwik/dev-bench.rb +175 -0
- data/vendor/qwik/lib/qwik/dev-calctime.rb +52 -0
- data/vendor/qwik/lib/qwik/dev-css-compressor.rb +60 -0
- data/vendor/qwik/lib/qwik/dev-extract-catalog.rb +102 -0
- data/vendor/qwik/lib/qwik/dev-js-compressor.rb +73 -0
- data/vendor/qwik/lib/qwik/dev-release.rb +235 -0
- data/vendor/qwik/lib/qwik/dev-replace.rb +353 -0
- data/vendor/qwik/lib/qwik/dev-sendmail.rb +25 -0
- data/vendor/qwik/lib/qwik/farm.rb +283 -0
- data/vendor/qwik/lib/qwik/gettext.rb +56 -0
- data/vendor/qwik/lib/qwik/group-cond.rb +157 -0
- data/vendor/qwik/lib/qwik/group-config.rb +247 -0
- data/vendor/qwik/lib/qwik/group-confirm.rb +147 -0
- data/vendor/qwik/lib/qwik/group-db.rb +326 -0
- data/vendor/qwik/lib/qwik/group-mail.rb +195 -0
- data/vendor/qwik/lib/qwik/group-member.rb +307 -0
- data/vendor/qwik/lib/qwik/group-sendmail.rb +231 -0
- data/vendor/qwik/lib/qwik/group-site.rb +374 -0
- data/vendor/qwik/lib/qwik/group-sweep.rb +63 -0
- data/vendor/qwik/lib/qwik/group.rb +157 -0
- data/vendor/qwik/lib/qwik/helper.rb +6 -0
- data/vendor/qwik/lib/qwik/html-generator.rb +104 -0
- data/vendor/qwik/lib/qwik/html-to-wabisabi.rb +148 -0
- data/vendor/qwik/lib/qwik/htree-diff.rb +87 -0
- data/vendor/qwik/lib/qwik/htree-format-xml.rb +57 -0
- data/vendor/qwik/lib/qwik/htree-generator.rb +144 -0
- data/vendor/qwik/lib/qwik/htree-get.rb +251 -0
- data/vendor/qwik/lib/qwik/htree-html-generator.rb +179 -0
- data/vendor/qwik/lib/qwik/htree-template.rb +263 -0
- data/vendor/qwik/lib/qwik/htree-to-wabisabi.rb +171 -0
- data/vendor/qwik/lib/qwik/loadlib.rb +79 -0
- data/vendor/qwik/lib/qwik/logger.rb +115 -0
- data/vendor/qwik/lib/qwik/mail-body.rb +171 -0
- data/vendor/qwik/lib/qwik/mail-header.rb +474 -0
- data/vendor/qwik/lib/qwik/mail-multipart.rb +193 -0
- data/vendor/qwik/lib/qwik/mail-parse.rb +147 -0
- data/vendor/qwik/lib/qwik/mail.rb +341 -0
- data/vendor/qwik/lib/qwik/mailaddress.rb +83 -0
- data/vendor/qwik/lib/qwik/mdlb-model.rb +81 -0
- data/vendor/qwik/lib/qwik/mdlb-sample.rb +324 -0
- data/vendor/qwik/lib/qwik/ml-catalog-factory.rb +27 -0
- data/vendor/qwik/lib/qwik/ml-exception.rb +15 -0
- data/vendor/qwik/lib/qwik/ml-generator.rb +28 -0
- data/vendor/qwik/lib/qwik/ml-gettext.rb +137 -0
- data/vendor/qwik/lib/qwik/ml-logger.rb +82 -0
- data/vendor/qwik/lib/qwik/ml-memory.rb +65 -0
- data/vendor/qwik/lib/qwik/ml-msg-validator.rb +86 -0
- data/vendor/qwik/lib/qwik/ml-processor.rb +609 -0
- data/vendor/qwik/lib/qwik/ml-quickml-server.rb +122 -0
- data/vendor/qwik/lib/qwik/ml-sendmail.rb +0 -0
- data/vendor/qwik/lib/qwik/ml-server.rb +107 -0
- data/vendor/qwik/lib/qwik/ml-session.rb +348 -0
- data/vendor/qwik/lib/qwik/ml-sweeper.rb +101 -0
- data/vendor/qwik/lib/qwik/mock-logger.rb +65 -0
- data/vendor/qwik/lib/qwik/mock-sendmail.rb +78 -0
- data/vendor/qwik/lib/qwik/mock-socket.rb +82 -0
- data/vendor/qwik/lib/qwik/modulobe.rb +406 -0
- data/vendor/qwik/lib/qwik/mongrel-server.rb +72 -0
- data/vendor/qwik/lib/qwik/page-files.rb +249 -0
- data/vendor/qwik/lib/qwik/page-generate.rb +82 -0
- data/vendor/qwik/lib/qwik/page-get.rb +262 -0
- data/vendor/qwik/lib/qwik/page-images.rb +168 -0
- data/vendor/qwik/lib/qwik/page-put.rb +128 -0
- data/vendor/qwik/lib/qwik/page-rrefs.rb +154 -0
- data/vendor/qwik/lib/qwik/page-title.rb +0 -0
- data/vendor/qwik/lib/qwik/page-wikidb.rb +234 -0
- data/vendor/qwik/lib/qwik/page.rb +67 -0
- data/vendor/qwik/lib/qwik/pages.rb +444 -0
- data/vendor/qwik/lib/qwik/parse-plugin.rb +249 -0
- data/vendor/qwik/lib/qwik/parser-emode.rb +116 -0
- data/vendor/qwik/lib/qwik/parser-inline.rb +272 -0
- data/vendor/qwik/lib/qwik/parser.rb +349 -0
- data/vendor/qwik/lib/qwik/password.rb +183 -0
- data/vendor/qwik/lib/qwik/periodic.rb +79 -0
- data/vendor/qwik/lib/qwik/qp.rb +56 -0
- data/vendor/qwik/lib/qwik/qwik-service.rb +341 -0
- data/vendor/qwik/lib/qwik/qwik.rb +5 -0
- data/vendor/qwik/lib/qwik/qwikweb-adduser.rb +34 -0
- data/vendor/qwik/lib/qwik/qwikweb-catalog-validator.rb +110 -0
- data/vendor/qwik/lib/qwik/qwikweb-incgen.rb +28 -0
- data/vendor/qwik/lib/qwik/qwikweb-makesite.rb +41 -0
- data/vendor/qwik/lib/qwik/qwikweb-server.rb +44 -0
- data/vendor/qwik/lib/qwik/qwikweb-showpassword.rb +26 -0
- data/vendor/qwik/lib/qwik/qwikweb-watchlog.rb +67 -0
- data/vendor/qwik/lib/qwik/request-path.rb +304 -0
- data/vendor/qwik/lib/qwik/request-ua.rb +76 -0
- data/vendor/qwik/lib/qwik/request-webrick.rb +81 -0
- data/vendor/qwik/lib/qwik/request.rb +91 -0
- data/vendor/qwik/lib/qwik/resolve-tdiary.rb +292 -0
- data/vendor/qwik/lib/qwik/resolve.rb +121 -0
- data/vendor/qwik/lib/qwik/response.rb +228 -0
- data/vendor/qwik/lib/qwik/server-memory.rb +57 -0
- data/vendor/qwik/lib/qwik/server-webrick.rb +102 -0
- data/vendor/qwik/lib/qwik/server.rb +252 -0
- data/vendor/qwik/lib/qwik/site-config.rb +149 -0
- data/vendor/qwik/lib/qwik/site-db.rb +136 -0
- data/vendor/qwik/lib/qwik/site-event.rb +162 -0
- data/vendor/qwik/lib/qwik/site-files.rb +86 -0
- data/vendor/qwik/lib/qwik/site-group.rb +103 -0
- data/vendor/qwik/lib/qwik/site-index.rb +47 -0
- data/vendor/qwik/lib/qwik/site-log.rb +64 -0
- data/vendor/qwik/lib/qwik/site-member.rb +230 -0
- data/vendor/qwik/lib/qwik/site-monitor.rb +97 -0
- data/vendor/qwik/lib/qwik/site-pages.rb +62 -0
- data/vendor/qwik/lib/qwik/site-plan.rb +139 -0
- data/vendor/qwik/lib/qwik/site-report.rb +282 -0
- data/vendor/qwik/lib/qwik/site-resolve.rb +230 -0
- data/vendor/qwik/lib/qwik/site-rrefs.rb +18 -0
- data/vendor/qwik/lib/qwik/site-search.rb +180 -0
- data/vendor/qwik/lib/qwik/site-timeline.rb +153 -0
- data/vendor/qwik/lib/qwik/site-url.rb +189 -0
- data/vendor/qwik/lib/qwik/site.rb +76 -0
- data/vendor/qwik/lib/qwik/smil-time.rb +105 -0
- data/vendor/qwik/lib/qwik/smtp-session.rb +331 -0
- data/vendor/qwik/lib/qwik/template-generator.rb +149 -0
- data/vendor/qwik/lib/qwik/template.rb +85 -0
- data/vendor/qwik/lib/qwik/test-common.rb +10 -0
- data/vendor/qwik/lib/qwik/test-ml-info.rb +225 -0
- data/vendor/qwik/lib/qwik/test-module-ml.rb +142 -0
- data/vendor/qwik/lib/qwik/test-module-path.rb +110 -0
- data/vendor/qwik/lib/qwik/test-module-public.rb +70 -0
- data/vendor/qwik/lib/qwik/test-module-server.rb +98 -0
- data/vendor/qwik/lib/qwik/test-module-session.rb +264 -0
- data/vendor/qwik/lib/qwik/test-module-suite.rb +91 -0
- data/vendor/qwik/lib/qwik/test-ms-applemail.rb +59 -0
- data/vendor/qwik/lib/qwik/test-ms-attach.rb +174 -0
- data/vendor/qwik/lib/qwik/test-ms-basic.rb +40 -0
- data/vendor/qwik/lib/qwik/test-ms-close.rb +35 -0
- data/vendor/qwik/lib/qwik/test-ms-confirm.rb +75 -0
- data/vendor/qwik/lib/qwik/test-ms-ignore-spam.rb +57 -0
- data/vendor/qwik/lib/qwik/test-ms-japanese.rb +97 -0
- data/vendor/qwik/lib/qwik/test-ms-jfilename.rb +82 -0
- data/vendor/qwik/lib/qwik/test-ms-large.rb +58 -0
- data/vendor/qwik/lib/qwik/test-ms-member.rb +103 -0
- data/vendor/qwik/lib/qwik/test-ms-multipart.rb +84 -0
- data/vendor/qwik/lib/qwik/test-ms-org.rb +129 -0
- data/vendor/qwik/lib/qwik/test-ms-plan.rb +130 -0
- data/vendor/qwik/lib/qwik/test-ms-post.rb +53 -0
- data/vendor/qwik/lib/qwik/test-ms-quopri.rb +76 -0
- data/vendor/qwik/lib/qwik/test-sub-quopri.rb +45 -0
- data/vendor/qwik/lib/qwik/test-submit-base64.rb +59 -0
- data/vendor/qwik/lib/qwik/test-submit-forward.rb +61 -0
- data/vendor/qwik/lib/qwik/test-submit-html-mail.rb +52 -0
- data/vendor/qwik/lib/qwik/test-submit-japanese.rb +135 -0
- data/vendor/qwik/lib/qwik/test-submit-jfilename.rb +144 -0
- data/vendor/qwik/lib/qwik/test-submit-uuencode.rb +71 -0
- data/vendor/qwik/lib/qwik/test-suite-all.rb +8 -0
- data/vendor/qwik/lib/qwik/test-suite-basic.rb +9 -0
- data/vendor/qwik/lib/qwik/test-suite-ml.rb +9 -0
- data/vendor/qwik/lib/qwik/test-typekey.rb +64 -0
- data/vendor/qwik/lib/qwik/testunit.rb +45 -0
- data/vendor/qwik/lib/qwik/tokenizer-inline.rb +288 -0
- data/vendor/qwik/lib/qwik/tokenizer.rb +331 -0
- data/vendor/qwik/lib/qwik/typekey.rb +160 -0
- data/vendor/qwik/lib/qwik/util-basic.rb +135 -0
- data/vendor/qwik/lib/qwik/util-charset.rb +331 -0
- data/vendor/qwik/lib/qwik/util-css.rb +56 -0
- data/vendor/qwik/lib/qwik/util-csv-tokenizer.rb +113 -0
- data/vendor/qwik/lib/qwik/util-filename.rb +112 -0
- data/vendor/qwik/lib/qwik/util-pathname.rb +202 -0
- data/vendor/qwik/lib/qwik/util-pid.rb +58 -0
- data/vendor/qwik/lib/qwik/util-safe.rb +67 -0
- data/vendor/qwik/lib/qwik/util-sendmail.rb +273 -0
- data/vendor/qwik/lib/qwik/util-string.rb +202 -0
- data/vendor/qwik/lib/qwik/util-time.rb +125 -0
- data/vendor/qwik/lib/qwik/util-webrick.rb +176 -0
- data/vendor/qwik/lib/qwik/version.rb +11 -0
- data/vendor/qwik/lib/qwik/wabisabi-basic.rb +163 -0
- data/vendor/qwik/lib/qwik/wabisabi-diff.rb +130 -0
- data/vendor/qwik/lib/qwik/wabisabi-format-xml.rb +310 -0
- data/vendor/qwik/lib/qwik/wabisabi-generator.rb +262 -0
- data/vendor/qwik/lib/qwik/wabisabi-index.rb +174 -0
- data/vendor/qwik/lib/qwik/wabisabi-table.rb +212 -0
- data/vendor/qwik/lib/qwik/wabisabi-template.rb +295 -0
- data/vendor/qwik/lib/qwik/wabisabi-to-htree.rb +111 -0
- data/vendor/qwik/lib/qwik/wabisabi-to-wiki.rb +690 -0
- data/vendor/qwik/lib/qwik/wabisabi-traverse.rb +207 -0
- data/vendor/qwik/lib/qwik/wabisabi-validator.rb +116 -0
- data/vendor/qwik/lib/qwik/wabisabi.rb +5 -0
- metadata +492 -0
@@ -0,0 +1,349 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
6
|
+
require 'qwik/util-string'
|
7
|
+
require 'qwik/tokenizer'
|
8
|
+
require 'qwik/parser-inline'
|
9
|
+
require 'qwik/tokenizer-inline'
|
10
|
+
require 'qwik/html-to-wabisabi'
|
11
|
+
require 'qwik/wabisabi-validator'
|
12
|
+
|
13
|
+
module Qwik
|
14
|
+
class TextParser
|
15
|
+
# Make a tree from tokens.
|
16
|
+
def self.make_tree(tokens)
|
17
|
+
ar = []
|
18
|
+
|
19
|
+
tokens.each {|token|
|
20
|
+
tag = token.first
|
21
|
+
case tag
|
22
|
+
|
23
|
+
when :h2, :h3, :h4, :h5, :h6
|
24
|
+
ar << [tag, *inline(token[1])]
|
25
|
+
|
26
|
+
when :ul, :ol
|
27
|
+
lu = ar
|
28
|
+
token[1].times {
|
29
|
+
if lu.last && lu.last.is_a?(Array) && lu.last.first == tag
|
30
|
+
lu = lu.last
|
31
|
+
else
|
32
|
+
a = [tag]
|
33
|
+
lu << a
|
34
|
+
lu = a
|
35
|
+
end
|
36
|
+
}
|
37
|
+
lu << [:li, *inline(token[2])]
|
38
|
+
|
39
|
+
when :pre, :blockquote
|
40
|
+
if ar.last && ar.last.first == tag
|
41
|
+
ar.last[1] << "\n"+token[1]
|
42
|
+
else
|
43
|
+
ar << [tag, token[1]]
|
44
|
+
end
|
45
|
+
|
46
|
+
when :dl
|
47
|
+
a = []
|
48
|
+
a << [:dt, *inline(token[1])] if token[1]
|
49
|
+
a << [:dd, *inline(token[2])] if token[2]
|
50
|
+
if ar.last && ar.last.first == tag
|
51
|
+
ar.last << a[0]
|
52
|
+
ar.last << a[1] if a[1]
|
53
|
+
else
|
54
|
+
ar << [tag, *a]
|
55
|
+
end
|
56
|
+
|
57
|
+
when :table
|
58
|
+
token.shift
|
59
|
+
table_ar = token.map {|td|
|
60
|
+
inline_ar = inline(td)
|
61
|
+
inline_ar << '' if inline_ar.empty?
|
62
|
+
[:td] + inline_ar
|
63
|
+
}
|
64
|
+
tr = [:tr] + table_ar
|
65
|
+
if ar.last && ar.last.first == tag
|
66
|
+
ar.last << tr
|
67
|
+
else
|
68
|
+
ar << [tag, tr]
|
69
|
+
end
|
70
|
+
|
71
|
+
when :text
|
72
|
+
line_ar = inline(token[1])
|
73
|
+
if ar.last && ar.last.is_a?(Array) && ar.last.first == :p
|
74
|
+
ar[-1] << "\n" if ar.last.last != [:br]
|
75
|
+
ar[-1] += line_ar
|
76
|
+
else
|
77
|
+
ar << [:p, *line_ar]
|
78
|
+
end
|
79
|
+
|
80
|
+
when :empty
|
81
|
+
ar << ["\n"]
|
82
|
+
|
83
|
+
when :plugin
|
84
|
+
ar << parse_plugin(token)
|
85
|
+
|
86
|
+
when :html
|
87
|
+
ar << parse_html(token)
|
88
|
+
|
89
|
+
else
|
90
|
+
ar << token
|
91
|
+
end
|
92
|
+
}
|
93
|
+
|
94
|
+
nar = []
|
95
|
+
ar.each {|block|
|
96
|
+
tag = block.first
|
97
|
+
case tag
|
98
|
+
when :blockquote
|
99
|
+
str = block[1]
|
100
|
+
|
101
|
+
tokens = TextTokenizer.tokenize(str)
|
102
|
+
tree = make_tree(tokens) # Recursive.
|
103
|
+
nar << [tag, *tree]
|
104
|
+
|
105
|
+
when :p
|
106
|
+
while block[1] == [:br]
|
107
|
+
block.delete_at(1)
|
108
|
+
end
|
109
|
+
while block.last == [:br]
|
110
|
+
block.pop
|
111
|
+
end
|
112
|
+
nar << block
|
113
|
+
else
|
114
|
+
nar << block
|
115
|
+
end
|
116
|
+
}
|
117
|
+
|
118
|
+
return nar
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.inline(str)
|
122
|
+
return str if str.is_a? Array
|
123
|
+
|
124
|
+
tokens = InlineTokenizer.tokenize(str)
|
125
|
+
tree = InlineParser.make_tree(tokens)
|
126
|
+
return tree
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.parse_plugin(token)
|
130
|
+
method = token[1].to_s
|
131
|
+
param = token[2].to_s
|
132
|
+
plugin = [:plugin, {:method=>method, :param=>param}]
|
133
|
+
plugin << token[3].to_s if token[3]
|
134
|
+
return plugin
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.parse_html(token)
|
138
|
+
str = token[1]
|
139
|
+
wabisabi = HtmlToWabisabi.parse(str)
|
140
|
+
|
141
|
+
v = WabisabiValidator.valid?(wabisabi)
|
142
|
+
if v == true
|
143
|
+
return [:html, *wabisabi]
|
144
|
+
else
|
145
|
+
return [:div, {:class=>'error'}, "can not use [#{v}]"]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
if $0 == __FILE__
|
153
|
+
if ARGV[0] == '-b'
|
154
|
+
$bench = true
|
155
|
+
else
|
156
|
+
require 'qwik/testunit'
|
157
|
+
$test = true
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
if defined?($test) && $test
|
162
|
+
class TestParser < Test::Unit::TestCase
|
163
|
+
def ok(e, str)
|
164
|
+
tokens = Qwik::TextTokenizer.tokenize(str)
|
165
|
+
ok_eq(e, Qwik::TextParser.make_tree(tokens))
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_all
|
169
|
+
# test none
|
170
|
+
ok([], '')
|
171
|
+
ok([["\n"]], "#t")
|
172
|
+
|
173
|
+
# test p
|
174
|
+
ok([[:p, 't']], 't')
|
175
|
+
ok([[:p, 's', "\n", 't']], "s\nt")
|
176
|
+
ok([[:p, 's'], ["\n"], [:p, 't']], "s\n\nt")
|
177
|
+
ok([[:p, 's', [:br], 't']], "s~\nt~")
|
178
|
+
|
179
|
+
ok([[:dl, [:dt, 'dt1'], [:dd, 'dd1']], [:p, 'p1'],
|
180
|
+
[:dl, [:dd, 'dd2']]], ":dt1:dd1\np1\n::dd2")
|
181
|
+
|
182
|
+
# test header
|
183
|
+
ok([[:h2, 't']], '*t')
|
184
|
+
ok([[:h2, 't'], [:p, 't']], "*t\nt")
|
185
|
+
ok([[:h3, 't']], '**t')
|
186
|
+
ok([[:h4, 't']], '***t')
|
187
|
+
ok([[:h5, 't']], '****t')
|
188
|
+
ok([[:h6, 't']], '*****t')
|
189
|
+
ok([[:h6, '*t']], '******t')
|
190
|
+
ok([[:h6, '**t']], '*******t')
|
191
|
+
|
192
|
+
# test_ignore_space
|
193
|
+
ok([[:h2, 't']], '* t')
|
194
|
+
ok([[:h2, 't']], '*t ')
|
195
|
+
ok([[:h2, 't']], '* t ')
|
196
|
+
ok([[:h3, 't']], '** t')
|
197
|
+
ok([[:h3, 't']], '**t ')
|
198
|
+
ok([[:h3, 't']], '** t ')
|
199
|
+
|
200
|
+
# test listing
|
201
|
+
ok([[:ul, [:li, 't']]], '-t')
|
202
|
+
ok([[:ul, [:ul, [:li, 't']]]], '--t')
|
203
|
+
ok([[:ul, [:ul, [:ul, [:li, 't']]]]], '---t')
|
204
|
+
ok([[:ul, [:li, 't']], [:p, 't']], "-t\nt")
|
205
|
+
ok([[:ul, [:li, 't'], [:li, 't']]], "-t\n-t")
|
206
|
+
ok([[:ul, [:li, 't'], [:ul, [:li, 't']]]], "-t\n--t")
|
207
|
+
ok([[:ul, [:ul, [:li, 't']], [:li, 't']]], "--t\n-t")
|
208
|
+
ok([[:ul, [:ul, [:li, 't']], [:li, 't'], [:ul, [:li, 't']]]],
|
209
|
+
"--t\n-t\n--t")
|
210
|
+
ok([[:ol, [:li, 't']]], "+t")
|
211
|
+
ok([[:ul, [:li, 't']], [:ol, [:li, 't']]], "-t\n+t")
|
212
|
+
ok([[:ul, [:li, 't1']], ["\n"], [:ul, [:li, 't2']]], "-t1\n\n-t2")
|
213
|
+
ok([["\n"], [:ul, [:li, 't1'], [:li, 't2']]], "\n-t1\n-t2")
|
214
|
+
|
215
|
+
# test blockquote
|
216
|
+
ok([[:blockquote, [:p, 't']]], ">t")
|
217
|
+
ok([[:blockquote, [:p, 's', "\n", 't']]], ">s\n>t")
|
218
|
+
ok([[:blockquote, [:ul, [:li, 's'], [:li, 't']]]], ">-s\n>-t")
|
219
|
+
|
220
|
+
# test dl
|
221
|
+
ok([[:dl, [:dt, 'dt'],[:dd, 'dd']]], ':dt:dd')
|
222
|
+
ok([[:dl, [:dt, 'dt']]], ':dt')
|
223
|
+
ok([[:dl]], ':')
|
224
|
+
ok([[:dl]], '::')
|
225
|
+
ok([[:dl, [:dd, 'dd']]], '::dd')
|
226
|
+
ok([[:dl, [:dt, 'dt'], [:dd, 'dd'], [:dt, 'dt2'], [:dd, 'dd2']]],
|
227
|
+
":dt:dd\n:dt2:dd2")
|
228
|
+
ok([[:dl, [:dt, 'dt'], [:dd, 'dd'], [:dd, 'dd2']]], ":dt:dd\n::dd2")
|
229
|
+
|
230
|
+
# test pre
|
231
|
+
ok([[:pre, 't']], ' t')
|
232
|
+
ok([[:pre, "s\nt"]], " s\n t")
|
233
|
+
|
234
|
+
ok([[:pre, "s\n"]], "{{{\ns\n}}}")
|
235
|
+
ok([[:pre, "s\nt\n"]], "{{{\ns\nt\n}}}")
|
236
|
+
ok([[:pre, "#s\n"]], "{{{\n#s\n}}}")
|
237
|
+
|
238
|
+
ok([[:pre, 't1'], ["\n"], [:pre, 't2']], " t1\n\n t2")
|
239
|
+
|
240
|
+
# test_table
|
241
|
+
ok([[:table, [:tr, [:td, 't']]]], ',t')
|
242
|
+
ok([[:table, [:tr, [:td, 't1'], [:td, 't2']]]], ',t1,t2')
|
243
|
+
ok([[:table, [:tr, [:td, ''], [:td, 't2']]]], ',,t2')
|
244
|
+
ok([[:table, [:tr, [:td, 's']], [:tr, [:td, 't']]]], ",s\n,t")
|
245
|
+
ok([[:table, [:tr, [:td, 's1'], [:td, 's2']],
|
246
|
+
[:tr, [:td, 't1'], [:td, 't2']]]], ",s1,s2\n,t1,t2")
|
247
|
+
|
248
|
+
# test plugin
|
249
|
+
ok([[:plugin, {:method=>'t', :param=>''}]], "{{t}}")
|
250
|
+
ok([[:plugin, {:method=>'t', :param=>'a'}]], "{{t(a)}}")
|
251
|
+
ok([[:plugin, {:method=>'t', :param=>""}, "s\n"]], "{{t\ns\n}}")
|
252
|
+
ok([[:plugin, {:method=>'t', :param=>""}, "s1\ns2\n"]],
|
253
|
+
"{{t\ns1\ns2\n}}")
|
254
|
+
|
255
|
+
# test_multiline
|
256
|
+
ok([[:p, 's', "\n", 't']], "s\nt")
|
257
|
+
ok([[:p, 's', [:br], 't']], "s~\nt~")
|
258
|
+
ok([[:p, 's'], ["\n"], [:p, 't']], "s\n\nt")
|
259
|
+
ok([[:p, 's', [:br], [:br], 't']], "s~\n~\nt~")
|
260
|
+
|
261
|
+
str = <<'EOT'
|
262
|
+
p1~
|
263
|
+
~
|
264
|
+
> b1~
|
265
|
+
> b2~
|
266
|
+
> ~
|
267
|
+
> > bb1~
|
268
|
+
> > bb2~
|
269
|
+
> ~
|
270
|
+
> b3~
|
271
|
+
> b4~
|
272
|
+
~
|
273
|
+
p2~
|
274
|
+
EOT
|
275
|
+
ok([[:p, 'p1'],
|
276
|
+
[:blockquote, [:p, 'b1', [:br], 'b2'],
|
277
|
+
[:blockquote, [:p, 'bb1', [:br], 'bb2']],
|
278
|
+
[:p, 'b3', [:br], 'b4']],
|
279
|
+
[:p, 'p2']],
|
280
|
+
str)
|
281
|
+
|
282
|
+
# test_html
|
283
|
+
ok([[:html, "t\n"]], "<html>\nt\n</html>")
|
284
|
+
ok([[:div, {:class=>'error'}, "can not use [script]"]],
|
285
|
+
"<html>\n<script>t</script>\n</html>")
|
286
|
+
|
287
|
+
# test_ref
|
288
|
+
ok([[:ul, [:li, [:a, {:href=>'http://e.com/'}, 't']]]],
|
289
|
+
"- [http://e.com/ t]")
|
290
|
+
|
291
|
+
# test_hr
|
292
|
+
ok([[:hr]], "====")
|
293
|
+
|
294
|
+
# test_bug
|
295
|
+
ok_eq("\226]", '望')
|
296
|
+
ok([[:p, [:a, {:href=>"\226].html"}, "\226]"]]], '[[望]]')
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_from_resolve
|
300
|
+
# test_lines
|
301
|
+
ok([[:ul, [:li, 't1'], [:li, 't2']]], "- t1\n- t2")
|
302
|
+
ok([[:p, 't1'], [:ul, [:li, 't2']]], "t1\n- t2")
|
303
|
+
|
304
|
+
# test_qwik_text
|
305
|
+
ok([[:ul, [:li, 't']]], '- t')
|
306
|
+
ok([[:ul, [:li, 's'], [:ul, [:li, 't']]]], "- s\n-- t")
|
307
|
+
ok([[:ol, [:li, 't']]], "+ t")
|
308
|
+
|
309
|
+
# test_ul
|
310
|
+
ok([[:ul, [:li, 't1']], ["\n"], [:ul, [:li, 't2']]], "- t1\n\n- t2")
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_format
|
314
|
+
# test_inline
|
315
|
+
ok([[:p, [:em, 't']]], "''t''")
|
316
|
+
ok([[:p, [:a, {:href=>'t.html'}, 't']]], "[[t]]")
|
317
|
+
ok([[:p, [:a, {:href=>'1.html'}, '1']]], "[[1]]")
|
318
|
+
ok([[:p, [:plugin, {:method=>'interwiki', :param=>'Test:t'}, 'Test:t']]],
|
319
|
+
"[[Test:t]]")
|
320
|
+
ok([[:plugin, {:method=>'t', :param=>''}]], "{{t}}")
|
321
|
+
ok([[:p, 'a', [:plugin, {:method=>'t', :param=>''}, ''], 'b']], "a{{t}}b")
|
322
|
+
ok([[:p, [:a, {:href=>'http://e.com/'}, 'http://e.com/']]],
|
323
|
+
'http://e.com/')
|
324
|
+
ok([[:p, 'a ', [:a, {:href=>'http://e.com/'}, 'http://e.com/'], ' b']],
|
325
|
+
'a http://e.com/ b')
|
326
|
+
|
327
|
+
# test_escape
|
328
|
+
ok([[:h2, "'"]], "*'")
|
329
|
+
ok([[:h2, "<"]], "*<")
|
330
|
+
|
331
|
+
# test_sjis
|
332
|
+
ok([[:h2, "\202\240"]], "* あ")
|
333
|
+
ok([[:h3, "\202\240"]], "** あ")
|
334
|
+
ok([[:h3, "\212\277\216\232"]], "** 漢字")
|
335
|
+
ok([[:h3, "\221\322"]], "** 待")
|
336
|
+
|
337
|
+
# test ?
|
338
|
+
ok([[:h2, [:a, {:href=>'t.html'}, 't']]], "*[[t]]")
|
339
|
+
ok([[:h2, [:a, {:href=>'t.html'}, 't']]], "* [[t]]")
|
340
|
+
ok([[:h2, [:a, {:href=>'t.html'}, 't']]], "* [[t]] ")
|
341
|
+
ok([[:h2, [:a, {:href=>'t.html'}, 't'], ' a']], "* [[t]] a")
|
342
|
+
ok([[:h2, [:a, {:href=>'t.html'}, 't'], ' a']], "* [[t]] a")
|
343
|
+
|
344
|
+
# test_format
|
345
|
+
ok([[:h2, "<"]], "*<")
|
346
|
+
ok([[:p, [:strong, '']]], "''''''")
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
6
|
+
require 'qwik/util-pathname'
|
7
|
+
require 'qwik/util-string'
|
8
|
+
require 'qwik/server-memory'
|
9
|
+
|
10
|
+
module Qwik
|
11
|
+
class ServerMemory
|
12
|
+
# password
|
13
|
+
def passgen
|
14
|
+
@passgen = PasswordGenerator.new(@config) unless defined? @passgen
|
15
|
+
return @passgen
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class PasswordGenerator
|
20
|
+
DEFAULT_SITE_PASSWORD = ''
|
21
|
+
PASSWORD_FILE = 'password.txt'
|
22
|
+
GENERATION_FILE = 'generation.txt'
|
23
|
+
|
24
|
+
def initialize(config)
|
25
|
+
etc_path = config.etc_dir.path
|
26
|
+
@site_password_file = etc_path + PASSWORD_FILE
|
27
|
+
@site_password = DEFAULT_SITE_PASSWORD
|
28
|
+
if @site_password_file.exist?
|
29
|
+
@site_password = @site_password_file.read.to_s.chomp
|
30
|
+
end
|
31
|
+
@generation_file = etc_path + GENERATION_FILE
|
32
|
+
@generation = PasswordGenerator.generation_get(@generation_file)
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate(user)
|
36
|
+
generation = 0
|
37
|
+
generation = @generation[user] if @generation[user]
|
38
|
+
return PasswordGenerator.generate_md5hex(@site_password,
|
39
|
+
user, generation).hex.to_s[-8, 8]
|
40
|
+
end
|
41
|
+
|
42
|
+
def generate_hex(user)
|
43
|
+
generation = 0
|
44
|
+
generation = @generation[user] if @generation[user]
|
45
|
+
return PasswordGenerator.generate_md5hex(@site_password,
|
46
|
+
user, generation).upcase[0, 8]
|
47
|
+
end
|
48
|
+
|
49
|
+
def match?(user, pass)
|
50
|
+
return false if user.nil? || user.empty?
|
51
|
+
return false if pass.nil? || pass.empty?
|
52
|
+
|
53
|
+
pa = generate(user)
|
54
|
+
return true if pa == pass
|
55
|
+
pa = generate_hex(user)
|
56
|
+
return true if pa == pass
|
57
|
+
return true if pa == pass.upcase
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
|
61
|
+
def generation_inc(user)
|
62
|
+
generation = PasswordGenerator.generation_get(@generation_file)
|
63
|
+
gen = 0
|
64
|
+
gen = generation[user] if generation[user]
|
65
|
+
gen += 1 # Increment the generation of the user.
|
66
|
+
PasswordGenerator.generation_add(@generation_file, user, gen)
|
67
|
+
@generation = PasswordGenerator.generation_get(@generation_file)
|
68
|
+
return gen
|
69
|
+
end
|
70
|
+
|
71
|
+
def generation_store
|
72
|
+
PasswordGenerator.generation_store(@generation_file, @generation)
|
73
|
+
return nil
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def self.generation_get(file)
|
79
|
+
file.write('') if ! file.exist?
|
80
|
+
str = file.read
|
81
|
+
generation = {}
|
82
|
+
str.each {|line|
|
83
|
+
next unless line[0] == ?,
|
84
|
+
dummy, user, gen = line.chomp.split(',')
|
85
|
+
generation[user] = gen.to_i
|
86
|
+
}
|
87
|
+
return generation
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.generate_md5hex(site_password, user, generation=0)
|
91
|
+
return "#{user}:#{site_password}:#{generation}".md5hex
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.generation_add(file, user, gen)
|
95
|
+
file.add(",#{user},#{gen}\n")
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.generation_store(file, generation)
|
99
|
+
str = generation.map {|user, gen|
|
100
|
+
[user, gen]
|
101
|
+
}.sort.map {|user, gen|
|
102
|
+
",#{user},#{gen}\n"
|
103
|
+
}.join
|
104
|
+
file.write(str)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if $0 == __FILE__
|
110
|
+
require 'qwik/testunit'
|
111
|
+
require 'qwik/config'
|
112
|
+
$test = true
|
113
|
+
end
|
114
|
+
|
115
|
+
if defined?($test) && $test
|
116
|
+
class TestPasswordGenerator < Test::Unit::TestCase
|
117
|
+
def test_all
|
118
|
+
config = Qwik::Config.new
|
119
|
+
config.update Qwik::Config::DebugConfig
|
120
|
+
config.update Qwik::Config::TestConfig
|
121
|
+
generation_file = config.etc_dir.path +
|
122
|
+
Qwik::PasswordGenerator::GENERATION_FILE
|
123
|
+
generation_file.write('')
|
124
|
+
|
125
|
+
gen = Qwik::PasswordGenerator.new(config)
|
126
|
+
|
127
|
+
# test_generate
|
128
|
+
assert_equal '95988593', gen.generate('user@e.com')
|
129
|
+
|
130
|
+
# test_generate_hex
|
131
|
+
assert_equal '68246775', gen.generate_hex('user@e.com')
|
132
|
+
|
133
|
+
# test_match?
|
134
|
+
assert_equal true, gen.match?('user@e.com', '95988593')
|
135
|
+
# generation 0
|
136
|
+
assert_equal false, gen.match?('user@e.com', '64006086')
|
137
|
+
assert_equal true, gen.match?('user@e.com', '68246775')
|
138
|
+
|
139
|
+
# test_generation_inc
|
140
|
+
gen.generation_inc('user@e.com')
|
141
|
+
assert_equal ",user@e.com,1\n", generation_file.read
|
142
|
+
assert_equal false, gen.match?('user@e.com', '95988593') # Changed.
|
143
|
+
assert_equal '85127862', gen.generate('user@e.com') # generation 1
|
144
|
+
assert_equal true, gen.match?('user@e.com', '85127862')
|
145
|
+
|
146
|
+
# test_generation_inc, again
|
147
|
+
gen.generation_inc('user@e.com')
|
148
|
+
assert_equal ",user@e.com,1\n,user@e.com,2\n", generation_file.read
|
149
|
+
assert_equal '78735937', gen.generate('user@e.com')
|
150
|
+
|
151
|
+
# test_store
|
152
|
+
gen.generation_store
|
153
|
+
assert_equal ",user@e.com,2\n", generation_file.read
|
154
|
+
|
155
|
+
# test_another_user
|
156
|
+
gen.generation_inc('another@e.com')
|
157
|
+
assert_equal ",user@e.com,2\n,another@e.com,1\n", generation_file.read
|
158
|
+
gen.generation_store
|
159
|
+
assert_equal ",another@e.com,1\n,user@e.com,2\n", generation_file.read
|
160
|
+
|
161
|
+
# teardown
|
162
|
+
generation_file.unlink
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_password_file
|
166
|
+
config = Qwik::Config.new
|
167
|
+
config.update Qwik::Config::DebugConfig
|
168
|
+
config.update Qwik::Config::TestConfig
|
169
|
+
password_file = config.etc_dir.path+Qwik::PasswordGenerator::PASSWORD_FILE
|
170
|
+
password_file.write('')
|
171
|
+
|
172
|
+
gen = Qwik::PasswordGenerator.new(config)
|
173
|
+
assert_equal '95988593', gen.generate('user@e.com')
|
174
|
+
|
175
|
+
password_file.write('t')
|
176
|
+
gen = Qwik::PasswordGenerator.new(config)
|
177
|
+
assert_equal '57318391', gen.generate('user@e.com')
|
178
|
+
|
179
|
+
# teardown
|
180
|
+
password_file.unlink
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
6
|
+
require 'qwik/config'
|
7
|
+
require 'qwik/site-report'
|
8
|
+
|
9
|
+
module Qwik
|
10
|
+
class PeriodicThread
|
11
|
+
def initialize(config, memory, time)
|
12
|
+
@config, @memory = config, memory
|
13
|
+
@logger = @memory[:logger]
|
14
|
+
@time = time
|
15
|
+
end
|
16
|
+
|
17
|
+
def start
|
18
|
+
loop {
|
19
|
+
begin
|
20
|
+
process
|
21
|
+
rescue Exception => e
|
22
|
+
pp e
|
23
|
+
end
|
24
|
+
sleep @time
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def process # abstract method
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class SweepThread < PeriodicThread
|
33
|
+
def initialize(config, memory)
|
34
|
+
super(config, memory, 60*60) # 1hour
|
35
|
+
end
|
36
|
+
|
37
|
+
def process
|
38
|
+
sleep 30*60 # 30min
|
39
|
+
farm = @memory.farm
|
40
|
+
farm.sweep
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if $0 == __FILE__
|
46
|
+
require 'qwik/test-common'
|
47
|
+
$test = true
|
48
|
+
end
|
49
|
+
|
50
|
+
if defined?($test) && $test
|
51
|
+
class TestPeriodic < Test::Unit::TestCase
|
52
|
+
include TestSession
|
53
|
+
|
54
|
+
def test_dummy
|
55
|
+
end
|
56
|
+
|
57
|
+
def nu_test_all
|
58
|
+
@periodic = Qwik::Periodic.new(@config, @memory)
|
59
|
+
# @periodic.time = 1 # for test, do it on every second.
|
60
|
+
@periodic.time = 1000 # for test, do it on every second.
|
61
|
+
|
62
|
+
t = Thread.new { @periodic.start }
|
63
|
+
t.abort_on_exception = true
|
64
|
+
|
65
|
+
@farm = @memory.farm
|
66
|
+
@site = @farm.get_site('test')
|
67
|
+
ok_eq(false, @site.inactive?)
|
68
|
+
page = @site['_SiteConfig']
|
69
|
+
page.store(':ml_life_time:0') # die soon.
|
70
|
+
|
71
|
+
sleep 2 # will run sweep
|
72
|
+
|
73
|
+
@site = @farm.get_site('test')
|
74
|
+
ok_eq(nil, @site)
|
75
|
+
|
76
|
+
t.kill
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
module QP
|
6
|
+
def caller_msg(ca)
|
7
|
+
file, linenum, msg = ca.first.split(/:([0-9]+):/)
|
8
|
+
msg = $1 if /\Ain \`(.+)\'\z/ =~ msg
|
9
|
+
File.basename(file)+':'+linenum.to_s+':'+msg.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def ar_inspect(ar)
|
13
|
+
'['+ar.map {|arg| arg.inspect }.join(', ')+']'
|
14
|
+
end
|
15
|
+
|
16
|
+
def runtime
|
17
|
+
$__qp_t__ = Time.now unless defined? $__qp_t__
|
18
|
+
sprintf('%.1f', Time.now - $__qp_t__)
|
19
|
+
end
|
20
|
+
|
21
|
+
def qp(ca, *args)
|
22
|
+
QP.caller_msg(ca)+"\t"+QP.ar_inspect(args)
|
23
|
+
end
|
24
|
+
|
25
|
+
def tp(ca, *args)
|
26
|
+
QP.runtime+':'+QP.qp(ca, *args)
|
27
|
+
end
|
28
|
+
|
29
|
+
module_function :caller_msg, :ar_inspect, :runtime, :qp, :tp
|
30
|
+
end
|
31
|
+
|
32
|
+
def qp(*args)
|
33
|
+
$stdout.print QP.qp(caller(1), *args)+"\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
def tp(*args)
|
37
|
+
print QP.tp(caller(1), *args)+"\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
if $0 == __FILE__
|
41
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
42
|
+
$test = true
|
43
|
+
end
|
44
|
+
|
45
|
+
if defined?($test) && $test
|
46
|
+
require 'qwik/testunit'
|
47
|
+
|
48
|
+
class TestQP < Test::Unit::TestCase
|
49
|
+
def test_all
|
50
|
+
#assert_match(/testcase.rb:\d\d:_*send_*/, QP.caller_msg(caller(1)))
|
51
|
+
ok_eq("[1, \"a\"]", QP.ar_inspect([1, 'a']))
|
52
|
+
assert_match(/\d+\.\d/, QP.runtime)
|
53
|
+
#assert_match(/\d+\.\d:testcase.rb:\d\d:_*send_* \[1, 'a'\]/, QP.tp(caller(1), 1, 'a'))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|