card 1.102.0 → 1.103.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (506) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/02_patches/active_record.rb +2 -2
  4. data/config/locales/en.yml +0 -144
  5. data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +1 -1
  6. data/db/migrate_core_cards/20200821231558_add_nest_list_type.rb +2 -2
  7. data/db/seed/new/card_actions.yml +3228 -2716
  8. data/db/seed/new/card_acts.yml +3 -3
  9. data/db/seed/new/card_references.yml +1898 -1387
  10. data/db/seed/new/cards.yml +6800 -5415
  11. data/db/seed/new/schema_migrations_core_cards.yml +20 -0
  12. data/db/seed/test/fixtures/card_actions.yml +4713 -4121
  13. data/db/seed/test/fixtures/card_acts.yml +755 -695
  14. data/db/seed/test/fixtures/card_changes.yml +103 -103
  15. data/db/seed/test/fixtures/card_references.yml +3185 -2632
  16. data/db/seed/test/fixtures/cards.yml +10085 -8448
  17. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +20 -0
  18. data/db/test_seed.rb +6 -1
  19. data/lib/card/auth/current.rb +1 -1
  20. data/lib/card/cache.rb +1 -1
  21. data/lib/card/cache/persistent.rb +1 -1
  22. data/lib/card/cache/persistent_class.rb +1 -1
  23. data/lib/card/codename.rb +1 -1
  24. data/lib/card/director/all.rb +4 -4
  25. data/lib/card/error.rb +1 -1
  26. data/lib/card/format.rb +1 -1
  27. data/lib/card/format/error.rb +1 -1
  28. data/lib/card/format/nest/fetch.rb +1 -1
  29. data/lib/card/model/save_helper.rb +1 -1
  30. data/lib/card/model/save_helper/save_arguments.rb +3 -1
  31. data/lib/card/reference/all.rb +1 -1
  32. data/lib/card/set/format/haml_paths.rb +6 -5
  33. data/lib/card/set/type.rb +1 -1
  34. data/lib/card/tasks/card.rake +0 -18
  35. data/lib/card/tasks/card/asset.rake +22 -0
  36. data/lib/card/tasks/card/migrate.rake +7 -7
  37. data/lib/card/tasks/card/mod.rake +30 -0
  38. data/lib/cardio.rb +5 -10
  39. data/lib/cardio/all.rb +1 -0
  40. data/lib/cardio/application.rb +3 -132
  41. data/lib/cardio/delaying.rb +3 -3
  42. data/lib/cardio/generators/class_methods.rb +1 -1
  43. data/lib/cardio/migration.rb +8 -27
  44. data/lib/cardio/migration/deck_structure.rb +1 -1
  45. data/lib/cardio/mod.rb +55 -2
  46. data/lib/cardio/mod/dirs.rb +41 -41
  47. data/lib/cardio/mod/load_strategy.rb +1 -1
  48. data/lib/cardio/mod/load_strategy/eval.rb +1 -1
  49. data/lib/cardio/mod/load_strategy/pattern_tmp_files.rb +1 -1
  50. data/lib/cardio/mod/load_strategy/set_binding_magic.rb +1 -1
  51. data/lib/cardio/mod/load_strategy/set_tmp_files.rb +1 -1
  52. data/lib/cardio/mod/load_strategy/tmp_files.rb +1 -1
  53. data/lib/cardio/mod/loader.rb +2 -2
  54. data/lib/cardio/mod/loader/set_loader.rb +1 -1
  55. data/lib/cardio/mod/loader/set_pattern_loader.rb +1 -1
  56. data/lib/cardio/mod/loader/set_template.rb +1 -1
  57. data/lib/cardio/mod/modfile_api.rb +22 -0
  58. data/lib/cardio/mod/modfile_loader.rb +18 -0
  59. data/lib/cardio/mod/module_template.rb +1 -1
  60. data/lib/cardio/railtie.rb +134 -0
  61. data/lib/cardio/schema.rb +68 -69
  62. data/lib/cardio/utils.rb +22 -28
  63. data/lib/generators/migration/migration_generator.rb +1 -1
  64. data/lib/generators/mod/mod_generator.rb +10 -14
  65. data/mod/admin/locales/en.yml +4 -0
  66. data/mod/admin/set/self/admin.rb +2 -2
  67. data/mod/core/locales/en.yml +30 -0
  68. data/mod/core/set/all/initialize.rb +5 -1
  69. data/mod/core/set/all/name_events.rb +1 -1
  70. data/mod/core/set/all/utils.rb +2 -2
  71. data/tmpsets/set_pattern/100-all.rb +1 -1
  72. data/tmpsets/set_pattern/101-all_plus.rb +1 -1
  73. data/tmpsets/set_pattern/102-type.rb +1 -1
  74. data/tmpsets/set_pattern/103-star.rb +1 -1
  75. data/tmpsets/set_pattern/104-rstar.rb +1 -1
  76. data/tmpsets/set_pattern/105-rule.rb +1 -1
  77. data/tmpsets/set_pattern/106-right.rb +1 -1
  78. data/tmpsets/set_pattern/107-type_plus_right.rb +1 -1
  79. data/tmpsets/set_pattern/108-self.rb +1 -1
  80. metadata +50 -469
  81. data/lib/cardio/defaults.yml +0 -71
  82. data/tmpsets/set/mod001-admin/self/admin.rb +0 -155
  83. data/tmpsets/set/mod001-admin/self/admin_info.rb +0 -52
  84. data/tmpsets/set/mod001-admin/self/debugger.rb +0 -12
  85. data/tmpsets/set/mod002-core/all/abort.rb +0 -85
  86. data/tmpsets/set/mod002-core/all/assign_attributes.rb +0 -119
  87. data/tmpsets/set/mod002-core/all/autoname.rb +0 -26
  88. data/tmpsets/set/mod002-core/all/codename.rb +0 -39
  89. data/tmpsets/set/mod002-core/all/collection.rb +0 -62
  90. data/tmpsets/set/mod002-core/all/content.rb +0 -74
  91. data/tmpsets/set/mod002-core/all/debug.rb +0 -29
  92. data/tmpsets/set/mod002-core/all/initialize.rb +0 -93
  93. data/tmpsets/set/mod002-core/all/name_events.rb +0 -172
  94. data/tmpsets/set/mod002-core/all/reference_events.rb +0 -78
  95. data/tmpsets/set/mod002-core/all/states.rb +0 -93
  96. data/tmpsets/set/mod002-core/all/subcards.rb +0 -29
  97. data/tmpsets/set/mod002-core/all/trash.rb +0 -142
  98. data/tmpsets/set/mod002-core/all/type.rb +0 -70
  99. data/tmpsets/set/mod002-core/all/utils.rb +0 -104
  100. data/tmpsets/set/mod002-core/right/autoname.rb +0 -12
  101. data/tmpsets/set/mod002-core/self/autoname.rb +0 -12
  102. data/tmpsets/set/mod002-core/self/trash.rb +0 -73
  103. data/tmpsets/set/mod002-core/self/version.rb +0 -18
  104. data/tmpsets/set/mod002-core/type/cardtype.rb +0 -37
  105. data/tmpsets/set/mod004-email/abstract/email_field.rb +0 -49
  106. data/tmpsets/set/mod004-email/abstract/test_context.rb +0 -36
  107. data/tmpsets/set/mod004-email/all/email_html.rb +0 -18
  108. data/tmpsets/set/mod004-email/all/email_text.rb +0 -22
  109. data/tmpsets/set/mod004-email/right/bcc.rb +0 -10
  110. data/tmpsets/set/mod004-email/right/cc.rb +0 -10
  111. data/tmpsets/set/mod004-email/right/from.rb +0 -10
  112. data/tmpsets/set/mod004-email/right/html_message.rb +0 -23
  113. data/tmpsets/set/mod004-email/right/subject.rb +0 -10
  114. data/tmpsets/set/mod004-email/right/text_message.rb +0 -10
  115. data/tmpsets/set/mod004-email/right/to.rb +0 -10
  116. data/tmpsets/set/mod004-email/type/email_template.rb +0 -101
  117. data/tmpsets/set/mod004-email/type/email_template/email_config.rb +0 -92
  118. data/tmpsets/set/mod005-collection/abstract/items.rb +0 -215
  119. data/tmpsets/set/mod005-collection/abstract/paging.rb +0 -74
  120. data/tmpsets/set/mod005-collection/abstract/paging/paging_links.rb +0 -99
  121. data/tmpsets/set/mod005-collection/abstract/paging/paging_views.rb +0 -121
  122. data/tmpsets/set/mod005-collection/all/extended.rb +0 -59
  123. data/tmpsets/set/mod005-collection/all/item.rb +0 -145
  124. data/tmpsets/set/mod006-content/abstract/00_sources.rb +0 -33
  125. data/tmpsets/set/mod006-content/abstract/01_code_file.rb +0 -94
  126. data/tmpsets/set/mod006-content/abstract/asset_file.rb +0 -84
  127. data/tmpsets/set/mod006-content/abstract/haml_file.rb +0 -32
  128. data/tmpsets/set/mod006-content/abstract/lock.rb +0 -36
  129. data/tmpsets/set/mod006-content/abstract/read_only.rb +0 -23
  130. data/tmpsets/set/mod006-content/abstract/templated_nests.rb +0 -16
  131. data/tmpsets/set/mod006-content/abstract/vendor_code_file.rb +0 -18
  132. data/tmpsets/set/mod006-content/all/chunk.rb +0 -151
  133. data/tmpsets/set/mod006-content/all/contextual_content.rb +0 -29
  134. data/tmpsets/set/mod006-content/all/templating.rb +0 -79
  135. data/tmpsets/set/mod006-content/right/default.rb +0 -43
  136. data/tmpsets/set/mod006-content/right/structure.rb +0 -85
  137. data/tmpsets/set/mod006-content/self/default.rb +0 -11
  138. data/tmpsets/set/mod006-content/self/structure.rb +0 -13
  139. data/tmpsets/set/mod007-format/all/active_card.rb +0 -14
  140. data/tmpsets/set/mod007-format/all/base.rb +0 -148
  141. data/tmpsets/set/mod007-format/all/content.rb +0 -77
  142. data/tmpsets/set/mod007-format/all/css.rb +0 -45
  143. data/tmpsets/set/mod007-format/all/csv.rb +0 -103
  144. data/tmpsets/set/mod007-format/all/demo.rb +0 -45
  145. data/tmpsets/set/mod007-format/all/error.rb +0 -81
  146. data/tmpsets/set/mod007-format/all/export.rb +0 -79
  147. data/tmpsets/set/mod007-format/all/file.rb +0 -18
  148. data/tmpsets/set/mod007-format/all/frame.rb +0 -58
  149. data/tmpsets/set/mod007-format/all/haml.rb +0 -84
  150. data/tmpsets/set/mod007-format/all/head.rb +0 -170
  151. data/tmpsets/set/mod007-format/all/header.rb +0 -71
  152. data/tmpsets/set/mod007-format/all/html_content.rb +0 -178
  153. data/tmpsets/set/mod007-format/all/html_error.rb +0 -217
  154. data/tmpsets/set/mod007-format/all/html_show.rb +0 -62
  155. data/tmpsets/set/mod007-format/all/html_title.rb +0 -56
  156. data/tmpsets/set/mod007-format/all/html_wrapper.rb +0 -173
  157. data/tmpsets/set/mod007-format/all/js.rb +0 -18
  158. data/tmpsets/set/mod007-format/all/json.rb +0 -174
  159. data/tmpsets/set/mod007-format/all/links.rb +0 -160
  160. data/tmpsets/set/mod007-format/all/menu.rb +0 -138
  161. data/tmpsets/set/mod007-format/all/path.rb +0 -88
  162. data/tmpsets/set/mod007-format/all/rich_html.rb +0 -25
  163. data/tmpsets/set/mod007-format/all/rss.rb +0 -86
  164. data/tmpsets/set/mod007-format/all/text.rb +0 -15
  165. data/tmpsets/set/mod007-format/self/home.rb +0 -18
  166. data/tmpsets/set/mod007-format/type/cardtype.rb +0 -98
  167. data/tmpsets/set/mod007-format/type/html.rb +0 -36
  168. data/tmpsets/set/mod007-format/type/json.rb +0 -50
  169. data/tmpsets/set/mod007-format/type/number.rb +0 -33
  170. data/tmpsets/set/mod007-format/type/phrase.rb +0 -14
  171. data/tmpsets/set/mod007-format/type/plain_text.rb +0 -18
  172. data/tmpsets/set/mod007-format/type/toggle.rb +0 -47
  173. data/tmpsets/set/mod007-format/type/uri.rb +0 -24
  174. data/tmpsets/set/mod008-list/abstract/01_pointer.rb +0 -19
  175. data/tmpsets/set/mod008-list/abstract/01_pointer/events.rb +0 -80
  176. data/tmpsets/set/mod008-list/abstract/01_pointer/html_views.rb +0 -131
  177. data/tmpsets/set/mod008-list/abstract/01_pointer/html_views/filter.rb +0 -72
  178. data/tmpsets/set/mod008-list/abstract/01_pointer/options_api.rb +0 -87
  179. data/tmpsets/set/mod008-list/abstract/01_pointer/other_views.rb +0 -112
  180. data/tmpsets/set/mod008-list/abstract/code_pointer.rb +0 -44
  181. data/tmpsets/set/mod008-list/abstract/id_pointer.rb +0 -30
  182. data/tmpsets/set/mod008-list/all/supports_content_options.rb +0 -16
  183. data/tmpsets/set/mod008-list/right/content_option_view.rb +0 -19
  184. data/tmpsets/set/mod008-list/right/content_options.rb +0 -32
  185. data/tmpsets/set/mod008-list/self/content_option_view.rb +0 -18
  186. data/tmpsets/set/mod008-list/self/content_options.rb +0 -18
  187. data/tmpsets/set/mod008-list/self/input_options.rb +0 -23
  188. data/tmpsets/set/mod008-list/type/link_list.rb +0 -49
  189. data/tmpsets/set/mod008-list/type/list.rb +0 -25
  190. data/tmpsets/set/mod008-list/type/nest_list.rb +0 -55
  191. data/tmpsets/set/mod008-list/type/pointer.rb +0 -19
  192. data/tmpsets/set/mod009-permissions/abstract/permission.rb +0 -132
  193. data/tmpsets/set/mod009-permissions/all/permissions.rb +0 -240
  194. data/tmpsets/set/mod009-permissions/all/update_read_rules.rb +0 -20
  195. data/tmpsets/set/mod009-permissions/right/create.rb +0 -10
  196. data/tmpsets/set/mod009-permissions/right/delete.rb +0 -10
  197. data/tmpsets/set/mod009-permissions/right/read.rb +0 -86
  198. data/tmpsets/set/mod009-permissions/right/update.rb +0 -10
  199. data/tmpsets/set/mod009-permissions/self/create.rb +0 -12
  200. data/tmpsets/set/mod009-permissions/self/delete.rb +0 -12
  201. data/tmpsets/set/mod009-permissions/self/read.rb +0 -12
  202. data/tmpsets/set/mod009-permissions/self/update.rb +0 -12
  203. data/tmpsets/set/mod010-account/abstract/account_field.rb +0 -31
  204. data/tmpsets/set/mod010-account/abstract/accountable.rb +0 -62
  205. data/tmpsets/set/mod010-account/all/account.rb +0 -115
  206. data/tmpsets/set/mod010-account/right/account.rb +0 -62
  207. data/tmpsets/set/mod010-account/right/account/events.rb +0 -108
  208. data/tmpsets/set/mod010-account/right/account/views.rb +0 -74
  209. data/tmpsets/set/mod010-account/right/email.rb +0 -56
  210. data/tmpsets/set/mod010-account/right/password.rb +0 -61
  211. data/tmpsets/set/mod010-account/right/roles.rb +0 -36
  212. data/tmpsets/set/mod010-account/right/salt.rb +0 -22
  213. data/tmpsets/set/mod010-account/right/status.rb +0 -27
  214. data/tmpsets/set/mod010-account/self/signin.rb +0 -222
  215. data/tmpsets/set/mod010-account/type/role.rb +0 -30
  216. data/tmpsets/set/mod010-account/type/signup.rb +0 -63
  217. data/tmpsets/set/mod010-account/type/signup/views.rb +0 -107
  218. data/tmpsets/set/mod010-account/type/user.rb +0 -76
  219. data/tmpsets/set/mod010-account/type_plus_right/user/email.rb +0 -22
  220. data/tmpsets/set/mod011-edit/all/bridge.rb +0 -73
  221. data/tmpsets/set/mod011-edit/all/bridge/bridge_pills.rb +0 -56
  222. data/tmpsets/set/mod011-edit/all/bridge/follow_section.rb +0 -46
  223. data/tmpsets/set/mod011-edit/all/bridge/related_section.rb +0 -43
  224. data/tmpsets/set/mod011-edit/all/bridge/tab_views.rb +0 -50
  225. data/tmpsets/set/mod011-edit/all/bridge/tab_visibility.rb +0 -67
  226. data/tmpsets/set/mod011-edit/all/edit_content.rb +0 -69
  227. data/tmpsets/set/mod011-edit/all/edit_inline.rb +0 -65
  228. data/tmpsets/set/mod011-edit/all/edit_name.rb +0 -65
  229. data/tmpsets/set/mod011-edit/all/edit_type.rb +0 -129
  230. data/tmpsets/set/mod011-edit/all/editing.rb +0 -100
  231. data/tmpsets/set/mod011-edit/all/editor.rb +0 -63
  232. data/tmpsets/set/mod011-edit/all/form.rb +0 -257
  233. data/tmpsets/set/mod011-edit/all/form_buttons.rb +0 -82
  234. data/tmpsets/set/mod011-edit/all/form_elements.rb +0 -81
  235. data/tmpsets/set/mod011-edit/all/formgroup.rb +0 -46
  236. data/tmpsets/set/mod011-edit/all/new.rb +0 -195
  237. data/tmpsets/set/mod011-edit/all/overlay_guide.rb +0 -18
  238. data/tmpsets/set/mod011-edit/all/template_nest.rb +0 -51
  239. data/tmpsets/set/mod011-edit/right/input_type.rb +0 -44
  240. data/tmpsets/set/mod011-edit/self/input_type.rb +0 -21
  241. data/tmpsets/set/mod011-edit/type/list.rb +0 -24
  242. data/tmpsets/set/mod011-edit/type/plain_text.rb +0 -22
  243. data/tmpsets/set/mod011-edit/type/pointer.rb +0 -20
  244. data/tmpsets/set/mod012-history/all/history.rb +0 -119
  245. data/tmpsets/set/mod012-history/all/history/act_listing.rb +0 -136
  246. data/tmpsets/set/mod012-history/all/history/actions.rb +0 -137
  247. data/tmpsets/set/mod012-history/all/history/acts.rb +0 -17
  248. data/tmpsets/set/mod012-history/all/history/events.rb +0 -109
  249. data/tmpsets/set/mod012-history/all/history/last.rb +0 -107
  250. data/tmpsets/set/mod012-history/all/history/revision.rb +0 -74
  251. data/tmpsets/set/mod012-history/all/history/selected.rb +0 -73
  252. data/tmpsets/set/mod012-history/all/history/views.rb +0 -75
  253. data/tmpsets/set/mod012-history/all/history_bridge.rb +0 -88
  254. data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +0 -144
  255. data/tmpsets/set/mod013-carrierwave/abstract/attachment/cloud.rb +0 -146
  256. data/tmpsets/set/mod013-carrierwave/abstract/attachment/coded.rb +0 -36
  257. data/tmpsets/set/mod013-carrierwave/abstract/attachment/local.rb +0 -52
  258. data/tmpsets/set/mod013-carrierwave/abstract/attachment/paths.rb +0 -68
  259. data/tmpsets/set/mod013-carrierwave/abstract/attachment/storage_type.rb +0 -180
  260. data/tmpsets/set/mod013-carrierwave/abstract/attachment/upload_cache.rb +0 -98
  261. data/tmpsets/set/mod013-carrierwave/abstract/attachment/web.rb +0 -12
  262. data/tmpsets/set/mod013-carrierwave/all/file_utils.rb +0 -50
  263. data/tmpsets/set/mod013-carrierwave/self/admin.rb +0 -32
  264. data/tmpsets/set/mod013-carrierwave/self/favicon.rb +0 -26
  265. data/tmpsets/set/mod013-carrierwave/self/new_file.rb +0 -22
  266. data/tmpsets/set/mod013-carrierwave/self/new_image.rb +0 -22
  267. data/tmpsets/set/mod013-carrierwave/type/file.rb +0 -144
  268. data/tmpsets/set/mod013-carrierwave/type/image.rb +0 -113
  269. data/tmpsets/set/mod013-carrierwave/type/image/html_views.rb +0 -88
  270. data/tmpsets/set/mod014-virtual/abstract/virtual_cache.rb +0 -52
  271. data/tmpsets/set/mod015-machines/abstract/machine.rb +0 -230
  272. data/tmpsets/set/mod015-machines/abstract/machine/output_cache.rb +0 -25
  273. data/tmpsets/set/mod015-machines/abstract/machine/output_update.rb +0 -84
  274. data/tmpsets/set/mod015-machines/abstract/machine_input.rb +0 -82
  275. data/tmpsets/set/mod015-machines/all/reset_machines.rb +0 -31
  276. data/tmpsets/set/mod015-machines/right/machine_cache.rb +0 -14
  277. data/tmpsets/set/mod015-machines/right/machine_input.rb +0 -16
  278. data/tmpsets/set/mod015-machines/right/machine_output.rb +0 -53
  279. data/tmpsets/set/mod016-script/abstract/01_asset_java_script.rb +0 -32
  280. data/tmpsets/set/mod016-script/abstract/asset_coffee_script.rb +0 -34
  281. data/tmpsets/set/mod016-script/abstract/asset_list.rb +0 -98
  282. data/tmpsets/set/mod016-script/abstract/manifest_group.rb +0 -22
  283. data/tmpsets/set/mod016-script/abstract/mod_assets.rb +0 -145
  284. data/tmpsets/set/mod016-script/abstract/script.rb +0 -98
  285. data/tmpsets/set/mod016-script/right/script.rb +0 -30
  286. data/tmpsets/set/mod016-script/self/script.rb +0 -10
  287. data/tmpsets/set/mod016-script/self/script_html5shiv_printshiv.rb +0 -20
  288. data/tmpsets/set/mod016-script/self/script_mods.rb +0 -10
  289. data/tmpsets/set/mod016-script/type/01_coffee_script.rb +0 -35
  290. data/tmpsets/set/mod016-script/type/02_java_script.rb +0 -24
  291. data/tmpsets/set/mod016-script/type/local_folder_group.rb +0 -30
  292. data/tmpsets/set/mod016-script/type/local_manifest_group.rb +0 -35
  293. data/tmpsets/set/mod016-script/type/mod_script_assets.rb +0 -22
  294. data/tmpsets/set/mod016-script/type/remote_manifest_group.rb +0 -41
  295. data/tmpsets/set/mod017-ace_editor/all/ace_editor.rb +0 -20
  296. data/tmpsets/set/mod017-ace_editor/self/ace.rb +0 -16
  297. data/tmpsets/set/mod017-ace_editor/self/script_ace.rb +0 -12
  298. data/tmpsets/set/mod017-ace_editor/self/script_ace_config.rb +0 -12
  299. data/tmpsets/set/mod018-alias/all/alias.rb +0 -30
  300. data/tmpsets/set/mod018-alias/all_plus/alias.rb +0 -31
  301. data/tmpsets/set/mod018-alias/type/alias.rb +0 -42
  302. data/tmpsets/set/mod019-api_key/right/account.rb +0 -18
  303. data/tmpsets/set/mod019-api_key/right/api_key.rb +0 -103
  304. data/tmpsets/set/mod020-style/abstract/skin_box.rb +0 -44
  305. data/tmpsets/set/mod020-style/right/style.rb +0 -65
  306. data/tmpsets/set/mod020-style/self/style.rb +0 -13
  307. data/tmpsets/set/mod020-style/self/style_bootstrap_compatible.rb +0 -10
  308. data/tmpsets/set/mod020-style/self/style_cards.rb +0 -10
  309. data/tmpsets/set/mod020-style/self/style_jquery_ui_smoothness.rb +0 -10
  310. data/tmpsets/set/mod020-style/self/style_libraries.rb +0 -10
  311. data/tmpsets/set/mod020-style/self/style_mods.rb +0 -10
  312. data/tmpsets/set/mod020-style/type/css.rb +0 -95
  313. data/tmpsets/set/mod020-style/type/scss.rb +0 -30
  314. data/tmpsets/set/mod020-style/type/skin.rb +0 -18
  315. data/tmpsets/set/mod021-bar_and_box/abstract/media.rb +0 -26
  316. data/tmpsets/set/mod021-bar_and_box/all/bar.rb +0 -112
  317. data/tmpsets/set/mod021-bar_and_box/all/box.rb +0 -25
  318. data/tmpsets/set/mod021-bar_and_box/self/style_media.rb +0 -15
  319. data/tmpsets/set/mod021-bar_and_box/type/image.rb +0 -47
  320. data/tmpsets/set/mod022-bootstrap/abstract/bootstrap_code_file.rb +0 -65
  321. data/tmpsets/set/mod022-bootstrap/abstract/bootswatch_theme.rb +0 -167
  322. data/tmpsets/set/mod022-bootstrap/abstract/bootswatch_theme/html_views.rb +0 -39
  323. data/tmpsets/set/mod022-bootstrap/abstract/bs_badge.rb +0 -31
  324. data/tmpsets/set/mod022-bootstrap/all/bootstrap/accordion.rb +0 -72
  325. data/tmpsets/set/mod022-bootstrap/all/bootstrap/dropdown.rb +0 -93
  326. data/tmpsets/set/mod022-bootstrap/all/bootstrap/form.rb +0 -44
  327. data/tmpsets/set/mod022-bootstrap/all/bootstrap/helper.rb +0 -73
  328. data/tmpsets/set/mod022-bootstrap/all/bootstrap/icon.rb +0 -125
  329. data/tmpsets/set/mod022-bootstrap/all/bootstrap/navbar.rb +0 -55
  330. data/tmpsets/set/mod022-bootstrap/all/bootstrap/table.rb +0 -110
  331. data/tmpsets/set/mod022-bootstrap/all/bootstrap/tabs.rb +0 -49
  332. data/tmpsets/set/mod022-bootstrap/all/bootstrap/wrapper.rb +0 -27
  333. data/tmpsets/set/mod022-bootstrap/all/rich_bootstrap.rb +0 -24
  334. data/tmpsets/set/mod022-bootstrap/self/bootstrap_core.rb +0 -23
  335. data/tmpsets/set/mod022-bootstrap/self/bootstrap_functions.rb +0 -14
  336. data/tmpsets/set/mod022-bootstrap/self/font_awesome.rb +0 -11
  337. data/tmpsets/set/mod022-bootstrap/self/material_icons.rb +0 -11
  338. data/tmpsets/set/mod022-bootstrap/self/script_load_select2.rb +0 -11
  339. data/tmpsets/set/mod022-bootstrap/self/smartmenu_css.rb +0 -14
  340. data/tmpsets/set/mod022-bootstrap/self/smartmenu_js.rb +0 -14
  341. data/tmpsets/set/mod022-bootstrap/self/style_bootstrap_cards.rb +0 -10
  342. data/tmpsets/set/mod022-bootstrap/self/style_bootstrap_colorpicker.rb +0 -15
  343. data/tmpsets/set/mod022-bootstrap/self/style_select2.rb +0 -19
  344. data/tmpsets/set/mod022-bootstrap/self/style_select2_bootstrap.rb +0 -10
  345. data/tmpsets/set/mod022-bootstrap/type/bootswatch_skin.rb +0 -24
  346. data/tmpsets/set/mod022-bootstrap/type/customized_bootswatch_skin.rb +0 -129
  347. data/tmpsets/set/mod022-bootstrap/type/customized_bootswatch_skin/html_views.rb +0 -43
  348. data/tmpsets/set/mod022-bootstrap/type_plus_right/customized_bootswatch_skin/colors.rb +0 -123
  349. data/tmpsets/set/mod023-comment/all/comment.rb +0 -92
  350. data/tmpsets/set/mod023-comment/right/comment.rb +0 -10
  351. data/tmpsets/set/mod023-comment/right/discussion.rb +0 -18
  352. data/tmpsets/set/mod024-date/all/calendar.rb +0 -18
  353. data/tmpsets/set/mod024-date/right/when_created.rb +0 -16
  354. data/tmpsets/set/mod024-date/right/when_last_edited.rb +0 -16
  355. data/tmpsets/set/mod024-date/self/datepicker.rb +0 -15
  356. data/tmpsets/set/mod024-date/self/now.rb +0 -14
  357. data/tmpsets/set/mod024-date/self/script_datepicker_config.rb +0 -12
  358. data/tmpsets/set/mod024-date/self/style_datepicker.rb +0 -20
  359. data/tmpsets/set/mod024-date/type/date.rb +0 -14
  360. data/tmpsets/set/mod026-follow/abstract/follow_option.rb +0 -65
  361. data/tmpsets/set/mod026-follow/all/follow.rb +0 -42
  362. data/tmpsets/set/mod026-follow/all/follow/follow_link.rb +0 -70
  363. data/tmpsets/set/mod026-follow/all/follow/follow_link_views.rb +0 -38
  364. data/tmpsets/set/mod026-follow/all/follow/followed_by.rb +0 -79
  365. data/tmpsets/set/mod026-follow/all/follow/follower_ids.rb +0 -130
  366. data/tmpsets/set/mod026-follow/all/follow/start_follow_link.rb +0 -19
  367. data/tmpsets/set/mod026-follow/all/follow/stop_follow_link.rb +0 -20
  368. data/tmpsets/set/mod026-follow/all/notify.rb +0 -91
  369. data/tmpsets/set/mod026-follow/all/notify/base_views.rb +0 -137
  370. data/tmpsets/set/mod026-follow/all/notify/html_views.rb +0 -26
  371. data/tmpsets/set/mod026-follow/right/account.rb +0 -24
  372. data/tmpsets/set/mod026-follow/right/follow.rb +0 -127
  373. data/tmpsets/set/mod026-follow/right/follow_fields.rb +0 -12
  374. data/tmpsets/set/mod026-follow/right/followers.rb +0 -32
  375. data/tmpsets/set/mod026-follow/right/following.rb +0 -59
  376. data/tmpsets/set/mod026-follow/self/always.rb +0 -22
  377. data/tmpsets/set/mod026-follow/self/created.rb +0 -28
  378. data/tmpsets/set/mod026-follow/self/edited.rb +0 -29
  379. data/tmpsets/set/mod026-follow/self/follow.rb +0 -10
  380. data/tmpsets/set/mod026-follow/self/follow_defaults.rb +0 -98
  381. data/tmpsets/set/mod026-follow/self/follow_fields.rb +0 -10
  382. data/tmpsets/set/mod026-follow/self/never.rb +0 -22
  383. data/tmpsets/set/mod026-follow/type/cardtype.rb +0 -30
  384. data/tmpsets/set/mod026-follow/type/notification_template.rb +0 -42
  385. data/tmpsets/set/mod026-follow/type/set.rb +0 -62
  386. data/tmpsets/set/mod026-follow/type/user.rb +0 -16
  387. data/tmpsets/set/mod026-follow/type_plus_right/user/follow.rb +0 -87
  388. data/tmpsets/set/mod026-follow/type_plus_right/user/follow/follow_editor_helper.rb +0 -130
  389. data/tmpsets/set/mod027-google_analytics/all/google_analytics.rb +0 -51
  390. data/tmpsets/set/mod028-help/all/guide.rb +0 -60
  391. data/tmpsets/set/mod028-help/all/help.rb +0 -58
  392. data/tmpsets/set/mod028-help/right/guide.rb +0 -17
  393. data/tmpsets/set/mod028-help/right/help.rb +0 -24
  394. data/tmpsets/set/mod028-help/self/guide.rb +0 -11
  395. data/tmpsets/set/mod028-help/self/help.rb +0 -13
  396. data/tmpsets/set/mod029-integrate/all/observer.rb +0 -31
  397. data/tmpsets/set/mod029-integrate/self/on_create.rb +0 -11
  398. data/tmpsets/set/mod029-integrate/self/on_delete.rb +0 -11
  399. data/tmpsets/set/mod029-integrate/self/on_update.rb +0 -11
  400. data/tmpsets/set/mod029-integrate/self/thanks.rb +0 -13
  401. data/tmpsets/set/mod030-session/all/location_history.rb +0 -28
  402. data/tmpsets/set/mod030-session/type/session.rb +0 -70
  403. data/tmpsets/set/mod031-layout/abstract/account_dropdown.rb +0 -32
  404. data/tmpsets/set/mod031-layout/abstract/pointer/html_views.rb +0 -14
  405. data/tmpsets/set/mod031-layout/all/alert.rb +0 -32
  406. data/tmpsets/set/mod031-layout/all/layouts.rb +0 -43
  407. data/tmpsets/set/mod031-layout/all/modal.rb +0 -129
  408. data/tmpsets/set/mod031-layout/all/navbar_links.rb +0 -77
  409. data/tmpsets/set/mod031-layout/all/overlay.rb +0 -110
  410. data/tmpsets/set/mod031-layout/all/process_layout.rb +0 -88
  411. data/tmpsets/set/mod031-layout/all/tabs.rb +0 -61
  412. data/tmpsets/set/mod031-layout/right/enabled_roles.rb +0 -70
  413. data/tmpsets/set/mod031-layout/right/head.rb +0 -26
  414. data/tmpsets/set/mod031-layout/self/account_links.rb +0 -107
  415. data/tmpsets/set/mod031-layout/self/alerts.rb +0 -14
  416. data/tmpsets/set/mod031-layout/self/dropdown_divider.rb +0 -18
  417. data/tmpsets/set/mod031-layout/self/foot.rb +0 -14
  418. data/tmpsets/set/mod031-layout/self/head.rb +0 -35
  419. data/tmpsets/set/mod031-layout/self/layout.rb +0 -12
  420. data/tmpsets/set/mod031-layout/self/navbox.rb +0 -42
  421. data/tmpsets/set/mod031-layout/self/sidebar.rb +0 -14
  422. data/tmpsets/set/mod031-layout/type/html.rb +0 -23
  423. data/tmpsets/set/mod031-layout/type/layout_type.rb +0 -25
  424. data/tmpsets/set/mod032-legacy/abstract/table_of_contents.rb +0 -76
  425. data/tmpsets/set/mod032-legacy/self/csv_structure.rb +0 -10
  426. data/tmpsets/set/mod032-legacy/self/default_html_view.rb +0 -10
  427. data/tmpsets/set/mod032-legacy/self/table_of_contents.rb +0 -13
  428. data/tmpsets/set/mod032-legacy/type/basic.rb +0 -10
  429. data/tmpsets/set/mod033-markdown/type/markdown.rb +0 -26
  430. data/tmpsets/set/mod034-prosemirror_editor/all/prosemirror_editor.rb +0 -16
  431. data/tmpsets/set/mod034-prosemirror_editor/self/script_prosemirror.rb +0 -12
  432. data/tmpsets/set/mod034-prosemirror_editor/self/script_prosemirror_config.rb +0 -13
  433. data/tmpsets/set/mod034-prosemirror_editor/self/style_prosemirror.rb +0 -12
  434. data/tmpsets/set/mod035-recaptcha/all/recaptcha.rb +0 -111
  435. data/tmpsets/set/mod035-recaptcha/self/admin_info.rb +0 -36
  436. data/tmpsets/set/mod035-recaptcha/self/captcha.rb +0 -14
  437. data/tmpsets/set/mod035-recaptcha/self/recaptcha_proxy.rb +0 -12
  438. data/tmpsets/set/mod035-recaptcha/self/recaptcha_secret_key.rb +0 -18
  439. data/tmpsets/set/mod035-recaptcha/self/recaptcha_settings.rb +0 -40
  440. data/tmpsets/set/mod035-recaptcha/self/recaptcha_site_key.rb +0 -18
  441. data/tmpsets/set/mod036-search/abstract/00_filter_helper.rb +0 -55
  442. data/tmpsets/set/mod036-search/abstract/02_search_params.rb +0 -59
  443. data/tmpsets/set/mod036-search/abstract/03_filter.rb +0 -38
  444. data/tmpsets/set/mod036-search/abstract/03_filter/filter_form.rb +0 -110
  445. data/tmpsets/set/mod036-search/abstract/03_filter/form_helper.rb +0 -114
  446. data/tmpsets/set/mod036-search/abstract/03_filter/query_construction.rb +0 -47
  447. data/tmpsets/set/mod036-search/abstract/04_right_filter_form.rb +0 -35
  448. data/tmpsets/set/mod036-search/abstract/05_search.rb +0 -93
  449. data/tmpsets/set/mod036-search/abstract/05_search/views.rb +0 -174
  450. data/tmpsets/set/mod036-search/abstract/06_cql_search.rb +0 -102
  451. data/tmpsets/set/mod036-search/abstract/filterable.rb +0 -22
  452. data/tmpsets/set/mod036-search/abstract/filterable_bar.rb +0 -20
  453. data/tmpsets/set/mod036-search/right/children.rb +0 -13
  454. data/tmpsets/set/mod036-search/right/created.rb +0 -12
  455. data/tmpsets/set/mod036-search/right/edited.rb +0 -12
  456. data/tmpsets/set/mod036-search/right/editors.rb +0 -12
  457. data/tmpsets/set/mod036-search/right/follow.rb +0 -12
  458. data/tmpsets/set/mod036-search/right/linked_to_by.rb +0 -12
  459. data/tmpsets/set/mod036-search/right/links_to.rb +0 -14
  460. data/tmpsets/set/mod036-search/right/mates.rb +0 -12
  461. data/tmpsets/set/mod036-search/right/nested_by.rb +0 -12
  462. data/tmpsets/set/mod036-search/right/nests.rb +0 -12
  463. data/tmpsets/set/mod036-search/right/referred_to_by.rb +0 -12
  464. data/tmpsets/set/mod036-search/right/refers_to.rb +0 -12
  465. data/tmpsets/set/mod036-search/self/recent.rb +0 -44
  466. data/tmpsets/set/mod036-search/self/search.rb +0 -104
  467. data/tmpsets/set/mod036-search/type/cardtype.rb +0 -14
  468. data/tmpsets/set/mod036-search/type/search_type.rb +0 -90
  469. data/tmpsets/set/mod037-rules/all/related_sets.rb +0 -34
  470. data/tmpsets/set/mod037-rules/right/self.rb +0 -12
  471. data/tmpsets/set/mod037-rules/right/type_plus_right.rb +0 -13
  472. data/tmpsets/set/mod037-rules/rstar/rule_user.rb +0 -16
  473. data/tmpsets/set/mod037-rules/rule/bar_view.rb +0 -102
  474. data/tmpsets/set/mod037-rules/rule/bridge_rules_editor.rb +0 -37
  475. data/tmpsets/set/mod037-rules/rule/editor.rb +0 -119
  476. data/tmpsets/set/mod037-rules/rule/html_views.rb +0 -22
  477. data/tmpsets/set/mod037-rules/rule/quick_editor.rb +0 -48
  478. data/tmpsets/set/mod037-rules/rule/rule_form.rb +0 -65
  479. data/tmpsets/set/mod037-rules/rule/rule_form/buttons.rb +0 -54
  480. data/tmpsets/set/mod037-rules/rule/rule_form/form_elements.rb +0 -61
  481. data/tmpsets/set/mod037-rules/rule/rule_form/rule_set_radio.rb +0 -92
  482. data/tmpsets/set/mod037-rules/rule/rule_form/set_selection.rb +0 -48
  483. data/tmpsets/set/mod037-rules/rule/rules.rb +0 -118
  484. data/tmpsets/set/mod037-rules/self/cardtype.rb +0 -51
  485. data/tmpsets/set/mod037-rules/self/recent_settings.rb +0 -16
  486. data/tmpsets/set/mod037-rules/self/script_rules.rb +0 -12
  487. data/tmpsets/set/mod037-rules/type/cardtype.rb +0 -14
  488. data/tmpsets/set/mod037-rules/type/set.rb +0 -116
  489. data/tmpsets/set/mod037-rules/type/set/html_views.rb +0 -60
  490. data/tmpsets/set/mod037-rules/type/set/html_views/rule_lists.rb +0 -51
  491. data/tmpsets/set/mod037-rules/type/set/html_views/template.rb +0 -21
  492. data/tmpsets/set/mod037-rules/type/set/rules_filter.rb +0 -69
  493. data/tmpsets/set/mod037-rules/type/set/setting_lists.rb +0 -85
  494. data/tmpsets/set/mod037-rules/type/setting.rb +0 -86
  495. data/tmpsets/set/mod038-tinymce_editor/all/reference_editor.rb +0 -53
  496. data/tmpsets/set/mod038-tinymce_editor/all/reference_editor/link_editor.rb +0 -42
  497. data/tmpsets/set/mod038-tinymce_editor/all/reference_editor/link_editor/link_parser.rb +0 -43
  498. data/tmpsets/set/mod038-tinymce_editor/all/reference_editor/nest_editor.rb +0 -184
  499. data/tmpsets/set/mod038-tinymce_editor/all/reference_editor/nest_image.rb +0 -77
  500. data/tmpsets/set/mod038-tinymce_editor/all/tinymce_editor.rb +0 -15
  501. data/tmpsets/set/mod038-tinymce_editor/self/script_tinymce.rb +0 -12
  502. data/tmpsets/set/mod038-tinymce_editor/self/script_tinymce_config.rb +0 -12
  503. data/tmpsets/set/mod038-tinymce_editor/self/tiny_mce.rb +0 -16
  504. data/tmpsets/set/mod040-monkey/all/event_viz.rb +0 -73
  505. data/tmpsets/set/mod040-monkey/all/view_viz.rb +0 -34
  506. data/tmpsets/set/mod040-monkey/right/debug.rb +0 -96
