card 1.104.2 → 1.105.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) 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 +161 -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/fetch/card_class.rb +19 -13
  53. data/lib/card/format/error.rb +6 -12
  54. data/lib/card/format/nest.rb +1 -1
  55. data/lib/card/format/wrapper.rb +1 -1
  56. data/lib/card/format.rb +4 -0
  57. data/lib/card/model/save_helper/save_arguments.rb +0 -44
  58. data/lib/card/model/save_helper/save_helper_helper.rb +0 -37
  59. data/lib/card/model/save_helper.rb +0 -82
  60. data/lib/card/name/all.rb +1 -4
  61. data/lib/card/name/card_class.rb +0 -2
  62. data/lib/card/name/name_variants.rb +4 -0
  63. data/lib/card/name.rb +3 -8
  64. data/lib/card/query/abstract_query/query_helper.rb +3 -5
  65. data/lib/card/query/abstract_query/tie.rb +1 -1
  66. data/lib/card/query/abstract_query.rb +36 -17
  67. data/lib/card/query/card_class.rb +36 -0
  68. data/lib/card/query/card_query/custom.rb +12 -0
  69. data/lib/card/query/card_query/interpretation.rb +1 -0
  70. data/lib/card/query/card_query/normalization.rb +11 -3
  71. data/lib/card/query/card_query/reference_attributes.rb +3 -2
  72. data/lib/card/query/card_query/sorting.rb +5 -4
  73. data/lib/card/query/card_query.rb +1 -0
  74. data/lib/card/query/sql_statement/order.rb +12 -10
  75. data/lib/card/query/sql_statement/where.rb +2 -2
  76. data/lib/card/query.rb +13 -6
  77. data/lib/card/reference/all.rb +10 -10
  78. data/lib/card/set/abstract.rb +1 -0
  79. data/lib/card/set/advanced_api.rb +1 -1
  80. data/lib/card/set/event/all.rb +9 -1
  81. data/lib/card/set/event/delayed_event.rb +4 -2
  82. data/lib/card/set/event/options.rb +1 -1
  83. data/lib/card/set/event/skip_and_trigger.rb +34 -10
  84. data/lib/card/set/format/abstract_format/haml_views.rb +3 -3
  85. data/lib/card/set/format/abstract_format/wrapper.rb +0 -1
  86. data/lib/card/set/format/abstract_format.rb +5 -4
  87. data/lib/card/set/format/haml_paths.rb +5 -21
  88. data/lib/card/set/format.rb +46 -20
  89. data/lib/card/set/helpers.rb +49 -36
  90. data/lib/card/set/inheritance.rb +4 -4
  91. data/lib/card/set/pattern/all.rb +1 -1
  92. data/lib/card/set/pattern/base.rb +1 -1
  93. data/lib/card/set/pattern/class_methods.rb +4 -4
  94. data/lib/card/set/registrar.rb +3 -5
  95. data/lib/card/set/required_field.rb +3 -2
  96. data/lib/card/set/trait.rb +1 -1
  97. data/lib/card/set/type.rb +1 -41
  98. data/lib/card/set.rb +67 -21
  99. data/lib/card/setting.rb +0 -1
  100. data/lib/card/subcards/all.rb +6 -8
  101. data/lib/card/subcards/args.rb +9 -9
  102. data/lib/card/view/cache/cache_action.rb +1 -1
  103. data/lib/card/view/options/visibility.rb +4 -0
  104. data/lib/card/view/options.rb +1 -0
  105. data/lib/card/view/permission.rb +12 -4
  106. data/lib/card/view.rb +4 -0
  107. data/lib/card.rb +48 -39
  108. data/lib/cardio/cli.rb +3 -1
  109. data/lib/cardio/command/application.rb +5 -0
  110. data/lib/cardio/{commands/command.rb → command/command_base.rb} +2 -2
  111. data/lib/cardio/{commands → command}/custom.rb +17 -13
  112. data/lib/cardio/{commands → command}/rake_command/parser.rb +3 -3
  113. data/lib/cardio/{commands → command}/rake_command.rb +5 -5
  114. data/lib/cardio/{commands → command}/rspec_command/parser.rb +9 -6
  115. data/lib/cardio/{commands → command}/rspec_command.rb +7 -9
  116. data/lib/cardio/command.rb +129 -0
  117. data/lib/cardio/commands.rb +17 -116
  118. data/lib/cardio/generators/deck_generator_loader.rb +1 -0
  119. data/lib/cardio/generators.rb +2 -2
  120. data/lib/cardio/migration.rb +3 -53
  121. data/lib/cardio/mod/class_methods.rb +28 -24
  122. data/lib/cardio/mod/dirs.rb +30 -23
  123. data/lib/cardio/mod/eat/edibles.rb +43 -16
  124. data/lib/cardio/mod/eat.rb +20 -14
  125. data/lib/cardio/mod/load_strategy/set_tmp_files.rb +1 -1
  126. data/lib/cardio/mod/load_strategy.rb +12 -2
  127. data/lib/cardio/mod/modfile_api.rb +18 -18
  128. data/lib/cardio/mod/{poop.rb → sow.rb} +25 -33
  129. data/lib/cardio/mod.rb +46 -73
  130. data/lib/cardio/railtie.rb +21 -58
  131. data/lib/cardio/schema.rb +2 -1
  132. data/lib/cardio/script_loader.rb +3 -1
  133. data/lib/cardio/seed.rb +101 -8
  134. data/lib/cardio/utils.rb +39 -1
  135. data/lib/generators/deck/deck_generator.rb +5 -2
  136. data/lib/generators/deck/templates/config/puma.rb +1 -1
  137. data/lib/generators/deck/templates/script/decko_rspec +1 -1
  138. data/lib/generators/deck/templates/simplecov.rb.erb +10 -8
  139. data/lib/generators/mod/USAGE +1 -1
  140. data/lib/generators/mod/mod_generator.rb +5 -5
  141. data/lib/generators/set/USAGE +2 -2
  142. data/mod/core/{locales → config/locales}/de.yml +4 -0
  143. data/mod/core/{locales → config/locales}/en.yml +13 -0
  144. data/mod/core/data/fixtures/real/card_actions.yml +78 -0
  145. data/{db/seed/new → mod/core/data/fixtures/real}/card_acts.yml +2 -2
  146. data/mod/core/data/fixtures/real/card_references.yml +8 -0
  147. data/mod/core/data/fixtures/real/cards.yml +135 -0
  148. data/mod/core/data/real.yml +79 -0
  149. data/mod/core/data/test/cardtype.yml +38 -0
  150. data/mod/core/data/test/sample.yml +50 -0
  151. data/mod/core/data/test/user.yml +41 -0
  152. data/mod/core/data/test.yml +79 -28
  153. data/{lib → mod/core/lib}/tasks/card/migrate.rake +4 -0
  154. data/{lib → mod/core/lib}/tasks/card/mod.rake +9 -5
  155. data/mod/core/lib/tasks/card/seed.rake +60 -0
  156. data/mod/core/lib/tasks/card.rake +119 -0
  157. data/mod/core/set/all/admin.rb +14 -0
  158. data/mod/core/set/all/codename.rb +4 -0
  159. data/mod/core/set/all/content.rb +8 -4
  160. data/mod/core/set/all/{abort.rb → result.rb} +11 -15
  161. data/mod/core/set/all/states.rb +21 -1
  162. data/mod/core/set/all/trash.rb +25 -73
  163. data/mod/core/set/all/type.rb +2 -2
  164. data/mod/core/set/all/utils.rb +3 -87
  165. data/mod/core/set/right/autoname.rb +2 -0
  166. data/mod/core/set/self/admin/warning_alert.haml +3 -0
  167. data/mod/core/set/self/admin.rb +173 -0
  168. data/mod/core/set/type/cardtype.rb +2 -0
  169. data/mod/core/set_pattern/02_all_plus.rb +1 -1
  170. data/mod/core/set_pattern/05_rstar.rb +1 -1
  171. data/mod/core/set_pattern/06_rule.rb +1 -1
  172. data/mod/core/set_pattern/07_right.rb +1 -1
  173. data/mod/core/set_pattern/08_type_plus_right.rb +1 -1
  174. data/mod/core/spec/set/all/assign_attributes_spec.rb +3 -3
  175. data/mod/core/spec/set/all/autoname_spec.rb +25 -0
  176. data/mod/core/spec/set/all/codename_spec.rb +1 -1
  177. data/mod/core/spec/set/all/name_events_spec.rb +43 -66
  178. data/mod/core/spec/set/all/trash_spec.rb +149 -68
  179. data/mod/{admin → core}/spec/set/self/admin_spec.rb +25 -22
  180. data/mod/core/spec/set/self/trash_spec.rb +5 -0
  181. metadata +88 -253
  182. data/db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb +0 -18
  183. data/db/migrate_core_cards/20130419215612_import_help_text.rb +0 -13
  184. data/db/migrate_core_cards/20130823192433_add_style_cards.rb +0 -100
  185. data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +0 -11
  186. data/db/migrate_core_cards/20130927191728_account_events.rb +0 -20
  187. data/db/migrate_core_cards/20131016172445_common_css_patch.rb +0 -9
  188. data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +0 -8
  189. data/db/migrate_core_cards/20140512155840_add_script_cards.rb +0 -86
  190. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +0 -132
  191. data/db/migrate_core_cards/20140725180118_config_card_updates.rb +0 -9
  192. data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +0 -7
  193. data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +0 -14
  194. data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +0 -15
  195. data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +0 -10
  196. data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +0 -26
  197. data/db/migrate_core_cards/20141230204340_uri_codename.rb +0 -13
  198. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +0 -76
  199. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +0 -41
  200. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +0 -36
  201. data/db/migrate_core_cards/20150331135745_new_card_menu.rb +0 -8
  202. data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +0 -11
  203. data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +0 -24
  204. data/db/migrate_core_cards/20150528084659_add_session_cardtype.rb +0 -18
  205. data/db/migrate_core_cards/20150601133433_add_recent_setting_session_card.rb +0 -18
  206. data/db/migrate_core_cards/20150610171702_add_debugger_session_card.rb +0 -12
  207. data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +0 -58
  208. data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +0 -7
  209. data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +0 -9
  210. data/db/migrate_core_cards/20150708224756_add_list_cards.rb +0 -29
  211. data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +0 -15
  212. data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +0 -10
  213. data/db/migrate_core_cards/20151120180631_add_token_expiration.rb +0 -7
  214. data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +0 -10
  215. data/db/migrate_core_cards/20160804112510_reorganize_scripts.rb +0 -27
  216. data/db/migrate_core_cards/20160908154210_add_trash_card.rb +0 -7
  217. data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +0 -17
  218. data/db/migrate_core_cards/20170209132834_email_test_context.rb +0 -49
  219. data/db/migrate_core_cards/20170314175313_add_notification_event_card.rb +0 -20
  220. data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +0 -20
  221. data/db/migrate_core_cards/20170608083819_add_full_width_layout_card.rb +0 -23
  222. data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +0 -8
  223. data/db/migrate_core_cards/20180423120222_add_mod_styles_card.rb +0 -20
  224. data/db/migrate_core_cards/20180508210903_add_json_type.rb +0 -10
  225. data/db/migrate_core_cards/20180515175726_add_codenames.rb +0 -8
  226. data/db/migrate_core_cards/20180712042655_head_rule.rb +0 -13
  227. data/db/migrate_core_cards/20181120200937_update_layout.rb +0 -7
  228. data/db/migrate_core_cards/20190204195039_add_rule_card.rb +0 -10
  229. data/db/migrate_core_cards/20190321085735_wagn_to_decko_logo.rb +0 -11
  230. data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +0 -17
  231. data/db/migrate_core_cards/20190424100531_update_credit_image.rb +0 -76
  232. data/db/migrate_core_cards/20190424101004_add_read_anyone_rules.rb +0 -13
  233. data/db/migrate_core_cards/20190503122739_update_pristine_data.rb +0 -18
  234. data/db/migrate_core_cards/20190605133556_tweak_config_cards.rb +0 -10
  235. data/db/migrate_core_cards/20190618110446_add_dropdown_divider.rb +0 -8
  236. data/db/migrate_core_cards/20190621143156_add_role_assign_permissions.rb +0 -9
  237. data/db/migrate_core_cards/20190710090209_homepage_tweaks.rb +0 -13
  238. data/db/migrate_core_cards/20190820155833_update_cardtype_type_structure.rb +0 -7
  239. data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +0 -19
  240. data/db/migrate_core_cards/20190826132738_add_more_guides.rb +0 -7
  241. data/db/migrate_core_cards/20190829093961_cardtype_grouping.rb +0 -16
  242. data/db/migrate_core_cards/20190830131820_setting_settings_aside.rb +0 -17
  243. data/db/migrate_core_cards/20190902161223_add_style_media.rb +0 -7
  244. data/db/migrate_core_cards/20190918200115_ensure_description_card.rb +0 -13
  245. data/db/migrate_core_cards/20191008201046_fixture_fix.rb +0 -11
  246. data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +0 -9
  247. data/db/migrate_core_cards/20191118145629_codename_fixes.rb +0 -5
  248. data/db/migrate_core_cards/20200821231558_add_nest_list_type.rb +0 -9
  249. data/db/migrate_core_cards/data/1.11_help_text.json +0 -410
  250. data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +0 -104
  251. data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +0 -228
  252. data/db/migrate_core_cards/data/1.12_stylesheets/right_sidebar.scss +0 -27
  253. data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -143
  254. data/db/migrate_core_cards/data/1.13_config_text.json +0 -32
  255. data/db/migrate_core_cards/data/1.14_config_descriptions_etc.json +0 -77
  256. data/db/migrate_core_cards/data/bootstrap_layout.json +0 -96
  257. data/db/migrate_core_cards/data/cards/Xaccount +0 -22
  258. data/db/migrate_core_cards/data/cards/Xaccount_setting-Xright-Xstructure +0 -12
  259. data/db/migrate_core_cards/data/cards/Xall-Xlayout +0 -1
  260. data/db/migrate_core_cards/data/cards/Xcredit +0 -2
  261. data/db/migrate_core_cards/data/cards/Xfooter +0 -3
  262. data/db/migrate_core_cards/data/cards/Xgetting_started +0 -31
  263. data/db/migrate_core_cards/data/cards/Xgetting_started-shark +0 -66
  264. data/db/migrate_core_cards/data/cards/Xgetting_started_link +0 -6
  265. data/db/migrate_core_cards/data/cards/Xheader +0 -19
  266. data/db/migrate_core_cards/data/cards/Xhome +0 -1
  267. data/db/migrate_core_cards/data/cards/Xlogo +0 -1
  268. data/db/migrate_core_cards/data/cards/Xmain_menu +0 -2
  269. data/db/migrate_core_cards/data/cards/Xrecaptcha_setting-Xself-Xstructure +0 -1
  270. data/db/migrate_core_cards/data/cards/Xsidebar +0 -7
  271. data/db/migrate_core_cards/data/cards/Xstructure-Xright-Xguide +0 -12
  272. data/db/migrate_core_cards/data/cards/Xtitle +0 -1
  273. data/db/migrate_core_cards/data/cards/administrator-dashboard +0 -23
  274. data/db/migrate_core_cards/data/cards/administrator-description +0 -1
  275. data/db/migrate_core_cards/data/cards/anyone_signed_in-dashboard +0 -0
  276. data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xguide +0 -24
  277. data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xstructure +0 -3
  278. data/db/migrate_core_cards/data/cards/default_layout +0 -6
  279. data/db/migrate_core_cards/data/cards/full_width_layout +0 -5
  280. data/db/migrate_core_cards/data/cards/help_desk-dashboard +0 -7
  281. data/db/migrate_core_cards/data/cards/help_desk-description +0 -1
  282. data/db/migrate_core_cards/data/cards/home +0 -2
  283. data/db/migrate_core_cards/data/cards/home-Xself-Xlayout +0 -1
  284. data/db/migrate_core_cards/data/cards/home-original +0 -22
  285. data/db/migrate_core_cards/data/cards/home_layout +0 -6
  286. data/db/migrate_core_cards/data/cards/left_sidebar_layout +0 -6
  287. data/db/migrate_core_cards/data/cards/menu +0 -1
  288. data/db/migrate_core_cards/data/cards/right_thin_sidebar_layout +0 -8
  289. data/db/migrate_core_cards/data/cards/role-Xtype-Xstructure +0 -2
  290. data/db/migrate_core_cards/data/cards/shark-dashboard +0 -19
  291. data/db/migrate_core_cards/data/cards/shark-description +0 -1
  292. data/db/migrate_core_cards/data/cards/shark_menu +0 -2
  293. data/db/migrate_core_cards/data/cards.yml +0 -138
  294. data/db/migrate_core_cards/data/decko_logo.svg +0 -1
  295. data/db/migrate_core_cards/data/mailer/follower_notification_email.html +0 -9
  296. data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +0 -11
  297. data/db/migrate_core_cards/data/mailer/mail_config.json +0 -22
  298. data/db/migrate_core_cards/data/mailer/password_reset_email.html +0 -13
  299. data/db/migrate_core_cards/data/mailer/password_reset_email.txt +0 -11
  300. data/db/migrate_core_cards/data/mailer/signup_alert_email.html +0 -7
  301. data/db/migrate_core_cards/data/mailer/signup_alert_email.txt +0 -5
  302. data/db/migrate_core_cards/data/mailer/verification_email.html +0 -12
  303. data/db/migrate_core_cards/data/mailer/verification_email.txt +0 -9
  304. data/db/migrate_core_cards/data/skin_images.json +0 -91
  305. data/db/migrate_core_cards/data/themes/bootstrap_default/_bootswatch.scss +0 -0
  306. data/db/migrate_core_cards/data/themes/bootstrap_default/_variables.scss +0 -867
  307. data/db/migrate_core_cards/data/themes/cerulean/_bootswatch.scss +0 -125
  308. data/db/migrate_core_cards/data/themes/cerulean/_variables.scss +0 -861
  309. data/db/migrate_core_cards/data/themes/cosmo/_bootswatch.scss +0 -237
  310. data/db/migrate_core_cards/data/themes/cosmo/_variables.scss +0 -861
  311. data/db/migrate_core_cards/data/themes/cyborg/_bootswatch.scss +0 -210
  312. data/db/migrate_core_cards/data/themes/cyborg/_variables.scss +0 -861
  313. data/db/migrate_core_cards/data/themes/darkly/_bootswatch.scss +0 -330
  314. data/db/migrate_core_cards/data/themes/darkly/_variables.scss +0 -861
  315. data/db/migrate_core_cards/data/themes/flatly/_bootswatch.scss +0 -313
  316. data/db/migrate_core_cards/data/themes/flatly/_variables.scss +0 -861
  317. data/db/migrate_core_cards/data/themes/journal/_bootswatch.scss +0 -120
  318. data/db/migrate_core_cards/data/themes/journal/_variables.scss +0 -861
  319. data/db/migrate_core_cards/data/themes/lumen/_bootswatch.scss +0 -496
  320. data/db/migrate_core_cards/data/themes/lumen/_variables.scss +0 -861
  321. data/db/migrate_core_cards/data/themes/paper/_bootswatch.scss +0 -607
  322. data/db/migrate_core_cards/data/themes/paper/_variables.scss +0 -861
  323. data/db/migrate_core_cards/data/themes/readable/_bootswatch.scss +0 -174
  324. data/db/migrate_core_cards/data/themes/readable/_variables.scss +0 -861
  325. data/db/migrate_core_cards/data/themes/sandstone/_bootswatch.scss +0 -194
  326. data/db/migrate_core_cards/data/themes/sandstone/_variables.scss +0 -861
  327. data/db/migrate_core_cards/data/themes/simplex/_bootswatch.scss +0 -142
  328. data/db/migrate_core_cards/data/themes/simplex/_variables.scss +0 -861
  329. data/db/migrate_core_cards/data/themes/slate/_bootswatch.scss +0 -417
  330. data/db/migrate_core_cards/data/themes/slate/_variables.scss +0 -861
  331. data/db/migrate_core_cards/data/themes/spacelab/_bootswatch.scss +0 -137
  332. data/db/migrate_core_cards/data/themes/spacelab/_variables.scss +0 -861
  333. data/db/migrate_core_cards/data/themes/superhero/_bootswatch.scss +0 -332
  334. data/db/migrate_core_cards/data/themes/superhero/_variables.scss +0 -861
  335. data/db/migrate_core_cards/data/themes/united/_bootswatch.scss +0 -42
  336. data/db/migrate_core_cards/data/themes/united/_variables.scss +0 -861
  337. data/db/migrate_core_cards/data/themes/yeti/_bootswatch.scss +0 -437
  338. data/db/migrate_core_cards/data/themes/yeti/_variables.scss +0 -861
  339. data/db/seed/README.md +0 -2
  340. data/db/seed/new/card_actions.yml +0 -5913
  341. data/db/seed/new/card_references.yml +0 -6532
  342. data/db/seed/new/cards.yml +0 -14595
  343. data/db/seed/test/fixtures/card_actions.yml +0 -8153
  344. data/db/seed/test/fixtures/card_acts.yml +0 -1039
  345. data/db/seed/test/fixtures/card_changes.yml +0 -230
  346. data/db/seed/test/fixtures/card_references.yml +0 -8471
  347. data/db/seed/test/fixtures/cards.yml +0 -20171
  348. data/db/seed/test/fixtures/file1.txt +0 -1
  349. data/db/seed/test/fixtures/file2.txt +0 -1
  350. data/db/seed/test/fixtures/mao2.jpg +0 -0
  351. data/db/seed/test/fixtures/rails.gif +0 -0
  352. data/db/seed/test/fixtures/schema_migrations.yml +0 -67
  353. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +0 -347
  354. data/db/seed/test/fixtures/schema_migrations_deck.yml +0 -1
  355. data/db/seed/test/fixtures/schema_migrations_deck_cards.yml +0 -5
  356. data/db/test_seed.rb +0 -322
  357. data/lib/card/content/truncate.rb +0 -67
  358. data/lib/card/director/card_methods.rb +0 -45
  359. data/lib/card/file_card_creator/abstract_file_card/migration_file.rb +0 -50
  360. data/lib/card/file_card_creator/abstract_file_card/ruby_file.rb +0 -30
  361. data/lib/card/file_card_creator/abstract_file_card/source_file.rb +0 -36
  362. data/lib/card/file_card_creator/abstract_file_card.rb +0 -44
  363. data/lib/card/file_card_creator/haml_card.rb +0 -42
  364. data/lib/card/file_card_creator/output_helper.rb +0 -53
  365. data/lib/card/file_card_creator/script_card.rb +0 -35
  366. data/lib/card/file_card_creator/style_card.rb +0 -25
  367. data/lib/card/file_card_creator.rb +0 -25
  368. data/lib/card/name/fields_and_traits.rb +0 -42
  369. data/lib/cardio/commands/application.rb +0 -10
  370. data/lib/cardio/migration/import/import_data/card_attributes.rb +0 -64
  371. data/lib/cardio/migration/import/import_data/card_content.rb +0 -30
  372. data/lib/cardio/migration/import/import_data.rb +0 -119
  373. data/lib/cardio/migration/import/merger.rb +0 -46
  374. data/lib/cardio/migration/import.rb +0 -125
  375. data/lib/tasks/card/create.rake +0 -81
  376. data/lib/tasks/card.rake +0 -65
  377. data/mod/admin/locales/de.yml +0 -4
  378. data/mod/admin/locales/en.yml +0 -4
  379. data/mod/admin/set/all/admin.rb +0 -16
  380. data/mod/admin/set/self/admin.rb +0 -144
  381. data/mod/admin/set/self/admin_info.rb +0 -40
  382. data/mod/admin/set/self/debugger.rb +0 -3
  383. data/mod/admin/spec/set/self/admin_info_spec.rb +0 -9
  384. data/mod/core/data/production.yml +0 -7
  385. data/mod/core/set/all/collection.rb +0 -53
  386. data/mod/core/spec/set/all/collection_spec.rb +0 -170
  387. data/mod/core/spec/set/all/utils_spec.rb +0 -5
  388. data/mod/standard/data/files/favicon/image-icon.png +0 -0
  389. data/mod/standard/data/files/favicon/image-large.png +0 -0
  390. data/mod/standard/data/files/favicon/image-medium.png +0 -0
  391. data/mod/standard/data/files/favicon/image-original.png +0 -0
  392. data/mod/standard/data/files/favicon/image-small.png +0 -0
  393. data/mod/standard/data/files/logo/image-original.svg +0 -1
  394. /data/{db/seed/new → mod/core/data/fixtures/real}/card_changes.yml +0 -0
  395. /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations.yml +0 -0
  396. /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_core_cards.yml +0 -0
  397. /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck.yml +0 -0
  398. /data/{db/seed/new → mod/core/data/fixtures/real}/schema_migrations_deck_cards.yml +0 -0
