card 1.104.2 → 1.105.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (390) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -6
  3. data/VERSION +1 -1
  4. data/config/environments/development.rb +1 -1
  5. data/config/environments/test.rb +1 -0
  6. data/config/initializers/01_core_extensions/object.rb +10 -0
  7. data/config/initializers/01_core_extensions/string.rb +9 -0
  8. data/config/initializers/core_extensions.rb +1 -0
  9. data/db/migrate/{20160122153608_new_indeces.rb → 20160122153608_new_indices.rb} +2 -2
  10. data/db/migrate/{20200805200729_add_unique_pair_indeces.rb → 20200805200729_add_unique_pair_indices.rb} +1 -1
  11. data/db/migrate/20221031182227_remove_referee_key_requirement.rb +11 -0
  12. data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +1 -9
  13. data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +1 -38
  14. data/db/migrate_core_cards/20161103154836_update_keys.rb +1 -1
  15. data/db/migrate_core_cards/20180905061537_migrate_layouts.rb +1 -1
  16. data/db/migrate_core_cards/20190125125150_add_script_rules_card.rb +1 -1
  17. data/db/migrate_core_cards/20190320091257_upgrade_recaptcha_to_v3.rb +1 -1
  18. data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +2 -20
  19. data/db/migrate_core_cards/20190528131330_enabled_roles.rb +0 -3
  20. data/db/migrate_core_cards/20190625153616_pointer_overhaul.rb +0 -2
  21. data/db/migrate_core_cards/20190718140126_add_guides.rb +1 -1
  22. data/db/migrate_core_cards/20190822093633_move_help_text_to_code.rb +1 -1
  23. data/db/migrate_core_cards/20190829205148_remove_add_help.rb +1 -1
  24. data/db/migrate_core_cards/20190902193208_input_type.rb +1 -1
  25. data/db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb +2 -2
  26. data/db/schema.rb +2 -2
  27. data/db/seeds.rb +14 -1
  28. data/db/version.txt +1 -1
  29. data/lib/card/auth/current.rb +4 -2
  30. data/lib/card/auth/permissions.rb +1 -1
  31. data/lib/card/auth/setup.rb +1 -1
  32. data/lib/card/auth/token.rb +1 -1
  33. data/lib/card/cache/persistent.rb +4 -1
  34. data/lib/card/codename.rb +2 -6
  35. data/lib/card/content/all.rb +2 -2
  36. data/lib/card/content/clean.rb +1 -1
  37. data/lib/card/content/parser.rb +0 -2
  38. data/lib/card/content.rb +1 -8
  39. data/lib/card/director/all.rb +67 -0
  40. data/lib/card/director/card_class.rb +158 -2
  41. data/lib/card/director/{act_direction.rb → class_methods.rb} +13 -3
  42. data/lib/card/director/phases.rb +7 -4
  43. data/lib/card/director/run.rb +51 -50
  44. data/lib/card/director/stages.rb +18 -16
  45. data/lib/card/director/store.rb +1 -1
  46. data/lib/card/director.rb +6 -7
  47. data/lib/card/env/location.rb +1 -1
  48. data/lib/card/env/serializable.rb +2 -0
  49. data/lib/card/env/serialization.rb +2 -3
  50. data/lib/card/env.rb +2 -2
  51. data/lib/card/error.rb +9 -5
  52. data/lib/card/format/error.rb +6 -12
  53. data/lib/card/format/nest.rb +1 -1
  54. data/lib/card/format/wrapper.rb +1 -1
  55. data/lib/card/format.rb +4 -0
  56. data/lib/card/model/save_helper/save_arguments.rb +0 -44
  57. data/lib/card/model/save_helper/save_helper_helper.rb +0 -37
  58. data/lib/card/model/save_helper.rb +0 -82
  59. data/lib/card/name/all.rb +1 -4
  60. data/lib/card/name/card_class.rb +0 -2
  61. data/lib/card/name/name_variants.rb +4 -0
  62. data/lib/card/name.rb +0 -5
  63. data/lib/card/query/abstract_query/query_helper.rb +3 -5
  64. data/lib/card/query/abstract_query/tie.rb +1 -1
  65. data/lib/card/query/abstract_query.rb +36 -17
  66. data/lib/card/query/card_class.rb +36 -0
  67. data/lib/card/query/card_query/custom.rb +12 -0
  68. data/lib/card/query/card_query/interpretation.rb +1 -0
  69. data/lib/card/query/card_query/normalization.rb +11 -3
  70. data/lib/card/query/card_query/reference_attributes.rb +3 -2
  71. data/lib/card/query/card_query/sorting.rb +5 -4
  72. data/lib/card/query/card_query.rb +1 -0
  73. data/lib/card/query/sql_statement/order.rb +12 -10
  74. data/lib/card/query/sql_statement/where.rb +2 -2
  75. data/lib/card/query.rb +5 -1
  76. data/lib/card/reference/all.rb +10 -10
  77. data/lib/card/set/advanced_api.rb +1 -1
  78. data/lib/card/set/event/all.rb +9 -1
  79. data/lib/card/set/event/delayed_event.rb +4 -2
  80. data/lib/card/set/event/options.rb +1 -1
  81. data/lib/card/set/event/skip_and_trigger.rb +34 -10
  82. data/lib/card/set/format/abstract_format/haml_views.rb +3 -3
  83. data/lib/card/set/format/abstract_format.rb +1 -1
  84. data/lib/card/set/format/haml_paths.rb +5 -21
  85. data/lib/card/set/inheritance.rb +4 -4
  86. data/lib/card/set/pattern/all.rb +1 -1
  87. data/lib/card/set/pattern/base.rb +1 -1
  88. data/lib/card/set/pattern/class_methods.rb +4 -4
  89. data/lib/card/set/trait.rb +1 -1
  90. data/lib/card/set/type.rb +0 -41
  91. data/lib/card/setting.rb +0 -1
  92. data/lib/card/subcards/all.rb +6 -8
  93. data/lib/card/subcards/args.rb +9 -9
  94. data/lib/card/view/cache/cache_action.rb +1 -1
  95. data/lib/card/view/options/visibility.rb +4 -0
  96. data/lib/card/view/options.rb +1 -0
  97. data/lib/card/view/permission.rb +12 -4
  98. data/lib/card/view.rb +4 -0
  99. data/lib/card.rb +18 -27
  100. data/lib/cardio/cli.rb +3 -1
  101. data/lib/cardio/command/application.rb +5 -0
  102. data/lib/cardio/{commands/command.rb → command/command_base.rb} +2 -2
  103. data/lib/cardio/{commands → command}/custom.rb +16 -13
  104. data/lib/cardio/{commands → command}/rake_command/parser.rb +3 -3
  105. data/lib/cardio/{commands → command}/rake_command.rb +4 -4
  106. data/lib/cardio/{commands → command}/rspec_command/parser.rb +2 -2
  107. data/lib/cardio/{commands → command}/rspec_command.rb +7 -9
  108. data/lib/cardio/command.rb +129 -0
  109. data/lib/cardio/commands.rb +17 -116
  110. data/lib/cardio/generators/deck_generator_loader.rb +1 -0
  111. data/lib/cardio/generators.rb +2 -2
  112. data/lib/cardio/migration.rb +3 -53
  113. data/lib/cardio/mod/class_methods.rb +26 -22
  114. data/lib/cardio/mod/dirs.rb +29 -22
  115. data/lib/cardio/mod/eat/edibles.rb +22 -15
  116. data/lib/cardio/mod/eat.rb +18 -14
  117. data/lib/cardio/mod/load_strategy/set_tmp_files.rb +1 -1
  118. data/lib/cardio/mod/load_strategy.rb +12 -2
  119. data/lib/cardio/mod/modfile_api.rb +18 -18
  120. data/lib/cardio/mod/{poop.rb → sow.rb} +10 -18
  121. data/lib/cardio/mod.rb +21 -30
  122. data/lib/cardio/railtie.rb +19 -56
  123. data/lib/cardio/schema.rb +2 -1
  124. data/lib/cardio/script_loader.rb +3 -1
  125. data/lib/cardio/seed.rb +101 -8
  126. data/lib/cardio/utils.rb +39 -1
  127. data/lib/generators/deck/deck_generator.rb +5 -2
  128. data/lib/generators/deck/templates/config/puma.rb +1 -1
  129. data/lib/generators/deck/templates/script/decko_rspec +1 -1
  130. data/lib/generators/deck/templates/simplecov.rb.erb +10 -8
  131. data/lib/generators/mod/USAGE +1 -1
  132. data/lib/generators/set/USAGE +2 -2
  133. data/mod/core/data/fixtures/real/card_actions.yml +78 -0
  134. data/{db/seed/new → mod/core/data/fixtures/real}/card_acts.yml +2 -2
  135. data/{db/seed/new → mod/core/data/fixtures/real}/card_changes.yml +0 -0
  136. data/mod/core/data/fixtures/real/card_references.yml +8 -0
  137. data/mod/core/data/fixtures/real/cards.yml +135 -0
  138. data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations.yml +0 -0
  139. data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_core_cards.yml +0 -0
  140. data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck.yml +0 -0
  141. data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck_cards.yml +0 -0
  142. data/mod/core/data/real.yml +79 -0
  143. data/mod/core/data/test/cardtype.yml +38 -0
  144. data/mod/core/data/test/sample.yml +50 -0
  145. data/mod/core/data/test/user.yml +41 -0
  146. data/mod/core/data/test.yml +79 -28
  147. data/mod/core/lib/tasks/card/assets.rake +17 -0
  148. data/{lib → mod/core/lib}/tasks/card/create.rake +0 -0
  149. data/{lib → mod/core/lib}/tasks/card/migrate.rake +4 -0
  150. data/{lib → mod/core/lib}/tasks/card/mod.rake +4 -3
  151. data/mod/core/lib/tasks/card/seed.rake +58 -0
  152. data/mod/core/lib/tasks/card.rake +115 -0
  153. data/mod/core/locales/de.yml +4 -0
  154. data/mod/core/locales/en.yml +13 -0
  155. data/mod/core/set/all/admin.rb +14 -0
  156. data/mod/core/set/all/codename.rb +4 -0
  157. data/mod/core/set/all/content.rb +8 -4
  158. data/mod/core/set/all/{abort.rb → result.rb} +11 -15
  159. data/mod/core/set/all/states.rb +15 -1
  160. data/mod/core/set/all/trash.rb +25 -73
  161. data/mod/core/set/all/type.rb +2 -2
  162. data/mod/core/set/all/utils.rb +3 -87
  163. data/mod/core/set/right/autoname.rb +2 -0
  164. data/mod/core/set/self/admin/warning_alert.haml +3 -0
  165. data/mod/core/set/self/admin.rb +173 -0
  166. data/mod/core/set/type/cardtype.rb +2 -0
  167. data/mod/core/set_pattern/02_all_plus.rb +1 -1
  168. data/mod/core/set_pattern/05_rstar.rb +1 -1
  169. data/mod/core/set_pattern/06_rule.rb +1 -1
  170. data/mod/core/set_pattern/07_right.rb +1 -1
  171. data/mod/core/set_pattern/08_type_plus_right.rb +1 -1
  172. data/mod/core/spec/set/all/assign_attributes_spec.rb +3 -3
  173. data/mod/core/spec/set/all/autoname_spec.rb +25 -0
  174. data/mod/core/spec/set/all/codename_spec.rb +1 -1
  175. data/mod/core/spec/set/all/name_events_spec.rb +43 -66
  176. data/mod/core/spec/set/all/trash_spec.rb +149 -68
  177. data/mod/{admin → core}/spec/set/self/admin_spec.rb +25 -22
  178. data/mod/core/spec/set/self/trash_spec.rb +5 -0
  179. metadata +88 -251
  180. data/db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb +0 -18
  181. data/db/migrate_core_cards/20130419215612_import_help_text.rb +0 -13
  182. data/db/migrate_core_cards/20130823192433_add_style_cards.rb +0 -100
  183. data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +0 -11
  184. data/db/migrate_core_cards/20130927191728_account_events.rb +0 -20
  185. data/db/migrate_core_cards/20131016172445_common_css_patch.rb +0 -9
  186. data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +0 -8
  187. data/db/migrate_core_cards/20140512155840_add_script_cards.rb +0 -86
  188. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +0 -132
  189. data/db/migrate_core_cards/20140725180118_config_card_updates.rb +0 -9
  190. data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +0 -7
  191. data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +0 -14
  192. data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +0 -15
  193. data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +0 -10
  194. data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +0 -26
  195. data/db/migrate_core_cards/20141230204340_uri_codename.rb +0 -13
  196. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +0 -76
  197. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +0 -41
  198. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +0 -36
  199. data/db/migrate_core_cards/20150331135745_new_card_menu.rb +0 -8
  200. data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +0 -11
  201. data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +0 -24
  202. data/db/migrate_core_cards/20150528084659_add_session_cardtype.rb +0 -18
  203. data/db/migrate_core_cards/20150601133433_add_recent_setting_session_card.rb +0 -18
  204. data/db/migrate_core_cards/20150610171702_add_debugger_session_card.rb +0 -12
  205. data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +0 -58
  206. data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +0 -7
  207. data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +0 -9
  208. data/db/migrate_core_cards/20150708224756_add_list_cards.rb +0 -29
  209. data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +0 -15
  210. data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +0 -10
  211. data/db/migrate_core_cards/20151120180631_add_token_expiration.rb +0 -7
  212. data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +0 -10
  213. data/db/migrate_core_cards/20160804112510_reorganize_scripts.rb +0 -27
  214. data/db/migrate_core_cards/20160908154210_add_trash_card.rb +0 -7
  215. data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +0 -17
  216. data/db/migrate_core_cards/20170209132834_email_test_context.rb +0 -49
  217. data/db/migrate_core_cards/20170314175313_add_notification_event_card.rb +0 -20
  218. data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +0 -20
  219. data/db/migrate_core_cards/20170608083819_add_full_width_layout_card.rb +0 -23
  220. data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +0 -8
  221. data/db/migrate_core_cards/20180423120222_add_mod_styles_card.rb +0 -20
  222. data/db/migrate_core_cards/20180508210903_add_json_type.rb +0 -10
  223. data/db/migrate_core_cards/20180515175726_add_codenames.rb +0 -8
  224. data/db/migrate_core_cards/20180712042655_head_rule.rb +0 -13
  225. data/db/migrate_core_cards/20181120200937_update_layout.rb +0 -7
  226. data/db/migrate_core_cards/20190204195039_add_rule_card.rb +0 -10
  227. data/db/migrate_core_cards/20190321085735_wagn_to_decko_logo.rb +0 -11
  228. data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +0 -17
  229. data/db/migrate_core_cards/20190424100531_update_credit_image.rb +0 -76
  230. data/db/migrate_core_cards/20190424101004_add_read_anyone_rules.rb +0 -13
  231. data/db/migrate_core_cards/20190503122739_update_pristine_data.rb +0 -18
  232. data/db/migrate_core_cards/20190605133556_tweak_config_cards.rb +0 -10
  233. data/db/migrate_core_cards/20190618110446_add_dropdown_divider.rb +0 -8
  234. data/db/migrate_core_cards/20190621143156_add_role_assign_permissions.rb +0 -9
  235. data/db/migrate_core_cards/20190710090209_homepage_tweaks.rb +0 -13
  236. data/db/migrate_core_cards/20190820155833_update_cardtype_type_structure.rb +0 -7
  237. data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +0 -19
  238. data/db/migrate_core_cards/20190826132738_add_more_guides.rb +0 -7
  239. data/db/migrate_core_cards/20190829093961_cardtype_grouping.rb +0 -16
  240. data/db/migrate_core_cards/20190830131820_setting_settings_aside.rb +0 -17
  241. data/db/migrate_core_cards/20190902161223_add_style_media.rb +0 -7
  242. data/db/migrate_core_cards/20190918200115_ensure_description_card.rb +0 -13
  243. data/db/migrate_core_cards/20191008201046_fixture_fix.rb +0 -11
  244. data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +0 -9
  245. data/db/migrate_core_cards/20191118145629_codename_fixes.rb +0 -5
  246. data/db/migrate_core_cards/20200821231558_add_nest_list_type.rb +0 -9
  247. data/db/migrate_core_cards/data/1.11_help_text.json +0 -410
  248. data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +0 -104
  249. data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +0 -228
  250. data/db/migrate_core_cards/data/1.12_stylesheets/right_sidebar.scss +0 -27
  251. data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -143
  252. data/db/migrate_core_cards/data/1.13_config_text.json +0 -32
  253. data/db/migrate_core_cards/data/1.14_config_descriptions_etc.json +0 -77
  254. data/db/migrate_core_cards/data/bootstrap_layout.json +0 -96
  255. data/db/migrate_core_cards/data/cards/Xaccount +0 -22
  256. data/db/migrate_core_cards/data/cards/Xaccount_setting-Xright-Xstructure +0 -12
  257. data/db/migrate_core_cards/data/cards/Xall-Xlayout +0 -1
  258. data/db/migrate_core_cards/data/cards/Xcredit +0 -2
  259. data/db/migrate_core_cards/data/cards/Xfooter +0 -3
  260. data/db/migrate_core_cards/data/cards/Xgetting_started +0 -31
  261. data/db/migrate_core_cards/data/cards/Xgetting_started-shark +0 -66
  262. data/db/migrate_core_cards/data/cards/Xgetting_started_link +0 -6
  263. data/db/migrate_core_cards/data/cards/Xheader +0 -19
  264. data/db/migrate_core_cards/data/cards/Xhome +0 -1
  265. data/db/migrate_core_cards/data/cards/Xlogo +0 -1
  266. data/db/migrate_core_cards/data/cards/Xmain_menu +0 -2
  267. data/db/migrate_core_cards/data/cards/Xrecaptcha_setting-Xself-Xstructure +0 -1
  268. data/db/migrate_core_cards/data/cards/Xsidebar +0 -7
  269. data/db/migrate_core_cards/data/cards/Xstructure-Xright-Xguide +0 -12
  270. data/db/migrate_core_cards/data/cards/Xtitle +0 -1
  271. data/db/migrate_core_cards/data/cards/administrator-dashboard +0 -23
  272. data/db/migrate_core_cards/data/cards/administrator-description +0 -1
  273. data/db/migrate_core_cards/data/cards/anyone_signed_in-dashboard +0 -0
  274. data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xguide +0 -24
  275. data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xstructure +0 -3
  276. data/db/migrate_core_cards/data/cards/default_layout +0 -6
  277. data/db/migrate_core_cards/data/cards/full_width_layout +0 -5
  278. data/db/migrate_core_cards/data/cards/help_desk-dashboard +0 -7
  279. data/db/migrate_core_cards/data/cards/help_desk-description +0 -1
  280. data/db/migrate_core_cards/data/cards/home +0 -2
  281. data/db/migrate_core_cards/data/cards/home-Xself-Xlayout +0 -1
  282. data/db/migrate_core_cards/data/cards/home-original +0 -22
  283. data/db/migrate_core_cards/data/cards/home_layout +0 -6
  284. data/db/migrate_core_cards/data/cards/left_sidebar_layout +0 -6
  285. data/db/migrate_core_cards/data/cards/menu +0 -1
  286. data/db/migrate_core_cards/data/cards/right_thin_sidebar_layout +0 -8
  287. data/db/migrate_core_cards/data/cards/role-Xtype-Xstructure +0 -2
  288. data/db/migrate_core_cards/data/cards/shark-dashboard +0 -19
  289. data/db/migrate_core_cards/data/cards/shark-description +0 -1
  290. data/db/migrate_core_cards/data/cards/shark_menu +0 -2
  291. data/db/migrate_core_cards/data/cards.yml +0 -138
  292. data/db/migrate_core_cards/data/decko_logo.svg +0 -1
  293. data/db/migrate_core_cards/data/mailer/follower_notification_email.html +0 -9
  294. data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +0 -11
  295. data/db/migrate_core_cards/data/mailer/mail_config.json +0 -22
  296. data/db/migrate_core_cards/data/mailer/password_reset_email.html +0 -13
  297. data/db/migrate_core_cards/data/mailer/password_reset_email.txt +0 -11
  298. data/db/migrate_core_cards/data/mailer/signup_alert_email.html +0 -7
  299. data/db/migrate_core_cards/data/mailer/signup_alert_email.txt +0 -5
  300. data/db/migrate_core_cards/data/mailer/verification_email.html +0 -12
  301. data/db/migrate_core_cards/data/mailer/verification_email.txt +0 -9
  302. data/db/migrate_core_cards/data/skin_images.json +0 -91
  303. data/db/migrate_core_cards/data/themes/bootstrap_default/_bootswatch.scss +0 -0
  304. data/db/migrate_core_cards/data/themes/bootstrap_default/_variables.scss +0 -867
  305. data/db/migrate_core_cards/data/themes/cerulean/_bootswatch.scss +0 -125
  306. data/db/migrate_core_cards/data/themes/cerulean/_variables.scss +0 -861
  307. data/db/migrate_core_cards/data/themes/cosmo/_bootswatch.scss +0 -237
  308. data/db/migrate_core_cards/data/themes/cosmo/_variables.scss +0 -861
  309. data/db/migrate_core_cards/data/themes/cyborg/_bootswatch.scss +0 -210
  310. data/db/migrate_core_cards/data/themes/cyborg/_variables.scss +0 -861
  311. data/db/migrate_core_cards/data/themes/darkly/_bootswatch.scss +0 -330
  312. data/db/migrate_core_cards/data/themes/darkly/_variables.scss +0 -861
  313. data/db/migrate_core_cards/data/themes/flatly/_bootswatch.scss +0 -313
  314. data/db/migrate_core_cards/data/themes/flatly/_variables.scss +0 -861
  315. data/db/migrate_core_cards/data/themes/journal/_bootswatch.scss +0 -120
  316. data/db/migrate_core_cards/data/themes/journal/_variables.scss +0 -861
  317. data/db/migrate_core_cards/data/themes/lumen/_bootswatch.scss +0 -496
  318. data/db/migrate_core_cards/data/themes/lumen/_variables.scss +0 -861
  319. data/db/migrate_core_cards/data/themes/paper/_bootswatch.scss +0 -607
  320. data/db/migrate_core_cards/data/themes/paper/_variables.scss +0 -861
  321. data/db/migrate_core_cards/data/themes/readable/_bootswatch.scss +0 -174
  322. data/db/migrate_core_cards/data/themes/readable/_variables.scss +0 -861
  323. data/db/migrate_core_cards/data/themes/sandstone/_bootswatch.scss +0 -194
  324. data/db/migrate_core_cards/data/themes/sandstone/_variables.scss +0 -861
  325. data/db/migrate_core_cards/data/themes/simplex/_bootswatch.scss +0 -142
  326. data/db/migrate_core_cards/data/themes/simplex/_variables.scss +0 -861
  327. data/db/migrate_core_cards/data/themes/slate/_bootswatch.scss +0 -417
  328. data/db/migrate_core_cards/data/themes/slate/_variables.scss +0 -861
  329. data/db/migrate_core_cards/data/themes/spacelab/_bootswatch.scss +0 -137
  330. data/db/migrate_core_cards/data/themes/spacelab/_variables.scss +0 -861
  331. data/db/migrate_core_cards/data/themes/superhero/_bootswatch.scss +0 -332
  332. data/db/migrate_core_cards/data/themes/superhero/_variables.scss +0 -861
  333. data/db/migrate_core_cards/data/themes/united/_bootswatch.scss +0 -42
  334. data/db/migrate_core_cards/data/themes/united/_variables.scss +0 -861
  335. data/db/migrate_core_cards/data/themes/yeti/_bootswatch.scss +0 -437
  336. data/db/migrate_core_cards/data/themes/yeti/_variables.scss +0 -861
  337. data/db/seed/README.md +0 -2
  338. data/db/seed/new/card_actions.yml +0 -5913
  339. data/db/seed/new/card_references.yml +0 -6532
  340. data/db/seed/new/cards.yml +0 -14595
  341. data/db/seed/test/fixtures/card_actions.yml +0 -8153
  342. data/db/seed/test/fixtures/card_acts.yml +0 -1039
  343. data/db/seed/test/fixtures/card_changes.yml +0 -230
  344. data/db/seed/test/fixtures/card_references.yml +0 -8471
  345. data/db/seed/test/fixtures/cards.yml +0 -20171
  346. data/db/seed/test/fixtures/file1.txt +0 -1
  347. data/db/seed/test/fixtures/file2.txt +0 -1
  348. data/db/seed/test/fixtures/mao2.jpg +0 -0
  349. data/db/seed/test/fixtures/rails.gif +0 -0
  350. data/db/seed/test/fixtures/schema_migrations.yml +0 -67
  351. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +0 -347
  352. data/db/seed/test/fixtures/schema_migrations_deck.yml +0 -1
  353. data/db/seed/test/fixtures/schema_migrations_deck_cards.yml +0 -5
  354. data/db/test_seed.rb +0 -322
  355. data/lib/card/content/truncate.rb +0 -67
  356. data/lib/card/director/card_methods.rb +0 -45
  357. data/lib/card/file_card_creator/abstract_file_card/migration_file.rb +0 -50
  358. data/lib/card/file_card_creator/abstract_file_card/ruby_file.rb +0 -30
  359. data/lib/card/file_card_creator/abstract_file_card/source_file.rb +0 -36
  360. data/lib/card/file_card_creator/abstract_file_card.rb +0 -44
  361. data/lib/card/file_card_creator/haml_card.rb +0 -42
  362. data/lib/card/file_card_creator/output_helper.rb +0 -53
  363. data/lib/card/file_card_creator/script_card.rb +0 -35
  364. data/lib/card/file_card_creator/style_card.rb +0 -25
  365. data/lib/card/file_card_creator.rb +0 -25
  366. data/lib/card/name/fields_and_traits.rb +0 -42
  367. data/lib/cardio/commands/application.rb +0 -10
  368. data/lib/cardio/migration/import/import_data/card_attributes.rb +0 -64
  369. data/lib/cardio/migration/import/import_data/card_content.rb +0 -30
  370. data/lib/cardio/migration/import/import_data.rb +0 -119
  371. data/lib/cardio/migration/import/merger.rb +0 -46
  372. data/lib/cardio/migration/import.rb +0 -125
  373. data/lib/tasks/card.rake +0 -65
  374. data/mod/admin/locales/de.yml +0 -4
  375. data/mod/admin/locales/en.yml +0 -4
  376. data/mod/admin/set/all/admin.rb +0 -16
  377. data/mod/admin/set/self/admin.rb +0 -144
  378. data/mod/admin/set/self/admin_info.rb +0 -40
  379. data/mod/admin/set/self/debugger.rb +0 -3
  380. data/mod/admin/spec/set/self/admin_info_spec.rb +0 -9
  381. data/mod/core/data/production.yml +0 -7
  382. data/mod/core/set/all/collection.rb +0 -53
  383. data/mod/core/spec/set/all/collection_spec.rb +0 -170
  384. data/mod/core/spec/set/all/utils_spec.rb +0 -5
  385. data/mod/standard/data/files/favicon/image-icon.png +0 -0
  386. data/mod/standard/data/files/favicon/image-large.png +0 -0
  387. data/mod/standard/data/files/favicon/image-medium.png +0 -0
  388. data/mod/standard/data/files/favicon/image-original.png +0 -0
  389. data/mod/standard/data/files/favicon/image-small.png +0 -0
  390. data/mod/standard/data/files/logo/image-original.svg +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c315f9b25036d3cfe0a8689bf7f8bde71a68715a4dbacf742e5d1cffe999e8f5