@@ -1,12 +1,12 @@
1
1
  module Cardio
2
- # Convenient extendable API for turning delaying on and off.
2
+ # easy access method for delay configuration
3
3
  module Delaying
4
4
  def delaying! on=true
5
- Cardio.config.delaying = (on == true)
5
+ config.delaying = (on == true)
6
6
  end
7
7
 
8
8
  def delaying?
9
- Cardio.config.delaying
9
+ config.delaying
10
10
  end
11
11
  end
12
12
  end
@@ -9,7 +9,7 @@ module Cardio
9
9
  @_card_source_root = path
10
10
  else
11
11
  @_card_source_root ||= File.expand_path(
12
- "../../../generators/card/#{generator_name}/templates", __FILE__
12
+ "../../../generators/#{generator_name}/templates", __FILE__
13
13
  )
14
14
  end
15
15
  end
@@ -28,40 +28,29 @@ module Cardio
28
28
  end
29
29
 
30
30
  def migration_paths mig_type=type
31
- Cardio.migration_paths mig_type
32
- end
33
-
34
- def schema mig_type=type
35
- Cardio.schema mig_type
31
+ Schema.migration_paths mig_type
36
32
  end
37
33
 
38
34
  def schema_suffix mig_type=type
39
- Cardio.schema_suffix mig_type
35
+ Schema.suffix mig_type
40
36
  end