@@ -3,7 +3,7 @@
3
3
  class Card
4
4
  module Set
5
5
  # the set loading process has two main phases:
6
-
6
+ #
7
7
  # 1. Definition: interpret each set file, creating/defining set and
8
8
  # set_format modules
9
9
  # 2. Organization: have base classes include modules associated with the
@@ -72,10 +72,8 @@ class Card
72
72
 
73
73
  # makes sets ready for dynamic loading via #include_set_modules
74
74
  def register_set_of_type set_module, set_type
75
- mods = modules[set_type]
76
- key = set_module.shortname
77
- mods[key] ||= []
78
- mods[key] << set_module
75
+ list = modules[set_type][set_module.shortname] ||= []
76
+ list << set_module unless list.member? set_module
79
77
  end
80
78
 
81
79
  def process_base_format_modules base_format_modules
@@ -18,11 +18,12 @@ class Card
18
18
  end
19
19
 
20
20
  def parent_event_name
21
- [parent_set.underscore, "requires_field", field].join("__").to_sym
21
+ [parent_set.underscored_name, "requires_field", field].join("__").to_sym
22
22
  end
23
23
 
24
24
  def field_event_name action
25
- [field, "required_by", parent_set.underscore, "on", action].join("__").to_sym
25
+ [field, "required_by", parent_set.underscored_name, "on", action]
26
+ .join("__").to_sym
26
27
  end