4
- data.tar.gz: fb9f8e44f73b7a8236d14a33b04ba653adaac3eadad49db3abb5bfbb11d03eb6
3
+ metadata.gz: c27e643a91315f8bfd6fc3fba7c744848203ba221637e03808a35f7d21869bec
4
+ data.tar.gz: 6792846d1b8853ab5681db115b60a5fdb0753771b90af28572b00208ef1a147d
5
5
  SHA512:
6
- metadata.gz: 3e72cb6beab5d390e721a574d861cc4de210888fbc2f6b9a1f59f30f7b3c4f578e70871f6418dd31d0ed6264192bbd05d74f91cf877f5938312fc0d1648a3c58
7
- data.tar.gz: 47d0f5bbefbeabdf939a65074e91f46f3b917c6c4f9508d7bb63ed012f1e6e2ddc71fbe69bed6482139fc11f5c009f10e2be7704d6350091535ce6c688e042fc
6
+ metadata.gz: 736423e17a671d1cdd5281fea9ba90ceaf6f37ab55bcbe52ac5ef8f0c91649a93d9e6e38d24fd841dba3966379162fdd55e0a3b71be7bab9fb7697c40fafef1b
7
+ data.tar.gz: 4e6de86094dfad8e899383d005bb78fa8d9a21d0e73f4d2799c49db683b8a08a37d711fb45be7325240fb77d0a284f9539206f35ccb107e29bdc6766fc1470d6
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  # @title README - Card
3
3
  -->