41
37
 
42
- def schema_mode mig_type=type
43
- Cardio.with_suffix mig_type do
44
- paths = Cardio.migration_paths(type)
45
- yield(paths)
46
- end
38
+ def schema_mode mig_type=type, &block
39
+ Schema.mode mig_type, &block
47
40
  end
48
41
 
49
42
  def assume_migrated_upto_version
50
- schema_mode do
51
- ActiveRecord::Schema.assume_migrated_upto_version schema,
52
- migration_paths
53
- end
43
+ Schema.assume_migrated_upto_version type
54
44
  end
55
45
 
56
46
  def data_path filename=nil
57
- path = migration_paths.first
58
- File.join([path, "data", filename].compact)
47
+ File.join([migration_paths.first, "data", filename].compact)
59
48
  end
60
49
  end
61
50
 
62
51
  def contentedly
63
52
  Card::Cache.reset_all
64
- Cardio.schema_mode "" do
53
+ Schema.mode "" do
65
54
  Card::Auth.as_bot do
66
55
  yield
67
56
  ensure
@@ -101,7 +90,7 @@ module Cardio
101
90
  names_or_keys = Array(names_or_keys)
102
91
  Card::Mailer.perform_deliveries = false
103
92
 
104
- Cardio::Migration::Import.new(data_path).merge only: names_or_keys
93
+ Migration::Import.new(data_path).merge only: names_or_keys
105
94
  end