27
28
 
28
29
  private
@@ -60,7 +60,7 @@ class Card
60
60
  if all_set?
61
61
  [:right, trait]
62
62
  elsif type_set?
63
- [:type_plus_right, set_name_parts.last, trait]
63
+ [:type_plus_right, set_name_parts[3], trait]
64
64
  end
65
65
  end
66
66
 
data/lib/card/set/type.rb CHANGED
@@ -1,49 +1,9 @@
1
1
  class Card
2
2
  module Set
3
+ # Base class for type sets defined in {Card::Set set modules}
3
4
  class Type < Pattern::Base
4
5
  cattr_accessor :assignment
5
6
  self.assignment = {}
6
-
7
- def initialize card
8
- super
9
- # support type inheritance
10
- @inherit_card = card unless module_key
11
- end
12
-
13
- def lookup_module_list modules_hash
14
- lookup_key = module_key || inherited_key
15
- modules_hash[lookup_key] if lookup_key
16
- end
17
-
18
- private
19
-
20
- def inherited_key
21
- if defined?(@inherited_key)
22
- @inherited_key
23
- else
24
- @inherited_key = lookup_inherited_key
25
- end
26
- end
27
-
28
- def lookup_inherited_key
29
- return unless (card = @inherit_card)
30
-
31
- @inherit_card = nil
32
- return unless (type_code = default_type_code card)
33
-
34
- mod_key = "Type::#{type_code.to_s.camelize}"
35
- mod_key if mods_exist_for_key? mod_key
36
- end
37
-
38
- def default_type_code card
39
- card.rule_card(:default, skip_modules: true)&.type_code
40
- end
41
-
42
- def mods_exist_for_key? mod_key
43
- list_of_hashes = Card::Set.modules[:nonbase_format].values
44
- list_of_hashes << Card::Set.modules[:nonbase]
45
- list_of_hashes.any? { |h| h[mod_key] }
46
- end
47
7
  end