4
- # A Developer's introduction to the Decko/Card code base
4
+ # An intro to Decko Monkeying
5
5
 
6
6
  New folks should start here after playing with Decko but before digging into
7
7
  code.
@@ -42,11 +42,10 @@ want.
42
42
 
43
43
  Ruby-on-Rails developers reading this will find lots of familiar patterns in
44
44
  Decko, which indeed depends upon rails gems. **Although Decko is a Rails
45
- descendant and owes a ton to the Rails community, it is not Rails.** Unlike
46
- Rails, Decko is not an implementation of the "MVC" (Model-View-Controller)
47
- architectural pattern (see Architecture below). More concretely, while Rails'
48
- core pattern is adding new things (especially models, views, and controllers),
49
- Decko's core pattern is subdividing existing things into new Sets.
45
+ descendant and owes a ton to the Rails community, it is not Rails.** Rails developers'
46
+ primary activities are adding and editing core MVC (Model-View-Controller) structures.
47
+ Decko Monkeys, by contrast, mostly work by code associated with *subsets* of the
48
+ Card model called *Sets*.
50
49
 
51
50
  Deck-coders do create lots of card views (though they're quite different from
52
51
  Rails views), but we rarely if ever create new controllers or ActiveRecord
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.2
1
+ 0.15.0
@@ -71,7 +71,7 @@ Cardio.application.class.configure do
71
71
  # with SQLite, MySQL, and PostgreSQL)