106
95
 
107
96
  def merge_pristine_cards names_or_keys
@@ -121,14 +110,6 @@ module Cardio
121
110
  self.class.data_path filename
122
111
  end
123
112
 
124
- def schema_mode
125
- Cardio.schema_mode self.class.type
126
- end
127
-
128
- def migration_paths
129
- Cardio.paths self.class.type
130
- end
131
-
132
113
  # Execute this migration in the named direction
133
114
  # copied from ActiveRecord to wrap 'up' in 'contentendly'
134
115
  def exec_migration conn, direction
@@ -10,7 +10,7 @@ module Cardio
10
10
  @type = :deck
11
11
 
12
12
  def contentedly &block
13
- Cardio.schema_mode :deck, &block
13
+ Schema.mode :deck, &block
14
14
  end
15
15
  end
16
16
  end
data/lib/cardio/mod.rb CHANGED
@@ -59,13 +59,62 @@ module Cardio
59
59
  # - **set_pattern** for additional {Card::Set::Pattern set patterns},
60
60
  # or types of sets.
61
61
  # - **file** for fixed initial card content
62
- module Mod
62
+ class Mod
63
+ attr_reader :name, :path, :index
64
+
65
+ def initialize name, path, index
66
+ @name = Mod.normalize_name name
67
+ @path = path
68
+ @index = index
69
+ end
70
+
71
+ def mod_card_name
72
+ "mod: #{name}"
73
+ end
74
+
75
+ def codename
76
+ "mod_#{name}"
77
+ end
78
+
79
+ def tmp_dir type
80
+ File.join Cardio.paths["tmp/#{type}"].first,
81
+ "mod#{'%03d' % (@index + 1)}-#{@name}"
82
+ end
83
+
84
+ def public_path
85
+ File.join @path, "public"
86
+ end
87
+
88
+ def assets_path
89
+ File.join @path, "assets"
90
+ end
91
+
92
+ def ensure_mod_installed
93
+ Card::Auth.as_bot do
94
+ card = ensure_mod_card
95
+ card.ensure_mod_script_card
96
+ card.ensure_mod_style_card
97
+ end
98
+ end
99
+
100
+ private
101
+
102
+ def ensure_mod_card
103
+ if Card::Codename.exists? codename
104
+ card = Card.fetch codename.to_sym
105
+ card.update type: :mod unless card.type_code == :mod
106
+ card
107
+ else
108
+ Card.create name: mod_card_name, type: :mod, codename: codename
109
+ end
110
+ end
111
+
63
112
  class << self