48
8
  end
49
9
  end
data/lib/card/set.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  class Card
4
- #
5
4
  # A _Set_ is a group of {Card Cards} to which _Rules_ may apply. Sets can be as
6
5
  # specific as a single card, as general as all cards, or anywhere in between.
7
6
  #
@@ -11,39 +10,86 @@ class Card
11
10
  # web interface and are thus documented at https://decko.org/rules.
12
11
  # - **Code rules** can be defined in a 'set module'.
13
12
  #
14
- # The {Cardio::Mod} docs explain how to create mods and set_modules. This page explains
15
- # how those modules become useful.
13
+ # ## Set Modules
14
+ #
15
+ # ### File structure
16
+ #
17
+ # Set modules specify views, events, and other methods for a given set of cards.
18
+ # They are defined in a {Cardio::Mod mod's} _set_ directory. For example, suppose
19
+ # you've created a mod called *biz*, your deck has Company cards, and you want to
20
+ # extend the behavior of those cards.
21
+ #
22
+ # You can add a set module like so:
23
+ #
24
+ # card generate set biz type company
25
+ #
26
+ # This will create the following two files:
27
+ #
28
+ # mod/biz/set/type/company.rb
29
+ # mod/biz/spec/set/type/company.rb
30
+ #
31
+ # If you would like to break this code into smaller files, you can extend this
32
+ # pattern into another directory, eg:
33
+ #
34
+ # mod/biz/set/type/company/foo.rb
35
+ # mod/biz/set/type/company/bar.rb
36
+ #
37
+ # The general pattern can be expressed as follows:
38
+ #
39
+ # DECKNAME/mod/MODNAME/set/SET_PATTERN/ANCHOR[/FREENAME].rb
16
40
  #