72
72
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
73
73
 
74
- # if File.exists?(File.join(Rails.root,'tmp', 'debug.txt'))
74
+ # if File.exist?(File.join(Rails.root,'tmp', 'debug.txt'))
75
75
  # require 'ruby-debug'
76
76
  # Debugger.wait_connection = true
77
77
  # Debugger.start_remote
@@ -3,6 +3,7 @@
3
3
  Cardio.application.class.configure do
4
4
  # Settings specified here will take precedence over those in config/application.rb
5
5
 
6
+ config.seed_type = :test
6
7
  config.eager_load = false
7
8
 
8
9
  config.asset_refresh = :never
@@ -1,5 +1,11 @@
1
1
  module CoreExtensions
2
2
  module Object
3
+ def number?
4
+ true if Float(self)
5
+ rescue StandardError
6
+ false
7
+ end
8
+
3
9
  def deep_clone
4
10
  case self
5
11
  when Integer, Float, NilClass, FalseClass, TrueClass, Symbol
@@ -34,6 +40,10 @@ module CoreExtensions
34
40
  Card.id self
35
41
  end
36
42
 
43
+ def codename
44
+ Card::Codename[card_id]
45
+ end
46
+
37
47
  def name?
38
48
  # Although we want to check for instances of class Card::Name we can't use that