64
113
  def load
65
114
  return if ENV["CARD_MODS"] == "none"
66
115
 
67
116
  if Card.take
68
- Cardio::Mod::Loader.load_mods
117
+ Loader.load_mods
69
118
  else
70
119
  Rails.logger.warn "empty database"
71
120
  end
@@ -96,6 +145,10 @@ module Cardio
96
145
  end
97
146
  end
98
147
 
148
+ def normalize_name name
149
+ name.to_s.sub(/^card-mod-/, "")
150
+ end
151
+
99
152
  private
100
153
 
101
154
  def gem_spec name, nickname=true
@@ -1,5 +1,7 @@
1
+ require "cardio/mod/modfile_loader"
2
+
1
3
  module Cardio
2
- module Mod
4
+ class Mod
3
5
  # Dirs objects are used to manage the load paths for card mods.
4
6
  # Mods can be loaded as gems and by using directories with mod subdirectories.
5
7
  #
@@ -48,8 +50,8 @@ module Cardio
48
50
  # @param mod_paths [String, Array<String>] paths to directories that contain mods
49
51
  def initialize mod_paths=[]
50
52
  @mods = []
53
+ @mods_by_name = {}
51
54
  @loaded_gem_mods = ::Set.new
52
- @paths = {}
53
55
  mod_paths = Array(mod_paths)
