card 1.104.2 → 1.105.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -6
- data/VERSION +1 -1
- data/config/environments/development.rb +1 -1
- data/config/environments/test.rb +1 -0
- data/config/initializers/01_core_extensions/object.rb +10 -0
- data/config/initializers/01_core_extensions/string.rb +9 -0
- data/config/initializers/core_extensions.rb +1 -0
- data/db/migrate/{20160122153608_new_indeces.rb → 20160122153608_new_indices.rb} +2 -2
- data/db/migrate/{20200805200729_add_unique_pair_indeces.rb → 20200805200729_add_unique_pair_indices.rb} +1 -1
- data/db/migrate/20221031182227_remove_referee_key_requirement.rb +11 -0
- data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +1 -9
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +1 -38
- data/db/migrate_core_cards/20161103154836_update_keys.rb +1 -1
- data/db/migrate_core_cards/20180905061537_migrate_layouts.rb +1 -1
- data/db/migrate_core_cards/20190125125150_add_script_rules_card.rb +1 -1
- data/db/migrate_core_cards/20190320091257_upgrade_recaptcha_to_v3.rb +1 -1
- data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +2 -20
- data/db/migrate_core_cards/20190528131330_enabled_roles.rb +0 -3
- data/db/migrate_core_cards/20190625153616_pointer_overhaul.rb +0 -2
- data/db/migrate_core_cards/20190718140126_add_guides.rb +1 -1
- data/db/migrate_core_cards/20190822093633_move_help_text_to_code.rb +1 -1
- data/db/migrate_core_cards/20190829205148_remove_add_help.rb +1 -1
- data/db/migrate_core_cards/20190902193208_input_type.rb +1 -1
- data/db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb +2 -2
- data/db/schema.rb +2 -2
- data/db/seeds.rb +14 -1
- data/db/version.txt +1 -1
- data/lib/card/auth/current.rb +4 -2
- data/lib/card/auth/permissions.rb +1 -1
- data/lib/card/auth/setup.rb +1 -1
- data/lib/card/auth/token.rb +1 -1
- data/lib/card/cache/persistent.rb +4 -1
- data/lib/card/codename.rb +2 -6
- data/lib/card/content/all.rb +2 -2
- data/lib/card/content/clean.rb +1 -1
- data/lib/card/content/parser.rb +0 -2
- data/lib/card/content.rb +1 -8
- data/lib/card/director/all.rb +67 -0
- data/lib/card/director/card_class.rb +161 -2
- data/lib/card/director/{act_direction.rb → class_methods.rb} +13 -3
- data/lib/card/director/phases.rb +7 -4
- data/lib/card/director/run.rb +51 -50
- data/lib/card/director/stages.rb +18 -16
- data/lib/card/director/store.rb +1 -1
- data/lib/card/director.rb +6 -7
- data/lib/card/env/location.rb +1 -1
- data/lib/card/env/serializable.rb +2 -0
- data/lib/card/env/serialization.rb +2 -3
- data/lib/card/env.rb +2 -2
- data/lib/card/error.rb +9 -5
- data/lib/card/fetch/card_class.rb +19 -13
- data/lib/card/format/error.rb +6 -12
- data/lib/card/format/nest.rb +1 -1
- data/lib/card/format/wrapper.rb +1 -1
- data/lib/card/format.rb +4 -0
- data/lib/card/model/save_helper/save_arguments.rb +0 -44
- data/lib/card/model/save_helper/save_helper_helper.rb +0 -37
- data/lib/card/model/save_helper.rb +0 -82
- data/lib/card/name/all.rb +1 -4
- data/lib/card/name/card_class.rb +0 -2
- data/lib/card/name/name_variants.rb +4 -0
- data/lib/card/name.rb +3 -8
- data/lib/card/query/abstract_query/query_helper.rb +3 -5
- data/lib/card/query/abstract_query/tie.rb +1 -1
- data/lib/card/query/abstract_query.rb +36 -17
- data/lib/card/query/card_class.rb +36 -0
- data/lib/card/query/card_query/custom.rb +12 -0
- data/lib/card/query/card_query/interpretation.rb +1 -0
- data/lib/card/query/card_query/normalization.rb +11 -3
- data/lib/card/query/card_query/reference_attributes.rb +3 -2
- data/lib/card/query/card_query/sorting.rb +5 -4
- data/lib/card/query/card_query.rb +1 -0
- data/lib/card/query/sql_statement/order.rb +12 -10
- data/lib/card/query/sql_statement/where.rb +2 -2
- data/lib/card/query.rb +13 -6
- data/lib/card/reference/all.rb +10 -10
- data/lib/card/set/abstract.rb +1 -0
- data/lib/card/set/advanced_api.rb +1 -1
- data/lib/card/set/event/all.rb +9 -1
- data/lib/card/set/event/delayed_event.rb +4 -2
- data/lib/card/set/event/options.rb +1 -1
- data/lib/card/set/event/skip_and_trigger.rb +34 -10
- data/lib/card/set/format/abstract_format/haml_views.rb +3 -3
- data/lib/card/set/format/abstract_format/wrapper.rb +0 -1
- data/lib/card/set/format/abstract_format.rb +5 -4
- data/lib/card/set/format/haml_paths.rb +5 -21
- data/lib/card/set/format.rb +46 -20
- data/lib/card/set/helpers.rb +49 -36
- data/lib/card/set/inheritance.rb +4 -4
- data/lib/card/set/pattern/all.rb +1 -1
- data/lib/card/set/pattern/base.rb +1 -1
- data/lib/card/set/pattern/class_methods.rb +4 -4
- data/lib/card/set/registrar.rb +3 -5
- data/lib/card/set/required_field.rb +3 -2
- data/lib/card/set/trait.rb +1 -1
- data/lib/card/set/type.rb +1 -41
- data/lib/card/set.rb +67 -21
- data/lib/card/setting.rb +0 -1
- data/lib/card/subcards/all.rb +6 -8
- data/lib/card/subcards/args.rb +9 -9
- data/lib/card/view/cache/cache_action.rb +1 -1
- data/lib/card/view/options/visibility.rb +4 -0
- data/lib/card/view/options.rb +1 -0
- data/lib/card/view/permission.rb +12 -4
- data/lib/card/view.rb +4 -0
- data/lib/card.rb +48 -39
- data/lib/cardio/cli.rb +3 -1
- data/lib/cardio/command/application.rb +5 -0
- data/lib/cardio/{commands/command.rb → command/command_base.rb} +2 -2
- data/lib/cardio/{commands → command}/custom.rb +17 -13
- data/lib/cardio/{commands → command}/rake_command/parser.rb +3 -3
- data/lib/cardio/{commands → command}/rake_command.rb +5 -5
- data/lib/cardio/{commands → command}/rspec_command/parser.rb +9 -6
- data/lib/cardio/{commands → command}/rspec_command.rb +7 -9
- data/lib/cardio/command.rb +129 -0
- data/lib/cardio/commands.rb +17 -116
- data/lib/cardio/generators/deck_generator_loader.rb +1 -0
- data/lib/cardio/generators.rb +2 -2
- data/lib/cardio/migration.rb +3 -53
- data/lib/cardio/mod/class_methods.rb +28 -24
- data/lib/cardio/mod/dirs.rb +30 -23
- data/lib/cardio/mod/eat/edibles.rb +43 -16
- data/lib/cardio/mod/eat.rb +20 -14
- data/lib/cardio/mod/load_strategy/set_tmp_files.rb +1 -1
- data/lib/cardio/mod/load_strategy.rb +12 -2
- data/lib/cardio/mod/modfile_api.rb +18 -18
- data/lib/cardio/mod/{poop.rb → sow.rb} +25 -33
- data/lib/cardio/mod.rb +46 -73
- data/lib/cardio/railtie.rb +21 -58
- data/lib/cardio/schema.rb +2 -1
- data/lib/cardio/script_loader.rb +3 -1
- data/lib/cardio/seed.rb +101 -8
- data/lib/cardio/utils.rb +39 -1
- data/lib/generators/deck/deck_generator.rb +5 -2
- data/lib/generators/deck/templates/config/puma.rb +1 -1
- data/lib/generators/deck/templates/script/decko_rspec +1 -1
- data/lib/generators/deck/templates/simplecov.rb.erb +10 -8
- data/lib/generators/mod/USAGE +1 -1
- data/lib/generators/mod/mod_generator.rb +5 -5
- data/lib/generators/set/USAGE +2 -2
- data/mod/core/{locales → config/locales}/de.yml +4 -0
- data/mod/core/{locales → config/locales}/en.yml +13 -0
- data/mod/core/data/fixtures/real/card_actions.yml +78 -0
- data/{db/seed/new → mod/core/data/fixtures/real}/card_acts.yml +2 -2
- data/mod/core/data/fixtures/real/card_references.yml +8 -0
- data/mod/core/data/fixtures/real/cards.yml +135 -0
- data/mod/core/data/real.yml +79 -0
- data/mod/core/data/test/cardtype.yml +38 -0
- data/mod/core/data/test/sample.yml +50 -0
- data/mod/core/data/test/user.yml +41 -0
- data/mod/core/data/test.yml +79 -28
- data/{lib → mod/core/lib}/tasks/card/migrate.rake +4 -0
- data/{lib → mod/core/lib}/tasks/card/mod.rake +9 -5
- data/mod/core/lib/tasks/card/seed.rake +60 -0
- data/mod/core/lib/tasks/card.rake +119 -0
- data/mod/core/set/all/admin.rb +14 -0
- data/mod/core/set/all/codename.rb +4 -0
- data/mod/core/set/all/content.rb +8 -4
- data/mod/core/set/all/{abort.rb → result.rb} +11 -15
- data/mod/core/set/all/states.rb +21 -1
- data/mod/core/set/all/trash.rb +25 -73
- data/mod/core/set/all/type.rb +2 -2
- data/mod/core/set/all/utils.rb +3 -87
- data/mod/core/set/right/autoname.rb +2 -0
- data/mod/core/set/self/admin/warning_alert.haml +3 -0
- data/mod/core/set/self/admin.rb +173 -0
- data/mod/core/set/type/cardtype.rb +2 -0
- data/mod/core/set_pattern/02_all_plus.rb +1 -1
- data/mod/core/set_pattern/05_rstar.rb +1 -1
- data/mod/core/set_pattern/06_rule.rb +1 -1
- data/mod/core/set_pattern/07_right.rb +1 -1
- data/mod/core/set_pattern/08_type_plus_right.rb +1 -1
- data/mod/core/spec/set/all/assign_attributes_spec.rb +3 -3
- data/mod/core/spec/set/all/autoname_spec.rb +25 -0
- data/mod/core/spec/set/all/codename_spec.rb +1 -1
- data/mod/core/spec/set/all/name_events_spec.rb +43 -66
- data/mod/core/spec/set/all/trash_spec.rb +149 -68
- data/mod/{admin → core}/spec/set/self/admin_spec.rb +25 -22
- data/mod/core/spec/set/self/trash_spec.rb +5 -0
- metadata +88 -253
- data/db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb +0 -18
- data/db/migrate_core_cards/20130419215612_import_help_text.rb +0 -13
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +0 -100
- data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +0 -11
- data/db/migrate_core_cards/20130927191728_account_events.rb +0 -20
- data/db/migrate_core_cards/20131016172445_common_css_patch.rb +0 -9
- data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +0 -8
- data/db/migrate_core_cards/20140512155840_add_script_cards.rb +0 -86
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +0 -132
- data/db/migrate_core_cards/20140725180118_config_card_updates.rb +0 -9
- data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +0 -7
- data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +0 -14
- data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +0 -15
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +0 -10
- data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +0 -26
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +0 -13
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +0 -76
- data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +0 -41
- data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +0 -36
- data/db/migrate_core_cards/20150331135745_new_card_menu.rb +0 -8
- data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +0 -11
- data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +0 -24
- data/db/migrate_core_cards/20150528084659_add_session_cardtype.rb +0 -18
- data/db/migrate_core_cards/20150601133433_add_recent_setting_session_card.rb +0 -18
- data/db/migrate_core_cards/20150610171702_add_debugger_session_card.rb +0 -12
- data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +0 -58
- data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +0 -7
- data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +0 -9
- data/db/migrate_core_cards/20150708224756_add_list_cards.rb +0 -29
- data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +0 -15
- data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +0 -10
- data/db/migrate_core_cards/20151120180631_add_token_expiration.rb +0 -7
- data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +0 -10
- data/db/migrate_core_cards/20160804112510_reorganize_scripts.rb +0 -27
- data/db/migrate_core_cards/20160908154210_add_trash_card.rb +0 -7
- data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +0 -17
- data/db/migrate_core_cards/20170209132834_email_test_context.rb +0 -49
- data/db/migrate_core_cards/20170314175313_add_notification_event_card.rb +0 -20
- data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +0 -20
- data/db/migrate_core_cards/20170608083819_add_full_width_layout_card.rb +0 -23
- data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +0 -8
- data/db/migrate_core_cards/20180423120222_add_mod_styles_card.rb +0 -20
- data/db/migrate_core_cards/20180508210903_add_json_type.rb +0 -10
- data/db/migrate_core_cards/20180515175726_add_codenames.rb +0 -8
- data/db/migrate_core_cards/20180712042655_head_rule.rb +0 -13
- data/db/migrate_core_cards/20181120200937_update_layout.rb +0 -7
- data/db/migrate_core_cards/20190204195039_add_rule_card.rb +0 -10
- data/db/migrate_core_cards/20190321085735_wagn_to_decko_logo.rb +0 -11
- data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +0 -17
- data/db/migrate_core_cards/20190424100531_update_credit_image.rb +0 -76
- data/db/migrate_core_cards/20190424101004_add_read_anyone_rules.rb +0 -13
- data/db/migrate_core_cards/20190503122739_update_pristine_data.rb +0 -18
- data/db/migrate_core_cards/20190605133556_tweak_config_cards.rb +0 -10
- data/db/migrate_core_cards/20190618110446_add_dropdown_divider.rb +0 -8
- data/db/migrate_core_cards/20190621143156_add_role_assign_permissions.rb +0 -9
- data/db/migrate_core_cards/20190710090209_homepage_tweaks.rb +0 -13
- data/db/migrate_core_cards/20190820155833_update_cardtype_type_structure.rb +0 -7
- data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +0 -19
- data/db/migrate_core_cards/20190826132738_add_more_guides.rb +0 -7
- data/db/migrate_core_cards/20190829093961_cardtype_grouping.rb +0 -16
- data/db/migrate_core_cards/20190830131820_setting_settings_aside.rb +0 -17
- data/db/migrate_core_cards/20190902161223_add_style_media.rb +0 -7
- data/db/migrate_core_cards/20190918200115_ensure_description_card.rb +0 -13
- data/db/migrate_core_cards/20191008201046_fixture_fix.rb +0 -11
- data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +0 -9
- data/db/migrate_core_cards/20191118145629_codename_fixes.rb +0 -5
- data/db/migrate_core_cards/20200821231558_add_nest_list_type.rb +0 -9
- data/db/migrate_core_cards/data/1.11_help_text.json +0 -410
- data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +0 -104
- data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +0 -228
- data/db/migrate_core_cards/data/1.12_stylesheets/right_sidebar.scss +0 -27
- data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -143
- data/db/migrate_core_cards/data/1.13_config_text.json +0 -32
- data/db/migrate_core_cards/data/1.14_config_descriptions_etc.json +0 -77
- data/db/migrate_core_cards/data/bootstrap_layout.json +0 -96
- data/db/migrate_core_cards/data/cards/Xaccount +0 -22
- data/db/migrate_core_cards/data/cards/Xaccount_setting-Xright-Xstructure +0 -12
- data/db/migrate_core_cards/data/cards/Xall-Xlayout +0 -1
- data/db/migrate_core_cards/data/cards/Xcredit +0 -2
- data/db/migrate_core_cards/data/cards/Xfooter +0 -3
- data/db/migrate_core_cards/data/cards/Xgetting_started +0 -31
- data/db/migrate_core_cards/data/cards/Xgetting_started-shark +0 -66
- data/db/migrate_core_cards/data/cards/Xgetting_started_link +0 -6
- data/db/migrate_core_cards/data/cards/Xheader +0 -19
- data/db/migrate_core_cards/data/cards/Xhome +0 -1
- data/db/migrate_core_cards/data/cards/Xlogo +0 -1
- data/db/migrate_core_cards/data/cards/Xmain_menu +0 -2
- data/db/migrate_core_cards/data/cards/Xrecaptcha_setting-Xself-Xstructure +0 -1
- data/db/migrate_core_cards/data/cards/Xsidebar +0 -7
- data/db/migrate_core_cards/data/cards/Xstructure-Xright-Xguide +0 -12
- data/db/migrate_core_cards/data/cards/Xtitle +0 -1
- data/db/migrate_core_cards/data/cards/administrator-dashboard +0 -23
- data/db/migrate_core_cards/data/cards/administrator-description +0 -1
- data/db/migrate_core_cards/data/cards/anyone_signed_in-dashboard +0 -0
- data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xguide +0 -24
- data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xstructure +0 -3
- data/db/migrate_core_cards/data/cards/default_layout +0 -6
- data/db/migrate_core_cards/data/cards/full_width_layout +0 -5
- data/db/migrate_core_cards/data/cards/help_desk-dashboard +0 -7
- data/db/migrate_core_cards/data/cards/help_desk-description +0 -1
- data/db/migrate_core_cards/data/cards/home +0 -2
- data/db/migrate_core_cards/data/cards/home-Xself-Xlayout +0 -1
- data/db/migrate_core_cards/data/cards/home-original +0 -22
- data/db/migrate_core_cards/data/cards/home_layout +0 -6
- data/db/migrate_core_cards/data/cards/left_sidebar_layout +0 -6
- data/db/migrate_core_cards/data/cards/menu +0 -1
- data/db/migrate_core_cards/data/cards/right_thin_sidebar_layout +0 -8
- data/db/migrate_core_cards/data/cards/role-Xtype-Xstructure +0 -2
- data/db/migrate_core_cards/data/cards/shark-dashboard +0 -19
- data/db/migrate_core_cards/data/cards/shark-description +0 -1
- data/db/migrate_core_cards/data/cards/shark_menu +0 -2
- data/db/migrate_core_cards/data/cards.yml +0 -138
- data/db/migrate_core_cards/data/decko_logo.svg +0 -1
- data/db/migrate_core_cards/data/mailer/follower_notification_email.html +0 -9
- data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +0 -11
- data/db/migrate_core_cards/data/mailer/mail_config.json +0 -22
- data/db/migrate_core_cards/data/mailer/password_reset_email.html +0 -13
- data/db/migrate_core_cards/data/mailer/password_reset_email.txt +0 -11
- data/db/migrate_core_cards/data/mailer/signup_alert_email.html +0 -7
- data/db/migrate_core_cards/data/mailer/signup_alert_email.txt +0 -5
- data/db/migrate_core_cards/data/mailer/verification_email.html +0 -12
- data/db/migrate_core_cards/data/mailer/verification_email.txt +0 -9
- data/db/migrate_core_cards/data/skin_images.json +0 -91
- data/db/migrate_core_cards/data/themes/bootstrap_default/_bootswatch.scss +0 -0
- data/db/migrate_core_cards/data/themes/bootstrap_default/_variables.scss +0 -867
- data/db/migrate_core_cards/data/themes/cerulean/_bootswatch.scss +0 -125
- data/db/migrate_core_cards/data/themes/cerulean/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/cosmo/_bootswatch.scss +0 -237
- data/db/migrate_core_cards/data/themes/cosmo/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/cyborg/_bootswatch.scss +0 -210
- data/db/migrate_core_cards/data/themes/cyborg/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/darkly/_bootswatch.scss +0 -330
- data/db/migrate_core_cards/data/themes/darkly/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/flatly/_bootswatch.scss +0 -313
- data/db/migrate_core_cards/data/themes/flatly/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/journal/_bootswatch.scss +0 -120
- data/db/migrate_core_cards/data/themes/journal/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/lumen/_bootswatch.scss +0 -496
- data/db/migrate_core_cards/data/themes/lumen/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/paper/_bootswatch.scss +0 -607
- data/db/migrate_core_cards/data/themes/paper/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/readable/_bootswatch.scss +0 -174
- data/db/migrate_core_cards/data/themes/readable/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/sandstone/_bootswatch.scss +0 -194
- data/db/migrate_core_cards/data/themes/sandstone/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/simplex/_bootswatch.scss +0 -142
- data/db/migrate_core_cards/data/themes/simplex/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/slate/_bootswatch.scss +0 -417
- data/db/migrate_core_cards/data/themes/slate/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/spacelab/_bootswatch.scss +0 -137
- data/db/migrate_core_cards/data/themes/spacelab/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/superhero/_bootswatch.scss +0 -332
- data/db/migrate_core_cards/data/themes/superhero/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/united/_bootswatch.scss +0 -42
- data/db/migrate_core_cards/data/themes/united/_variables.scss +0 -861
- data/db/migrate_core_cards/data/themes/yeti/_bootswatch.scss +0 -437
- data/db/migrate_core_cards/data/themes/yeti/_variables.scss +0 -861
- data/db/seed/README.md +0 -2
- data/db/seed/new/card_actions.yml +0 -5913
- data/db/seed/new/card_references.yml +0 -6532
- data/db/seed/new/cards.yml +0 -14595
- data/db/seed/test/fixtures/card_actions.yml +0 -8153
- data/db/seed/test/fixtures/card_acts.yml +0 -1039
- data/db/seed/test/fixtures/card_changes.yml +0 -230
- data/db/seed/test/fixtures/card_references.yml +0 -8471
- data/db/seed/test/fixtures/cards.yml +0 -20171
- data/db/seed/test/fixtures/file1.txt +0 -1
- data/db/seed/test/fixtures/file2.txt +0 -1
- data/db/seed/test/fixtures/mao2.jpg +0 -0
- data/db/seed/test/fixtures/rails.gif +0 -0
- data/db/seed/test/fixtures/schema_migrations.yml +0 -67
- data/db/seed/test/fixtures/schema_migrations_core_cards.yml +0 -347
- data/db/seed/test/fixtures/schema_migrations_deck.yml +0 -1
- data/db/seed/test/fixtures/schema_migrations_deck_cards.yml +0 -5
- data/db/test_seed.rb +0 -322
- data/lib/card/content/truncate.rb +0 -67
- data/lib/card/director/card_methods.rb +0 -45
- data/lib/card/file_card_creator/abstract_file_card/migration_file.rb +0 -50
- data/lib/card/file_card_creator/abstract_file_card/ruby_file.rb +0 -30
- data/lib/card/file_card_creator/abstract_file_card/source_file.rb +0 -36
- data/lib/card/file_card_creator/abstract_file_card.rb +0 -44
- data/lib/card/file_card_creator/haml_card.rb +0 -42
- data/lib/card/file_card_creator/output_helper.rb +0 -53
- data/lib/card/file_card_creator/script_card.rb +0 -35
- data/lib/card/file_card_creator/style_card.rb +0 -25
- data/lib/card/file_card_creator.rb +0 -25
- data/lib/card/name/fields_and_traits.rb +0 -42
- data/lib/cardio/commands/application.rb +0 -10
- data/lib/cardio/migration/import/import_data/card_attributes.rb +0 -64
- data/lib/cardio/migration/import/import_data/card_content.rb +0 -30
- data/lib/cardio/migration/import/import_data.rb +0 -119
- data/lib/cardio/migration/import/merger.rb +0 -46
- data/lib/cardio/migration/import.rb +0 -125
- data/lib/tasks/card/create.rake +0 -81
- data/lib/tasks/card.rake +0 -65
- data/mod/admin/locales/de.yml +0 -4
- data/mod/admin/locales/en.yml +0 -4
- data/mod/admin/set/all/admin.rb +0 -16
- data/mod/admin/set/self/admin.rb +0 -144
- data/mod/admin/set/self/admin_info.rb +0 -40
- data/mod/admin/set/self/debugger.rb +0 -3
- data/mod/admin/spec/set/self/admin_info_spec.rb +0 -9
- data/mod/core/data/production.yml +0 -7
- data/mod/core/set/all/collection.rb +0 -53
- data/mod/core/spec/set/all/collection_spec.rb +0 -170
- data/mod/core/spec/set/all/utils_spec.rb +0 -5
- data/mod/standard/data/files/favicon/image-icon.png +0 -0
- data/mod/standard/data/files/favicon/image-large.png +0 -0
- data/mod/standard/data/files/favicon/image-medium.png +0 -0
- data/mod/standard/data/files/favicon/image-original.png +0 -0
- data/mod/standard/data/files/favicon/image-small.png +0 -0
- data/mod/standard/data/files/logo/image-original.svg +0 -1
- /data/{db/seed/new → mod/core/data/fixtures/real}/card_changes.yml +0 -0
- /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations.yml +0 -0
- /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_core_cards.yml +0 -0
- /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck.yml +0 -0
- /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck_cards.yml +0 -0
@@ -3,10 +3,10 @@ class Card
|
|
3
3
|
class SqlStatement
|
4
4
|
# handle where clause in SqlStatement
|
5
5
|
module Where
|
6
|
-
def where
|
6
|
+
def where explicit=true
|
7
7
|
conditions = [explicit_conditions(@query), implicit_conditions(@query)]
|
8
8
|
conditions = conditions.reject(&:blank?).join " AND "
|
9
|
-
"WHERE #{conditions}" unless conditions.blank?
|
9
|
+
"#{'WHERE ' if explicit}#{conditions}" unless conditions.blank?
|
10
10
|
end
|
11
11
|
|
12
12
|
# conditions explicitly specified in the query object
|
data/lib/card/query.rb
CHANGED
@@ -7,8 +7,8 @@ class Card
|
|
7
7
|
# frequently used directly in code.
|
8
8
|
#
|
9
9
|
# Query "statements" (objects, really) are made in CQL (Card Query
|
10
|
-
# Language). Because CQL is used by Sharks, the primary
|
11
|
-
#
|
10
|
+
# Language). Because CQL is used by Sharks, [the primary CQL Syntax documentation is
|
11
|
+
# on decko.org](https://decko.org/CQL_Syntax). Note that the
|
12
12
|
# examples there are in JSON, like Search card content, but statements in
|
13
13
|
# Card::Query are in ruby form.
|
14
14
|
#
|
@@ -17,9 +17,11 @@ class Card
|
|
17
17
|
# CQL statement interpretation.
|
18
18
|
#
|
19
19
|
# The most common way to use Card::Query is as follows:
|
20
|
+
#
|
20
21
|
# list_of_cards = Card::Query.run(statement)
|
21
22
|
#
|
22
23
|
# This is equivalent to:
|
24
|
+
#
|
23
25
|
# query = Card::Query.new(statement)
|
24
26
|
# list_of_cards = query.run
|
25
27
|
#
|
@@ -32,7 +34,8 @@ class Card
|
|
32
34
|
# - @subqueries - a list of other queries nested within this one
|
33
35
|
#
|
34
36
|
# Each condition is either a SQL-ready string (boo) or an Array in this form:
|
35
|
-
#
|
37
|
+
#
|
38
|
+
# [field_string_or_sym, (Card::Value::Query object)]
|
36
39
|
module Query
|
37
40
|
require "card/query/clause"
|
38
41
|
require "card/query/card_query"
|
@@ -48,8 +51,8 @@ class Card
|
|
48
51
|
# their values are translated fairly directly into SQL-safe values.
|
49
52
|
# (These are referred to as "properties" in CQL documentation. Need to
|
50
53
|
# reconcile #EFM)
|
51
|
-
basic: %i[id name key type_id content left_id right_id
|
52
|
-
creator_id updater_id
|
54
|
+
basic: %i[id name key type_id content left_id right_id codename read_rule_id
|
55
|
+
created_at updated_at creator_id updater_id ],
|
53
56
|
# "Relational" values can involve tying multiple queries together
|
54
57
|
relational: %i[type
|
55
58
|
part left right
|
@@ -68,6 +71,7 @@ class Card
|
|
68
71
|
|
69
72
|
plus_relational: %i[plus left_plus right_plus],
|
70
73
|
conjunction: %i[and or all any],
|
74
|
+
custom: [:compound],
|
71
75
|
ignore: %i[prepend append vars],
|
72
76
|
deprecated: %i[view params size]
|
73
77
|
}.each_with_object({}) do |pair, h|
|
@@ -76,7 +80,10 @@ class Card
|
|
76
80
|
|
77
81
|
CONJUNCTIONS = { any: :or, in: :or, or: :or, all: :and, and: :and }.freeze
|
78
82
|
|
79
|
-
|
83
|
+
# "dir" is DEPRECATED in favor of sort_dir
|
84
|
+
# "sort" is DEPRECATED in favor of sort_by, except in cases where sort's value
|
85
|
+
# is a hash
|
86
|
+
MODIFIERS = %i[conj return sort_by sort_as sort_dir sort dir group limit offset]
|
80
87
|
.each_with_object({}) { |v, h| h[v] = nil }
|
81
88
|
|
82
89
|
OPERATORS =
|
data/lib/card/reference/all.rb
CHANGED
@@ -73,16 +73,6 @@ class Card
|
|
73
73
|
|
74
74
|
private
|
75
75
|
|
76
|
-
def with_normalized_referee referee_name
|
77
|
-
return unless referee_name # eg commented nest has no referee_name
|
78
|
-
|
79
|
-
referee_name = referee_name.to_name
|
80
|
-
referee_key = referee_name.key
|
81
|
-
return if referee_key == key # don't create self reference
|
82
|
-
|
83
|
-
yield referee_name, referee_key, Lexicon.id(referee_name)
|
84
|
-
end
|
85
|
-
|
86
76
|
# interpretation phase helps to prevent duplicate references
|
87
77
|
# results in hash like:
|
88
78
|
# { referee1_key: [referee1_id, referee1_type2],
|
@@ -96,6 +86,16 @@ class Card
|
|
96
86
|
end
|
97
87
|
end
|
98
88
|
|
89
|
+
def with_normalized_referee referee_name
|
90
|
+
return unless referee_name # eg commented nest has no referee_name
|
91
|
+
|
92
|
+
referee_name = referee_name.to_name
|
93
|
+
referee_key = referee_name.key
|
94
|
+
return if referee_key == key # don't create self reference
|
95
|
+
|
96
|
+
yield referee_name, referee_key, Lexicon.id(referee_name)
|
97
|
+
end
|
98
|
+
|
99
99
|
# translate interpreted reference hash into values array,
|
100
100
|
# removing duplicate and unnecessary ref_types
|
101
101
|
def reference_values_array ref_hash
|
data/lib/card/set/abstract.rb
CHANGED
data/lib/card/set/event/all.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
class Card
|
2
2
|
module Set
|
3
3
|
class Event
|
4
|
-
# card methods for testing event applicability
|
4
|
+
# card methods for scheduling events and testing event applicability
|
5
5
|
module All
|
6
|
+
def schedule event
|
7
|
+
@scheduled ||= {}
|
8
|
+
return if @scheduled[event.to_sym]
|
9
|
+
|
10
|
+
send :"#{event}_with_delay"
|
11
|
+
@scheduled[event.to_sym] = true
|
12
|
+
end
|
13
|
+
|
6
14
|
include SkipAndTrigger
|
7
15
|
|
8
16
|
def event_applies? event
|
@@ -8,7 +8,8 @@ class Card
|
|
8
8
|
# needed, then we clearly need to make sure that they are fully restored. At a bare
|
9
9
|
# minimum they would need to include set modules.
|
10
10
|
def serializable_attributes
|
11
|
-
self.class.action_specific_attributes + set_specific.keys -
|
11
|
+
self.class.action_specific_attributes + set_specific.keys -
|
12
|
+
%i[supercard superleft subcards]
|
12
13
|
end
|
13
14
|
|
14
15
|
module Set
|
@@ -28,7 +29,8 @@ class Card
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def with_delay? opts
|
31
|
-
|
32
|
+
opts.delete(:delay) ||
|
33
|
+
DELAY_STAGES.intersect?([opts[:after], opts[:before]].to_set)
|
32
34
|
end
|
33
35
|
|
34
36
|
def define_delayed_event_method
|
@@ -3,6 +3,37 @@ class Card
|
|
3
3
|
class Event
|
4
4
|
# opt into (trigger) or out of (skip) events
|
5
5
|
module SkipAndTrigger
|
6
|
+
settings = [
|
7
|
+
:skip, # [Array] skip event(s) for all cards in act
|
8
|
+
:skip_in_action, # [Array] skip event for just this card
|
9
|
+
:trigger, # [Array] trigger event(s) for all cards in act
|
10
|
+
:trigger_in_action, # [Array] trigger event for just this card
|
11
|
+
]
|
12
|
+
attr_reader(*settings)
|
13
|
+
|
14
|
+
Card.action_specific_attributes +=
|
15
|
+
settings + %i[skip_hash full_skip_hash trigger_hash full_trigger_hash]
|
16
|
+
|
17
|
+
def skip= skip_val
|
18
|
+
@skip_hash = @full_skip_hash = nil
|
19
|
+
@skip = skip_val
|
20
|
+
end
|
21
|
+
|
22
|
+
def skip_in_action= skip_val
|
23
|
+
@skip_hash = @full_skip_hash = nil
|
24
|
+
@skip_in_action = skip_val
|
25
|
+
end
|
26
|
+
|
27
|
+
def trigger= trigger_val
|
28
|
+
@trigger_hash = @full_trigger_hash = nil
|
29
|
+
@trigger = trigger_val
|
30
|
+
end
|
31
|
+
|
32
|
+
def trigger_in_action= trigger_val
|
33
|
+
@trigger_hash = @full_trigger_hash = nil
|
34
|
+
@trigger_in_action = trigger_val
|
35
|
+
end
|
36
|
+
|
6
37
|
# force skipping this event for all cards in act
|
7
38
|
def skip_event! *events
|
8
39
|
@full_skip_hash = nil
|
@@ -59,23 +90,16 @@ class Card
|
|
59
90
|
end
|
60
91
|
|
61
92
|
def full_skip_hash
|
62
|
-
@full_skip_hash ||= act_skip_hash.merge
|
93
|
+
@full_skip_hash ||= act_skip_hash.merge hash_with_value(skip_in_action, true)
|
63
94
|
end
|
64
95
|
|
65
96
|
def act_skip_hash
|
66
97
|
(act_card || self).skip_hash
|
67
98
|
end
|
68
99
|
|
69
|
-
def skip_in_action_hash
|
70
|
-
hash_with_value skip_in_action, true
|
71
|
-
end
|
72
|
-
|
73
100
|
def full_trigger_hash
|
74
|
-
@full_trigger_hash ||=
|
75
|
-
|
76
|
-
|
77
|
-
def trigger_in_action_hash
|
78
|
-
hash_with_value trigger_in_action, true
|
101
|
+
@full_trigger_hash ||=
|
102
|
+
act_trigger_hash.merge hash_with_value(trigger_in_action, true)
|
79
103
|
end
|
80
104
|
|
81
105
|
def act_trigger_hash
|
@@ -10,15 +10,15 @@ class Card
|
|
10
10
|
# # mod/core/set/type/basic.rb
|
11
11
|
# view :my_view, template: :haml # uses mod/core/view/type/basic/my_view.haml
|
12
12
|
#
|
13
|
-
# view :
|
13
|
+
# view :sample_view, template: :haml do
|
14
14
|
# @actor = "Mark Haml"
|
15
15
|
# end
|
16
16
|
#
|
17
|
-
# # mod/core/
|
17
|
+
# # mod/core/set/type/basic/sample_view.haml
|
18
18
|
# Luke is played by
|
19
19
|
# = actor
|
20
20
|
#
|
21
|
-
# > render :
|
21
|
+
# > render :sample_view # => "Luke is played by Mark Haml"
|
22
22
|
module HamlViews
|
23
23
|
include Card::Set::Format::HamlPaths
|
24
24
|
|
@@ -3,9 +3,10 @@
|
|
3
3
|
class Card
|
4
4
|
module Set
|
5
5
|
module Format
|
6
|
-
# AbstractFormat manages the
|
7
|
-
#
|
8
|
-
# create a format
|
6
|
+
# AbstractFormat manages the DSL for defining {#view views}.
|
7
|
+
#
|
8
|
+
# Whenever you create a {Format format} block in a {Cardio::Set set module},
|
9
|
+
# you create a format module that is extended with AbstractFormat.
|
9
10
|
module AbstractFormat
|
10
11
|
include ViewOpts
|
11
12
|
include ViewDefinition
|
@@ -59,7 +60,7 @@ class Card
|
|
59
60
|
# * *:create*, *:read* (default), *:update*, *:delete* - only users with the
|
60
61
|
# given permission for the card viewed.
|
61
62
|
# * *:none* - no permission check; anyone can view
|
62
|
-
# * a
|
63
|
+
# * a format method name. Eg `perms: :is_my_view_ok?`
|
63
64
|
#
|
64
65
|
# * __:template__ [Symbol] view is defined in a template. Currently `:haml` is
|
65
66
|
# the only supported value. See {HamlViews}
|
@@ -3,9 +3,6 @@ class Card
|
|
3
3
|
module Format
|
4
4
|
# methods for handling paths to HAML templates
|
5
5
|
module HamlPaths
|
6
|
-
CORE_MODS = ::Set.new %w[core admin].freeze
|
7
|
-
TEMPLATE_DIR = %w[template set].freeze
|
8
|
-
|
9
6
|
delegate :tmp_files?, to: Cardio::Mod::LoadStrategy
|
10
7
|
|
11
8
|
def haml_to_html haml, locals={}, a_binding=nil, debug_info={}
|
@@ -49,34 +46,21 @@ class Card
|
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
52
|
-
TMPSET_REGEXP = %r{
|
49
|
+
TMPSET_REGEXP = %r{^.*/tmp(sets)?/set/[\w-]+/mod\d{3}-(?<modname>[^/]+)}
|
53
50
|
|
54
51
|
def deep_source source
|
55
52
|
return source unless tmp_files?
|
56
53
|
|
57
|
-
source&.
|
58
|
-
|
59
|
-
source_mod_dir match[:modname], match[:carddir]
|
54
|
+
source&.sub TMPSET_REGEXP do
|
55
|
+
"#{Cardio::Mod.fetch(Regexp.last_match[:modname]).path}/set"
|
60
56
|
end
|
61
57
|
end
|
62
58
|
|
63
|
-
def source_mod_dir modname, carddir
|
64
|
-
# TODO: handle non-standard mod dirs
|
65
|
-
dir = "/mod/#{modname}/set/"
|
66
|
-
return dir unless modname.in? CORE_MODS
|
67
|
-
|
68
|
-
"#{carddir}/#{dir}/"
|
69
|
-
end
|
70
|
-
|
71
59
|
def try_haml_template_path template_path, view, source_dir, ext="haml"
|
72
60
|
template_path = File.join(template_path, view.to_s) if view.present?
|
73
61
|
template_path += ".#{ext}"
|
74
|
-
|
75
|
-
|
76
|
-
.sub(%r{(/mod/[^/]+)/set/}, "\\1/#{template_dir}/")
|
77
|
-
return path if ::File.exist?(path)
|
78
|
-
end
|
79
|
-
false
|
62
|
+
path = ::File.expand_path(template_path, source_dir)
|
63
|
+
path if ::File.exist? path
|
80
64
|
end
|
81
65
|
|
82
66
|
def haml_block_locals &block
|
data/lib/card/set/format.rb
CHANGED
@@ -2,33 +2,58 @@
|
|
2
2
|
|
3
3
|
class Card
|
4
4
|
module Set
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# Card::Set::Format is responsible for handling `format` blocks within the set module
|
6
|
+
# DSL, which is used in {Cardio::Mod Set module} files found in {Cardio::Mod mods'}
|
7
|
+
# set directories. Monkeys use the DSL to define views that apply to specific sets of
|
8
|
+
# cards in specific formats. The views can then be
|
9
|
+
# used by Monkeys in code and by Sharks via the UI.
|
7
10
|
#
|
8
|
-
#
|
11
|
+
# For example, imagine you have a set module file in `mod/mymod/type/my_type.rb`.
|
12
|
+
# There you can define a view like this:
|
9
13
|
#
|
10
14
|
# format :html do
|
11
|
-
#
|
15
|
+
# view :hello do
|
16
|
+
# greeting
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# {AbstractFormat#view Learn more about defining views}
|
21
|
+
#
|
22
|
+
# This view will now be available to MyType cards in HTML -- but not in other formats.
|
23
|
+
# Similarly, you can define other methods in format blocks:
|
24
|
+
#
|
25
|
+
# format :html do
|
26
|
+
# def greeting
|
12
27
|
# :rocks
|
13
28
|
# end
|
14
29
|
# end
|
15
30
|
#
|
16
|
-
# The magic that happens here is that the method #
|
17
|
-
# available) _only_ to the cards in the set specified by the mod, and
|
18
|
-
#
|
31
|
+
# The magic that happens here is that the method #greeting is now applicable (and
|
32
|
+
# available) _only_ to the cards in the {Card::Set set} specified by the mod, and
|
33
|
+
# only when rendering a view of the card in the HTML format. {Card::Format Learn
|
34
|
+
# more about formats}.
|
19
35
|
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# How the format object for a given card in the set includes this module dynamically
|
23
|
-
# when it's initialized. And so on...
|
36
|
+
# So if, for example, I had a card "MyCard" with the type "MyType", the following
|
37
|
+
# should use the method above:
|
24
38
|
#
|
25
|
-
#
|
39
|
+
# ````
|
40
|
+
# "MyCard".card.format(:html).greeting
|
41
|
+
# ````
|
42
|
+
#
|
43
|
+
# ...but if the card had a different type, or if I tried to use the method in, say,
|
44
|
+
# the JSON format, this #beethoven method wouldn't be available.
|
45
|
+
#
|
46
|
+
# Under the hood, the DSL creates a ruby module that looks something like
|
47
|
+
# `Card::Set::Type::MyType::HtmlFormat`. This module will then be dynamically included
|
48
|
+
# in HTML format objects for MyCard.
|
49
|
+
#
|
50
|
+
# As monkeys, we don't usually think about all that much, because we work in
|
26
51
|
# the set module space, which lets us focus on the card patterns.
|
27
52
|
#
|
28
53
|
# Speaking of which, there are a few key patterns to be aware of:
|
29
54
|
#
|
30
55
|
# 1. Just as in {Card::Set sets}, format methods for narrower sets will override
|
31
|
-
# format methods for more general sets. So if a #
|
56
|
+
# format methods for more general sets. So if a #greeting method is defined
|
32
57
|
# for all cards and again for a specific card type, then the type method will
|
33
58
|
# override the all method when both apply.
|
34
59
|
# 2. Similarly, specific formats inherit from more general formats, and all formats
|
@@ -36,27 +61,28 @@ class Card
|
|
36
61
|
# will define methods on the base format class.
|
37
62
|
#
|
38
63
|
# format do
|
39
|
-
# def
|
40
|
-
#
|
64
|
+
# def farewell
|
65
|
+
# "goodbye"
|
41
66
|
# end
|
42
67
|
# end
|
43
68
|
#
|
44
69
|
# 3. It is possible to use super to refer to overridden methods. For example
|
45
70
|
#
|
46
71
|
# format :html do
|
47
|
-
# def
|
72
|
+
# def goodbye
|
48
73
|
# "<em>#{super}</em>"
|
49
74
|
# end
|
50
75
|
# end
|
51
76
|
#
|
52
77
|
# Note: Set precedence has a higher priority than Format precedence.
|
53
78
|
#
|
54
|
-
# 4.
|
55
|
-
# be defined on the base format.
|
56
|
-
#
|
57
|
-
# 5. Some very powerful API calls (including {AbstractFormat#view view} and
|
79
|
+
# 4. Some very powerful API calls (including {AbstractFormat#view view} and
|
58
80
|
# {AbstractFormat#before before}) are defined in {AbstractFormat}. These methods are
|
59
81
|
# always available in format blocks.
|
82
|
+
#
|
83
|
+
# 5. {#view} and {#before}, however, can ALSO both be called outside of a format
|
84
|
+
# block. They will be defined on the base format.
|
85
|
+
#
|
60
86
|
module Format
|
61
87
|
require "card/set/format/haml_paths"
|
62
88
|
require "card/set/format/abstract_format"
|
data/lib/card/set/helpers.rb
CHANGED
@@ -1,42 +1,32 @@
|
|
1
1
|
class Card
|
2
2
|
module Set
|
3
|
+
# These helper methods provide easy access to metadata, such as information about
|
4
|
+
# the set modified by a module. These methods are seldom used by Monkeys; they are
|
5
|
+
# primarily Platypus tools.
|
3
6
|
module Helpers
|
4
7
|
SET_PATTERN_TEST_REGEXP = /^(?<pattern>\w+)_set\?$/
|
5
8
|
|
9
|
+
# @return [String] short name of card module. For example, returns Type::User for
|
10
|
+
# Card::Set::Type::User
|
6
11
|
def shortname
|
7
12
|
first = 2 # shortname eliminates Card::Set
|
8
13
|
last = first + num_set_parts(pattern_code)
|
9
14
|
set_name_parts[first..last].join "::"
|
10
15
|
end
|
11
16
|
|
12
|
-
|
17
|
+
# @return [String] name of card module with underscores. For example, returns
|
18
|
+
# Card__Set__Type__User for Card::Set::Type::User
|
19
|
+
def underscored_name
|
13
20
|
shortname.tr(":", "_").underscore
|
14
21
|
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Pattern.find(pattern_code).anchor_parts_count
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_format_type_key
|
23
|
-
@set_format_type_key ||= :"#{set_type_key}_format"
|
24
|
-
end
|
25
|
-
|
26
|
-
def set_type_key
|
27
|
-
if all_set?
|
28
|
-
:base
|
29
|
-
elsif abstract_set?
|
30
|
-
:abstract
|
31
|
-
else
|
32
|
-
:nonbase
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
23
|
+
# @return [Array] list of strings of parts of set module's name
|
24
|
+
# Eg, returns ["Card", "Set", "Type", "User"] for Card::Set::Type::User
|
36
25
|
def set_name_parts
|
37
26
|
@set_name_parts ||= name.split "::"
|
38
27
|
end
|
39
28
|
|
29
|
+
# @return [Symbol] codename associated with set's pattern. Eg :type, :right, etc
|
40
30
|
def pattern_code
|
41
31
|
@pattern_code ||= set_name_parts[2].underscore.to_sym
|
42
32
|
end
|
@@ -50,6 +40,8 @@ class Card
|
|
50
40
|
end
|
51
41
|
end
|
52
42
|
|
43
|
+
# @return [true/false]
|
44
|
+
# handles all_set?, abstract_set?, type_set?, etc.
|
53
45
|
def respond_to_missing? method_name, _include_private=false
|
54
46
|
method_name.match? SET_PATTERN_TEST_REGEXP
|
55
47
|
end
|
@@ -64,21 +56,6 @@ class Card
|
|
64
56
|
end
|
65
57
|
end
|
66
58
|
|
67
|
-
def test_set
|
68
|
-
# rubocop:disable Lint/Eval
|
69
|
-
::Card::Set::Self.const_remove_if_defined :TestSet
|
70
|
-
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
|
71
|
-
class ::Card::Set::Self
|
72
|
-
module TestSet
|
73
|
-
extend Card::Set
|
74
|
-
include_set #{name}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
RUBY
|
78
|
-
::Card::Set::Self::TestSet
|
79
|
-
# rubocop:enable Lint/Eval
|
80
|
-
end
|
81
|
-
|
82
59
|
def format_modules format_sym, test: true
|
83
60
|
if base_format_modules?
|
84
61
|
[format_module(format_sym)]
|
@@ -95,6 +72,36 @@ class Card
|
|
95
72
|
|
96
73
|
private
|
97
74
|
|
75
|
+
# @return [Symbol] base_format,
|
76
|
+
def set_format_type_key
|
77
|
+
@set_format_type_key ||= :"#{set_type_key}_format"
|
78
|
+
end
|
79
|
+
|
80
|
+
def set_type_key
|
81
|
+
if all_set?
|
82
|
+
:base
|
83
|
+
elsif abstract_set?
|
84
|
+
:abstract
|
85
|
+
else
|
86
|
+
:nonbase
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_set
|
91
|
+
# rubocop:disable Lint/Eval
|
92
|
+
::Card::Set::Self.const_remove_if_defined :TestSet
|
93
|
+
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
|
94
|
+
class ::Card::Set::Self
|
95
|
+
module TestSet
|
96
|
+
extend Card::Set
|
97
|
+
include_set #{name}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
RUBY
|
101
|
+
::Card::Set::Self::TestSet
|
102
|
+
# rubocop:enable Lint/Eval
|
103
|
+
end
|
104
|
+
|
98
105
|
def base_format_modules?
|
99
106
|
!set_format_type_key || set_format_type_key == :base_format
|
100
107
|
end
|
@@ -107,6 +114,12 @@ class Card
|
|
107
114
|
format_class = Card::Format.format_class format: format_sym
|
108
115
|
Card::Set.modules[set_format_type_key][format_class][shortname] || []
|
109
116
|
end
|
117
|
+
|
118
|
+
def num_set_parts pattern_code
|
119
|
+
return 1 if pattern_code == :abstract
|
120
|
+
|
121
|
+
Pattern.find(pattern_code).anchor_parts_count
|
122
|
+
end
|
110
123
|
end
|
111
124
|
end
|
112
125
|
end
|
data/lib/card/set/inheritance.rb
CHANGED
@@ -3,8 +3,8 @@ class Card
|
|
3
3
|
# API to inherit other sets and their formats
|
4
4
|
module Inheritance
|
5
5
|
# include a set module and all its format modules
|
6
|
-
# @param [Module]
|
7
|
-
# @param [Hash]
|
6
|
+
# @param set [Module]
|
7
|
+
# @param opts [Hash] choose the formats you want to include. You can also
|
8
8
|
# pass arbitrary options to the included set. The option is saved
|
9
9
|
# in the including set. To use the option you need a `included` method
|
10
10
|
# in the included set to fetch the option.
|
@@ -41,8 +41,8 @@ class Card
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# include format modules of a set
|
44
|
-
# @param [Module]
|
45
|
-
# @param [Hash]
|
44
|
+
# @param set [Module]
|
45
|
+
# @param opts [Hash] choose the formats you want to include
|
46
46
|
# @option opts [Symbol, Array<Symbol>] :only include only these formats
|
47
47
|
# @option opts [Symbol, Array<Symbol>] :except don't include these formats
|
48
48
|
# @example
|
data/lib/card/set/pattern/all.rb
CHANGED
@@ -21,7 +21,7 @@ class Card
|
|
21
21
|
@patterns = @concrete_patterns = nil
|
22
22
|
@template = @virtual = nil
|
23
23
|
@set_mods_loaded = @set_modules = @set_names = @rule_lookup_keys = nil
|
24
|
-
@
|
24
|
+
@compound_only = nil # only applies to set cards
|
25
25
|
true
|
26
26
|
end
|
27
27
|
|
@@ -3,7 +3,7 @@ class Card
|
|
3
3
|
module Pattern
|
4
4
|
# methods for Set::Pattern classes
|
5
5
|
module ClassMethods
|
6
|
-
attr_accessor :pattern_code, :
|
6
|
+
attr_accessor :pattern_code, :compound_only, :assigns_type, :anchorless
|
7
7
|
attr_writer :anchor_parts_count
|
8
8
|
|
9
9
|
def new card
|
@@ -17,8 +17,8 @@ class Card
|
|
17
17
|
opts.each { |key, val| send "#{key}=", val }
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
|
20
|
+
def compound_only?
|
21
|
+
compound_only == true
|
22
22
|
end
|
23
23
|
|
24
24
|
def anchorless?
|
@@ -35,7 +35,7 @@ class Card
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def pattern_applies? card
|
38
|
-
|
38
|
+
compound_only? ? card.name.compound? : true
|
39
39
|
end
|
40
40
|
|
41
41
|
def anchor_parts_count
|