39
49
  # class because it is renewed with every request
@@ -0,0 +1,9 @@
1
+ # extend core Ruby object classes
2
+ module CoreExtensions
3
+ # extend core String class
4
+ module String
5
+ def url?
6
+ start_with?("http://", "https://")
7
+ end
8
+ end
9
+ end
@@ -6,6 +6,7 @@ module CoreExtensions
6
6
  ::Kernel.include Kernel
7
7
  ::Object.include Object
8
8
  ::Module.include Module
9
+ ::String.include String
9
10
  ::Array.include Array
10
11
  ::Hash.include Hash::Merging
11
12
  ::Symbol.include PersistentIdentifier
@@ -1,5 +1,5 @@
1
- # add new indeces for datetime and ref_type fields
2
- class NewIndeces < ActiveRecord::Migration[4.2]
1
+ # add new indices for datetime and ref_type fields
2
+ class NewIndices < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  add_index "card_references", ["ref_type"],
5
5
  name: "card_references_ref_type_index" # using: :btree
@@ -1,4 +1,4 @@
1
- class AddUniquePairIndeces < ActiveRecord::Migration[6.0]
1
+ class AddUniquePairIndices < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  stash_duplicate_cards
4
4
  delete_duplicate_virtuals
@@ -0,0 +1,11 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ class RemoveRefereeKeyRequirement < ActiveRecord::Migration[6.0]
4
+ def up
5
+ change_column_null :card_references, :referee_key, true
6
+ end
7
+
8
+ def down
9
+ change_column_null :card_references, :referee_key, false
10
+ end
11
+ end
@@ -2,14 +2,6 @@
2
2
 