54
56
  mod_paths.each do |mp|
55
57
  @current_path = mp
@@ -57,45 +59,46 @@ module Cardio
57
59
  end
58
60
  load_from_gemfile
59
61
  super()
60
- @mods.each do |mod_name|
61
- self << @paths[mod_name]
62
+ @mods.each do |mod|
63
+ self << mod.path
62
64
  end
63
65
  end
64
66
 
67
+ def add_gem_mod mod_name, mod_path
68
+ return if @loaded_gem_mods.include?(mod_name)
69
+
70
+ @loaded_gem_mods << mod_name
71
+ add_mod mod_name, mod_path
72
+ end
73
+
65
74
  # Add a mod to mod load paths
66
- def add_path mod_name, path=nil
67
- if @mods.include? mod_name
68
- raise Card::Error,
75
+ def add_mod mod_name, path=nil
76
+ if @mods_by_name.key? Mod.normalize_name(mod_name)
77
+ raise ::Card::Error,
69
78
  "name conflict: mod with name \"#{mod_name}\" already loaded"
70
79
  end
71
- @mods << mod_name
72
- path ||= File.join @current_path, mod_name
73
- @paths[mod_name] = path
74
- end
75
-
76
- def gem_mod name
77
- deps = Mod.dependencies name
78
- unknown_gem_mod!(name) if deps.blank?
79
- deps.each { |spec| add_gem_mod spec.name, spec.full_gem_path }
80
- end
81
80
 
