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,247 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2002-2004 Satoru Takabayashi <satoru@namazu.org>
|
3
|
+
# Copyright (C) 2003-2006 Kouichirou Eto
|
4
|
+
# All rights reserved.
|
5
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
6
|
+
#
|
7
|
+
# You can redistribute it and/or modify it under the terms of
|
8
|
+
# the GNU General Public License version 2.
|
9
|
+
#
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
12
|
+
require 'qwik/group-db'
|
13
|
+
|
14
|
+
module QuickML
|
15
|
+
class Group
|
16
|
+
def forward?
|
17
|
+
return @group_config.forward?
|
18
|
+
end
|
19
|
+
|
20
|
+
def group_config_check_exist
|
21
|
+
@group_config.check_exist
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_max_members
|
25
|
+
return @group_config[:max_members]
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def init_group_config
|
31
|
+
@group_config = GroupConfig.new(@db)
|
32
|
+
group_config = GroupConfig.get_group_config(@config)
|
33
|
+
@group_config.set_default(group_config)
|
34
|
+
@group_config.write
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class GroupConfig
|
39
|
+
DefaultConfig = {
|
40
|
+
:auto_unsubscribe_count => nil,
|
41
|
+
:max_mail_length => nil,
|
42
|
+
:max_members => nil,
|
43
|
+
:ml_alert_time => nil,
|
44
|
+
:ml_life_time => nil,
|
45
|
+
:forward => false,
|
46
|
+
:permanent => false,
|
47
|
+
:unlimited => false,
|
48
|
+
}
|
49
|
+
|
50
|
+
KEYS = DefaultConfig.keys.map {|s| s.to_s }.sort.map {|k| k.intern }
|
51
|
+
|
52
|
+
def initialize(db)
|
53
|
+
@db = db
|
54
|
+
@default = nil
|
55
|
+
@group_config = {}
|
56
|
+
@group_config.update(DefaultConfig)
|
57
|
+
@content = nil
|
58
|
+
read
|
59
|
+
end
|
60
|
+
|
61
|
+
def set_default(default)
|
62
|
+
@default = default
|
63
|
+
end
|
64
|
+
|
65
|
+
def check_exist
|
66
|
+
write if ! exist?
|
67
|
+
end
|
68
|
+
|
69
|
+
def exist?
|
70
|
+
return @db.exist?(:Config)
|
71
|
+
end
|
72
|
+
|
73
|
+
def [](key)
|
74
|
+
read
|
75
|
+
return @group_config[key]
|
76
|
+
end
|
77
|
+
|
78
|
+
def forward?
|
79
|
+
return true if @db.exist?(:Forward)
|
80
|
+
return true if self[:forward]
|
81
|
+
return false
|
82
|
+
end
|
83
|
+
|
84
|
+
def permanent?
|
85
|
+
return true if @db.exist?(:Permanent)
|
86
|
+
return true if self[:permanent]
|
87
|
+
return false
|
88
|
+
end
|
89
|
+
|
90
|
+
def unlimited?
|
91
|
+
return true if @db.exist?(:Unlimited)
|
92
|
+
return true if self[:unlimited]
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
|
96
|
+
def write
|
97
|
+
raise 'must have default' if @default.nil?
|
98
|
+
GroupConfig.set_default(@default, @group_config)
|
99
|
+
content = GroupConfig.generate(@group_config)
|
100
|
+
return if content == @content # Do nothing.
|
101
|
+
@db.put(:Config, content)
|
102
|
+
@content = content
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
def read
|
108
|
+
content = @db.get(:Config)
|
109
|
+
return if content && content == @content # Do nothing.
|
110
|
+
@content = content
|
111
|
+
config = GroupConfig.parse_hash(@content)
|
112
|
+
@group_config.update(config)
|
113
|
+
return
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.parse_hash(str)
|
117
|
+
config = {}
|
118
|
+
return config if str.nil?
|
119
|
+
str.each {|line|
|
120
|
+
k = v = nil
|
121
|
+
line.chomp!
|
122
|
+
if /\A\s+:([a-z_]+) => (\d+),\z/ =~ line
|
123
|
+
k = $1.intern
|
124
|
+
v = $2.to_i
|
125
|
+
config[k] = v
|
126
|
+
elsif /\A:([a-z_]+):(\d+)\z/ =~ line
|
127
|
+
k = $1.intern
|
128
|
+
v = $2.to_i
|
129
|
+
config[k] = v
|
130
|
+
elsif /\A:([a-z_]+):([a-z]+)\z/ =~ line
|
131
|
+
k = $1.intern
|
132
|
+
v = $2
|
133
|
+
v = true if v == 'true'
|
134
|
+
v = false if v == 'false'
|
135
|
+
config[k] = v
|
136
|
+
end
|
137
|
+
}
|
138
|
+
return config
|
139
|
+
end
|
140
|
+
|
141
|
+
def self.set_default(default, group_config)
|
142
|
+
default.each {|k, v|
|
143
|
+
group_config[k] ||= v
|
144
|
+
}
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.generate(config)
|
148
|
+
return KEYS.map {|k|
|
149
|
+
":#{k}:#{config[k]}\n"
|
150
|
+
}.join
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.get_group_config(config)
|
154
|
+
return {
|
155
|
+
:auto_unsubscribe_count => config[:auto_unsubscribe_count],
|
156
|
+
:max_mail_length => config[:max_ml_mail_length] ||
|
157
|
+
config[:max_mail_length],
|
158
|
+
:max_members => config[:max_members],
|
159
|
+
:ml_alert_time => config[:ml_alert_time],
|
160
|
+
:ml_life_time => config[:ml_life_time],
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
if $0 == __FILE__
|
168
|
+
require 'qwik/farm'
|
169
|
+
require 'qwik/server-memory'
|
170
|
+
require 'qwik/test-module-session'
|
171
|
+
require 'qwik/config'
|
172
|
+
$test = true
|
173
|
+
end
|
174
|
+
|
175
|
+
if defined?($test) && $test
|
176
|
+
class TestGroupConfig < Test::Unit::TestCase
|
177
|
+
include TestSession
|
178
|
+
|
179
|
+
def test_class_method
|
180
|
+
c = QuickML::GroupConfig
|
181
|
+
|
182
|
+
# test_parse_hash
|
183
|
+
ok_eq({}, c.parse_hash(''))
|
184
|
+
ok_eq({:max_members=>20}, c.parse_hash('{
|
185
|
+
:max_members => 20,
|
186
|
+
}'))
|
187
|
+
m = c.parse_hash(':max_members:20')
|
188
|
+
ok_eq({:max_members=>20}, m)
|
189
|
+
m = c.parse_hash(':forward:true')
|
190
|
+
ok_eq({:forward=>true}, m)
|
191
|
+
|
192
|
+
# test_generate
|
193
|
+
ok_eq(":auto_unsubscribe_count:\n:forward:\n:max_mail_length:\n:max_members:\n:ml_alert_time:\n:ml_life_time:\n:permanent:\n:unlimited:\n", c.generate({}))
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_all
|
197
|
+
sites_dir = '.test/data/'
|
198
|
+
group_name = 'test'
|
199
|
+
db = QuickML::GroupDB.new(sites_dir, group_name)
|
200
|
+
db.set_site(@site)
|
201
|
+
|
202
|
+
config = Qwik::Config.new
|
203
|
+
group_config = QuickML::GroupConfig.new(db)
|
204
|
+
default = QuickML::GroupConfig.get_group_config(config)
|
205
|
+
group_config.set_default(default)
|
206
|
+
group_config.write
|
207
|
+
|
208
|
+
# ==================== GroupConfig
|
209
|
+
# test_exist?
|
210
|
+
ok_eq(true, group_config.exist?)
|
211
|
+
|
212
|
+
# test_[]
|
213
|
+
ok_eq(100, group_config[:max_members])
|
214
|
+
|
215
|
+
# test_forward?
|
216
|
+
ok_eq(false, group_config.forward?)
|
217
|
+
|
218
|
+
# test_permanent?
|
219
|
+
ok_eq(false, group_config.permanent?)
|
220
|
+
|
221
|
+
# test_unlimited?
|
222
|
+
ok_eq(false, group_config.unlimited?)
|
223
|
+
|
224
|
+
# test_write
|
225
|
+
group_config.instance_eval {
|
226
|
+
@group_config[:max_members] = 10
|
227
|
+
}
|
228
|
+
ok_eq(10, group_config[:max_members])
|
229
|
+
group_config.write
|
230
|
+
|
231
|
+
# test_read
|
232
|
+
t_make_public(QuickML::GroupConfig, :read)
|
233
|
+
group_config.read
|
234
|
+
ok_eq(10, group_config[:max_members])
|
235
|
+
|
236
|
+
str = db.get(:Config)
|
237
|
+
ok_eq(":auto_unsubscribe_count:5\n:forward:false\n:max_mail_length:102400\n:max_members:10\n:ml_alert_time:2073600\n:ml_life_time:2678400\n:permanent:false\n:unlimited:false\n", str)
|
238
|
+
|
239
|
+
# test_forward?
|
240
|
+
ok_eq(false, group_config.forward?)
|
241
|
+
|
242
|
+
page = @site['_GroupConfig']
|
243
|
+
page.put_with_time(':forward:true', Time.at(Time.now.to_i+10))
|
244
|
+
ok_eq(true, group_config.forward?)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2002-2004 Satoru Takabayashi <satoru@namazu.org>
|
3
|
+
# Copyright (C) 2003-2006 Kouichirou Eto
|
4
|
+
# All rights reserved.
|
5
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
6
|
+
#
|
7
|
+
# You can redistribute it and/or modify it under the terms of
|
8
|
+
# the GNU General Public License version 2.
|
9
|
+
#
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
12
|
+
require 'qwik/group'
|
13
|
+
require 'qwik/group-db'
|
14
|
+
|
15
|
+
module QuickML
|
16
|
+
class Group
|
17
|
+
# ml-processor.rb:115: ml.prepare_confirmation(@mail)
|
18
|
+
def prepare_confirmation (mail)
|
19
|
+
# Create empty ML files.
|
20
|
+
@members.save
|
21
|
+
|
22
|
+
waiting_message_put(mail.bare)
|
23
|
+
str = waiting_message_get # FIXME: Why?
|
24
|
+
|
25
|
+
add_waiting_member(mail.from)
|
26
|
+
mail.collect_cc.each {|address|
|
27
|
+
add_waiting_member(address)
|
28
|
+
}
|
29
|
+
send_confirmation(mail.from)
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate_confirmation(time)
|
33
|
+
return waiting_message_exist? && waiting_message_mtime.to_i == time.to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
# ml-processor.rb:98: ml.accept_confirmation
|
37
|
+
def accept_confirmation
|
38
|
+
# Add suspended members.
|
39
|
+
waiting_members = (waiting_members_get || '').to_a.map {|line|
|
40
|
+
line.chomp
|
41
|
+
}
|
42
|
+
waiting_members.each {|address|
|
43
|
+
begin
|
44
|
+
add_member(address)
|
45
|
+
rescue TooManyMembers
|
46
|
+
end
|
47
|
+
}
|
48
|
+
|
49
|
+
# Read suspended message.
|
50
|
+
waiting_message = waiting_message_get || ''
|
51
|
+
mail = Mail.create { waiting_message }
|
52
|
+
|
53
|
+
submit(mail) # Send it.
|
54
|
+
|
55
|
+
waiting_members_delete
|
56
|
+
waiting_message_delete
|
57
|
+
@logger.log "[#{@name}]: Accept confirmation: #{@address}"
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def confirmation_address
|
63
|
+
t = waiting_message_mtime.to_i
|
64
|
+
return "confirm+#{t}+#{@address}"
|
65
|
+
end
|
66
|
+
|
67
|
+
# waiting_message
|
68
|
+
def waiting_message_exist?
|
69
|
+
return @db.exist?(:WaitingMessage)
|
70
|
+
end
|
71
|
+
def waiting_message_mtime
|
72
|
+
return @db.mtime(:WaitingMessage)
|
73
|
+
end
|
74
|
+
def waiting_message_put(content)
|
75
|
+
@db.put(:WaitingMessage, content)
|
76
|
+
end
|
77
|
+
def waiting_message_get
|
78
|
+
return @db.get(:WaitingMessage)
|
79
|
+
end
|
80
|
+
def waiting_message_delete
|
81
|
+
@db.delete(:WaitingMessage)
|
82
|
+
end
|
83
|
+
|
84
|
+
# waiting_member
|
85
|
+
def add_waiting_member (address)
|
86
|
+
waiting_members_add(address+"\n")
|
87
|
+
end
|
88
|
+
def waiting_members_exist?
|
89
|
+
return @db.exist?(:WaitingMembers)
|
90
|
+
end
|
91
|
+
def waiting_members_get
|
92
|
+
return @db.get(:WaitingMembers)
|
93
|
+
end
|
94
|
+
def waiting_members_add(content)
|
95
|
+
@db.add(:WaitingMembers, content)
|
96
|
+
end
|
97
|
+
def waiting_members_delete
|
98
|
+
@db.delete(:WaitingMembers)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
if $0 == __FILE__
|
104
|
+
require 'qwik/test-module-ml'
|
105
|
+
$test = true
|
106
|
+
end
|
107
|
+
|
108
|
+
if defined?($test) && $test
|
109
|
+
class TestGroupConfirmation < Test::Unit::TestCase
|
110
|
+
include TestModuleML
|
111
|
+
|
112
|
+
def setup_group
|
113
|
+
return QuickML::Group.new(@ml_config, 'test@example.com')
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_all
|
117
|
+
group = setup_group
|
118
|
+
|
119
|
+
t_make_readable(QuickML::Group, :db)
|
120
|
+
|
121
|
+
# test_prepare_confirmation
|
122
|
+
message =
|
123
|
+
'Date: Mon, 3 Feb 2001 12:34:56 +0900
|
124
|
+
From: user@e.com
|
125
|
+
To: test@example.com
|
126
|
+
Subject: create
|
127
|
+
|
128
|
+
Create a new mailing list.
|
129
|
+
'
|
130
|
+
mail = QuickML::Mail.generate { message }
|
131
|
+
group.prepare_confirmation(mail)
|
132
|
+
ok_eq(message, group.db.get(:WaitingMessage))
|
133
|
+
ok_eq("user@e.com\n", group.db.get(:WaitingMembers))
|
134
|
+
|
135
|
+
# test_validate_confirmation
|
136
|
+
t_make_public(QuickML::Group, :waiting_message_mtime)
|
137
|
+
time = group.waiting_message_mtime
|
138
|
+
ok_eq(true, group.validate_confirmation(time))
|
139
|
+
|
140
|
+
# test_accept_confirmation
|
141
|
+
t_make_public(QuickML::Group, :get_active_members)
|
142
|
+
ok_eq([], group.get_active_members)
|
143
|
+
group.accept_confirmation
|
144
|
+
ok_eq(['user@e.com'], group.get_active_members)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,326 @@
|
|
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
|
+
|
7
|
+
module QuickML
|
8
|
+
class GroupDB
|
9
|
+
=begin
|
10
|
+
FILENAME = {
|
11
|
+
:Members => ',members',
|
12
|
+
:Count => ',count',
|
13
|
+
:Config => ',config',
|
14
|
+
:Charset => ',charset',
|
15
|
+
:Alerted => ',alerted',
|
16
|
+
:Forward => ',forward',
|
17
|
+
:Permanent => ',permanent',
|
18
|
+
:Unlimited => ',unlimited',
|
19
|
+
:WaitingMembers => ',waiting-members',
|
20
|
+
:WaitingMessage => ',waiting-message',
|
21
|
+
}
|
22
|
+
=end
|
23
|
+
|
24
|
+
PAGENAME = {
|
25
|
+
:Members => '_GroupMembers',
|
26
|
+
:Count => '_GroupCount',
|
27
|
+
:Config => '_GroupConfig',
|
28
|
+
:Charset => '_GroupCharset',
|
29
|
+
:Alerted => '_GroupAlerted',
|
30
|
+
:Forward => '_GroupForward',
|
31
|
+
:Permanent => '_GroupPermanent',
|
32
|
+
:Unlimited => '_GroupUnlimited',
|
33
|
+
:WaitingMembers => '_GroupWaitingMembers',
|
34
|
+
:WaitingMessage => '_GroupWaitingMessage',
|
35
|
+
}
|
36
|
+
|
37
|
+
def initialize(sites_dir, group_name)
|
38
|
+
@sites_dir = sites_dir
|
39
|
+
@group_name = group_name
|
40
|
+
@site = nil
|
41
|
+
get_dirpath.mkpath # Make a new directory here.
|
42
|
+
end
|
43
|
+
|
44
|
+
def set_site(site)
|
45
|
+
@site = site
|
46
|
+
end
|
47
|
+
|
48
|
+
=begin
|
49
|
+
def update_files
|
50
|
+
if false
|
51
|
+
FILENAME.keys.each {|s|
|
52
|
+
sync(s)
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
=end
|
57
|
+
|
58
|
+
# read
|
59
|
+
def exist?(s)
|
60
|
+
#sync(s)
|
61
|
+
|
62
|
+
# f = get_filpath(s)
|
63
|
+
# return true if f.exist?
|
64
|
+
|
65
|
+
pagename = get_pagename(s)
|
66
|
+
page = @site[pagename]
|
67
|
+
return true if page
|
68
|
+
|
69
|
+
return false
|
70
|
+
end
|
71
|
+
|
72
|
+
def mtime(s)
|
73
|
+
# return [file_mtime(s), page_mtime(s)].max
|
74
|
+
return page_mtime(s)
|
75
|
+
end
|
76
|
+
|
77
|
+
def get(s) # with sync.
|
78
|
+
#sync(s)
|
79
|
+
|
80
|
+
# file_content = nil
|
81
|
+
# f = get_filepath(s)
|
82
|
+
# file_content = f.read if f.exist?
|
83
|
+
|
84
|
+
page_content = nil
|
85
|
+
pagename = get_pagename(s)
|
86
|
+
page = @site[pagename]
|
87
|
+
page_content = page.get if page
|
88
|
+
return page_content
|
89
|
+
|
90
|
+
# Both is nil.
|
91
|
+
# return nil if file_content.nil? && page_content.nil? # Do nothing.
|
92
|
+
|
93
|
+
# fmt = file_mtime(s)
|
94
|
+
# pmt = page_mtime(s)
|
95
|
+
|
96
|
+
# File is exist, but the page is not exist.
|
97
|
+
# if file_content && page_content.nil?
|
98
|
+
# page = @site.create(pagename)
|
99
|
+
# page.put_with_time(file_content, fmt)
|
100
|
+
# # FIXME: delete file?
|
101
|
+
# return file_content
|
102
|
+
# end
|
103
|
+
|
104
|
+
# File is not exist, but page is exist.
|
105
|
+
# if file_content.nil? && page_content
|
106
|
+
# # Do not create file.
|
107
|
+
# #f.put(page_content)
|
108
|
+
# #f.utime(pmt, pmt)
|
109
|
+
# return page_content
|
110
|
+
# end
|
111
|
+
|
112
|
+
# Both exist.
|
113
|
+
# if file_content == page_content
|
114
|
+
# return page_content
|
115
|
+
# end
|
116
|
+
|
117
|
+
# if fmt < pmt # The page is new.
|
118
|
+
# f.put(page_content)
|
119
|
+
# begin
|
120
|
+
# f.utime(pmt, pmt)
|
121
|
+
# rescue
|
122
|
+
# p 'error to set time'
|
123
|
+
# end
|
124
|
+
# return page_content
|
125
|
+
# end
|
126
|
+
|
127
|
+
# page.put_with_time(file_content, fmt)
|
128
|
+
# return file_content
|
129
|
+
end
|
130
|
+
|
131
|
+
# write
|
132
|
+
def put(s, content)
|
133
|
+
# f = get_filepath(s)
|
134
|
+
# f.put(content)
|
135
|
+
|
136
|
+
pagename = get_pagename(s)
|
137
|
+
page = @site[pagename]
|
138
|
+
page = @site.create(pagename) if page.nil?
|
139
|
+
page.put(content)
|
140
|
+
end
|
141
|
+
|
142
|
+
def add(s, content)
|
143
|
+
# f = get_filepath(s)
|
144
|
+
# f.add(content)
|
145
|
+
|
146
|
+
pagename = get_pagename(s)
|
147
|
+
page = @site[pagename]
|
148
|
+
page = @site.create(pagename) if page.nil?
|
149
|
+
page.add(content)
|
150
|
+
end
|
151
|
+
|
152
|
+
def delete(s)
|
153
|
+
return if ! exist?(s)
|
154
|
+
# f = get_filepath(s)
|
155
|
+
# f.unlink
|
156
|
+
|
157
|
+
pagename = get_pagename(s)
|
158
|
+
page = @site[pagename]
|
159
|
+
@site.delete(pagename) if page
|
160
|
+
end
|
161
|
+
|
162
|
+
# the mtime of the newest file in the directory
|
163
|
+
def last_article_time
|
164
|
+
max = nil
|
165
|
+
dir = get_dirpath
|
166
|
+
dir.each_entry {|f|
|
167
|
+
fs = f.to_s
|
168
|
+
|
169
|
+
next if /\A\./ =~ fs ||
|
170
|
+
# /,config/ =~ fs ||
|
171
|
+
/_GroupConfig.txt/ =~ fs ||
|
172
|
+
# /,charset/ =~ fs ||
|
173
|
+
/_GroupCharset.txt/ =~ fs
|
174
|
+
|
175
|
+
file = dir+f
|
176
|
+
mt = file.mtime
|
177
|
+
if max.nil? || max < mt
|
178
|
+
max = mt
|
179
|
+
end
|
180
|
+
}
|
181
|
+
return max || Time.now
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
|
186
|
+
def get_pagename(symbol)
|
187
|
+
return PAGENAME[symbol]
|
188
|
+
end
|
189
|
+
|
190
|
+
def get_dirpath
|
191
|
+
return "#{@sites_dir}/#{@group_name}".path
|
192
|
+
end
|
193
|
+
|
194
|
+
=begin
|
195
|
+
def get_filepath(symbol)
|
196
|
+
dir = get_dirpath
|
197
|
+
base = FILENAME[symbol]
|
198
|
+
return nil if base.nil?
|
199
|
+
return dir+base
|
200
|
+
end
|
201
|
+
|
202
|
+
def file_mtime(s)
|
203
|
+
f = get_filepath(s)
|
204
|
+
return f.mtime if f.exist?
|
205
|
+
return Time.at(0)
|
206
|
+
end
|
207
|
+
=end
|
208
|
+
|
209
|
+
def page_mtime(s)
|
210
|
+
pagename = get_pagename(s)
|
211
|
+
page = @site[pagename]
|
212
|
+
return page.mtime if page
|
213
|
+
return Time.at(0)
|
214
|
+
end
|
215
|
+
|
216
|
+
=begin
|
217
|
+
def sync(s)
|
218
|
+
file_content = nil
|
219
|
+
f = get_filepath(s)
|
220
|
+
file_content = f.read if f.exist?
|
221
|
+
|
222
|
+
page_content = nil
|
223
|
+
pagename = get_pagename(s)
|
224
|
+
page = @site[pagename]
|
225
|
+
page_content = page.get if page
|
226
|
+
|
227
|
+
# Both is nil.
|
228
|
+
return if file_content.nil? && page_content.nil? # Do nothing.
|
229
|
+
|
230
|
+
fmt = file_mtime(s)
|
231
|
+
pmt = page_mtime(s)
|
232
|
+
|
233
|
+
# File is exist, but the page is not exist.
|
234
|
+
if file_content && page_content.nil?
|
235
|
+
page = @site.create(pagename)
|
236
|
+
page.put_with_time(file_content, fmt)
|
237
|
+
# FIXME: delete file?
|
238
|
+
return
|
239
|
+
end
|
240
|
+
|
241
|
+
# File is not exist, but page is exist.
|
242
|
+
if file_content.nil? && page_content
|
243
|
+
f.put(page_content)
|
244
|
+
f.utime(pmt, pmt)
|
245
|
+
return
|
246
|
+
end
|
247
|
+
|
248
|
+
# Both exist.
|
249
|
+
if file_content == page_content
|
250
|
+
return # The two contents are already synced.
|
251
|
+
end
|
252
|
+
|
253
|
+
if fmt < pmt # The page is new.
|
254
|
+
f.put(page_content)
|
255
|
+
f.utime(pmt, pmt)
|
256
|
+
return
|
257
|
+
end
|
258
|
+
|
259
|
+
page.put_with_time(file_content, fmt)
|
260
|
+
return
|
261
|
+
end
|
262
|
+
=end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if $0 == __FILE__
|
267
|
+
require 'qwik/farm'
|
268
|
+
require 'qwik/server-memory'
|
269
|
+
require 'qwik/test-module-session'
|
270
|
+
$test = true
|
271
|
+
end
|
272
|
+
|
273
|
+
if defined?($test) && $test
|
274
|
+
class TestGroupDB < Test::Unit::TestCase
|
275
|
+
include TestSession
|
276
|
+
|
277
|
+
def test_db
|
278
|
+
sites_dir = './.test/data'
|
279
|
+
group_name = 'test'
|
280
|
+
|
281
|
+
db = QuickML::GroupDB.new(sites_dir, group_name)
|
282
|
+
|
283
|
+
ok_eq(true, './.test/data/test'.path.exist?)
|
284
|
+
|
285
|
+
db.set_site(@site)
|
286
|
+
|
287
|
+
t_make_public(QuickML::GroupDB, :get_dirpath)
|
288
|
+
ok_eq('./.test/data/test', db.get_dirpath.to_s)
|
289
|
+
|
290
|
+
# test_put
|
291
|
+
db.put(:Count, 'v')
|
292
|
+
|
293
|
+
# test_exist?
|
294
|
+
ok_eq(true, db.exist?(:Count))
|
295
|
+
|
296
|
+
# test_get
|
297
|
+
ok_eq('v', db.get(:Count))
|
298
|
+
|
299
|
+
# test_add
|
300
|
+
db.add(:Count, 'w')
|
301
|
+
#ok_eq('vw', db.get(:Count))
|
302
|
+
ok_eq("v\nw\n", db.get(:Count))
|
303
|
+
|
304
|
+
# test_last_article_time
|
305
|
+
t = db.last_article_time
|
306
|
+
assert_instance_of(Time, t)
|
307
|
+
|
308
|
+
# test_delete
|
309
|
+
db.delete(:Count)
|
310
|
+
ok_eq(false, db.exist?(:Count))
|
311
|
+
|
312
|
+
# test_use_site
|
313
|
+
site = @site
|
314
|
+
page = site['_GroupCount']
|
315
|
+
ok_eq(nil, page)
|
316
|
+
|
317
|
+
db.put(:Count, 'v2')
|
318
|
+
page = site['_GroupCount']
|
319
|
+
ok_eq('v2', page.get)
|
320
|
+
|
321
|
+
page.put_with_time('v3', Time.at(Time.now.to_i+10))
|
322
|
+
ok_eq('v3', db.get(:Count))
|
323
|
+
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|