mack-notifier 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems.rb +13 -0
- data/lib/gems/tmail-1.2.3.1/ext/Makefile +20 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/MANIFEST +4 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/depend +1 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/extconf.rb +33 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/tmailscanner.c +583 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail.rb +5 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/Makefile +18 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/address.rb +426 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/attachments.rb +46 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/base64.rb +46 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/compat.rb +41 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/config.rb +67 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/core_extensions.rb +63 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/encode.rb +581 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/header.rb +960 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/index.rb +9 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/interface.rb +1125 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/loader.rb +3 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mail.rb +578 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mailbox.rb +495 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/main.rb +6 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mbox.rb +3 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/net.rb +248 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/obsolete.rb +132 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.rb +1476 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.y +381 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/port.rb +379 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/quoting.rb +118 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/require_arch.rb +58 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner.rb +49 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner_r.rb +261 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/stringio.rb +280 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/utils.rb +337 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/version.rb +39 -0
- data/lib/gems/tmail-1.2.3.1/meta/MANIFEST +128 -0
- data/lib/gems/tmail-1.2.3.1/meta/VERSION +1 -0
- data/lib/gems/tmail-1.2.3.1/meta/project.yaml +30 -0
- data/lib/gems/tmail-1.2.3.1/meta/unixname +1 -0
- data/lib/gems/validatable-1.6.7/README +118 -0
- data/lib/gems/validatable-1.6.7/lib/child_validation.rb +15 -0
- data/lib/gems/validatable-1.6.7/lib/errors.rb +74 -0
- data/lib/gems/validatable-1.6.7/lib/included_validation.rb +9 -0
- data/lib/gems/validatable-1.6.7/lib/macros.rb +283 -0
- data/lib/gems/validatable-1.6.7/lib/object_extension.rb +21 -0
- data/lib/gems/validatable-1.6.7/lib/requireable.rb +26 -0
- data/lib/gems/validatable-1.6.7/lib/understandable.rb +31 -0
- data/lib/gems/validatable-1.6.7/lib/validatable.rb +19 -0
- data/lib/gems/validatable-1.6.7/lib/validatable_class_methods.rb +85 -0
- data/lib/gems/validatable-1.6.7/lib/validatable_instance_methods.rb +106 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_acceptance_of.rb +11 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_confirmation_of.rb +15 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_each.rb +14 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_format_of.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_length_of.rb +25 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_numericality_of.rb +16 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_presence_of.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_true_for.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validation_base.rb +88 -0
- data/lib/gems/validatable-1.6.7/rakefile.rb +50 -0
- data/lib/gems/validatable-1.6.7/test/all_tests.rb +1 -0
- data/lib/gems/validatable-1.6.7/test/functional/validatable_test.rb +437 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_acceptance_of_test.rb +16 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_confirmation_of_test.rb +56 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_each_test.rb +14 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_format_of_test.rb +34 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_length_of_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_numericality_of_test.rb +57 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_presence_of_test.rb +16 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_true_for_test.rb +27 -0
- data/lib/gems/validatable-1.6.7/test/test_helper.rb +33 -0
- data/lib/gems/validatable-1.6.7/test/unit/errors_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/unit/understandable_test.rb +19 -0
- data/lib/gems/validatable-1.6.7/test/unit/validatable_test.rb +38 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_acceptance_of_test.rb +21 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_confirmation_of_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb +34 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_length_of_test.rb +75 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_numericality_of_test.rb +52 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_presence_of_test.rb +25 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_true_for_test.rb +29 -0
- data/lib/gems/validatable-1.6.7/test/unit/validation_base_test.rb +52 -0
- data/lib/gems/xmpp4r-0.4/CHANGELOG +83 -0
- data/lib/gems/xmpp4r-0.4/COPYING +340 -0
- data/lib/gems/xmpp4r-0.4/LICENSE +59 -0
- data/lib/gems/xmpp4r-0.4/README.rdoc +110 -0
- data/lib/gems/xmpp4r-0.4/README_ruby19.txt +43 -0
- data/lib/gems/xmpp4r-0.4/Rakefile +262 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r.rb +116 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/base64.rb +32 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps.rb +1 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/client.rb +317 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/component.rb +103 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/connection.rb +219 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb +281 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/iq.rb +221 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/jid.rb +167 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/message.rb +148 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc.rb +14 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/presence.rb +232 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/query.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc.rb +2 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/sasl.rb +237 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/stream.rb +497 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune.rb +2 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard.rb +6 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb +37 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/gems/xmpp4r-0.4/setup.rb +1586 -0
- data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/gems/xmpp4r-0.4/test/caps/tc_helper.rb +156 -0
- data/lib/gems/xmpp4r-0.4/test/dataforms/tc_data.rb +81 -0
- data/lib/gems/xmpp4r-0.4/test/delay/tc_xdelay.rb +51 -0
- data/lib/gems/xmpp4r-0.4/test/discovery/tc_responder.rb +91 -0
- data/lib/gems/xmpp4r-0.4/test/lib/assert_equal_xml.rb +14 -0
- data/lib/gems/xmpp4r-0.4/test/lib/clienttester.rb +120 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_mucowner.rb +50 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_helper.rb +662 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_helper.rb +514 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_xroster.rb +73 -0
- data/lib/gems/xmpp4r-0.4/test/rpc/tc_helper.rb +96 -0
- data/lib/gems/xmpp4r-0.4/test/tc_callbacks.rb +129 -0
- data/lib/gems/xmpp4r-0.4/test/tc_class_names.rb +146 -0
- data/lib/gems/xmpp4r-0.4/test/tc_client.rb +30 -0
- data/lib/gems/xmpp4r-0.4/test/tc_errors.rb +146 -0
- data/lib/gems/xmpp4r-0.4/test/tc_idgenerator.rb +30 -0
- data/lib/gems/xmpp4r-0.4/test/tc_iq.rb +113 -0
- data/lib/gems/xmpp4r-0.4/test/tc_iqquery.rb +31 -0
- data/lib/gems/xmpp4r-0.4/test/tc_jid.rb +204 -0
- data/lib/gems/xmpp4r-0.4/test/tc_message.rb +116 -0
- data/lib/gems/xmpp4r-0.4/test/tc_presence.rb +150 -0
- data/lib/gems/xmpp4r-0.4/test/tc_rexml.rb +139 -0
- data/lib/gems/xmpp4r-0.4/test/tc_stream.rb +229 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamComponent.rb +95 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamError.rb +131 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamSend.rb +59 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamparser.rb +112 -0
- data/lib/gems/xmpp4r-0.4/test/tc_xmppstanza.rb +135 -0
- data/lib/gems/xmpp4r-0.4/test/ts_xmpp4r.rb +53 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_recv.rb +84 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_send.rb +74 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_tune.rb +79 -0
- data/lib/gems/xmpp4r-0.4/test/vcard/tc_helper.rb +49 -0
- data/lib/gems/xmpp4r-0.4/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/gems/xmpp4r-0.4/test/version/tc_helper.rb +60 -0
- data/lib/gems/xmpp4r-0.4/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/gems/xmpp4r-0.4/test/xhtml/tc_html.rb +41 -0
- data/lib/gems/xmpp4r-0.4/tools/gen_requires.bash +31 -0
- data/lib/gems/xmpp4r-0.4/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/gems/xmpp4r-0.4/xmpp4r.gemspec +291 -0
- data/lib/gems/xmpp4r-simple-0.8.8/CHANGELOG +73 -0
- data/lib/gems/xmpp4r-simple-0.8.8/COPYING +281 -0
- data/lib/gems/xmpp4r-simple-0.8.8/README +59 -0
- data/lib/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb +492 -0
- data/lib/gems/xmpp4r-simple-0.8.8/test/test_xmpp4r_simple.rb +242 -0
- data/lib/mack-notifier.rb +1 -3
- metadata +398 -46
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# version.rb
|
3
|
+
#
|
4
|
+
#--
|
5
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
# the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
#
|
26
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
27
|
+
# with permission of Minero Aoki.
|
28
|
+
#++
|
29
|
+
|
30
|
+
#:stopdoc:
|
31
|
+
module TMail
|
32
|
+
module VERSION
|
33
|
+
MAJOR = 1
|
34
|
+
MINOR = 2
|
35
|
+
TINY = 3
|
36
|
+
|
37
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# -x doc -x pkg -x log
|
2
|
+
CHANGES
|
3
|
+
LICENSE
|
4
|
+
NOTES
|
5
|
+
README
|
6
|
+
ext
|
7
|
+
ext/Makefile
|
8
|
+
ext/tmailscanner
|
9
|
+
ext/tmailscanner/tmail
|
10
|
+
ext/tmailscanner/tmail/MANIFEST
|
11
|
+
ext/tmailscanner/tmail/depend
|
12
|
+
ext/tmailscanner/tmail/extconf.rb
|
13
|
+
ext/tmailscanner/tmail/tmailscanner.c
|
14
|
+
lib
|
15
|
+
lib/tmail
|
16
|
+
lib/tmail/Makefile
|
17
|
+
lib/tmail/address.rb
|
18
|
+
lib/tmail/attachments.rb
|
19
|
+
lib/tmail/base64.rb
|
20
|
+
lib/tmail/compat.rb
|
21
|
+
lib/tmail/config.rb
|
22
|
+
lib/tmail/core_extensions.rb
|
23
|
+
lib/tmail/encode.rb
|
24
|
+
lib/tmail/header.rb
|
25
|
+
lib/tmail/index.rb
|
26
|
+
lib/tmail/interface.rb
|
27
|
+
lib/tmail/loader.rb
|
28
|
+
lib/tmail/mail.rb
|
29
|
+
lib/tmail/mailbox.rb
|
30
|
+
lib/tmail/main.rb
|
31
|
+
lib/tmail/mbox.rb
|
32
|
+
lib/tmail/net.rb
|
33
|
+
lib/tmail/obsolete.rb
|
34
|
+
lib/tmail/parser.rb
|
35
|
+
lib/tmail/parser.y
|
36
|
+
lib/tmail/port.rb
|
37
|
+
lib/tmail/quoting.rb
|
38
|
+
lib/tmail/require_arch.rb
|
39
|
+
lib/tmail/scanner.rb
|
40
|
+
lib/tmail/scanner_r.rb
|
41
|
+
lib/tmail/stringio.rb
|
42
|
+
lib/tmail/utils.rb
|
43
|
+
lib/tmail/version.rb
|
44
|
+
lib/tmail.rb
|
45
|
+
meta
|
46
|
+
meta/MANIFEST
|
47
|
+
meta/config.yaml
|
48
|
+
meta/icli.yaml
|
49
|
+
meta/project.yaml
|
50
|
+
meta/tmail.roll
|
51
|
+
sample
|
52
|
+
sample/bench_base64.rb
|
53
|
+
sample/data
|
54
|
+
sample/data/multipart
|
55
|
+
sample/data/normal
|
56
|
+
sample/data/sendtest
|
57
|
+
sample/data/simple
|
58
|
+
sample/data/test
|
59
|
+
sample/extract-attachements.rb
|
60
|
+
sample/from-check.rb
|
61
|
+
sample/multipart.rb
|
62
|
+
sample/parse-bench.rb
|
63
|
+
sample/parse-test.rb
|
64
|
+
sample/sendmail.rb
|
65
|
+
script
|
66
|
+
script/changelog
|
67
|
+
script/clobber
|
68
|
+
script/clobber/distclean
|
69
|
+
script/clobber/package
|
70
|
+
script/compile
|
71
|
+
script/pack
|
72
|
+
script/pack/gem
|
73
|
+
script/pack/tgz
|
74
|
+
script/pack/zip
|
75
|
+
script/prepare
|
76
|
+
script/publish
|
77
|
+
script/rdoc
|
78
|
+
script/release
|
79
|
+
script/setup
|
80
|
+
script/stamp
|
81
|
+
script/stats
|
82
|
+
script/tag
|
83
|
+
script/test
|
84
|
+
test
|
85
|
+
test/extctrl.rb
|
86
|
+
test/fixtures
|
87
|
+
test/fixtures/mailbox
|
88
|
+
test/fixtures/mailbox_without_any_from_or_sender
|
89
|
+
test/fixtures/mailbox_without_from
|
90
|
+
test/fixtures/mailbox_without_return_path
|
91
|
+
test/fixtures/raw_base64_decoded_string
|
92
|
+
test/fixtures/raw_base64_email
|
93
|
+
test/fixtures/raw_base64_encoded_string
|
94
|
+
test/fixtures/raw_email
|
95
|
+
test/fixtures/raw_email10
|
96
|
+
test/fixtures/raw_email11
|
97
|
+
test/fixtures/raw_email12
|
98
|
+
test/fixtures/raw_email13
|
99
|
+
test/fixtures/raw_email2
|
100
|
+
test/fixtures/raw_email3
|
101
|
+
test/fixtures/raw_email4
|
102
|
+
test/fixtures/raw_email5
|
103
|
+
test/fixtures/raw_email6
|
104
|
+
test/fixtures/raw_email7
|
105
|
+
test/fixtures/raw_email8
|
106
|
+
test/fixtures/raw_email9
|
107
|
+
test/fixtures/raw_email_quoted_with_0d0a
|
108
|
+
test/fixtures/raw_email_reply
|
109
|
+
test/fixtures/raw_email_simple
|
110
|
+
test/fixtures/raw_email_with_bad_date
|
111
|
+
test/fixtures/raw_email_with_illegal_boundary
|
112
|
+
test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
113
|
+
test/fixtures/raw_email_with_nested_attachment
|
114
|
+
test/fixtures/raw_email_with_partially_quoted_subject
|
115
|
+
test/fixtures/raw_email_with_quoted_illegal_boundary
|
116
|
+
test/kcode.rb
|
117
|
+
test/test_address.rb
|
118
|
+
test/test_attachments.rb
|
119
|
+
test/test_base64.rb
|
120
|
+
test/test_encode.rb
|
121
|
+
test/test_header.rb
|
122
|
+
test/test_helper.rb
|
123
|
+
test/test_mail.rb
|
124
|
+
test/test_mbox.rb
|
125
|
+
test/test_port.rb
|
126
|
+
test/test_quote.rb
|
127
|
+
test/test_scanner.rb
|
128
|
+
test/test_utils.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
1.2.3.1 stable (2008-04-11)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
project : tmail
|
3
|
+
version : 1.2.3.1
|
4
|
+
status : production
|
5
|
+
title : TMail
|
6
|
+
brief : Ruby Mail Handler
|
7
|
+
contact : Mikel Lindsaar <raasdnil AT gmail.com>
|
8
|
+
email : tmail-talk@rubyforge.org
|
9
|
+
homepage: http://tmail.rubyforge.org
|
10
|
+
authors :
|
11
|
+
- Minero Aoki
|
12
|
+
- Mikel Lindsaar
|
13
|
+
|
14
|
+
description:
|
15
|
+
TMail is a Ruby-based mail handler. It allows you
|
16
|
+
to compose stadards compliant emails in a
|
17
|
+
very Ruby-way.
|
18
|
+
|
19
|
+
loadpath:
|
20
|
+
- lib
|
21
|
+
- ext/tmailscanner
|
22
|
+
|
23
|
+
exclude: [doc,work]
|
24
|
+
|
25
|
+
hosts:
|
26
|
+
rubyforge:
|
27
|
+
type: rubyforge
|
28
|
+
rubytalk:
|
29
|
+
type: rubytalk
|
30
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
tmail
|
@@ -0,0 +1,118 @@
|
|
1
|
+
= Validatable
|
2
|
+
|
3
|
+
Validatable is a library for adding validations.
|
4
|
+
|
5
|
+
by Jay[http://jayfields.blogspot.com] Fields[http://jayfields.blogspot.com]
|
6
|
+
|
7
|
+
== Download and Installation
|
8
|
+
|
9
|
+
You can download Validatable from here[http://rubyforge.org/projects/validatable] or install it with the following command.
|
10
|
+
|
11
|
+
$ gem install validatable
|
12
|
+
|
13
|
+
== License
|
14
|
+
|
15
|
+
You may use, copy and redistribute this library under the same terms as Ruby itself (see http://www.ruby-lang.org/en/LICENSE.txt).
|
16
|
+
|
17
|
+
== Examples
|
18
|
+
|
19
|
+
Validation of an entire hierarchy of objects with errors aggregated at the root object.
|
20
|
+
|
21
|
+
class Person
|
22
|
+
include Validatable
|
23
|
+
validates_presence_of :name
|
24
|
+
attr_accessor :name
|
25
|
+
end
|
26
|
+
|
27
|
+
class PersonPresenter
|
28
|
+
include Validatable
|
29
|
+
include_validations_for :person
|
30
|
+
attr_accessor :person
|
31
|
+
|
32
|
+
def initialize(person)
|
33
|
+
@person = person
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
presenter = PersonPresenter.new(Person.new)
|
38
|
+
presenter.valid? #=> false
|
39
|
+
presenter.errors.on(:name) #=> "can't be blank"
|
40
|
+
|
41
|
+
Validations that turn off after X times of failed attempts.
|
42
|
+
|
43
|
+
class Person
|
44
|
+
include Validatable
|
45
|
+
validates_presence_of :name, :times => 1
|
46
|
+
attr_accessor :name
|
47
|
+
end
|
48
|
+
|
49
|
+
person = Person.new
|
50
|
+
person.valid? #=> false
|
51
|
+
person.valid? #=> true
|
52
|
+
|
53
|
+
Validations can be given levels. If a validation fails on a level the validations for subsequent levels will not be executed.
|
54
|
+
|
55
|
+
class Person
|
56
|
+
include Validatable
|
57
|
+
validates_presence_of :name, :level => 1, :message => "name message"
|
58
|
+
validates_presence_of :address, :level => 2
|
59
|
+
attr_accessor :name, :address
|
60
|
+
end
|
61
|
+
|
62
|
+
person = Person.new
|
63
|
+
person.valid? #=> false
|
64
|
+
person.errors.on(:name) #=> "name message"
|
65
|
+
person.errors.on(:address) #=> nil
|
66
|
+
|
67
|
+
Validations can also be given groups. Groups can be used to validate an object when it can be valid in various states. For example a mortgage application may be valid for saving (saving a partial application), but that same mortgage application would not be valid for underwriting. In our example a application can be saved as long as a Social Security Number is present; however, an application can not be underwritten unless the name attribute contains a value.
|
68
|
+
|
69
|
+
class MortgageApplication
|
70
|
+
include Validatable
|
71
|
+
validates_presence_of :ssn, :groups => [:saving, :underwriting]
|
72
|
+
validates_presence_of :name, :groups => :underwriting
|
73
|
+
attr_accessor :name, :ssn
|
74
|
+
end
|
75
|
+
|
76
|
+
application = MortgageApplication.new
|
77
|
+
application.ssn = 377990118
|
78
|
+
application.valid_for_saving? #=> true
|
79
|
+
application.valid_for_underwriting? #=> false
|
80
|
+
|
81
|
+
As you can see, you can use an array if the validation needs to be part of various groups. However, if the validation only applies to one group you can simply use a symbol for the group name.
|
82
|
+
|
83
|
+
Similar to Rails, Validatable also supports conditional validation.
|
84
|
+
|
85
|
+
class Person
|
86
|
+
include Validatable
|
87
|
+
attr_accessor :name
|
88
|
+
validates_format_of :name, :with => /.+/, :if => Proc.new { !name.nil? }
|
89
|
+
end
|
90
|
+
Person.new.valid? #=> true
|
91
|
+
|
92
|
+
Validatable also exposes an after_validate hook method.
|
93
|
+
|
94
|
+
class Person
|
95
|
+
include Validatable
|
96
|
+
validates_presence_of :name
|
97
|
+
attr_accessor :name
|
98
|
+
end
|
99
|
+
|
100
|
+
class ValidatesPresenceOf
|
101
|
+
after_validate do |result, instance, attribute|
|
102
|
+
instance.errors.add("#{attribute} can't be blank") unless result
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
person = Person.new
|
107
|
+
person.valid? #=> false
|
108
|
+
person.errors.on(:name) #=> "name can't be blank"
|
109
|
+
|
110
|
+
The after_validate hook yields the result of the validation being run,
|
111
|
+
the instance the validation was run on, and the attribute that was validated
|
112
|
+
|
113
|
+
In the above example the attribute "name" is appended to the message.
|
114
|
+
|
115
|
+
See the tests for more examples
|
116
|
+
|
117
|
+
== Contributors
|
118
|
+
Rick Bradley, Anonymous Z, Jason Miller, Ali Aghareza, Xavier Shay, Dan Manges, Karthik Krishnan and Venkat, Clint Bishop
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Validatable
|
2
|
+
class ChildValidation #:nodoc:
|
3
|
+
attr_accessor :attribute, :map, :should_validate_proc
|
4
|
+
|
5
|
+
def initialize(attribute, map, should_validate_proc)
|
6
|
+
@attribute = attribute
|
7
|
+
@map = map
|
8
|
+
@should_validate_proc = should_validate_proc
|
9
|
+
end
|
10
|
+
|
11
|
+
def should_validate?(instance)
|
12
|
+
instance.instance_eval &should_validate_proc
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Validatable
|
2
|
+
class Errors
|
3
|
+
extend Forwardable
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
def_delegators :errors, :clear, :each, :each_pair, :empty?, :length, :size
|
7
|
+
|
8
|
+
# call-seq: on(attribute)
|
9
|
+
#
|
10
|
+
# * Returns nil, if no errors are associated with the specified +attribute+.
|
11
|
+
# * Returns the error message, if one error is associated with the specified +attribute+.
|
12
|
+
# * Returns an array of error messages, if more than one error is associated with the specified +attribute+.
|
13
|
+
def on(attribute)
|
14
|
+
return nil if errors[attribute.to_sym].nil?
|
15
|
+
errors[attribute.to_sym].size == 1 ? errors[attribute.to_sym].first : errors[attribute.to_sym]
|
16
|
+
end
|
17
|
+
|
18
|
+
def add(attribute, message) #:nodoc:
|
19
|
+
errors[attribute.to_sym] = [] if errors[attribute.to_sym].nil?
|
20
|
+
errors[attribute.to_sym] << message
|
21
|
+
end
|
22
|
+
|
23
|
+
def merge!(errors) #:nodoc:
|
24
|
+
errors.each_pair{|k, v| add(k,v)}
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
# call-seq: replace(attribute)
|
29
|
+
#
|
30
|
+
# * Replaces the errors value for the given +attribute+
|
31
|
+
def replace(attribute, value)
|
32
|
+
errors[attribute.to_sym] = value
|
33
|
+
end
|
34
|
+
|
35
|
+
# call-seq: raw(attribute)
|
36
|
+
#
|
37
|
+
# * Returns an array of error messages associated with the specified +attribute+.
|
38
|
+
def raw(attribute)
|
39
|
+
errors[attribute.to_sym]
|
40
|
+
end
|
41
|
+
|
42
|
+
def errors #:nodoc:
|
43
|
+
@errors ||= {}
|
44
|
+
end
|
45
|
+
|
46
|
+
def count #:nodoc:
|
47
|
+
errors.values.flatten.size
|
48
|
+
end
|
49
|
+
|
50
|
+
# call-seq: full_messages -> an_array_of_messages
|
51
|
+
#
|
52
|
+
# Returns an array containing the full list of error messages.
|
53
|
+
def full_messages
|
54
|
+
full_messages = []
|
55
|
+
|
56
|
+
errors.each_key do |attribute|
|
57
|
+
errors[attribute].each do |msg|
|
58
|
+
next if msg.nil?
|
59
|
+
|
60
|
+
if attribute.to_s == "base"
|
61
|
+
full_messages << msg
|
62
|
+
else
|
63
|
+
full_messages << humanize(attribute.to_s) + " " + msg
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
full_messages
|
68
|
+
end
|
69
|
+
|
70
|
+
def humanize(lower_case_and_underscored_word) #:nodoc:
|
71
|
+
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,283 @@
|
|
1
|
+
module Validatable
|
2
|
+
module Macros
|
3
|
+
# call-seq: validates_each(*args)
|
4
|
+
#
|
5
|
+
# Validates that the logic evaluates to true
|
6
|
+
#
|
7
|
+
# class Address
|
8
|
+
# include Validatable
|
9
|
+
# validates_each :zip_code, :logic => lambda { errors.add(:zip_code, "is not valid") if ZipCodeService.allows(zip_code) }
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# The logic option is required.
|
13
|
+
#
|
14
|
+
# Configuration options:
|
15
|
+
#
|
16
|
+
# * after_validate - A block that executes following the run of a validation
|
17
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
18
|
+
# * if - A block that when executed must return true of the validation will not occur
|
19
|
+
# * level - The level at which the validation should occur
|
20
|
+
# * logic - A block that executes to perform the validation
|
21
|
+
# * message - The message to add to the errors collection when the validation fails
|
22
|
+
# * times - The number of times the validation applies
|
23
|
+
def validates_each(*args)
|
24
|
+
add_validations(args, ValidatesEach)
|
25
|
+
end
|
26
|
+
|
27
|
+
# call-seq: validates_format_of(*args)
|
28
|
+
#
|
29
|
+
# Validates whether the value of the specified attribute is of the
|
30
|
+
# correct form by matching it against the regular expression provided.
|
31
|
+
#
|
32
|
+
# class Person
|
33
|
+
# include Validatable
|
34
|
+
# validates_format_of :first_name, :with => /[ A-Za-z]/
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# A regular expression must be provided or else an exception will be raised.
|
38
|
+
#
|
39
|
+
# Configuration options:
|
40
|
+
#
|
41
|
+
# * after_validate - A block that executes following the run of a validation
|
42
|
+
# * message - The message to add to the errors collection when the validation fails
|
43
|
+
# * times - The number of times the validation applies
|
44
|
+
# * level - The level at which the validation should occur
|
45
|
+
# * if - A block that when executed must return true of the validation will not occur
|
46
|
+
# * with - The regular expression used to validate the format
|
47
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
48
|
+
def validates_format_of(*args)
|
49
|
+
add_validations(args, ValidatesFormatOf)
|
50
|
+
end
|
51
|
+
|
52
|
+
# call-seq: validates_length_of(*args)
|
53
|
+
#
|
54
|
+
# Validates that the specified attribute matches the length restrictions supplied.
|
55
|
+
#
|
56
|
+
# class Person
|
57
|
+
# include Validatable
|
58
|
+
# validates_length_of :first_name, :maximum=>30
|
59
|
+
# validates_length_of :last_name, :minimum=>30
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# Configuration options:
|
63
|
+
#
|
64
|
+
# * after_validate - A block that executes following the run of a validation
|
65
|
+
# * message - The message to add to the errors collection when the validation fails
|
66
|
+
# * times - The number of times the validation applies
|
67
|
+
# * level - The level at which the validation should occur
|
68
|
+
# * if - A block that when executed must return true of the validation will not occur
|
69
|
+
# * minimum - The minimum size of the attribute
|
70
|
+
# * maximum - The maximum size of the attribute
|
71
|
+
# * is - The size the attribute must be
|
72
|
+
# * within - A range that the size of the attribute must fall within
|
73
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
74
|
+
def validates_length_of(*args)
|
75
|
+
add_validations(args, ValidatesLengthOf)
|
76
|
+
end
|
77
|
+
|
78
|
+
# call-seq: validates_numericality_of(*args)
|
79
|
+
#
|
80
|
+
# Validates that the specified attribute is numeric.
|
81
|
+
#
|
82
|
+
# class Person
|
83
|
+
# include Validatable
|
84
|
+
# validates_numericality_of :age
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# Configuration options:
|
88
|
+
#
|
89
|
+
# * after_validate - A block that executes following the run of a validation
|
90
|
+
# * message - The message to add to the errors collection when the validation fails
|
91
|
+
# * times - The number of times the validation applies
|
92
|
+
# * level - The level at which the validation should occur
|
93
|
+
# * if - A block that when executed must return true of the validation will not occur
|
94
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
95
|
+
# * only_integer - Whether the attribute must be an integer (default is false)
|
96
|
+
def validates_numericality_of(*args)
|
97
|
+
add_validations(args, ValidatesNumericalityOf)
|
98
|
+
end
|
99
|
+
|
100
|
+
# call-seq: validates_acceptance_of(*args)
|
101
|
+
#
|
102
|
+
# Encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). Example:
|
103
|
+
#
|
104
|
+
# class Person
|
105
|
+
# include Validatable
|
106
|
+
# validates_acceptance_of :terms_of_service
|
107
|
+
# validates_acceptance_of :eula, :message => "must be abided"
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# Configuration options:
|
111
|
+
#
|
112
|
+
# * after_validate - A block that executes following the run of a validation
|
113
|
+
# * message - The message to add to the errors collection when the validation fails
|
114
|
+
# * times - The number of times the validation applies
|
115
|
+
# * level - The level at which the validation should occur
|
116
|
+
# * if - A block that when executed must return true of the validation will not occur
|
117
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
118
|
+
def validates_acceptance_of(*args)
|
119
|
+
add_validations(args, ValidatesAcceptanceOf)
|
120
|
+
end
|
121
|
+
|
122
|
+
# call-seq: validates_confirmation_of(*args)
|
123
|
+
#
|
124
|
+
# Encapsulates the pattern of wanting to validate a password or email address field with a confirmation. Example:
|
125
|
+
#
|
126
|
+
# Class:
|
127
|
+
# class PersonPresenter
|
128
|
+
# include Validatable
|
129
|
+
# validates_confirmation_of :user_name, :password
|
130
|
+
# validates_confirmation_of :email_address, :message => "should match confirmation"
|
131
|
+
# end
|
132
|
+
#
|
133
|
+
# View:
|
134
|
+
# <%= password_field "person", "password" %>
|
135
|
+
# <%= password_field "person", "password_confirmation" %>
|
136
|
+
#
|
137
|
+
# Configuration options:
|
138
|
+
#
|
139
|
+
# * after_validate - A block that executes following the run of a validation
|
140
|
+
# * case_sensitive - Whether or not to apply case-sensitivity on the comparison. Defaults to true.
|
141
|
+
# * message - The message to add to the errors collection when the validation fails
|
142
|
+
# * times - The number of times the validation applies
|
143
|
+
# * level - The level at which the validation should occur
|
144
|
+
# * if - A block that when executed must return true of the validation will not occur
|
145
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
146
|
+
def validates_confirmation_of(*args)
|
147
|
+
add_validations(args, ValidatesConfirmationOf)
|
148
|
+
end
|
149
|
+
|
150
|
+
# call-seq: validates_presence_of(*args)
|
151
|
+
#
|
152
|
+
# Validates that the specified attributes are not nil or an empty string
|
153
|
+
#
|
154
|
+
# class Person
|
155
|
+
# include Validatable
|
156
|
+
# validates_presence_of :first_name
|
157
|
+
# end
|
158
|
+
#
|
159
|
+
# The first_name attribute must be in the object and it cannot be nil or empty.
|
160
|
+
#
|
161
|
+
# Configuration options:
|
162
|
+
#
|
163
|
+
# * after_validate - A block that executes following the run of a validation
|
164
|
+
# * message - The message to add to the errors collection when the validation fails
|
165
|
+
# * times - The number of times the validation applies
|
166
|
+
# * level - The level at which the validation should occur
|
167
|
+
# * if - A block that when executed must return true of the validation will not occur
|
168
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
169
|
+
def validates_presence_of(*args)
|
170
|
+
add_validations(args, ValidatesPresenceOf)
|
171
|
+
end
|
172
|
+
|
173
|
+
# call-seq: validates_true_for(*args)
|
174
|
+
#
|
175
|
+
# Validates that the logic evaluates to true
|
176
|
+
#
|
177
|
+
# class Person
|
178
|
+
# include Validatable
|
179
|
+
# validates_true_for :first_name, :logic => lambda { first_name == 'Jamie' }
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# The logic option is required.
|
183
|
+
#
|
184
|
+
# Configuration options:
|
185
|
+
#
|
186
|
+
# * after_validate - A block that executes following the run of a validation
|
187
|
+
# * message - The message to add to the errors collection when the validation fails
|
188
|
+
# * times - The number of times the validation applies
|
189
|
+
# * level - The level at which the validation should occur
|
190
|
+
# * if - A block that when executed must return true of the validation will not occur
|
191
|
+
# * group - The group that this validation belongs to. A validation can belong to multiple groups
|
192
|
+
# * logic - A block that executes to perform the validation
|
193
|
+
def validates_true_for(*args)
|
194
|
+
add_validations(args, ValidatesTrueFor)
|
195
|
+
end
|
196
|
+
|
197
|
+
# call-seq: include_validations_from(attribute)
|
198
|
+
#
|
199
|
+
# Includes all the validations that are defined on the attribute.
|
200
|
+
# class Person
|
201
|
+
# include Validatable
|
202
|
+
# validates_presence_of :name
|
203
|
+
# end
|
204
|
+
#
|
205
|
+
# class PersonPresenter
|
206
|
+
# include Validatable
|
207
|
+
# include_validataions_from :person
|
208
|
+
# attr_accessor :person
|
209
|
+
# def name
|
210
|
+
# person.name
|
211
|
+
# end
|
212
|
+
#
|
213
|
+
# def initialize(person)
|
214
|
+
# @person = person
|
215
|
+
# end
|
216
|
+
# end
|
217
|
+
#
|
218
|
+
# presenter = PersonPresenter.new(Person.new)
|
219
|
+
# presenter.valid? #=> false
|
220
|
+
# presenter.errors.on(:name) #=> "can't be blank"
|
221
|
+
#
|
222
|
+
# The name attribute whose validations should be added.
|
223
|
+
def include_validations_from(attribute_to_validate, options = {})
|
224
|
+
validations_to_include << IncludedValidation.new(attribute_to_validate)
|
225
|
+
end
|
226
|
+
|
227
|
+
# call-seq: include_errors_from(attribute_to_validate, options = {})
|
228
|
+
#
|
229
|
+
# Validates the specified attributes.
|
230
|
+
# class Person
|
231
|
+
# include Validatable
|
232
|
+
# validates_presence_of :name
|
233
|
+
# attr_accessor :name
|
234
|
+
# end
|
235
|
+
#
|
236
|
+
# class PersonPresenter
|
237
|
+
# include Validatable
|
238
|
+
# include_errors_from :person, :map => { :name => :namen }, :if => lambda { not person.nil? }
|
239
|
+
# attr_accessor :person
|
240
|
+
#
|
241
|
+
# def initialize(person)
|
242
|
+
# @person = person
|
243
|
+
# end
|
244
|
+
# end
|
245
|
+
#
|
246
|
+
# presenter = PersonPresenter.new(Person.new)
|
247
|
+
# presenter.valid? #=> false
|
248
|
+
# presenter.errors.on(:namen) #=> "can't be blank"
|
249
|
+
#
|
250
|
+
# The person attribute will be validated.
|
251
|
+
# If person is invalid the errors will be added to the PersonPresenter errors collection.
|
252
|
+
#
|
253
|
+
# Configuration options:
|
254
|
+
#
|
255
|
+
# * map - A hash that maps attributes of the child to attributes of the parent.
|
256
|
+
# * if - A block that when executed must return true of the validation will not occur.
|
257
|
+
def include_errors_from(attribute_to_validate, options = {})
|
258
|
+
children_to_validate << ChildValidation.new(attribute_to_validate, options[:map] || {}, options[:if] || lambda { true })
|
259
|
+
end
|
260
|
+
|
261
|
+
def include_validations_for(attribute_to_validate, options = {}) #:nodoc:
|
262
|
+
puts "include_validations_for is deprecated; use include_errors_from instead"
|
263
|
+
children_to_validate << ChildValidation.new(attribute_to_validate, options[:map] || {}, options[:if] || lambda { true })
|
264
|
+
end
|
265
|
+
|
266
|
+
# call-seq: before_validation(&block)
|
267
|
+
#
|
268
|
+
# Is called before valid? or valid_for_*?
|
269
|
+
#
|
270
|
+
# class Person
|
271
|
+
# include Validatable
|
272
|
+
# before_validation do
|
273
|
+
# self.name = "default name"
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# attr_accessor :name
|
277
|
+
# end
|
278
|
+
#
|
279
|
+
def before_validation(&block)
|
280
|
+
before_validations << block
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|