82
- def unknown_gem_mod! name
83
- raise Card::Error, %(Unknown gem "#{name}". Make sure it is in your Gemfile.)
81
+ path ||= File.join @current_path, mod_name
82
+ mod = Mod.new mod_name, path, @mods.size
83
+ @mods << mod
84
+ @mods_by_name[mod.name] = mod
84
85
  end
85
86
 
86
- def add_gem_mod mod_name, mod_path
87
- return if @loaded_gem_mods.include?(mod_name)
88
-
89
- @loaded_gem_mods << mod_name
90
- add_path mod_name, mod_path
87
+ def delete_mod mod_name
88
+ name = Mod.normalize_name mod_name
89
+ mod = @mods_by_name[name]
90
+ @mods.delete mod
91
+ @mods_by_name.delete name
91
92
  end
92
93
 
93
- alias_method :mod, :add_path
94
-
95
94
  # @param mod_name [String] the name of a mod
96
95
  # @return the path to mod `mod_name`
97
96
  def path mod_name
98
- @paths[mod_name] || @paths["card-mod-#{mod_name}"]
97
+ fetch_mod(mod_name)&.path
98
+ end
99
+
100
+ def fetch_mod mod_name
101
+ @mods_by_name[Mod.normalize_name(mod_name)]
99
102
  end