17
- # Suppose you have created a "mod" for managing your contacts called "contactmanager",
18
- # and it includes code that would apply to all +address cards here:
41
+ # **Note:** _the set module's filename connects it to the set, so both the set_pattern
42
+ # and the set_anchor must correspond to the codename of a card in the database to
43
+ # function correctly. For example, the type/company directory corresponds to the Set
44
+ # card named `:company+:type`. Both the :company and :type codenames must exist for this
45
+ # to work properly._
46
+ #
47
+ # ### Writing/Editing set modules
48
+ #
49
+ # A set module is mostly standard ruby, but the files are quite concise because
50
+ #
51
+ # 1. the set module's file location is used to autogenerate ruby module definitions
52
+ # 2. A DSL (Domain-Specific Language) makes common tasks easy.
53
+ #
54
+ # You can, for example, edit `mod/biz/set/type/company.rb`, and add _only_ the
55
+ # following code:
56
+ #
57
+ # def hello
58
+ # "world"
59
+ # end
19
60
  #
20
- # ./contactmanager/set/right/address.rb
61
+ # No further code is needed for this method to be available to cards with the type
62
+ # Company (as specified by the file's location). This code will automatically be added
63
+ # to a ruby module named `Card::Set::Type::Company`. That module is extended with the
64
+ # {Card::Set} module, giving it access to the set module DSL.
21
65
  #