3
3
  class UpdateStylesheets < Cardio::Migration::Core
4
4
  def up
5
- dir = File.join data_path, "1.12_stylesheets"
6
- %w[common traditional].each do |sheetname|
7
- card = Card["style: #{sheetname}"]
8
- card.update! content: File.read("#{dir}/#{sheetname}.scss") if card&.pristine?
9
- end
10
-
11
- if (c = Card["*all+*style+file"])
12
- c.delete!
13
- end
5
+ Card["*all+*style+file"]&.delete!
14
6
  end
15
7
  end
@@ -5,38 +5,6 @@ end
5
5
 
6
6
  class UserDataToCards < Cardio::Migration::Core
7
7
  def up
8
- puts "adding new codename cards"
9
- %i[password token salt status signin stats].each do |codename|
10
- Card.create! name: "*#{codename}", codename: codename
11
- end
12
-
13
- puts "setting read permissions for account cards (Administrator)"
14
- %i[password token salt status email account].each do |codename|
15
- rule_name = [codename, :right, :read].map { |code| Card[code].name } * "+"
16
- rule_card = Card.fetch rule_name, new: {}
17
- rule_card.content = "[[Administrator]]"
18
- rule_card.save!
19
- end
20
-
21
- puts "making email and password fields default to Phrase cards"
22
- %i[email password].each do |field|
23
- rulename = [field, :right, :default].map { |code| Card[code].name } * "+"
24
- Card.create! name: rulename, type_id: Card::PhraseID
25
- end
26
-
27
- puts "signin permissions"
28
- %i[read update].each do |setting|
29
- rulename = [:signin, :self, setting].map { |code| Card[code].name } * "+"
30
- Card.create! name: rulename, content: "[[#{Card[:anyone].name}]]"
31
- end
32
-
33
- puts "supporting legacy handling of +*email on User cards"
34
- oldname = %i[email right structure].map { |code| Card[code].name } * "+"
35
- newname = %i[user email type_plus_right structure].map do |code|
36
- Card[code].name
37
- end * "+"
38
- Card[oldname].update! name: newname
39
-
40
8
  puts "importing all user details (for those not in trash) into +*account attributes"
41
9
  User.all.each do |user|
42
10
  base = Card[user.card_id]
@@ -45,7 +13,7 @@ class UserDataToCards < Cardio::Migration::Core
45
13
  puts "~ importing details for #{base.name}"
46
14
  date_args = { created_at: user.created_at, updated_at: user.updated_at }
47
15
  %i[email salt password status].each do |field|
48
- cardname = "#{base.name}+#{Card[:account].name}+#{Card[field].name}"
16
+ cardname = [base.name, :account, field].cardname
49
17
  user_field = (field == :password ? :crypted_password : field)
50
18
  next unless (content = user.send(user_field))
51
19
 
@@ -58,8 +26,3 @@ class UserDataToCards < Cardio::Migration::Core
58
26
  end
59
27
  end
60
28
  end
61
-
62
- # FIXME
63
- # before 1.13!
64
- # but add read permission migration for *stats and
65
- # structure for *stats+*right
@@ -1,4 +1,4 @@
1
- # -*- encoding : utf-8 -*-
1
+ l# -*- encoding : utf-8 -*-
2
2
 
3
3
  class UpdateKeys < Cardio::Migration::Core
4
4
  def up
@@ -39,7 +39,7 @@ class MigrateLayouts < Cardio::Migration::Core
39
39
 
40
40
  each_layout_set layout_card do |set_name|
41
41
  puts "creating head rule for '#{set_name}'"
42
- ensure_card [set_name, :head], content: head, type_id: Card::HtmlID
42
+ Card.ensure name: [set_name, :head], content: head, type_id: Card::HtmlID
43
43
  end
44
44
  end
45
45
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  class AddScriptRulesCard < Cardio::Migration::Core
4
4
  def up
5
- ensure_card name: "script: rules",
5
+ Card.ensure name: "script: rules",
6
6
  type_id: Card::CoffeeScriptID,
7
7
  codename: "script_rules"
8
8
  end
@@ -19,7 +19,7 @@ class UpgradeRecaptchaToV3 < Cardio::Migration::Core
19
19
  codename: "recaptcha_#{new_name}_key"
20
20
  end
21
21
 
22
- ensure_card [Card[:recaptcha_settings].name, "minimum score"],
22
+ Card.ensure name: [Card[:recaptcha_settings].name, "minimum score"],
23
23
  codename: "recaptcha_minimum_score",
24
24
  type_id: Card::NumberID
25
25
  end
@@ -2,13 +2,6 @@
2
2
 
3
3
  class AddSharkAndHelpDeskRole < Cardio::Migration::Core
4
4
  def up
5
- # delete_code_card :eagle
6
- ensure_role "Shark", codename: "shark"
7
- ensure_role "Help Desk", codename: "help_desk"
8
-
9
- ensure_card "*account settings",
10
- codename: "account_settings", type_id: Card::BasicID
11
-
12
5
  update_card! "Decker Menu", name: "Shark Menu"
13
6
  update_card! :ace, name: "*ace"
14
7
  update_card! "*google_analytics_key", name: "*google analytics key"
@@ -19,17 +12,6 @@ class AddSharkAndHelpDeskRole < Cardio::Migration::Core
19
12
  remove_redundant_permissions
20
13
  add_shark_permissions
21
14
  add_help_desk_permissions
22
-
23
- merge_cards %w[role+*type+*structure
24
- administrator+dashboard administrator+description
25
- shark+dashboard shark+description
26
- help_desk+dashboard help_desk+description
27
- anyone_signed_in+dashboard
28
- *recaptcha_settings+*self+*structure
29
- *account_settings+*right+*structure
30
- *getting_started+shark
31
- right_thin_sidebar_layout left_sidebar_layout
32
- *getting_started]
33
15
  end
34
16
 
35
17
  private
@@ -87,7 +69,7 @@ class AddSharkAndHelpDeskRole < Cardio::Migration::Core
87
69
 
88
70
  def add_help_desk_permissions
