wagn 1.12.13 → 1.13.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +7 -8
- data/.rspec +1 -1
- data/.simplecov +23 -0
- data/.tm_properties +1 -0
- data/Gemfile +15 -13
- data/Guardfile +34 -0
- data/README.rdoc +4 -10
- data/VERSION +1 -1
- data/app/assets/images/smoothness/animated-overlay.gif +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/smoothness/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/application.js +9 -8
- data/app/assets/javascripts/jquery.ui.autocomplete.html.js +1 -1
- data/app/controllers/card_controller.rb +190 -23
- data/config/environments/development.rb +17 -12
- data/config/initializers/01_init_ruby_extensions.rb +1 -70
- data/config/routes.rb +21 -8
- data/config/version_cards.txt +1 -1
- data/db/bootstrap/card_references.yml +520 -352
- data/db/bootstrap/card_revisions.yml +1818 -1887
- data/db/bootstrap/cards.yml +2279 -1310
- data/db/migrate_cards/20130411191151_renaming_for_menu.rb +0 -5
- data/db/migrate_cards/20130411211600_delete_old_related_tab_cards.rb +0 -6
- data/db/migrate_cards/20130419215612_import_help_text.rb +0 -7
- data/db/migrate_cards/20130823192433_add_style_cards.rb +2 -6
- data/db/migrate_cards/20130910183318_move_styles_to_content.rb +0 -5
- data/db/migrate_cards/20130920214038_jsonize_tinymce.rb +0 -6
- data/db/migrate_cards/20130920291703_update_stylesheets.rb +0 -5
- data/db/migrate_cards/20130927191728_account_events.rb +1 -6
- data/db/migrate_cards/20131016172445_common_css_patch.rb +0 -6
- data/db/migrate_cards/20140110193325_reset_account_request_type.rb +1 -6
- data/db/migrate_cards/20140307231621_user_data_to_cards.rb +78 -0
- data/db/migrate_cards/20140317035504_account_requests_to_signups.rb +45 -0
- data/db/migrate_cards/20140512155840_add_script_cards.rb +85 -0
- data/db/migrate_cards/data/1.12_stylesheets/common.scss +1 -1
- data/features/autonaming.feature +3 -3
- data/features/flexmail.feature +2 -2
- data/features/layouts.feature +1 -1
- data/features/navbox.feature +17 -0
- data/features/notifications.feature +4 -4
- data/features/pointer_inputs.feature +2 -2
- data/features/presetting_content.feature +1 -1
- data/features/reset_password.feature +34 -0
- data/features/{pattern_settings.feature → rules.feature} +7 -7
- data/features/setup.feature +32 -0
- data/features/signup.feature +47 -0
- data/features/step_definitions/email_steps.rb +24 -1
- data/features/step_definitions/wagn_steps.rb +66 -31
- data/features/step_definitions/web_steps.rb +1 -0
- data/features/{content_settings.feature → structure.feature} +3 -6
- data/features/support/env.rb +3 -0
- data/features/support/paths.rb +2 -2
- data/features/support/{wag_env.rb → wagn_env.rb} +1 -1
- data/features/table_of_contents.feature +1 -1
- data/features/update_includers.feature +3 -3
- data/features/watch.feature +2 -2
- data/lib/card.rb +12 -10
- data/lib/{active_record/quoting_and_matching.rb → card/active_record_ext.rb} +25 -20
- data/lib/card/auth.rb +205 -0
- data/lib/card/chunk.rb +70 -69
- data/lib/card/content.rb +1 -1
- data/lib/card/core_ext.rb +74 -0
- data/lib/card/env.rb +66 -0
- data/lib/card/flexmail.rb +43 -37
- data/lib/card/format.rb +42 -29
- data/lib/{generators → card/generators}/card_migration/USAGE +0 -0
- data/lib/{generators → card/generators}/card_migration/card_migration_generator.rb +0 -0
- data/lib/{generators → card/generators}/card_migration/templates/card_migration.erb +0 -6
- data/lib/{generators → card/generators}/format/USAGE +0 -0
- data/lib/{generators → card/generators}/format/format_generator.rb +0 -0
- data/lib/{generators → card/generators}/format/templates/format_spec_template.erb +1 -2
- data/lib/{generators → card/generators}/format/templates/format_template.erb +0 -0
- data/lib/{generators → card/generators}/set/USAGE +0 -0
- data/lib/{generators → card/generators}/set/set_generator.rb +0 -0
- data/lib/{generators → card/generators}/set/templates/set_spec_template.erb +1 -2
- data/lib/card/generators/set/templates/set_template.erb +1 -0
- data/lib/card/loader.rb +145 -0
- data/lib/card/mailer.rb +117 -0
- data/{app/views → lib/card}/mailer/change_notice.html.erb +2 -2
- data/lib/card/mailer/confirmation_email.html.erb +8 -0
- data/{app/views → lib/card}/mailer/flexmail.html.erb +0 -0
- data/lib/card/mailer/password_reset.html.erb +9 -0
- data/{app/views → lib/card}/mailer/signup_alert.html.erb +0 -0
- data/lib/card/name.rb +2 -3
- data/lib/card/query.rb +0 -3
- data/lib/card/query/card_spec.rb +4 -4
- data/lib/card/revision.rb +34 -32
- data/lib/card/set.rb +204 -180
- data/lib/card/set_pattern.rb +126 -101
- data/lib/wagn/all.rb +1 -8
- data/lib/wagn/application.rb +14 -7
- data/lib/wagn/commands/application.rb +1 -1
- data/lib/{generators → wagn/generators}/wagn/USAGE +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/Gemfile +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/Rakefile +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config.ru +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/application.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/boot.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/database.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/frontbase.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/ibm_db.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbc.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcmysql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcpostgresql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcsqlite3.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/mysql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/oracle.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/postgresql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/sqlite3.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/environment.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/gitignore +0 -0
- data/lib/wagn/generators/wagn/templates/public/files/htaccess +9 -0
- data/{public → lib/wagn/generators/wagn/templates/public}/robots.txt +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/script/wagn +0 -0
- data/lib/{generators → wagn/generators}/wagn/wagn_generator.rb +12 -0
- data/lib/wagn/location.rb +7 -11
- data/lib/wagn/migration_helper.rb +4 -1
- data/{app/mailers → lib/wagn/tasks}/.gitkeep +0 -0
- data/lib/{tasks → wagn/tasks}/cucumber.rake +0 -0
- data/lib/{tasks → wagn/tasks}/db.rake +0 -0
- data/lib/{tasks → wagn/tasks}/test.rake +5 -2
- data/lib/{tasks → wagn/tasks}/wagn.rake +29 -12
- data/mods/{standard → core}/chunks/include.rb +2 -0
- data/mods/{standard → core}/chunks/link.rb +3 -0
- data/mods/core/formats/html_format.rb +27 -35
- data/mods/core/sets/all/active_card.rb +15 -3
- data/mods/core/sets/all/attribute_tracking.rb +1 -1
- data/mods/core/sets/all/collection.rb +4 -5
- data/mods/core/sets/all/fetch.rb +98 -80
- data/mods/core/sets/all/initialize.rb +2 -0
- data/mods/core/sets/all/name.rb +13 -12
- data/mods/core/sets/all/pattern.rb +0 -9
- data/mods/core/sets/all/permissions.rb +56 -31
- data/mods/core/sets/all/phases.rb +63 -84
- data/mods/core/sets/all/references.rb +0 -1
- data/mods/core/sets/all/rules.rb +3 -4
- data/mods/core/sets/all/templating.rb +2 -3
- data/mods/core/sets/all/tracked_attributes.rb +26 -9
- data/mods/core/sets/all/trash.rb +1 -2
- data/mods/core/sets/all/type.rb +6 -1
- data/mods/core/sets/all/utils.rb +2 -3
- data/mods/standard/files/103/icon-6566.ico +0 -0
- data/mods/standard/files/103/large-6566.ico +0 -0
- data/mods/standard/files/103/medium-6566.ico +0 -0
- data/{public/favicon.ico → mods/standard/files/103/original-6566.ico} +0 -0
- data/mods/standard/files/103/small-6566.ico +0 -0
- data/mods/standard/files/79/icon-6556.png +0 -0
- data/mods/standard/files/79/large-6556.png +0 -0
- data/mods/standard/files/79/medium-6556.png +0 -0
- data/mods/standard/files/79/original-6556.png +0 -0
- data/mods/standard/files/79/small-6556.png +0 -0
- data/mods/standard/files/790/icon-6419.png +0 -0
- data/mods/standard/files/790/large-6419.png +0 -0
- data/mods/standard/files/790/medium-6419.png +0 -0
- data/mods/standard/files/790/original-6419.png +0 -0
- data/mods/standard/files/790/small-6419.png +0 -0
- data/mods/standard/lib/card/machine.rb +152 -0
- data/mods/standard/lib/card/machine_input.rb +40 -0
- data/{public/assets → mods/standard/lib/javascript}/html5shiv-printshiv.js +0 -0
- data/mods/standard/lib/javascript/jquery-ui.js +14913 -0
- data/mods/standard/lib/javascript/jquery.autosize.js +255 -0
- data/mods/standard/lib/javascript/jquery.fileupload.js +1112 -0
- data/mods/standard/lib/javascript/jquery.iframe-transport.js +157 -0
- data/mods/standard/lib/javascript/jquery.js +9473 -0
- data/mods/standard/lib/javascript/jquery.ui.autocomplete.html.js +41 -0
- data/mods/standard/lib/javascript/jquery_ujs.js +429 -0
- data/mods/standard/lib/javascript/jquerymobile.js +8800 -0
- data/mods/standard/lib/javascript/tinymce.js +13 -0
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn.js.coffee +10 -0
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn_menu.js +3 -12
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn_mod.js.coffee +18 -11
- data/mods/standard/lib/stylesheets/functional.scss +13 -9
- data/mods/standard/lib/stylesheets/jquery-ui-smoothness.css +922 -218
- data/mods/standard/lib/stylesheets/standard.scss +2 -2
- data/mods/standard/sets/all/account.rb +18 -205
- data/mods/standard/sets/all/all_css.rb +2 -3
- data/mods/standard/sets/all/all_csv.rb +0 -1
- data/mods/standard/sets/all/attach.rb +0 -1
- data/mods/standard/sets/all/base.rb +9 -7
- data/mods/standard/sets/all/comment.rb +5 -5
- data/mods/standard/sets/all/email_html.rb +0 -2
- data/mods/standard/sets/all/event_viz.rb +62 -0
- data/mods/standard/sets/all/file.rb +0 -1
- data/mods/standard/sets/all/follow.rb +13 -11
- data/mods/standard/sets/all/history.rb +2 -7
- data/mods/standard/sets/all/json.rb +6 -11
- data/mods/standard/sets/all/rich_html.rb +68 -52
- data/mods/standard/sets/all/rss.rb +4 -5
- data/mods/standard/sets/all/text.rb +0 -1
- data/mods/standard/sets/right/account.rb +100 -1
- data/mods/standard/sets/right/create.rb +8 -2
- data/mods/standard/sets/right/delete.rb +2 -0
- data/mods/standard/sets/right/email.rb +50 -2
- data/mods/standard/sets/right/machine_output.rb +12 -0
- data/mods/standard/sets/right/password.rb +39 -0
- data/mods/standard/sets/right/read.rb +2 -0
- data/mods/standard/sets/right/salt.rb +2 -1
- data/mods/standard/sets/right/script.rb +10 -0
- data/mods/standard/sets/right/stats.rb +35 -0
- data/mods/standard/sets/right/status.rb +9 -0
- data/mods/standard/sets/right/style.rb +7 -53
- data/mods/standard/sets/right/{crypted_password.rb → token.rb} +2 -1
- data/mods/standard/sets/right/update.rb +2 -0
- data/mods/standard/sets/rstar/rules.rb +7 -3
- data/mods/standard/sets/self/account_links.rb +16 -23
- data/mods/standard/sets/self/alerts.rb +0 -1
- data/mods/standard/sets/self/all.rb +21 -0
- data/mods/standard/sets/self/foot.rb +0 -1
- data/mods/standard/sets/self/head.rb +21 -24
- data/mods/standard/sets/self/navbox.rb +0 -1
- data/mods/standard/sets/self/now.rb +0 -1
- data/mods/standard/sets/self/recent.rb +38 -35
- data/mods/standard/sets/self/script_card_menu.rb +8 -0
- data/mods/standard/sets/self/script_html5shiv_printshiv.rb +7 -0
- data/mods/standard/sets/self/script_jquery.rb +8 -0
- data/mods/standard/sets/self/script_jquery_helper.rb +13 -0
- data/mods/standard/sets/self/script_slot.rb +9 -0
- data/mods/standard/sets/self/script_tinymce.rb +8 -0
- data/mods/standard/sets/self/search.rb +0 -1
- data/mods/standard/sets/self/signin.rb +111 -0
- data/mods/standard/sets/self/stats.rb +91 -0
- data/mods/standard/sets/self/style_functional.rb +1 -1
- data/mods/standard/sets/self/style_jquery_ui_smoothness.rb +1 -1
- data/mods/standard/sets/self/style_standard.rb +1 -1
- data/mods/standard/sets/type/basic.rb +15 -14
- data/mods/standard/sets/type/cardtype.rb +2 -3
- data/mods/standard/sets/type/coffee_script.rb +46 -0
- data/mods/standard/sets/type/css.rb +16 -5
- data/mods/standard/sets/type/date.rb +0 -1
- data/mods/standard/sets/type/file.rb +0 -2
- data/mods/standard/sets/type/html.rb +0 -1
- data/mods/standard/sets/type/image.rb +1 -2
- data/mods/standard/sets/type/java_script.rb +32 -0
- data/mods/standard/sets/type/layout_type.rb +1 -1
- data/mods/standard/sets/type/number.rb +0 -1
- data/mods/standard/sets/type/pointer.rb +13 -8
- data/mods/standard/sets/type/scss.rb +17 -3
- data/mods/standard/sets/type/search_type.rb +36 -34
- data/mods/standard/sets/type/set.rb +1 -5
- data/mods/standard/sets/type/setting.rb +1 -2
- data/mods/standard/sets/type/signup.rb +92 -0
- data/mods/standard/sets/type/skin.rb +4 -5
- data/mods/standard/sets/type/toggle.rb +1 -1
- data/mods/standard/sets/type/user.rb +51 -4
- data/public/{404.html → assets/jasmine/404.html} +0 -0
- data/public/{500.html → assets/jasmine/500.html} +0 -0
- data/public/{jasmine → assets/jasmine}/card_form.html +0 -0
- data/public/assets/jquery-ui/animated-overlay-602eee4c79a4796b02bb6442948c9e28.gif +0 -0
- data/public/assets/jquery-ui/animated-overlay.gif +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_flat_0_aaaaaa_40x100-7d1197a52442bc56fcad60d0390f4b32.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_flat_75_ffffff_40x100-3c4b974defa5e8bdaf8a603034c4435e.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_55_fbf9ee_1x400-38c2dea4d046fd3f56cc3996e2e6018b.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_65_ffffff_1x400-ddb7ee7527bff283054406c50e597e1e.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_75_dadada_1x400-d618461418b1ebc6b7996979f4c3dc92.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_75_e6e6e6_1x400-48d8d545f708e5870a965ce9df8b0e38.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_95_fef1ec_1x400-f3526b8f82249928f0a6baf044204b15.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_highlight-soft_75_cccccc_1x100-cec5c56503b8480f834c3fce35dae8df.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/{app/assets/images/images/ui-icons_2e83ff_256x240.png → public/assets/jquery-ui/ui-icons_222222_256x240-b1eb177a51ea7925448318a26d988842.png} +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-icons_222222_256x240.png +0 -0
- data/{app/assets/images/images/ui-icons_454545_256x240.png → public/assets/jquery-ui/ui-icons_2e83ff_256x240-49c2da9cac2dc565265586f716491298.png} +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_2e83ff_256x240.png +0 -0
- data/{app/assets/images/images/ui-icons_888888_256x240.png → public/assets/jquery-ui/ui-icons_454545_256x240-68b2fe3268f7604fb0767a0372e2db85.png} +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_454545_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_888888_256x240-8040cfcc88792375b7788feb59189eef.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_888888_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240-d4a62216bf6f0cd0071149890763a5ff.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery.min-388372ef65cc311f6a3df4a6ceac8d22.map +1 -0
- data/public/assets/jquery.min.map +1 -1
- data/public/assets/manifest.yml +61 -31
- data/public/assets/smoothness/animated-overlay-602eee4c79a4796b02bb6442948c9e28.gif +0 -0
- data/public/assets/smoothness/animated-overlay.gif +0 -0
- data/public/assets/smoothness/ui-bg_flat_0_aaaaaa_40x100-31613497e63975a54520b7065b125dea.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_75_ffffff_40x100-f4b0e20e6f4c83b9f52cf062ed0f5284.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_55_fbf9ee_1x400-e3606d6e7ad67486ffdc83edca64d4c5.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_65_ffffff_1x400-dcec96932b90ff4cd4fea91284a6e9a3.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_dadada_1x400-a2310f533684ede4f1216d7299b5cd58.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_e6e6e6_1x400-d872f3a0a02dea609e4b0321520236d9.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_95_fef1ec_1x400-9ccaed8a65a3c285c16a73bdf03a69b3.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_highlight-soft_75_cccccc_1x100-2ef1d227b5c0f33ce3c5e45afa953991.png +0 -0
- data/public/assets/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/assets/smoothness/ui-icons_222222_256x240-0675a996f0bdc78890f7b312c543b06a.png +0 -0
- data/public/assets/smoothness/ui-icons_222222_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_2e83ff_256x240-6aea736f81a417977efd77f183519a54.png +0 -0
- data/public/assets/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_454545_256x240-6f4361f45745fb0cd7b0cc2851dc1cc3.png +0 -0
- data/public/assets/smoothness/ui-icons_454545_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_888888_256x240-8f6818bd8631ba3489de718e26c7e6cf.png +0 -0
- data/public/assets/smoothness/ui-icons_888888_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_cd0a0a_256x240-2969ddba6d0a9c62603a4aa85a363cda.png +0 -0
- data/public/assets/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/controllers/card_controller_spec.rb +77 -61
- data/spec/controllers/location_spec.rb +3 -2
- data/spec/lib/card/auth_spec.rb +17 -0
- data/spec/lib/card/chunk_spec.rb +0 -1
- data/spec/lib/card/codename_spec.rb +12 -18
- data/spec/lib/card/content_spec.rb +0 -1
- data/spec/lib/card/diff_spec.rb +0 -1
- data/spec/lib/card/flexmail_spec.rb +19 -20
- data/spec/lib/card/format_spec.rb +0 -169
- data/spec/lib/{wagn → card}/loader_spec.rb +1 -2
- data/spec/lib/card/name_spec.rb +3 -5
- data/spec/lib/card/query_spec.rb +5 -8
- data/spec/{models → lib}/card/reference_spec.rb +6 -7
- data/spec/lib/card/revision_spec.rb +30 -0
- data/spec/lib/card/set_pattern_spec.rb +0 -1
- data/spec/lib/card/set_spec.rb +9 -9
- data/spec/lib/wagn/cache_spec.rb +0 -1
- data/spec/mailers/mailer_spec.rb +4 -9
- data/spec/models/card/cardtype_spec.rb +12 -14
- data/spec/models/card/create_spec.rb +3 -4
- data/spec/models/card/trash_spec.rb +24 -23
- data/spec/models/card/type_transition_spec.rb +3 -4
- data/spec/models/card/validation_spec.rb +0 -1
- data/spec/models/card_spec.rb +10 -11
- data/spec/mods/core/chunks/literal_spec.rb +0 -1
- data/spec/mods/core/chunks/uri_spec.rb +0 -1
- data/spec/mods/core/formats/data_format_spec.rb +0 -1
- data/spec/mods/core/formats/html_format_spec.rb +17 -18
- data/spec/mods/core/formats/text_format_spec.rb +0 -1
- data/spec/mods/core/sets/all/active_card_spec.rb +1 -2
- data/spec/mods/core/sets/all/attribute_tracking_spec.rb +1 -2
- data/spec/mods/core/sets/all/collection_spec.rb +1 -5
- data/spec/mods/core/sets/all/content_spec.rb +0 -1
- data/spec/mods/core/sets/all/fetch_spec.rb +7 -10
- data/spec/mods/core/sets/all/initialize_spec.rb +0 -1
- data/spec/mods/core/sets/all/name_spec.rb +34 -3
- data/spec/mods/core/sets/all/pattern_spec.rb +6 -9
- data/spec/mods/core/sets/all/permissions_spec.rb +61 -62
- data/spec/mods/core/sets/all/phases_spec.rb +1 -2
- data/spec/mods/core/sets/all/references_spec.rb +0 -1
- data/spec/mods/core/sets/all/rules2_spec.rb +31 -31
- data/spec/mods/core/sets/all/rules_spec.rb +3 -4
- data/spec/mods/core/sets/all/states_spec.rb +1 -2
- data/spec/mods/core/sets/all/templating_spec.rb +11 -12
- data/spec/mods/core/sets/all/tracked_attributes_spec.rb +18 -8
- data/spec/mods/core/sets/all/trash_spec.rb +1 -2
- data/spec/mods/core/sets/all/type_spec.rb +6 -5
- data/spec/mods/core/sets/all/utils_spec.rb +1 -2
- data/spec/mods/standard/chunks/include_spec.rb +14 -15
- data/spec/mods/standard/chunks/link_spec.rb +0 -1
- data/spec/mods/standard/formats/css_format_spec.rb +1 -2
- data/spec/mods/standard/formats/csv_format_spec.rb +0 -1
- data/spec/mods/standard/formats/email_html_format_spec.rb +1 -2
- data/spec/mods/standard/formats/file_format_spec.rb +0 -1
- data/spec/mods/standard/formats/js_format_spec.rb +3 -0
- data/spec/mods/standard/formats/json_format_spec.rb +0 -1
- data/spec/mods/standard/formats/rss_format_spec.rb +1 -2
- data/spec/mods/standard/formats/xml_format_spec.rb +0 -1
- data/spec/mods/standard/lib/machine_input_spec.rb +48 -0
- data/spec/mods/standard/lib/machine_spec.rb +110 -0
- data/spec/mods/standard/sets/all/account_spec.rb +50 -30
- data/spec/mods/standard/sets/all/all_css_spec.rb +0 -1
- data/spec/mods/standard/sets/all/all_csv_spec.rb +0 -1
- data/spec/mods/standard/sets/all/attach_spec.rb +0 -1
- data/spec/mods/standard/sets/all/base_spec.rb +5 -6
- data/spec/mods/standard/sets/all/comment_spec.rb +5 -0
- data/spec/mods/standard/sets/all/email_html_spec.rb +2 -3
- data/spec/mods/standard/sets/all/event_viz_spec.rb +7 -0
- data/spec/mods/standard/sets/all/file_spec.rb +0 -1
- data/spec/mods/standard/sets/all/flexmail_spec.rb +0 -1
- data/spec/mods/standard/sets/all/follow_spec.rb +10 -11
- data/spec/mods/standard/sets/all/history_spec.rb +10 -0
- data/spec/mods/standard/sets/all/json_spec.rb +5 -6
- data/spec/mods/standard/sets/all/rich_html_spec.rb +16 -13
- data/spec/mods/standard/sets/all/rss_spec.rb +4 -2
- data/spec/mods/standard/sets/all/text_spec.rb +1 -2
- data/spec/mods/standard/sets/right/account_spec.rb +86 -2
- data/spec/mods/standard/sets/right/add_help_spec.rb +0 -1
- data/spec/mods/standard/sets/right/comment_spec.rb +37 -2
- data/spec/mods/standard/sets/right/create_spec.rb +6 -2
- data/spec/mods/standard/sets/right/default_spec.rb +0 -1
- data/spec/mods/standard/sets/right/delete_spec.rb +0 -1
- data/spec/mods/standard/sets/right/email_spec.rb +43 -15
- data/spec/mods/standard/sets/right/help_spec.rb +0 -1
- data/spec/mods/standard/sets/right/machine_output_spec.rb +20 -0
- data/spec/mods/standard/sets/right/password_spec.rb +45 -0
- data/spec/mods/standard/sets/right/read_spec.rb +0 -1
- data/spec/mods/standard/sets/right/salt_spec.rb +0 -1
- data/spec/mods/standard/sets/right/script_spec.rb +20 -0
- data/spec/mods/standard/sets/right/stats_spec.rb +13 -0
- data/spec/mods/standard/sets/right/status_spec.rb +5 -0
- data/spec/mods/standard/sets/right/structure_spec.rb +2 -3
- data/spec/mods/standard/sets/right/style_spec.rb +19 -2
- data/spec/mods/standard/sets/right/token_spec.rb +5 -0
- data/spec/mods/standard/sets/right/update_spec.rb +0 -1
- data/spec/mods/standard/sets/right/when_created_spec.rb +0 -1
- data/spec/mods/standard/sets/right/when_last_edited_spec.rb +0 -1
- data/spec/mods/standard/sets/rstar/rules_spec.rb +3 -4
- data/spec/mods/standard/sets/self/account_links_spec.rb +0 -1
- data/spec/mods/standard/sets/self/alerts_spec.rb +0 -1
- data/spec/mods/standard/sets/self/all_spec.rb +47 -0
- data/spec/mods/standard/sets/self/foot_spec.rb +0 -1
- data/spec/mods/standard/sets/self/head_spec.rb +0 -1
- data/spec/mods/standard/sets/self/navbox_spec.rb +0 -1
- data/spec/mods/standard/sets/self/now_spec.rb +0 -1
- data/spec/mods/standard/sets/self/recent_spec.rb +1 -2
- data/spec/mods/standard/sets/self/search_spec.rb +1 -2
- data/spec/mods/standard/sets/self/signin_spec.rb +73 -0
- data/spec/mods/standard/sets/self/stats_spec.rb +12 -0
- data/spec/mods/standard/sets/self/style_functional_spec.rb +1 -2
- data/spec/mods/standard/sets/self/style_jquery_ui_smoothness_spec.rb +1 -2
- data/spec/mods/standard/sets/self/style_standard_spec.rb +1 -2
- data/spec/mods/standard/sets/self/version_spec.rb +0 -1
- data/spec/mods/standard/sets/type/basic_spec.rb +1 -2
- data/spec/mods/standard/sets/type/cardtype_spec.rb +1 -2
- data/spec/mods/standard/sets/type/coffeescript_spec.rb +28 -0
- data/spec/mods/standard/sets/type/css_spec.rb +31 -4
- data/spec/mods/standard/sets/type/date_spec.rb +0 -1
- data/spec/mods/standard/sets/type/file_spec.rb +1 -2
- data/spec/mods/standard/sets/type/html_spec.rb +3 -4
- data/spec/mods/standard/sets/type/image_spec.rb +1 -2
- data/spec/mods/standard/sets/type/javascript_spec.rb +28 -0
- data/spec/mods/standard/sets/type/layout_type_spec.rb +0 -1
- data/spec/mods/standard/sets/type/number_spec.rb +0 -1
- data/spec/mods/standard/sets/type/phrase_spec.rb +0 -1
- data/spec/mods/standard/sets/type/plain_text_spec.rb +0 -1
- data/spec/mods/standard/sets/type/pointer_spec.rb +1 -2
- data/spec/mods/standard/sets/type/scss_spec.rb +47 -2
- data/spec/mods/standard/sets/type/search_type_spec.rb +14 -3
- data/spec/mods/standard/sets/type/set_spec.rb +0 -1
- data/spec/mods/standard/sets/type/setting_spec.rb +6 -2
- data/spec/mods/standard/sets/type/signup_spec.rb +93 -0
- data/spec/mods/standard/sets/type/skin_spec.rb +23 -2
- data/spec/mods/standard/sets/type/toggle_spec.rb +0 -1
- data/spec/mods/standard/sets/type/user_spec.rb +1 -2
- data/{lib/wagn → spec}/spec_helper.rb +59 -14
- data/test/1.10.0-data-dump.sql +327 -0
- data/test/fixtures/card_references.yml +777 -581
- data/test/fixtures/card_revisions.yml +2737 -2488
- data/test/fixtures/cards.yml +4037 -2184
- data/test/performance/card_create_test.rb +1 -1
- data/test/performance/render_test.rb +1 -1
- data/test/seed.rb +36 -63
- data/test/test_helper.rb +1 -1
- data/wagn.gemspec +9 -9
- metadata +257 -237
- data/app/assets/javascripts/html5shiv-printshiv.js +0 -499
- data/app/controllers/account_controller.rb +0 -61
- data/app/controllers/admin_controller.rb +0 -124
- data/app/controllers/stub_card_controller.rb +0 -9
- data/app/controllers/wagn_controller.rb +0 -165
- data/app/mailers/mailer.rb +0 -109
- data/app/models/.gitkeep +0 -0
- data/app/models/account.rb +0 -198
- data/app/models/user.rb +0 -123
- data/app/views/mailer/account_info.text.erb +0 -17
- data/config/initializers/backtrace_silencers.rb +0 -8
- data/config/initializers/schema_views.rb +0 -59
- data/config/initializers/wrap_parameters.rb +0 -15
- data/config/samples/database.yml.erb +0 -34
- data/db/bootstrap/users.yml +0 -29
- data/features/account_requests.feature +0 -22
- data/features/google_maps.feature +0 -31
- data/features/hello_wagn.feature +0 -31
- data/features/step_definitions/notification_steps.rb +0 -23
- data/features/templates.feature +0 -30
- data/features/virtual_cards.feature +0 -11
- data/lib/active_record/foreign_keys.rb +0 -80
- data/lib/card/constant.rb +0 -20
- data/lib/generators/set/templates/set_template.erb +0 -1
- data/lib/tasks/.gitkeep +0 -0
- data/lib/wagn/authenticated_system.rb +0 -38
- data/lib/wagn/env.rb +0 -42
- data/lib/wagn/loader.rb +0 -135
- data/mods/standard/formats/kml_format.rb +0 -6
- data/mods/standard/lib/google_maps_addon.rb +0 -30
- data/mods/standard/sets/all/admin.rb +0 -53
- data/mods/standard/sets/all/geocode.rb +0 -16
- data/mods/standard/sets/all/kml.rb +0 -49
- data/mods/standard/sets/type/account_request.rb +0 -74
- data/mods/standard/sets/type/ruby_and_script.rb +0 -31
- data/public/assets/application-058913c45d4f3262667bad443a03eb45.js +0 -144
- data/public/assets/application-058913c45d4f3262667bad443a03eb45.js.gz +0 -0
- data/public/assets/application.js +0 -144
- data/public/assets/application.js.gz +0 -0
- data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js +0 -1
- data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js.gz +0 -0
- data/public/assets/html5shiv-printshiv.js.gz +0 -0
- data/public/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/assets/images/ui-icons_222222_256x240-66e635a2f90b9f90675d402617630b24.png +0 -0
- data/public/assets/images/ui-icons_222222_256x240.png +0 -0
- data/public/assets/images/ui-icons_2e83ff_256x240-2ea4c160a75c1992daa2eeac86255b99.png +0 -0
- data/public/assets/images/ui-icons_454545_256x240-5c7f12676bcead9cb2d4cb8f23f16e95.png +0 -0
- data/public/assets/images/ui-icons_888888_256x240-95fd3047e1f7325d995a21c729b04125.png +0 -0
- data/public/assets/images/ui-icons_cd0a0a_256x240-c0c1ec6a8bcf48fec40303e975a4dfa6.png +0 -0
- data/public/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery.min-8b58c0fbf303b938d8e749262f7e50dd.map +0 -1
- data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js +0 -13
- data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js.gz +0 -0
- data/public/assets/tinymce.js +0 -13
- data/public/assets/tinymce.js.gz +0 -0
- data/spec/controllers/account_controller_spec.rb +0 -42
- data/spec/controllers/admin_controller_spec.rb +0 -23
- data/spec/controllers/captcha_spec.rb +0 -103
- data/spec/controllers/sets_spec.rb +0 -97
- data/spec/controllers/wagn_controller_spec.rb +0 -5
- data/spec/mailers/account_spec.rb +0 -66
- data/spec/models/account_spec.rb +0 -19
- data/spec/models/card/comment_spec.rb +0 -38
- data/spec/models/card/revision_spec.rb +0 -58
- data/spec/models/user_spec.rb +0 -95
- data/spec/mods/standard/formats/kml_format_spec.rb +0 -6
- data/spec/mods/standard/sets/all/admin_spec.rb +0 -6
- data/spec/mods/standard/sets/all/geocode_spec.rb +0 -37
- data/spec/mods/standard/sets/all/kml_spec.rb +0 -6
- data/spec/mods/standard/sets/right/crypted_password_spec.rb +0 -6
- data/spec/mods/standard/sets/type/account_request_spec.rb +0 -160
- data/spec/mods/standard/sets/type/ruby_and_script_spec.rb +0 -6
- data/spec/spec.opts +0 -6
- data/test/fixtures/users.yml +0 -169
data/features/support/env.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
ENV['RAILS_ENV'] = "cucumber"
|
3
3
|
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
|
4
7
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
5
8
|
# It is recommended to regenerate this file in the future when you upgrade to a
|
6
9
|
# newer version of cucumber-rails. Consider adding your own code to a new file
|
data/features/support/paths.rb
CHANGED
@@ -16,7 +16,7 @@ module NavigationHelpers
|
|
16
16
|
# Here is an example that pulls values out of the Regexp:
|
17
17
|
#
|
18
18
|
# when /^(.*)'s profile page$/i
|
19
|
-
# user_profile_path(
|
19
|
+
# user_profile_path(Auth[ $1 ])
|
20
20
|
|
21
21
|
when /card (.*) with (.*) layout$/
|
22
22
|
"/#{$1.to_name.url_key}?layout=$2"
|
@@ -31,7 +31,7 @@ module NavigationHelpers
|
|
31
31
|
"/card/new?card[name]=#{CGI.escape($1)}"
|
32
32
|
|
33
33
|
when /edit (.*)$/
|
34
|
-
"
|
34
|
+
"/#{$1.to_name.url_key}?view=edit"
|
35
35
|
|
36
36
|
when /new (.*)$/
|
37
37
|
"/new/#{$1.to_name.url_key}"
|
@@ -4,7 +4,7 @@ Feature: Table of Contents
|
|
4
4
|
I want to be able to set a minimum header number
|
5
5
|
|
6
6
|
Background:
|
7
|
-
Given I
|
7
|
+
Given I am signed in as Joe Admin
|
8
8
|
And I create Basic card "Two Header" with content "<h1>I'm a header</h1><h1>me too</h1>"
|
9
9
|
And I create Basic card "Three Headers" with content "<h1>I'm a header</h1><h2>Me too</h2><h1>same here</h1>"
|
10
10
|
|
@@ -6,7 +6,7 @@ Feature: Updates for Children of watched cards
|
|
6
6
|
#should this be in watch?
|
7
7
|
|
8
8
|
Background:
|
9
|
-
Given I
|
9
|
+
Given I am signed in as Joe User
|
10
10
|
And I create Book card "Ulysses"
|
11
11
|
And Joe Camel is watching "Ulysses"
|
12
12
|
And Joe Admin is watching "Book"
|
@@ -39,10 +39,10 @@ Feature: Updates for Children of watched cards
|
|
39
39
|
Then Joe Admin should be notified that "Joe User updated \"Bros Krmzv\""
|
40
40
|
|
41
41
|
Scenario: Watching a plus card on multiedit; and watching both plus card and including card on multiedit
|
42
|
-
Given I
|
42
|
+
Given I am signed in as Joe Admin
|
43
43
|
And I create Cardtype card "Froot"
|
44
44
|
And I create card "Froot+*type+*structure" with content "{{+color}} {{+flavor}}"
|
45
|
-
And I
|
45
|
+
And I am signed in as Joe User
|
46
46
|
And I create Froot card "Banana" with plusses:
|
47
47
|
|color|flavor|
|
48
48
|
|yellow|sweet|
|
data/features/watch.feature
CHANGED
@@ -5,10 +5,10 @@ Feature: Watch interface
|
|
5
5
|
I want simple watch interface on cards
|
6
6
|
|
7
7
|
Background:
|
8
|
-
Given I
|
8
|
+
Given I am signed in as Joe User
|
9
9
|
|
10
10
|
Scenario: Anonymous User should not see watch UI
|
11
|
-
Given I
|
11
|
+
Given I follow "Sign out"
|
12
12
|
When I go to the homepage
|
13
13
|
And I hover over the main menu
|
14
14
|
Then I should not see "follow"
|
data/lib/card.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
class Card < ActiveRecord::Base
|
4
|
+
require_dependency 'card/active_record_ext'
|
5
|
+
|
6
|
+
require_dependency 'card/codename'
|
4
7
|
require_dependency 'card/query'
|
5
|
-
require_dependency 'card/
|
8
|
+
require_dependency 'card/set_pattern'
|
6
9
|
require_dependency 'card/set'
|
7
10
|
require_dependency 'card/format'
|
8
11
|
require_dependency 'card/exceptions'
|
12
|
+
require_dependency 'card/auth'
|
13
|
+
require_dependency 'card/loader'
|
9
14
|
|
10
|
-
extend
|
11
|
-
extend Card::Constant
|
12
|
-
extend Wagn::Loader
|
15
|
+
extend Set
|
13
16
|
|
14
17
|
has_many :revisions, :order => :id
|
15
18
|
has_many :references_from, :class_name => :Reference, :foreign_key => :referee_id
|
@@ -21,10 +24,9 @@ class Card < ActiveRecord::Base
|
|
21
24
|
@@set_patterns, @@error_codes = [], {}
|
22
25
|
|
23
26
|
attr_writer :selected_revision_id #writer because read method is in mod (and does not override upon load)
|
24
|
-
attr_accessor :action,
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:update_referencers # wrong mechanism for this
|
27
|
+
attr_accessor :action, :supercard,
|
28
|
+
:comment, :comment_author, # obviated soon
|
29
|
+
:update_referencers # wrong mechanism for this
|
28
30
|
|
29
31
|
|
30
32
|
define_callbacks :approve, :store, :extend
|
@@ -33,8 +35,8 @@ class Card < ActiveRecord::Base
|
|
33
35
|
around_save :store
|
34
36
|
after_save :extend
|
35
37
|
|
36
|
-
load_mods
|
37
|
-
|
38
|
+
Loader.load_mods if count > 0
|
39
|
+
|
38
40
|
tracks :content # we can phase this out and just use "dirty" handling once current content is stored in the cards table
|
39
41
|
|
40
42
|
end
|
@@ -1,15 +1,8 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module ActiveRecord
|
3
|
-
module QuotingAndMatching
|
4
|
-
# dummy module to trigger loading code below
|
5
|
-
end
|
6
3
|
|
7
4
|
module ConnectionAdapters
|
8
5
|
class AbstractAdapter
|
9
|
-
def quote_interval(string)
|
10
|
-
raise "quote_interval not implemented"
|
11
|
-
end
|
12
|
-
|
13
6
|
def match(string)
|
14
7
|
raise "match not implemented"
|
15
8
|
end
|
@@ -24,20 +17,12 @@ module ActiveRecord
|
|
24
17
|
end
|
25
18
|
|
26
19
|
class PostgreSQLAdapter
|
27
|
-
def quote_interval(string)
|
28
|
-
"interval '#{string}'"
|
29
|
-
end
|
30
|
-
|
31
20
|
def match(string)
|
32
21
|
"~* #{string}"
|
33
22
|
end
|
34
23
|
end
|
35
24
|
|
36
25
|
module MysqlCommon
|
37
|
-
def quote_interval(string)
|
38
|
-
"interval #{string}"
|
39
|
-
end
|
40
|
-
|
41
26
|
def match(string)
|
42
27
|
"REGEXP #{string}"
|
43
28
|
end
|
@@ -60,13 +45,33 @@ module ActiveRecord
|
|
60
45
|
end
|
61
46
|
|
62
47
|
class SQLiteAdapter
|
63
|
-
def quote_interval(string)
|
64
|
-
"interval #{string}"
|
65
|
-
end
|
66
|
-
|
67
48
|
def match(string)
|
68
49
|
"REGEXP #{string}"
|
69
50
|
end
|
70
51
|
end
|
71
52
|
end
|
72
|
-
|
53
|
+
|
54
|
+
module Transactions
|
55
|
+
#FIXME!!
|
56
|
+
# the following code is already in Rails 4 (see https://github.com/rails/rails/commit/c8792c7b2ea4f5fe7a5610225433ea8dd8d0f83e)
|
57
|
+
# it allows manual rollbacks in after_save (eg store events) to reset the object correctly
|
58
|
+
# hopefully we can soon get rid of this code!
|
59
|
+
|
60
|
+
def with_transaction_returning_status
|
61
|
+
status = nil
|
62
|
+
self.class.transaction do
|
63
|
+
add_to_transaction
|
64
|
+
begin
|
65
|
+
status = yield
|
66
|
+
rescue ActiveRecord::Rollback
|
67
|
+
@_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
|
68
|
+
status = nil
|
69
|
+
end
|
70
|
+
|
71
|
+
raise ActiveRecord::Rollback unless status
|
72
|
+
end
|
73
|
+
status
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
data/lib/card/auth.rb
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class Card
|
4
|
+
module Auth
|
5
|
+
@@as_card = @@as_id = @@current_id = @@current = @@simulating_setup_need = nil
|
6
|
+
|
7
|
+
NON_CREATEABLE_TYPES = %w{ signup setting set } # NEED API
|
8
|
+
NEED_SETUP_KEY = 'NEED_SETUP'
|
9
|
+
|
10
|
+
#after_save :reset_instance_cache
|
11
|
+
|
12
|
+
class << self
|
13
|
+
|
14
|
+
# Authenticates a user by their login name and unencrypted password.
|
15
|
+
def authenticate email, password
|
16
|
+
accounted = Auth[ email ]
|
17
|
+
if accounted and account = accounted.account and account.active?
|
18
|
+
if Wagn.config.no_authentication or password_authenticated?( account, password.strip )
|
19
|
+
accounted.id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def password_authenticated? account, password
|
25
|
+
account.password == encrypt( password, account.salt )
|
26
|
+
end
|
27
|
+
|
28
|
+
def authenticate_by_token token
|
29
|
+
token_card = find_token_card(token) or return :token_not_found
|
30
|
+
|
31
|
+
token_card.updated_at >
|
32
|
+
Wagn.config.token_expiry.ago or return :token_expired # > means "after"
|
33
|
+
|
34
|
+
account = token_card.left and
|
35
|
+
account.right_id==Card::AccountID or return :bad_account
|
36
|
+
|
37
|
+
accounted = account.left and
|
38
|
+
accounted.accountable? or return :illegal_account #(overkill?)
|
39
|
+
|
40
|
+
as_bot { token_card.delete! }
|
41
|
+
accounted.id
|
42
|
+
end
|
43
|
+
|
44
|
+
def find_token_card token
|
45
|
+
Auth.as_bot do
|
46
|
+
Card.search(
|
47
|
+
:right_id=>Card::TokenID,
|
48
|
+
:content=>token
|
49
|
+
).first
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Encrypts some data with the salt.
|
54
|
+
def encrypt password, salt
|
55
|
+
Digest::SHA1.hexdigest "#{salt}--#{password}--"
|
56
|
+
end
|
57
|
+
|
58
|
+
# find accounted by email
|
59
|
+
def [] email
|
60
|
+
Auth.as_bot do
|
61
|
+
Card.search( :right_plus=>[
|
62
|
+
{:id=>Card::AccountID},
|
63
|
+
{:right_plus=>[{:id=>Card::EmailID},{ :content=>email.strip.downcase }]}
|
64
|
+
]).first
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def signin signin_id
|
69
|
+
self.current_id = signin_id
|
70
|
+
session[:user] = signin_id if session
|
71
|
+
end
|
72
|
+
|
73
|
+
def session
|
74
|
+
Card::Env[:session]
|
75
|
+
end
|
76
|
+
|
77
|
+
def set_current_from_session
|
78
|
+
self.current_id =
|
79
|
+
if session
|
80
|
+
if card_id=session[:user] and Card.exists? card_id
|
81
|
+
card_id
|
82
|
+
else
|
83
|
+
session[:user] = nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
current_id
|
87
|
+
end
|
88
|
+
|
89
|
+
def current_id
|
90
|
+
@@current_id ||= Card::AnonymousID
|
91
|
+
end
|
92
|
+
|
93
|
+
def current
|
94
|
+
if @@current && @@current.id == current_id
|
95
|
+
@@current
|
96
|
+
else
|
97
|
+
@@current = Card[current_id]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def current_id= card_id
|
102
|
+
@@current = @@as_id = @@as_card = nil
|
103
|
+
@@current_id = card_id
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_user_id user
|
107
|
+
case user
|
108
|
+
when NilClass; nil
|
109
|
+
when Card ; user.id
|
110
|
+
when Integer ; user
|
111
|
+
else
|
112
|
+
user = user.to_s
|
113
|
+
Card::Codename[user] or (cd=Card[user] and cd.id)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def as given_user
|
118
|
+
tmp_id, tmp_card = @@as_id, @@as_card
|
119
|
+
@@as_id, @@as_card = get_user_id( given_user ), nil # we could go ahead and set as_card if given a card...
|
120
|
+
|
121
|
+
@@current_id = @@as_id if @@current_id.nil?
|
122
|
+
|
123
|
+
if block_given?
|
124
|
+
value = yield
|
125
|
+
@@as_id, @@as_card = tmp_id, tmp_card
|
126
|
+
return value
|
127
|
+
else
|
128
|
+
#fail "BLOCK REQUIRED with Card#as"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def as_bot &block
|
133
|
+
as Card::WagnBotID, &block
|
134
|
+
end
|
135
|
+
|
136
|
+
def among? authzed
|
137
|
+
as_card.among? authzed
|
138
|
+
end
|
139
|
+
|
140
|
+
def as_id
|
141
|
+
@@as_id || current_id
|
142
|
+
end
|
143
|
+
|
144
|
+
def as_card
|
145
|
+
if @@as_card and @@as_card.id == as_id
|
146
|
+
@@as_card
|
147
|
+
else
|
148
|
+
@@as_card = Card[as_id]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def signed_in?
|
153
|
+
current_id != Card::AnonymousID
|
154
|
+
end
|
155
|
+
|
156
|
+
def needs_setup?
|
157
|
+
test = Card.cache.read NEED_SETUP_KEY
|
158
|
+
!test.nil? ? test : begin
|
159
|
+
@@simulating_setup_need or Card.cache.write( NEED_SETUP_KEY, (account_count < 3) ) # 3, because
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def simulate_setup_need! mode=true
|
164
|
+
@@simulating_setup_need = mode
|
165
|
+
Card.cache.write NEED_SETUP_KEY, nil
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
def always_ok?
|
170
|
+
#warn Rails.logger.warn("aok? #{as_id}, #{as_id&&Card[as_id].id}")
|
171
|
+
return false unless usr_id = as_id
|
172
|
+
return true if usr_id == Card::WagnBotID #cannot disable
|
173
|
+
|
174
|
+
always = Card.cache.read('ALWAYS') || {}
|
175
|
+
#warn(Rails.logger.warn "Auth.always_ok? #{usr_id}")
|
176
|
+
if always[usr_id].nil?
|
177
|
+
always = always.dup if always.frozen?
|
178
|
+
always[usr_id] = !!Card[usr_id].all_roles.detect{|r|r==Card::AdministratorID}
|
179
|
+
#warn(Rails.logger.warn "update always hash #{always[usr_id]}, #{always.inspect}")
|
180
|
+
Card.cache.write 'ALWAYS', always
|
181
|
+
end
|
182
|
+
#warn Rails.logger.warn("aok? #{usr_id}, #{always[usr_id]}")
|
183
|
+
always[usr_id]
|
184
|
+
end
|
185
|
+
# PERMISSIONS
|
186
|
+
|
187
|
+
|
188
|
+
def createable_types
|
189
|
+
type_names = Auth.as_bot do
|
190
|
+
Card.search :type=>Card::CardtypeID, :return=>:name, :not => { :codename => ['in'] + NON_CREATEABLE_TYPES }
|
191
|
+
end
|
192
|
+
type_names.reject do |name|
|
193
|
+
!Card.new( :type=>name ).ok? :create
|
194
|
+
end.sort
|
195
|
+
end
|
196
|
+
|
197
|
+
private
|
198
|
+
|
199
|
+
def account_count
|
200
|
+
as_bot { Card.count_by_wql :right=>Card[:account].name }
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
data/lib/card/chunk.rb
CHANGED
@@ -8,96 +8,97 @@ require 'uri/common'
|
|
8
8
|
# Chunks are initalized by passing in the result of a
|
9
9
|
# match by its pattern.
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
class Card
|
12
|
+
module Chunk
|
13
|
+
mattr_accessor :raw_list, :prefix_regexp_by_list, :prefix_map
|
14
|
+
@@raw_list, @@prefix_regexp_by_list, @@prefix_map = {}, {}, {}
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
class << self
|
17
|
+
def register_class klass, hash
|
18
|
+
klass.config = hash.merge :class => klass
|
19
|
+
prefix_index = hash[:idx_char] || :default # this is gross and needs to be moved out.
|
20
|
+
prefix_map[prefix_index] = klass.config
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def register_list key, list
|
24
|
+
raw_list[key] = list
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def find_class_by_prefix prefix
|
28
|
+
config = prefix_map[ prefix[0,1] ] || prefix_map[ prefix[-1,1] ] || prefix_map[:default]
|
29
|
+
#prefix identified by first character, last character, or default. a little ugly...
|
30
|
+
config[:class]
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
def get_prefix_regexp chunk_list_key
|
34
|
+
prefix_regexp_by_list[chunk_list_key] ||= begin
|
35
|
+
chunk_types = raw_list[chunk_list_key].map { |chunkname| const_get chunkname }
|
36
|
+
prefix_res = chunk_types.map do |chunk_class|
|
37
|
+
chunk_class.config[:prefix_re]
|
38
|
+
end
|
39
|
+
/(?:#{ prefix_res * '|' })/m
|
37
40
|
end
|
38
|
-
/(?:#{ prefix_res * '|' })/m
|
39
41
|
end
|
40
|
-
end
|
41
42
|
|
42
|
-
|
43
|
+
end
|
43
44
|
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
#not sure whether this is best place. Could really happen almost anywhere (even before chunk classes are loaded).
|
47
|
+
register_list :default, [ :URI, :HostURI, :EmailURI, :EscapedLiteral, :Include, :Link ]
|
48
|
+
register_list :references, [ :EscapedLiteral, :Include, :Link ]
|
49
|
+
register_list :inclusion_only, [ :Include ]
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
class Abstract
|
52
|
+
class_attribute :config
|
53
|
+
attr_reader :text, :process_chunk
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
# warn "attempting full match on #{content}. class = #{self}"
|
57
|
-
|
58
|
-
|
55
|
+
class << self
|
56
|
+
def full_match content, prefix=nil
|
57
|
+
# warn "attempting full match on #{content}. class = #{self}"
|
58
|
+
content.match full_re( prefix )
|
59
|
+
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
def full_re prefix
|
62
|
+
config[:full_re]
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
65
|
+
def context_ok? content, chunk_start
|
66
|
+
true
|
67
|
+
end
|
66
68
|
end
|
67
|
-
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
def initialize match, content
|
71
|
+
@text = match[0]
|
72
|
+
@processed = nil
|
73
|
+
@content = content
|
74
|
+
interpret match, content
|
75
|
+
self
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
def interpret match_string, content, params
|
79
|
+
Rails.logger.info "no #interpret method found for chunk class: #{self.class}"
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
def format
|
83
|
+
@content.format
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
def card
|
87
|
+
@content.card
|
88
|
+
end
|
88
89
|
|
89
|
-
|
90
|
-
|
91
|
-
|
90
|
+
def to_s
|
91
|
+
@process_chunk || @processed || @text
|
92
|
+
end
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
def inspect
|
95
|
+
"<##{self.class}##{to_s}>"
|
96
|
+
end
|
96
97
|
|
97
|
-
|
98
|
-
|
98
|
+
def as_json(options={})
|
99
|
+
@process_chunk || @processed|| "not rendered #{self.class}, #{card and card.name}"
|
100
|
+
end
|
99
101
|
end
|
100
102
|
end
|
101
|
-
|
102
|
-
Card.load_chunks
|
103
|
+
Loader.load_chunks
|
103
104
|
end
|