22
- # Then, whenever you fetch or instantiate a +address card, the card will automatically
23
- # include code from that set module. In fact, it will include all the set modules
24
- # associated with sets of which it is a member.
66
+ # These important Card::Set subclasses explain more about the DSL
67
+ #
68
+ # - {Format} introduces format blocks
69
+ # - {Format::AbstractFormat} covers {Format::AbstractFormat#view view} definitions
70
+ # - {Event::Api} explains {Event::Api#event event} definitions
71
+ #
72
+ # ### Loading set modules
73
+ #
74
+ # Whenever you fetch or instantiate a card, the card will automatically
75
+ # include code from all the set modules associated with sets of which it is a member.
25
76
  #
26
77
  # For example, say you have a Plaintext card named 'Philipp+address', and you have set
27
78
  # files for the following sets:
28
79
  #
29
- # * all cards
30
- # * all Plaintext cards
31
- # * all cards ending in +address
80
+ # * all cards
81
+ # * all Plaintext cards
82
+ # * all cards ending in +address
32
83
  #
33
- # When you run this:
84
+ # When you run any of these:
34
85
  #
35
- # mycard = Card.fetch 'Philipp+address'
86
+ # mycard = Card.fetch "Philipp+address"
87
+ # mycard = "Philipp+address".card
88
+ # mycard = ["Philipp", "address"].card
36
89
  #
37
90
  # ...then mycard will include the set modules associated with each of those sets in the
38
91
  # above order.
39
92
  #
40
- # Note that the set module's filename connects it to the set, so both the set_pattern
41
- # and the set_anchor must correspond to the codename of a card in the database to
42
- # function correctly.
43
- #
44
- # A set module is "just ruby", but is generally quite concise because Card uses
45
- # a) the set module's file location to autogenerate ruby module names and
46
- # b) Card::Set to provide API for the most common set methods.
47
93
  #
48
94
  module Set
49
95
  include Event::Api
data/lib/card/setting.rb CHANGED
@@ -49,7 +49,6 @@ class Card
49
49
  editing
50
50
  event
51
51
  other
52
- config
53
52
  ].each_with_object({}) do |key, groups|
54
53
  groups[key] = []
55
54
  end
@@ -2,6 +2,8 @@ class Card
2
2
  class Subcards
3
3
  # subcard-related Card instance methods
4
4
  module All
5
+ Card.action_specific_attributes << :subcards
6
+
5
7
  def subcards
6
8
  @subcards ||= Card::Subcards.new self
7
9
  end
@@ -27,7 +29,7 @@ class Card
27
29
  subcards.card(card_name).present?
28
30
  end
29
31
 
30
- def subfield field_name, args={}
32
+ def field field_name, args={}
31
33
  if (sf = subcards.field field_name)
32
34
  sf.assign_attributes args
33
35
  sf
@@ -36,23 +38,19 @@ class Card
36
38
  end
37
39
  end
38
40
 
39
- def subfield_content field_name
41
+ def field_content field_name
40
42
  subcards.field(field_name)&.content
41
43
  end
42
44
 
43
- def subfield? field_name
44
- subcards.field(field_name).present?
45
- end
46
-
47
45
  def field? tag
48
- field(tag) || subfield?(tag)
46
+ fetch(tag) || subcards.field(tag).present?
49
47
  end
50
48
 
51
49
  def drop_subcard name_or_card
52
50
  subcards.remove name_or_card
53
51
  end
54
52
 
55
- def drop_subfield name_or_card
53
+ def drop_field name_or_card
56
54
  subcards.remove_field name_or_card
57
55
  end
58
56
 
@@ -4,8 +4,8 @@ class Card
4
4
  module Args
5
5
  def extract_subcard_args! args
6
6
  safe_subcard_args args do |subcards|
7
- extract_explicit_subfields subcards, args
8
- extract_implicit_subfields subcards, args
7
+ extract_explicit_fields subcards, args
8
+ extract_implicit_fields subcards, args
9
9
  end
10
10
  end
11
11
 
@@ -18,21 +18,21 @@ class Card
18
18
  subcards.try(:to_unsafe_h) || subcards
19
19
  end
20
20
 
21
- def extract_explicit_subfields subcards, args
22
- return unless (subfields = args.delete :subfields)
21
+ def extract_explicit_fields subcards, args
22
+ return unless (fields = args.delete :fields)
23
23
 
24
- subfields.each_pair do |key, value|
25
- subcards[normalize_subfield_key(key)] = value
24
+ fields.each_pair do |key, value|
25
+ subcards[normalize_field_key(key)] = value
26
26
  end
27
27
  end
28
28
 
29
29
  # ensure a leading '+'
30
- def normalize_subfield_key key
31
- key = Card::Codename.name(key) if key.is_a?(Symbol) && Card::Codename.exist?(key)
30
+ def normalize_field_key key
31
+ key = Card::Codename.name! key if key.is_a?(Symbol)
32
32
  key.to_name.prepend_joint
33
33
  end
34
34
 
35
- def extract_implicit_subfields subcards, args
35
+ def extract_implicit_fields subcards, args
36
36
  args.each_key do |key|
37
37
  subcards[key.to_s] = args.delete(key) if key.to_s.match?(/^\+/)
38
38
  end
@@ -84,7 +84,7 @@ class Card
84
84
  case view_perms
85
85
  when :none then true
86
86
  when parent.view_perms then true
87
- when Symbol then format.anyone_can?(view_perms)
87
+ when *Permission::CRUD then format.anyone_can?(view_perms)
88
88
  else false
89
89
  end
90
90
  end
@@ -19,6 +19,10 @@ class Card
19
19
  !hide? view
20
20
  end
21
21
 
22
+ def explicit_show? view
23
+ viz_hash[view&.to_sym] == :show
24
+ end
25
+
22
26
  # write methods
23
27
 
24
28
  def show *views
@@ -56,6 +56,7 @@ class Card
56
56
  :type, # set the default type of new cards
57
57
  :size, # set an image size
58
58
  # (also used for character limit in one_line_content)
59
+ :header, # h1, h2, h3..
59
60
  :items, # options for items (Hash)
60
61
  :cache, # change view cache behaviour
61
62
  # (Symbol<:always, :standard, :never>)
@@ -8,6 +8,8 @@ class Card
8
8
  # # only render if user has permission to update card
9
9
  # view :myview, perms: :update do...
10
10
  module Permission
11
+ CRUD = ::Set.new(%i[create read update delete]).freeze
12
+
11
13
  def view_perms