89
71
  %w[*account *email *password *salt *status *token].each do |name|
90
- ensure_card [name, :right, :read], "Help Desk"
72
+ Card.ensure name: [name, :right, :read], content: "Help Desk"
91
73
  end
92
74
 
93
75
  ["*account", "*email", "*password", "*help", "*add help", "*status",
@@ -98,7 +80,7 @@ class AddSharkAndHelpDeskRole < Cardio::Migration::Core
98
80
 
99
81
  def ensure_cud_permissions name, set, content, actions: %i[create update delete]
100
82
  actions.each do |action|
101
- ensure_card [name, set, action].compact, content
83
+ Card.ensure name: [name, set, action].compact, content: content
102
84
  end
103
85
  end
104
86
  end
@@ -2,9 +2,6 @@
2
2
 
3
3
  class EnabledRoles < Cardio::Migration::Core
4
4
  def up
5
- ensure_trait "*enabled roles", "enabled_roles",
6
- default: { type_id: Card::SessionID }
7
-
8
5
  Card.search type_id: Card::SessionID do |card|
9
6
  card.update_column :trash, true unless card.codename.present?
10
7
  end
@@ -11,8 +11,6 @@ class PointerOverhaul < Cardio::Migration::Core
11
11
  codename: "mirror_list"
12
12
  end
13
13
  update "Pointer", name: "List", codename: "list" unless Card::Codename[:list]
14
- ensure_code_card "Pointer", type_id: Card::CardtypeID
15
- ensure_code_card "Link list", type_id: Card::CardtypeID
16
14
  Card::Cache.reset_all
17
15
  ensure_list_card "list+*input+*type plus right+*options",
18
16
  content: ["List", "Multiselect", "Checkbox", "Filtered list"]
@@ -13,7 +13,7 @@ class AddGuides < Cardio::Migration
13
13
  MD
14
14
 
15
15
  def up
16
- ensure_card "*guide", codename: "guide", type_id: Card::SettingID
16
+ Card.ensure name: "*guide", codename: "guide", type_id: Card::SettingID
17
17
  Card::Cache.reset_all
18
18
  end
19
19
  end
@@ -6,7 +6,7 @@ class MoveHelpTextToCode < Cardio::Migration::Core
6
6
  Card::Cache.reset_all
7
7
 
8
8
  # avoid that "list" as input option gets the description of the cardtype "list"
9
- ensure_card %i[input right options_label], "options description"
9
+ Card.ensure name: %i[input right options_label], content: "options description"
10
10
 
11
11
  remove_setting_help_rules
12
12
  remove_search_help_rules
@@ -6,7 +6,7 @@ class RemoveAddHelp < Cardio::Migration::Core
6
6
  left: { type_id: Card::SetID }).each do |card|
7
7
  next if Card.exists? [card.left, :help]
8
8
 
9
- ensure_card [card.left, :help], content: card.content
9
+ Card.ensure name: [card.left, :help], content: card.content
10
10
  end
11
11
  delete_code_card :add_help
12
12
  Card::Cache.reset_all
@@ -9,7 +9,7 @@ class InputType < Cardio::Migration::Core
9
9
 
10
10
  Card::Cache.reset_all
11
11
 
12
- ensure_card %i[all content_option_view], content: "smart_label"
12
+ Card.ensure name: %i[all content_option_view], content: "smart_label"
13
13
  Card.search right: :content_option_view, left: { not: :all }, &:delete!
14
14
  end
15
15
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  class AddCardtypeInputTypes < Cardio::Migration::Core
4
4
  def up
5
- ensure_card %i[input_type right default],
5
+ Card.ensure name: %i[input_type right default],
6
6
  type_id: Card::PointerID
7
- ensure_card %i[content_option_view right default],
7
+ Card.ensure name: %i[content_option_view right default],
8
8
  type_id: "smart label"
9
9
  end
10
10
  end
data/db/schema.rb CHANGED
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2021_11_28_040849) do
13
+ ActiveRecord::Schema.define(version: 2022_10_31_182227) do
14
14
 
15
15
  create_table "card_actions", id: :integer, charset: "utf8mb3", force: :cascade do |t|
16
16
  t.integer "card_id"
@@ -42,7 +42,7 @@ ActiveRecord::Schema.define(version: 2021_11_28_040849) do
42
42
 
43
43
  create_table "card_references", id: :integer, charset: "utf8mb3", force: :cascade do |t|
44
44
  t.integer "referer_id", default: 0, null: false
45
- t.string "referee_key", default: "", null: false
45
+ t.string "referee_key", default: ""
46
46
  t.integer "referee_id"
47
47
  t.string "ref_type", limit: 1, default: "", null: false
48
48
  t.integer "is_present"
data/db/seeds.rb CHANGED
@@ -1,4 +1,17 @@
1
1
  require "cardio/seed"
2
2
  require "active_record/fixtures"
3
- ActiveRecord::FixtureSet.create_fixtures Cardio::Seed.path, Cardio::Seed::TABLES
3
+
4
+ Cardio::Seed.load
5
+
6
+ Card::Cache.reset_all
7
+
8
+ # get rid of bad constants
9
+ Card::Codename.reset_cache
10
+ Card::Codename.generate_id_constants
11
+
12
+ # TODO: explain why this is necessary
13
+ # (card:seed:build breaks without it)
14
+ # I think it has something to do with Card being partially loaded by the
15
+ # ActiveRecord::FixtureSet handling in Cardio::Seed.load, but if that's the case
16
+ # this might not be a complete enough fix.
4
17
  Cardio::Mod::Loader.load_mods
data/db/version.txt CHANGED
@@ -1 +1 @@
1
- 20211128040849
1
+ 20221031182227
@@ -26,8 +26,10 @@ class Card
26
26
  alias_method :current, :current_card
27
27
 
28
28
  def current_roles
29
- @current_roles ||= [Card.fetch_name(:anyone_signed_in),
30
- current.fetch(:roles)&.item_names].flatten.compact
29
+ return [] unless signed_in?
30
+
31
+ @current_roles ||= [:anyone_signed_in.cardname] +
32
+ Set::Self::Role.role_ids(current_id).map(&:cardname)
31
33
  end
32
34
 
33
35
  # set current user in process and session
@@ -20,7 +20,7 @@ class Card
20
20
  Auth.as_bot do
21
21
  Card.search(
22
22
  { type: Card::CardtypeID, return: :name,
23
- not: { codename: ["in"] + Card.config.non_createable_types } },
23
+ not: { codename: ["in"] + Set.basket[:non_createable_types] } },
24
24
  "find createable types"
25
25
  )
26
26
  end
@@ -42,7 +42,7 @@ class Card
42
42
 