100
103
 
101
104
  # Iterate over each mod directory
@@ -114,22 +117,24 @@ module Cardio
114
117
 
115
118
  def each_tmp type
116
119
  @mods.each do |mod|
117
- path = tmp_dir mod, type
120
+ path = mod.tmp_dir type
118
121
  yield path if Dir.exist? path
119
122
  end
120
123
  end
121
124
 
122
125
  def each_with_tmp type=nil
123
126
  @mods.each do |mod|
124
- dirname = dirname @paths[mod], type
125
- yield dirname, tmp_dir(mod, type) if Dir.exist? dirname
127
+ dirname = dirname mod.path, type
128
+ yield dirname, mod.tmp_dir(type) if Dir.exist? dirname
126
129
  end
127
130
  end
128
131
 
129
- def each_assets_path
132
+ def each_public_path
130
133
  @mods.each do |mod|
131
- path = File.join(@paths[mod], "public", "assets")
132
- yield mod, path if Dir.exist? path
134
+ path = mod.public_path
135
+ next unless Dir.exist? path
136
+
137
+ yield mod.name, path
133
138
  end
134
139
  end
135
140
 
@@ -139,13 +144,14 @@ module Cardio
139
144
  modfile_path = File.join @current_path, "Modfile"
140
145
  return unless File.exist? modfile_path
141
146
 
142
- eval File.read(modfile_path), binding
147
+ loader = ModfileLoader.new self
148
+ loader.load modfile_path
143
149
  true
144
150
  end
145
151
 
146
152
  def load_from_dir
147
153
  Dir.entries(@current_path).sort.each do |filename|
148
- add_path filename unless filename.match?(/^\./)
154
+ add_mod filename unless filename.match?(/^\./)
149
155
  end
150
156
  end
151
157
 
@@ -154,12 +160,6 @@ module Cardio
154
160
  add_gem_mod mod_name, mod_spec.full_gem_path
155
161
  end
156
162
  end
157
-
158
- def tmp_dir modname, type
159
- index = @mods.index modname
160
- File.join Card.paths["tmp/#{type}"].first,
161
- "mod#{'%03d' % (index + 1)}-#{modname}"
162
- end
163
163
  end
164
164
  end
165
165
  end
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  # Shared code for the three different load strategies: Eval, TmpFiles and BindingMagic
4
4
  class LoadStrategy
5
5
  class << self
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class LoadStrategy
4
4
  # Put everything for the module definition in one string and the evaluate
5
5
  # it immediately with ruby's eval method.
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class LoadStrategy
4
4
  # The {TmpFiles} load strategy version for set pattern modules/
5
5
  class PatternTmpFiles < TmpFiles
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  # Tries to build the module with as little string evaluation as possible.
4
4
  # The problem here is that in methods like `module_eval` the Module.nesting
5
5
  # list gets lost so all references in mod files to constants in the
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class LoadStrategy
4
4
  # The {TmpFiles} load strategy version for set modules
5
5
  class SetTmpFiles < LoadStrategy::TmpFiles
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class LoadStrategy
4
4
  # LoadStrategy for mod modules. It writes the code to tmp files
5
5
  # and then loads the tmp files. (deprecated)
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module Cardio
4
- module Mod
4
+ class Mod
5
5
  # Cardio::Mod::Loader is used to load all part of a mod,
6
6
  # i.e. initializers, patterns, formats, chunks, layouts and sets
7
7
  # cards are not accessible at this point
@@ -28,7 +28,7 @@ module Cardio
28
28
  end
29
29
 
30
30
  def load_initializers
31
- Cardio.config.paths["mod/config/initializers"].existent.sort.each do |init|
31
+ Cardio.config.paths["late/initializers"].existent.sort.each do |init|
32
32
  load init
33
33
  end
34
34
  end
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class Loader
4
4
  # A SetLoader object loads all set modules for a list of mods.
5
5
  # The mods are given by a Mod::Dirs object.
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class Loader
4
4
  class SetPatternLoader < Loader
5
5
  def template_class
@@ -1,5 +1,5 @@
1
1
  module Cardio
2
- module Mod
2
+ class Mod
3
3
  class Loader
4
4
  # Template for set modules
5
5
  class SetTemplate < ModuleTemplate
@@ -0,0 +1,22 @@
1
+ module Cardio
2
+ class Mod
3
+ # Methods used via "eval" in Modfiles
4
+ module ModfileApi
5
+ def mod mod_name, path=nil
6
+ @dirs.add_mod mod_name, path
7
+ end
8
+
9
+ def gem_mod name
10
+ deps = Mod.dependencies name
11
+ unknown_gem_mod!(name) if deps.blank?
12
+ deps.each { |spec| @dirs.add_gem_mod spec.name, spec.full_gem_path }
13
+ end
14
+
15
+ private
16
+
17
+ def unknown_gem_mod! name
18
+ raise Card::Error, %(Unknown gem "#{name}". Make sure it is in your Gemfile.)
19
+ end
20
+ end
21
+ end
22
+ end