12
14
  @view_perms = setting(:perms) || :read
13
15
  end
@@ -47,11 +49,17 @@ class Card
47
49
  format.view_for_denial requested_view, task
48
50
  end
49
51
 
52
+ def crud? task
53
+ task.in? CRUD
54
+ end
55
+
50
56
  def denied_task
51
- if view_perms.is_a? Proc
52
- :read unless view_perms.call(format) # read isn't quite right
53
- else
54
- Array.wrap(view_perms).find { |task| !format.ok? task }
57
+ Array.wrap(view_perms).find do |task|
58
+ if crud? task
59
+ !format.ok? task
60
+ else
61
+ !format.send task
62
+ end
55
63
  end
56
64
  end
57
65
  end
data/lib/card/view.rb CHANGED
@@ -106,6 +106,10 @@ class Card
106
106
  !parent && !format.parent
107
107
  end
108
108
 
109
+ def depth
110
+ @depth ||= parent ? (parent.depth + 1) : 0
111
+ end
112
+
109
113
  # next voo object found tracing ancestry through parent voos and/or parent formats
110
114
  # @return [Card::View]
111
115
  def next_ancestor across_format=true
data/lib/card.rb CHANGED
@@ -19,11 +19,11 @@ ActiveSupport.run_load_hooks(:before_card, self)
19
19
  # unique _name_, _key_, and _id_. Some cards also have a _codename_.
20
20
  #
21
21
  # @card.name # The name, a Card::Name object, is the most recognizable card
22
- # mark.
22
+ # # mark.
23
23
  # @card.key # The key, a String, is a simple lower-case name variant.
24
24
  # @card.id # The id is an Integer.
25
25
  # @card.codename # The codename, a Symbol, is the name by which a card can be
26
- # referred to in code.
26
+ # # referred to in code.
27
27
  #
28
28
  # All names with the same key (including the key itself) are considered variants of each
29
29
  # other. No two cards can have names with the same key. {Card::Name} objects inherit from
@@ -47,7 +47,7 @@ ActiveSupport.run_load_hooks(:before_card, self)
47
47
  # @card.type_code # returns codename of type card [Symbol]
48
48
  # @card.type_card # returns Cardtype card associated with @card's type [Card]
49
49
  #
50
- # {file:mod/core/set/all/type.rb Common type methods}
50
+ # - {Set::All::Type Common type methods}
51
51
  #
52
52
  # ## Content
53
53
  #
@@ -57,9 +57,8 @@ ActiveSupport.run_load_hooks(:before_card, self)
57
57
  # @card.content # the "official" content, which may be different from
58
58
  # db_content when db_content is overridden with a structure rule.
59
59
  #
60
- # {Card::Content Processing card content}
61
- #
62
- # {file:mod/core/set/all/content.rb Common content methods}
60
+ # - {Content Processing card content}
61
+ # - {Set::All::Content Common content methods}
63
62
  #
64
63
  # ## Fetch
65
64
  #
@@ -68,15 +67,35 @@ ActiveSupport.run_load_hooks(:before_card, self)
68
67
  #
69
68
  # Any of the above marks (name, key, id, codename) can be used to fetch a card, eg:
70
69
  #
71
- # @card = Card.fetch "Garden" # returns the card with the name "Garden" (or, more
70
+ # @card1 = Card.fetch "Garden" # returns the card with the name "Garden" (or, more
72
71
  # precisely, with the key "garden")
73
- # @card = Card.fetch 100 # returns the card with the id 100
74
- # @card = Card.fetch :help # returns the card with the codename help
72
+ # @card2 = Card.fetch 100 # returns the card with the id 100
73
+ # @card3 = Card.fetch :help # returns the card with the codename help
75
74
  #
76
75
  # The fetch API will first try to find the card in the cache and will only look in the
77
76
  # database if necessary.
78
77
  #
79
- # {file:mod/core/set/all/fetch.rb More on fetching.}
78
+ # The `Card[]` shortcut will return the same results but does not support the full range
79
+ # of advanced options and will not return virtual cards
80
+ # (cards that can be constructed from naming patterns but are not actually in the
81
+ # database).
82
+ #
83
+ # # equivalent to the above but more concise
84
+ # @card1 = Card["Garden"]
85
+ # @card2 = Card[100]
86
+ # @card3 = Card[:help]
87
+ #
88
+ # Better still, you can use the `#card` method on Strings, Integers, Symbols, and Arrays
89
+ #
90
+ # # equivalent to the above but even more concise
91
+ # @card1 = "Garden".card
92
+ # @card2 = 100.card
93
+ # @card3 = :help.card
94
+ #
95
+ # The `#card_id`, `#cardname`, and `#codename` methods work on all the same objects and
96
+ # provide convenient shortcuts for quickly fetching and returning card attributes.
97
+ #
98
+ # - {Card::Fetch::CardClass More on fetching.}
80
99
  #
81
100
  # ## Query
82
101
  #
@@ -84,7 +103,7 @@ ActiveSupport.run_load_hooks(:before_card, self)
84
103
  #
85
104
  # Card.search type_id: 4 # returns an Array of cards with the type_id of 4.
86
105
  #
87
- # {Card::Query More on queries}
106
+ # - {Card::Query More on queries}
88
107
  #
89
108
  # ## Views and Events
90
109
  #
@@ -95,9 +114,8 @@ ActiveSupport.run_load_hooks(:before_card, self)
95
114
  # Both views and events are defined in {Cardio::Mod mods}, short for modules or
96
115
  # modifications.
97
116
  #
98
- # {Card::Set::Format::AbstractFormat More on views}
99
- #
100
- # {Card::Set::Event::Api More on events}
117
+ # - {Set::Format::AbstractFormat#view More on views}
118
+ # - {Set::Event::Api#event More on events}
101
119
  #
102
120
  # ## Accounts and Permissions
103
121
  #
@@ -117,10 +135,25 @@ class Card < Cardio::Record
117
135
  extend Cache::CardClass
118
136
  extend Director::CardClass
119
137
  extend Fetch::CardClass
138
+ extend Query::CardClass
139
+
140
+ cattr_accessor :action_specific_attributes, :set_specific_attributes
141
+
142
+ self.action_specific_attributes = [
143
+ :supercard, # [Card]
144
+ :superleft, # [Card]
145
+ :action, # [Symbol] :create, :update, or :delete
146
+ :current_action, # [Card::Action]
147
+ :last_action_id_before_edit, # [Integer]
148
+
149
+ :comment, # TODO: refactor in favor of card[add], card[drop]
150
+ :silent_change # TODO: refactor following to use skip/trigger
151
+ ]
152
+
153
+ attr_accessor(*action_specific_attributes)
120
154
 