43
43
  def user_account_cql
44
44
  # every deck starts with two accounts: WagnBot and Anonymous
45
- { right_id: Card::AccountID, creator_id: ["ne", Card::WagnBotID] }
45
+ { right: :account, creator_id: ["ne", Card::WagnBotID] }
46
46
  end
47
47
 
48
48
  def user_account_count
@@ -25,7 +25,7 @@ class Card
25
25
  def decode token
26
26
  decoded = JWT.decode(token, SECRET_KEY)[0]
27
27
  HashWithIndifferentAccess.new decoded
28
- rescue JWT::DecodeError => e
28
+ rescue StandardError => e
29
29
  e.message
30
30
  end
31
31
 
@@ -25,6 +25,7 @@ class Card
25
25
  # @option opts [String] :database
26
26
  def initialize opts
27
27
  @store = opts[:store]
28
+ @file_cache = @store.is_a? ActiveSupport::Cache::FileStore
28
29
  @klass = opts[:class]
29
30
  @class_key = @klass.to_s.to_name.key
30
31
  @database = opts[:database] || Cardio.database
@@ -72,7 +73,9 @@ class Card
72
73
  # @param key [String]
73
74
  # @return [String]
74
75
  def full_key key
75
- "#{prefix}/#{key}"
76
+ fk = "#{prefix}/#{key}"
77
+ fk.tr! "*", "X" if @file_cache # save for windows fs
78
+ fk
76
79
  end
77
80
 
78
81
  def read key
data/lib/card/codename.rb CHANGED
@@ -44,11 +44,7 @@ class Card
44
44
  end
45
45
 
46
46
  def name codename=nil
47
- return super() if codename.nil?
48
-
49
- name! codename
50
- rescue Error::CodenameNotFound => _e
51
- yield if block_given?
47
+ id(codename)&.cardname
52
48
  end
53
49
 
54
50
  def card codename
@@ -86,7 +82,7 @@ class Card
86
82
  # @param codename [Symbol, String]
87
83
  # @return [Card::Name]
88
84
  def name! codename
89
- Card::Name[codename.to_sym]
85
+ id!(codename)&.cardname
90
86
  end
91
87
 
92
88
  def generate_id_constants
@@ -16,7 +16,7 @@ class Card
16
16
  end
17
17
 
18
18
  def standard_content
19
- db_content || (new_card? && template.db_content)
19
+ db_content || (new_card? ? default_content : "")
20
20
  end
21
21
 
22
22
  def standardize_content value
@@ -24,7 +24,7 @@ class Card
24
24
  end
25
25
 
26
26
  def structured_content
27
- structure && template.db_content
27
+ structure && default_content
28
28
  end
29
29
 
30
30
  def refresh_content
@@ -1,6 +1,6 @@
1
1
  class Card
2
2
  class Content
3
- # tools for cleaning content, especially for restricing unwanted HTML
3
+ # tools for cleaning content, especially for restricting unwanted HTML
4
4
  module Clean
5
5
  allowed_tags = {}
6
6
  %w[
@@ -1,5 +1,3 @@
1
- # require "card/content/chunk"
2
-
3
1
  class Card
4
2
  class Content
5
3
  # The Content::Parser breaks content strings into an Array of "chunks",
data/lib/card/content.rb CHANGED
@@ -8,7 +8,6 @@ class Card
8
8
  #
9
9
  class Content < SimpleDelegator
10
10
  extend Clean
11
- extend Truncate
12
11
 
13
12
  Chunk # trigger autoload
14
13
 
@@ -150,7 +149,7 @@ class Card
150
149
 
151
150
  def unstash_chunks content, stashed_chunks
152
151
  Chunk::Nest.gsub content do |nest_content|
153
- number?(nest_content) ? stashed_chunks[nest_content.to_i] : "{{#{nest_content}}}"
152
+ nest_content.number? ? stashed_chunks[nest_content.to_i] : "{{#{nest_content}}}"
154
153
  end
155
154
  end
156
155
 
@@ -161,11 +160,5 @@ class Card
161
160
  format_or_card
162
161
  end
163
162
  end
164
-
165
- def number? str
166
- true if Float(str)
167
- rescue StandardError
168
- false
169
- end
170
163
  end
171
164
  end
@@ -2,6 +2,31 @@ class Card
2
2
  class Director
3
3
  # director-related Card instance methods
4
4
  module All
5
+ attr_writer :director
6
+
7
+ delegate :validation_phase, :storage_phase, :integration_phase,
8
+ :validation_phase_callback?, :integration_phase_callback?, to: :director
9
+
10
+ def director
11
+ @director ||= Director.fetch self
12
+ end
13
+
14
+ def prepare_for_phases
15
+ reset_patterns
16
+ include_set_modules
17
+ end
18
+
19
+ def identify_action
20
+ @action =
21
+ if trash && trash_changed?
22
+ :delete
23
+ elsif new_card?
24
+ :create
25
+ else
26
+ :update
27
+ end
28
+ end
29
+
5
30
  def act options={}, &block
6
31
  if act_card
7
32
  add_to_act options, &block
@@ -39,11 +64,53 @@ class Card
39
64
  act { super }
40
65
  end
41
66
 
67
+ def save_if_needed
68
+ validate
69
+ save if save_needed?
70
+ end
71
+
72
+ def save_if_needed!
73
+ validate
74
+ save! if save_needed?
75
+ end
76
+
77
+ def save_needed?
78
+ # (
79
+ new? || test_field_changing? || subcards.cards.any?(&:save_needed?)
80
+ # ).tap do |r|
81
+ # # binding.pry if r
82
+ # puts "save needed for #{name}".yellow if r && !new?
83
+ # end
84
+ end
85
+
42
86
  alias_method :update_attributes, :update
43
87
  alias_method :update_attributes!, :update!
44
88
 
89
+ def restore_changes_information
90
+ # restores changes for integration phase
91
+ # (rails cleared them in an after_create/after_update hook which is
92
+ # executed before the integration phase)
93
+ return unless saved_changes.present?
94
+
95
+ @mutations_from_database = mutations_before_last_save
96
+ end
97
+
98
+ def clear_action_specific_attributes
99
+ self.class.action_specific_attributes.each do |attr|
100
+ instance_variable_set "@#{attr}", nil
101
+ end
102
+ end
103
+
45
104
  private
46
105
 
106
+ def test_field_changing?
107
+ save_test_fields.any? { |fld| send "#{fld}_is_changing?" }
108
+ end
109
+
110
+ def save_test_fields
111
+ %i[name db_content trash type_id codename]
112
+ end
113
+
47
114
  def start_new_act &block
48
115
  self.director = nil
49
116
  Director.run_act(self) do