121
155
  include Dirty
122
156
  include DirtyNames
123
- include Director::CardMethods
124
157
  include Name::All
125
158
  include Content::All
126
159
  include Set::CardMethods
@@ -139,36 +172,12 @@ class Card < Cardio::Record
139
172
  has_many :actions, -> { where(draft: [nil, false]).order :id }
140
173
  has_many :drafts, -> { where(draft: true).order :id }, class_name: :Action
141
174
 
142
- cattr_accessor :action_specific_attributes, :set_specific_attributes
143
175
  alias_method :card_id, :id
144
176
 
145
177
  class << self
146
178
  delegate :config, :paths, to: Cardio
147
179
  end
148
180
 
149
- self.action_specific_attributes = [
150
- :supercard,
151
- :superleft,
152
- :action, # [Symbol] :create, :update, or :delete
153
- :current_action, # [Card::Action]
154
- :last_action_id_before_edit,
155
-
156
- :skip, # [Array] skip event(s) for all cards in act
157
- :skip_in_action, # [Array] skip event for just this card
158
- :trigger, # [Array] trigger event(s) for all cards in act
159
- :trigger_in_action, # [Array] trigger event for just this card
160
- :comment, # obviated soon
161
-
162
- # TODO: refactor following to use skip/trigger
163
- :update_all_users, # if the above is wrong then this one too
164
- :silent_change # and this probably too
165
- ]
166
-
167
- attr_accessor(*action_specific_attributes)
168
-
169
- self.action_specific_attributes +=
170
- %i[skip_hash full_skip_hash trigger_hash full_trigger_hash]
171
-
172
181
  define_callbacks :select_action, :show_page, :act
173
182
 
174
183
  ActiveSupport.run_load_hooks :card, self
data/lib/cardio/cli.rb CHANGED
@@ -2,6 +2,8 @@ require "rbconfig"
2
2
  require "colorize"
3
3
  require "cardio/script_loader"
4
4
 
5
+ Cardio::ScriptLoader.script_name = "card"
6
+
5
7
  # If we are inside a Decko application this method performs an exec and thus
6
8
  # the rest of this script is not run.
7
9
  Cardio::ScriptLoader.exec!
@@ -9,4 +11,4 @@ Cardio::ScriptLoader.exec!
9
11
  require "rails/ruby_version_check"
10
12
  Signal.trap("INT") { exit(1) }
11
13
 
12
- require "cardio/commands/application"
14
+ require "cardio/command/application"
@@ -0,0 +1,5 @@
1
+ require "rails/generators"
2
+ require File.expand_path("../../../generators/deck/deck_generator", __FILE__)
3
+ require "cardio/command"
4
+
5
+ Cardio::Command.run_non_deck_command ARGV.first, "cardio/commands"
@@ -1,7 +1,7 @@
1
1
  module Cardio
2
- class Commands
2
+ class Command
3
3
  # shared handling of commands splitting cardio and original args with "--"
4
- class Command
4
+ class CommandBase
5
5
  def run
6
6
  puts command
7
7
  exit_with_child_status command
@@ -2,13 +2,15 @@ require "optparse"
2
2
  require "cardio/version"
3
3
 
4
4
  module Cardio
5
- class Commands
5
+ class Command
6
+ # Card-extensions of Rails command patterns
6
7
  module Custom
7
8
  private
8
9
 
9
10
  def run_new
10
11
  if !["-h", "--help"].intersection(args).empty?
11
- require "cardio/commands/application"
12
+ ARGV.unshift "new"
13
+ require "cardio/command/application"
12
14
  else
13
15
  puts "Can't initialize a new deck within the directory of another, " \
14
16
  "please change to a non-deck directory first.\n"
@@ -22,33 +24,35 @@ module Cardio
22
24
  end
23
25
 
24
26
  def run_rspec
25
- require "cardio/commands/rspec_command"
27
+ require "cardio/command/rspec_command"
26
28
  RspecCommand.new(args).run
27
29
  end
28
30
 
29
31
  # def run_jasmine
30
- # require "cardio/commands/rake_command"
32
+ # require "cardio/command/rake_command"
31
33
  # RakeCommand.new("spec:javascript", envs: "test").run
32
34
  # end
33
35
 
34
36
  def run_help
35
37
  puts "Usage:"
36
- puts " #{gem} COMMAND [OPTIONS]".green
38
+ puts " #{Command.bin_name} COMMAND [OPTIONS]".green
37
39
  puts
38
40
  puts "Run commands with -h (or --help) for more info."
39
41
 
40
42
  %i[shark monkey].each do |group|
41
- puts
42
- puts "For " + "#{group}s".yellow + ":"
43
- map.each do |command, conf|
44
- next unless conf[:group] == group
45
- puts command_help(command, conf)
46
- end
47
- puts
43
+ run_help_for_group group
48
44
  end
49
45
  end
50
46
 
51
- private
47
+ def run_help_for_group group
48
+ puts
49
+ puts "For " + "#{group}s".yellow + ":"
50
+ map.each do |command, conf|
51
+ next unless conf[:group] == group
52
+ puts command_help(command, conf)
53
+ end
54
+ puts
55
+ end
52
56
 
53
57
  # formats command string for help text
54
58
  def command_help command, conf
@@ -3,7 +3,7 @@
3
3
  # require "optparse"
4
4
  #
5
5
  # module Cardio
6
- # class Commands
6
+ # class Command
7
7
  # class RakeCommand
8
8
  # # parse decko/card -specific options for rake
9
9
  # class Parser < OptionParser
@@ -23,8 +23,8 @@
23
23
  # super() do |parser|
24
24
  # parser.banner =
25
25
  # "Usage:\n" +
26
- # " #{Commands.gem} #{command} [options]".green +
27
- # "\n\nRuns `rake #{Commands.gem}:#{command}` task."
26
+ # " #{Command.bin_name} #{command} [options]".green +
27
+ # "\n\nRuns `rake #{Command.bin_name}:#{command}` task."
28
28
  # parser_ons parser, command do |env_array|
29
29
  # opts[:envs] = env_array
30
30
  # end