cable_ready 5.0.0.pre9 → 5.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -1
  3. data/Gemfile.lock +119 -100
  4. data/README.md +12 -15
  5. data/app/assets/javascripts/cable_ready.js +465 -155
  6. data/app/assets/javascripts/cable_ready.umd.js +449 -169
  7. data/app/channels/cable_ready/stream.rb +7 -5
  8. data/app/helpers/cable_ready/view_helper.rb +58 -0
  9. data/app/jobs/cable_ready/broadcast_job.rb +15 -0
  10. data/app/models/concerns/cable_ready/updatable/collection_updatable_callbacks.rb +2 -0
  11. data/app/models/concerns/cable_ready/updatable/collections_registry.rb +31 -5
  12. data/app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb +9 -4
  13. data/app/models/concerns/cable_ready/updatable.rb +107 -39
  14. data/app/models/concerns/extend_has_many.rb +2 -0
  15. data/cable_ready.gemspec +4 -6
  16. data/lib/cable_ready/broadcaster.rb +2 -0
  17. data/lib/cable_ready/cable_car.rb +2 -0
  18. data/lib/cable_ready/channel.rb +12 -4
  19. data/lib/cable_ready/channels.rb +3 -1
  20. data/lib/cable_ready/config.rb +17 -2
  21. data/lib/cable_ready/engine.rb +33 -14
  22. data/lib/cable_ready/identifiable.rb +23 -5
  23. data/lib/cable_ready/importmap.rb +3 -1
  24. data/lib/cable_ready/installer.rb +224 -0
  25. data/lib/cable_ready/operation_builder.rb +1 -1
  26. data/lib/cable_ready/sanity_checker.rb +1 -31
  27. data/lib/cable_ready/updatable/memory_cache_debounce_adapter.rb +22 -0
  28. data/lib/cable_ready/version.rb +1 -1
  29. data/lib/cable_ready.rb +5 -8
  30. data/lib/cable_ready_helper.rb +13 -0
  31. data/lib/generators/cable_ready/channel_generator.rb +51 -12
  32. data/lib/generators/cable_ready/templates/config/initializers/cable_ready.rb +15 -6
  33. data/lib/install/action_cable.rb +144 -0
  34. data/lib/install/broadcaster.rb +109 -0
  35. data/lib/install/bundle.rb +54 -0
  36. data/lib/install/compression.rb +51 -0
  37. data/lib/install/config.rb +39 -0
  38. data/lib/install/development.rb +34 -0
  39. data/lib/install/esbuild.rb +101 -0
  40. data/lib/install/importmap.rb +96 -0
  41. data/lib/install/initializers.rb +15 -0
  42. data/lib/install/mrujs.rb +121 -0
  43. data/lib/install/npm_packages.rb +13 -0
  44. data/lib/install/shakapacker.rb +65 -0
  45. data/lib/install/spring.rb +54 -0
  46. data/lib/install/updatable.rb +34 -0
  47. data/lib/install/vite.rb +66 -0
  48. data/lib/install/webpacker.rb +93 -0
  49. data/lib/install/yarn.rb +56 -0
  50. data/lib/tasks/cable_ready/cable_ready.rake +247 -0
  51. data/package.json +36 -22
  52. data/{rollup.config.js → rollup.config.mjs} +7 -25
  53. data/web-test-runner.config.mjs +12 -0
  54. data/yarn.lock +3058 -398
  55. metadata +39 -167
  56. data/IMPLEMENTATION.md +0 -93
  57. data/LATEST +0 -1
  58. data/app/assets/javascripts/cable_ready.min.js +0 -2
  59. data/app/assets/javascripts/cable_ready.min.js.map +0 -1
  60. data/app/assets/javascripts/cable_ready.umd.min.js +0 -2
  61. data/app/assets/javascripts/cable_ready.umd.min.js.map +0 -1
  62. data/app/helpers/cable_ready_helper.rb +0 -26
  63. data/app/jobs/cable_ready_broadcast_job.rb +0 -14
  64. data/lib/generators/cable_ready/helpers_generator.rb +0 -43
  65. data/lib/generators/cable_ready/initializer_generator.rb +0 -14
  66. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  67. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  68. data/test/dummy/app/controllers/application_controller.rb +0 -2
  69. data/test/dummy/app/helpers/application_helper.rb +0 -2
  70. data/test/dummy/app/jobs/application_job.rb +0 -7
  71. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  72. data/test/dummy/app/models/application_record.rb +0 -3
  73. data/test/dummy/app/models/dugong.rb +0 -4
  74. data/test/dummy/app/models/global_idable_entity.rb +0 -16
  75. data/test/dummy/app/models/post.rb +0 -4
  76. data/test/dummy/app/models/section.rb +0 -6
  77. data/test/dummy/app/models/team.rb +0 -6
  78. data/test/dummy/app/models/topic.rb +0 -4
  79. data/test/dummy/app/models/user.rb +0 -7
  80. data/test/dummy/config/application.rb +0 -22
  81. data/test/dummy/config/boot.rb +0 -5
  82. data/test/dummy/config/environment.rb +0 -5
  83. data/test/dummy/config/environments/development.rb +0 -76
  84. data/test/dummy/config/environments/production.rb +0 -120
  85. data/test/dummy/config/environments/test.rb +0 -59
  86. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  87. data/test/dummy/config/initializers/assets.rb +0 -12
  88. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
  89. data/test/dummy/config/initializers/cable_ready.rb +0 -18
  90. data/test/dummy/config/initializers/content_security_policy.rb +0 -28
  91. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  92. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -6
  93. data/test/dummy/config/initializers/inflections.rb +0 -16
  94. data/test/dummy/config/initializers/mime_types.rb +0 -4
  95. data/test/dummy/config/initializers/permissions_policy.rb +0 -11
  96. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  97. data/test/dummy/config/puma.rb +0 -43
  98. data/test/dummy/config/routes.rb +0 -3
  99. data/test/dummy/db/migrate/20210902154139_create_users.rb +0 -9
  100. data/test/dummy/db/migrate/20210902154153_create_posts.rb +0 -10
  101. data/test/dummy/db/migrate/20210904081930_create_topics.rb +0 -9
  102. data/test/dummy/db/migrate/20210904093607_create_sections.rb +0 -9
  103. data/test/dummy/db/migrate/20210913191735_create_teams.rb +0 -8
  104. data/test/dummy/db/migrate/20210913191759_add_team_reference_to_users.rb +0 -5
  105. data/test/dummy/db/migrate/20220329222959_create_dugongs.rb +0 -8
  106. data/test/dummy/db/migrate/20220329230221_create_active_storage_tables.active_storage.rb +0 -36
  107. data/test/dummy/db/schema.rb +0 -84
  108. data/test/dummy/test/models/dugong_test.rb +0 -7
  109. data/test/dummy/test/models/post_test.rb +0 -7
  110. data/test/dummy/test/models/section_test.rb +0 -7
  111. data/test/dummy/test/models/team_test.rb +0 -7
  112. data/test/dummy/test/models/topic_test.rb +0 -7
  113. data/test/dummy/test/models/user_test.rb +0 -7
  114. data/test/lib/cable_ready/cable_car_test.rb +0 -50
  115. data/test/lib/cable_ready/compoundable_test.rb +0 -26
  116. data/test/lib/cable_ready/helper_test.rb +0 -25
  117. data/test/lib/cable_ready/identifiable_test.rb +0 -69
  118. data/test/lib/cable_ready/operation_builder_test.rb +0 -189
  119. data/test/lib/cable_ready/updatable_test.rb +0 -135
  120. data/test/lib/generators/cable_ready/channel_generator_test.rb +0 -157
  121. data/test/support/generator_test_helpers.rb +0 -28
  122. data/test/test_helper.rb +0 -18
@@ -1 +0,0 @@
1
- {"version":3,"file":"cable_ready.umd.min.js","sources":["../../../javascript/enums.js","../../../javascript/active_element.js","../../../javascript/utils.js","../../../javascript/morph_callbacks.js","../../../javascript/operations.js","../../../javascript/operation_store.js","../../../javascript/cable_ready.js","../../../javascript/cable_consumer.js","../../../javascript/elements/subscribing_element.js","../../../javascript/elements/stream_from_element.js","../../../javascript/elements/updates_for_element.js","../../../javascript/updatable/inner_updates_compat.js","../../../javascript/index.js","../../../javascript/elements/index.js"],"sourcesContent":["export const inputTags = {\n INPUT: true,\n TEXTAREA: true,\n SELECT: true\n}\n\nexport const mutableTags = {\n INPUT: true,\n TEXTAREA: true,\n OPTION: true\n}\n\nexport const textInputTypes = {\n 'datetime-local': true,\n 'select-multiple': true,\n 'select-one': true,\n color: true,\n date: true,\n datetime: true,\n email: true,\n month: true,\n number: true,\n password: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n textarea: true,\n time: true,\n url: true,\n week: true\n}\n","let activeElement\n\nexport default {\n get element () {\n return activeElement\n },\n set (element) {\n activeElement = element\n }\n}\n","import { inputTags, textInputTypes } from './enums'\nimport ActiveElement from './active_element'\n\n// Indicates if the passed element is considered a text input.\n//\nconst isTextInput = element => {\n return inputTags[element.tagName] && textInputTypes[element.type]\n}\n\n// Assigns focus to the appropriate element... preferring the explicitly passed selector\n//\n// * selector - a CSS selector for the element that should have focus\n//\nconst assignFocus = selector => {\n const element =\n selector && selector.nodeType === Node.ELEMENT_NODE\n ? selector\n : document.querySelector(selector)\n const focusElement = element || ActiveElement.element\n if (focusElement && focusElement.focus) focusElement.focus()\n}\n\n// Dispatches an event on the passed element\n//\n// * element - the element\n// * name - the name of the event\n// * detail - the event detail\n//\nconst dispatch = (element, name, detail = {}) => {\n const init = { bubbles: true, cancelable: true, detail: detail }\n const evt = new CustomEvent(name, init)\n element.dispatchEvent(evt)\n if (window.jQuery) window.jQuery(element).trigger(name, detail)\n}\n\n// Accepts an xPath query and returns the element found at that position in the DOM\n//\nconst xpathToElement = xpath => {\n return document.evaluate(\n xpath,\n document,\n null,\n XPathResult.FIRST_ORDERED_NODE_TYPE,\n null\n ).singleNodeValue\n}\n\n// Return an array with the class names to be used\n//\n// * names - could be a string or an array of strings for multiple classes.\n//\nconst getClassNames = names => Array(names).flat()\n\n// Perform operation for either the first or all of the elements returned by CSS selector\n//\n// * operation - the instruction payload from perform\n// * callback - the operation function to run for each element\n//\nconst processElements = (operation, callback) => {\n Array.from(\n operation.selectAll ? operation.element : [operation.element]\n ).forEach(callback)\n}\n\n// camelCase to kebab-case\n//\nconst kebabize = str => {\n return str\n .split('')\n .map((letter, idx) => {\n return letter.toUpperCase() === letter\n ? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`\n : letter\n })\n .join('')\n}\n\n// Provide a standardized pipeline of checks and modifications to all operations based on provided options\n// Currently skips execution if cancelled and implements an optional delay\n//\nconst operate = (operation, callback) => {\n if (!operation.cancel) {\n operation.delay ? setTimeout(callback, operation.delay) : callback()\n return true\n }\n return false\n}\n\n// Dispatch life-cycle events with standardized naming\nconst before = (target, operation) =>\n dispatch(\n target,\n `cable-ready:before-${kebabize(operation.operation)}`,\n operation\n )\n\nconst after = (target, operation) =>\n dispatch(\n target,\n `cable-ready:after-${kebabize(operation.operation)}`,\n operation\n )\n\nfunction debounce (func, timeout) {\n let timer\n return (...args) => {\n clearTimeout(timer)\n timer = setTimeout(() => func.apply(this, args), timeout)\n }\n}\n\nfunction handleErrors (response) {\n if (!response.ok) throw Error(response.statusText)\n return response\n}\n\n// A proxy method to wrap a fetch call in error handling\n//\n// * url - the URL to fetch\n// * additionalHeaders - an object of additional headers passed to fetch\n//\nasync function graciouslyFetch (url, additionalHeaders) {\n try {\n const response = await fetch(url, {\n headers: {\n 'X-REQUESTED-WITH': 'XmlHttpRequest',\n ...additionalHeaders\n }\n })\n if (response == undefined) return\n\n handleErrors(response)\n\n return response\n } catch (e) {\n console.error(`Could not fetch ${url}`)\n }\n}\n\nexport {\n isTextInput,\n assignFocus,\n dispatch,\n xpathToElement,\n getClassNames,\n processElements,\n operate,\n before,\n after,\n debounce,\n handleErrors,\n graciouslyFetch,\n kebabize\n}\n","import { mutableTags } from './enums'\nimport { isTextInput } from './utils'\nimport ActiveElement from './active_element'\n\n// Indicates whether or not we should morph an element via onBeforeElUpdated callback\n// SEE: https://github.com/patrick-steele-idem/morphdom#morphdomfromnode-tonode-options--node\n//\nconst shouldMorph = operation => (fromEl, toEl) => {\n return !shouldMorphCallbacks\n .map(callback => {\n return typeof callback === 'function'\n ? callback(operation, fromEl, toEl)\n : true\n })\n .includes(false)\n}\n\n// Execute any pluggable functions that modify elements after morphing via onElUpdated callback\n//\nconst didMorph = operation => el => {\n didMorphCallbacks.forEach(callback => {\n if (typeof callback === 'function') callback(operation, el)\n })\n}\n\nconst verifyNotMutable = (detail, fromEl, toEl) => {\n // Skip nodes that are equal:\n // https://github.com/patrick-steele-idem/morphdom#can-i-make-morphdom-blaze-through-the-dom-tree-even-faster-yes\n if (!mutableTags[fromEl.tagName] && fromEl.isEqualNode(toEl)) return false\n return true\n}\n\nconst verifyNotContentEditable = (detail, fromEl, toEl) => {\n if (fromEl === ActiveElement.element && fromEl.isContentEditable) return false\n return true\n}\n\nconst verifyNotPermanent = (detail, fromEl, toEl) => {\n const { permanentAttributeName } = detail\n if (!permanentAttributeName) return true\n\n const permanent = fromEl.closest(`[${permanentAttributeName}]`)\n\n // only morph attributes on the active non-permanent text input\n if (!permanent && fromEl === ActiveElement.element && isTextInput(fromEl)) {\n const ignore = { value: true }\n Array.from(toEl.attributes).forEach(attribute => {\n if (!ignore[attribute.name])\n fromEl.setAttribute(attribute.name, attribute.value)\n })\n return false\n }\n\n return !permanent\n}\n\nconst shouldMorphCallbacks = [\n verifyNotMutable,\n verifyNotPermanent,\n verifyNotContentEditable\n]\nconst didMorphCallbacks = []\n\nexport {\n shouldMorphCallbacks,\n didMorphCallbacks,\n shouldMorph,\n didMorph,\n verifyNotMutable,\n verifyNotContentEditable,\n verifyNotPermanent\n}\n","import morphdom from 'morphdom'\nimport { shouldMorph, didMorph } from './morph_callbacks'\nimport {\n assignFocus,\n dispatch,\n getClassNames,\n processElements,\n before,\n after,\n operate\n} from './utils'\n\nexport default {\n // DOM Mutations\n\n append: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.insertAdjacentHTML('beforeend', html || '')\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n graft: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { parent, focusSelector } = operation\n const parentElement = document.querySelector(parent)\n if (parentElement) {\n parentElement.appendChild(element)\n assignFocus(focusSelector)\n }\n })\n after(element, operation)\n })\n },\n\n innerHtml: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.innerHTML = html || ''\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n insertAdjacentHtml: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, position, focusSelector } = operation\n element.insertAdjacentHTML(position || 'beforeend', html || '')\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n insertAdjacentText: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { text, position, focusSelector } = operation\n element.insertAdjacentText(position || 'beforeend', text || '')\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n morph: operation => {\n processElements(operation, element => {\n const { html } = operation\n const template = document.createElement('template')\n template.innerHTML = String(html).trim()\n operation.content = template.content\n const parent = element.parentElement\n const ordinal = Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { childrenOnly, focusSelector } = operation\n morphdom(\n element,\n childrenOnly ? template.content : template.innerHTML,\n {\n childrenOnly: !!childrenOnly,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: didMorph(operation)\n }\n )\n assignFocus(focusSelector)\n })\n after(parent.children[ordinal], operation)\n })\n },\n\n outerHtml: operation => {\n processElements(operation, element => {\n const parent = element.parentElement\n const ordinal = Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.outerHTML = html || ''\n assignFocus(focusSelector)\n })\n after(parent.children[ordinal], operation)\n })\n },\n\n prepend: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.insertAdjacentHTML('afterbegin', html || '')\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n remove: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { focusSelector } = operation\n element.remove()\n assignFocus(focusSelector)\n })\n after(document, operation)\n })\n },\n\n replace: operation => {\n processElements(operation, element => {\n const parent = element.parentElement\n const ordinal = Array.from(parent.children).indexOf(element)\n before(element, operation)\n operate(operation, () => {\n const { html, focusSelector } = operation\n element.outerHTML = html || ''\n assignFocus(focusSelector)\n })\n after(parent.children[ordinal], operation)\n })\n },\n\n textContent: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { text, focusSelector } = operation\n element.textContent = (text != null) ? text : ''\n assignFocus(focusSelector)\n })\n after(element, operation)\n })\n },\n\n // Element Property Mutations\n\n addCssClass: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.classList.add(...getClassNames(name || ''))\n })\n after(element, operation)\n })\n },\n\n removeAttribute: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.removeAttribute(name)\n })\n after(element, operation)\n })\n },\n\n removeCssClass: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name } = operation\n element.classList.remove(...getClassNames(name))\n })\n after(element, operation)\n })\n },\n\n setAttribute: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.setAttribute(name, value || '')\n })\n after(element, operation)\n })\n },\n\n setDatasetProperty: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.dataset[name] = value || ''\n })\n after(element, operation)\n })\n },\n\n setProperty: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n if (name in element) element[name] = value || ''\n })\n after(element, operation)\n })\n },\n\n setStyle: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, value } = operation\n element.style[name] = value || ''\n })\n after(element, operation)\n })\n },\n\n setStyles: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { styles } = operation\n for (let [name, value] of Object.entries(styles))\n element.style[name] = value || ''\n })\n after(element, operation)\n })\n },\n\n setValue: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { value } = operation\n element.value = value || ''\n })\n after(element, operation)\n })\n },\n\n // DOM Events\n\n dispatchEvent: operation => {\n processElements(operation, element => {\n before(element, operation)\n operate(operation, () => {\n const { name, detail } = operation\n dispatch(element, name, detail)\n })\n after(element, operation)\n })\n },\n\n setMeta: operation => {\n before(document, operation)\n operate(operation, () => {\n const { name, content } = operation\n let meta = document.head.querySelector(`meta[name='${name}']`)\n if (!meta) {\n meta = document.createElement('meta')\n meta.name = name\n document.head.appendChild(meta)\n }\n meta.content = content\n })\n after(document, operation)\n },\n\n // Browser Manipulations\n\n clearStorage: operation => {\n before(document, operation)\n operate(operation, () => {\n const { type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.clear()\n })\n after(document, operation)\n },\n\n go: operation => {\n before(window, operation)\n operate(operation, () => {\n const { delta } = operation\n history.go(delta)\n })\n after(window, operation)\n },\n\n pushState: operation => {\n before(window, operation)\n operate(operation, () => {\n const { state, title, url } = operation\n history.pushState(state || {}, title || '', url)\n })\n after(window, operation)\n },\n\n redirectTo: operation => {\n before(window, operation)\n operate(operation, () => {\n let { url, action } = operation\n action = action || 'advance'\n if (window.Turbo) window.Turbo.visit(url, { action })\n if (window.Turbolinks) window.Turbolinks.visit(url, { action })\n if (!window.Turbo && !window.Turbolinks) window.location.href = url\n })\n after(window, operation)\n },\n\n reload: operation => {\n before(window, operation)\n operate(operation, () => {\n window.location.reload()\n })\n after(window, operation)\n },\n\n removeStorageItem: operation => {\n before(document, operation)\n operate(operation, () => {\n const { key, type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.removeItem(key)\n })\n after(document, operation)\n },\n\n replaceState: operation => {\n before(window, operation)\n operate(operation, () => {\n const { state, title, url } = operation\n history.replaceState(state || {}, title || '', url)\n })\n after(window, operation)\n },\n\n scrollIntoView: operation => {\n const { element } = operation\n before(element, operation)\n operate(operation, () => {\n element.scrollIntoView(operation)\n })\n after(element, operation)\n },\n\n setCookie: operation => {\n before(document, operation)\n operate(operation, () => {\n const { cookie } = operation\n document.cookie = cookie || ''\n })\n after(document, operation)\n },\n\n setFocus: operation => {\n const { element } = operation\n before(element, operation)\n operate(operation, () => {\n assignFocus(element)\n })\n after(element, operation)\n },\n\n setStorageItem: operation => {\n before(document, operation)\n operate(operation, () => {\n const { key, value, type } = operation\n const storage = type === 'session' ? sessionStorage : localStorage\n storage.setItem(key, value || '')\n })\n after(document, operation)\n },\n\n // Notifications\n\n consoleLog: operation => {\n before(document, operation)\n operate(operation, () => {\n const { message, level } = operation\n level && ['warn', 'info', 'error'].includes(level)\n ? console[level](message || '')\n : console.log(message || '')\n })\n after(document, operation)\n },\n\n consoleTable: operation => {\n before(document, operation)\n operate(operation, () => {\n const { data, columns } = operation\n console.table(data, columns || [])\n })\n after(document, operation)\n },\n\n notification: operation => {\n before(document, operation)\n operate(operation, () => {\n const { title, options } = operation\n Notification.requestPermission().then(result => {\n operation.permission = result\n if (result === 'granted') new Notification(title || '', options)\n })\n })\n after(document, operation)\n }\n}\n","import Operations from './operations'\n\nlet operations = Operations\n\nconst add = newOperations => {\n operations = { ...operations, ...newOperations }\n}\n\nconst addOperations = operations => {\n add(operations)\n}\n\nconst addOperation = (name, operation) => {\n const operations = {}\n operations[name] = operation\n\n add(operations)\n}\n\nexport { addOperation, addOperations }\n\nexport default {\n get all () {\n return operations\n }\n}\n","import { xpathToElement, dispatch } from './utils'\n\nimport ActiveElement from './active_element'\nimport OperationStore from './operation_store'\n\nconst perform = (\n operations,\n options = { emitMissingElementWarnings: true }\n) => {\n const batches = {}\n operations.forEach(operation => {\n if (!!operation.batch)\n batches[operation.batch] = batches[operation.batch]\n ? ++batches[operation.batch]\n : 1\n })\n operations.forEach(operation => {\n const name = operation.operation\n try {\n if (operation.selector) {\n operation.element = operation.xpath\n ? xpathToElement(operation.selector)\n : document[\n operation.selectAll ? 'querySelectorAll' : 'querySelector'\n ](operation.selector)\n } else {\n operation.element = document\n }\n if (operation.element || options.emitMissingElementWarnings) {\n ActiveElement.set(document.activeElement)\n const cableReadyOperation = OperationStore.all[name]\n\n if (cableReadyOperation) {\n cableReadyOperation(operation)\n if (!!operation.batch && --batches[operation.batch] === 0)\n dispatch(document, 'cable-ready:batch-complete', {\n batch: operation.batch\n })\n } else {\n console.error(\n `CableReady couldn't find the \"${name}\" operation. Make sure you use the camelized form when calling an operation method.`\n )\n }\n }\n } catch (e) {\n if (operation.element) {\n console.error(\n `CableReady detected an error in ${name || 'operation'}: ${\n e.message\n }. If you need to support older browsers make sure you've included the corresponding polyfills. https://docs.stimulusreflex.com/setup#polyfills-for-ie11.`\n )\n console.error(e)\n } else {\n console.warn(\n `CableReady ${name ||\n 'operation'} failed due to missing DOM element for selector: '${\n operation.selector\n }'`\n )\n }\n }\n })\n}\n\nconst performAsync = (\n operations,\n options = { emitMissingElementWarnings: true }\n) => {\n return new Promise((resolve, reject) => {\n try {\n resolve(perform(operations, options))\n } catch (err) {\n reject(err)\n }\n })\n}\n\nexport { perform, performAsync }\n","let consumer\n\nconst BACKOFF = [25, 50, 75, 100, 200, 250, 500, 800, 1000, 2000]\n\nconst wait = (ms) => new Promise(resolve => setTimeout(resolve, ms))\n\nconst getConsumerWithRetry = async (retry = 0) => {\n if (consumer) return consumer\n\n if (retry >= BACKOFF.length) {\n throw new Error(\"Couldn't obtain a Action Cable consumer within 5s\")\n }\n\n await wait(BACKOFF[retry])\n\n return await getConsumerWithRetry(retry + 1)\n}\n\nexport default {\n setConsumer (value) {\n consumer = value\n },\n\n get consumer () {\n return consumer\n },\n\n async getConsumer () {\n return await getConsumerWithRetry()\n }\n}\n","export default class SubscribingElement extends HTMLElement {\n disconnectedCallback () {\n if (this.channel) this.channel.unsubscribe()\n }\n\n createSubscription (consumer, channel, receivedCallback) {\n this.channel = consumer.subscriptions.create(\n {\n channel,\n identifier: this.identifier\n },\n {\n received: receivedCallback\n }\n )\n }\n\n get preview () {\n return (\n document.documentElement.hasAttribute('data-turbolinks-preview') ||\n document.documentElement.hasAttribute('data-turbo-preview')\n )\n }\n\n get identifier () {\n return this.getAttribute('identifier')\n }\n}\n","import { perform } from '../cable_ready'\nimport SubscribingElement from './subscribing_element'\nimport CableConsumer from '../cable_consumer'\n\nexport default class StreamFromElement extends SubscribingElement {\n async connectedCallback () {\n if (this.preview) return\n\n const consumer = await CableConsumer.getConsumer()\n\n if (consumer) {\n this.createSubscription(\n consumer,\n 'CableReady::Stream',\n this.performOperations\n )\n } else {\n console.error(\n 'The `stream_from` helper cannot connect without an ActionCable consumer.\\nPlease run `rails generate cable_ready:helpers` to fix this.'\n )\n }\n }\n\n performOperations (data) {\n if (data.cableReady) perform(data.operations)\n }\n}\n","import morphdom from 'morphdom'\n\nimport SubscribingElement from './subscribing_element'\n\nimport { shouldMorph } from '../morph_callbacks'\nimport { debounce, assignFocus, dispatch, graciouslyFetch } from '../utils'\n\nimport ActiveElement from '../active_element'\nimport CableConsumer from '../cable_consumer'\n\nconst template = `\n<style>\n :host {\n display: block;\n }\n</style>\n<slot></slot>\n`\n\nfunction url (element) {\n return element.hasAttribute('url')\n ? element.getAttribute('url')\n : location.href\n}\n\nexport default class UpdatesForElement extends SubscribingElement {\n constructor () {\n super()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n shadowRoot.innerHTML = template\n }\n\n async connectedCallback () {\n if (this.preview) return\n this.update = debounce(this.update.bind(this), this.debounce)\n\n const consumer = await CableConsumer.getConsumer()\n\n if (consumer) {\n this.createSubscription(consumer, 'CableReady::Stream', this.update)\n } else {\n console.error(\n 'The `updates-for` helper cannot connect without an ActionCable consumer.\\nPlease run `rails generate cable_ready:helpers` to fix this.'\n )\n }\n }\n\n async update (data) {\n const blocks = Array.from(\n document.querySelectorAll(this.query),\n element => new Block(element)\n )\n\n // first updates-for element in the DOM *at any given moment* updates all of the others\n if (blocks[0].element !== this) return\n\n // hold a reference to the active element so that it can be restored after the morph\n ActiveElement.set(document.activeElement)\n\n // store all retrieved HTML in an object keyed by URL to minimize fetch calls\n this.html = {}\n\n const uniqueUrls = [...new Set(blocks.map(block => block.url))]\n\n await Promise.all(\n uniqueUrls.map(async url => {\n if (!this.html.hasOwnProperty(url)) {\n const response = await graciouslyFetch(url, {\n 'X-Cable-Ready': 'update'\n })\n this.html[url] = await response.text()\n }\n })\n )\n\n // track current block index for each URL; referred to as fragments\n this.index = {}\n\n blocks.forEach(block => {\n // if the block's URL is not in the index, initialize it to 0; otherwise, increment it\n this.index.hasOwnProperty(block.url)\n ? this.index[block.url]++\n : (this.index[block.url] = 0)\n\n block.process(data, this.html, this.index)\n })\n }\n\n get query () {\n return `updates-for[identifier=\"${this.identifier}\"]`\n }\n\n get identifier () {\n return this.getAttribute('identifier')\n }\n\n get debounce () {\n return this.hasAttribute('debounce')\n ? parseInt(this.getAttribute('debounce'))\n : 20\n }\n}\n\nclass Block {\n constructor (element) {\n this.element = element\n }\n\n async process (data, html, index) {\n // with the index incremented, we can now safely bail - before a fetch - if there's no work to be done\n if (!this.shouldUpdate(data)) return\n\n const blockIndex = index[this.url]\n const template = document.createElement('template')\n this.element.setAttribute('updating', 'updating')\n\n template.innerHTML = String(html[this.url]).trim()\n\n await this.resolveTurboFrames(template.content)\n\n const fragments = template.content.querySelectorAll(this.query)\n\n if (fragments.length <= blockIndex) {\n console.warn(\n `Update aborted due to insufficient number of elements. The offending url is ${this.url}.`\n )\n return\n }\n\n const operation = {\n element: this.element,\n html: fragments[blockIndex],\n permanentAttributeName: 'data-ignore-updates'\n }\n\n dispatch(this.element, 'cable-ready:before-update', operation)\n morphdom(this.element, fragments[blockIndex], {\n childrenOnly: true,\n onBeforeElUpdated: shouldMorph(operation),\n onElUpdated: _ => {\n this.element.removeAttribute('updating')\n dispatch(this.element, 'cable-ready:after-update', operation)\n assignFocus(operation.focusSelector)\n }\n })\n }\n\n async resolveTurboFrames (documentFragment) {\n const reloadingTurboFrames = [\n ...documentFragment.querySelectorAll(\n 'turbo-frame[src]:not([loading=\"lazy\"])'\n )\n ]\n\n return Promise.all(\n reloadingTurboFrames.map(frame => {\n return new Promise(async resolve => {\n const frameResponse = await graciouslyFetch(\n frame.getAttribute('src'),\n {\n 'Turbo-Frame': frame.id,\n 'X-Cable-Ready': 'update'\n }\n )\n\n const frameTemplate = document.createElement('template')\n frameTemplate.innerHTML = await frameResponse.text()\n\n // recurse here to get all nested eager loaded frames\n await this.resolveTurboFrames(frameTemplate.content)\n\n documentFragment.querySelector(\n `turbo-frame#${frame.id}`\n ).innerHTML = String(\n frameTemplate.content.querySelector(`turbo-frame#${frame.id}`)\n .innerHTML\n ).trim()\n\n resolve()\n })\n })\n )\n }\n\n shouldUpdate (data) {\n // if everything that could prevent an update is false, update this block\n return !this.ignoresInnerUpdates && this.hasChangesSelectedForUpdate(data)\n }\n\n hasChangesSelectedForUpdate (data) {\n // if there's an only attribute, only update if at least one of the attributes changed is in the allow list\n const only = this.element.getAttribute('only')\n\n return !(\n only &&\n data.changed &&\n !only.split(' ').some(attribute => data.changed.includes(attribute))\n )\n }\n\n get ignoresInnerUpdates () {\n // don't update during a Reflex or Turbolinks redraw\n return (\n this.element.hasAttribute('ignore-inner-updates') &&\n this.element.hasAttribute('performing-inner-update')\n )\n }\n\n get url () {\n return this.element.hasAttribute('url')\n ? this.element.getAttribute('url')\n : location.href\n }\n\n get identifier () {\n return this.element.identifier\n }\n\n get query () {\n return this.element.query\n }\n}\n","export const registerInnerUpdates = () => {\n document.addEventListener('stimulus-reflex:before', event => {\n recursiveMarkUpdatesForElements(event.detail.element)\n })\n\n document.addEventListener('stimulus-reflex:after', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.detail.element)\n })\n })\n\n document.addEventListener('turbo:submit-start', event => {\n recursiveMarkUpdatesForElements(event.target)\n })\n\n document.addEventListener('turbo:submit-end', event => {\n setTimeout(() => {\n recursiveUnmarkUpdatesForElements(event.target)\n })\n })\n}\n\nconst recursiveMarkUpdatesForElements = leaf => {\n const closestUpdatesFor = leaf && leaf.parentElement.closest('updates-for')\n if (closestUpdatesFor) {\n closestUpdatesFor.setAttribute('performing-inner-update', '')\n recursiveMarkUpdatesForElements(closestUpdatesFor)\n }\n}\n\nconst recursiveUnmarkUpdatesForElements = leaf => {\n const closestUpdatesFor = leaf && leaf.parentElement.closest('updates-for')\n if (closestUpdatesFor) {\n closestUpdatesFor.removeAttribute('performing-inner-update')\n recursiveUnmarkUpdatesForElements(closestUpdatesFor)\n }\n}\n","import packageInfo from '../package.json'\nimport { perform, performAsync } from './cable_ready'\nimport { initialize } from './elements'\nimport { shouldMorphCallbacks, didMorphCallbacks } from './morph_callbacks'\n\nimport * as MorphCallbacks from './morph_callbacks'\nimport * as Utils from './utils'\n\nimport OperationStore, { addOperation, addOperations } from './operation_store'\nimport StreamFromElement from './elements/stream_from_element'\nimport UpdatesForElement from './elements/updates_for_element'\nimport SubscribingElement from './elements/subscribing_element'\nimport CableConsumer from './cable_consumer'\n\nexport {\n Utils,\n MorphCallbacks,\n StreamFromElement,\n UpdatesForElement,\n SubscribingElement\n}\n\nconst global = {\n perform,\n performAsync,\n shouldMorphCallbacks,\n didMorphCallbacks,\n initialize,\n addOperation,\n addOperations,\n version: packageInfo.version,\n cable: CableConsumer,\n get DOMOperations () {\n console.warn(\n 'DEPRECATED: Please use `CableReady.operations` instead of `CableReady.DOMOperations`'\n )\n return OperationStore.all\n },\n get operations () {\n return OperationStore.all\n },\n get consumer () {\n return CableConsumer.consumer\n }\n}\n\nwindow.CableReady = global\n\nexport default global\n","import CableConsumer from '../cable_consumer'\n\nimport StreamFromElement from './stream_from_element'\nimport UpdatesForElement from './updates_for_element'\n\nimport { registerInnerUpdates } from '../updatable/inner_updates_compat'\n\nconst initialize = (initializeOptions = {}) => {\n const { consumer } = initializeOptions\n\n registerInnerUpdates()\n\n if (consumer) {\n CableConsumer.setConsumer(consumer)\n } else {\n console.error(\n 'CableReady requires a reference to your Action Cable `consumer` for its helpers to function.\\nEnsure that you have imported the `CableReady` package as well as `consumer` from your `channels` folder, then call `CableReady.initialize({ consumer })`.'\n )\n }\n\n if (!customElements.get('stream-from')) {\n customElements.define('stream-from', StreamFromElement)\n }\n\n if (!customElements.get('updates-for')) {\n customElements.define('updates-for', UpdatesForElement)\n }\n}\n\nexport { initialize }\n"],"names":["inputTags","INPUT","TEXTAREA","SELECT","mutableTags","OPTION","textInputTypes","color","date","datetime","email","month","number","password","range","search","tel","text","textarea","time","url","week","activeElement","ActiveElement","element","set","isTextInput","tagName","type","assignFocus","selector","focusElement","nodeType","Node","ELEMENT_NODE","document","querySelector","focus","dispatch","name","detail","evt","CustomEvent","bubbles","cancelable","dispatchEvent","window","jQuery","trigger","xpathToElement","xpath","evaluate","XPathResult","FIRST_ORDERED_NODE_TYPE","singleNodeValue","getClassNames","names","Array","flat","processElements","operation","callback","from","selectAll","forEach","kebabize","str","split","map","letter","idx","toUpperCase","toLowerCase","join","operate","cancel","delay","setTimeout","before","target","after","debounce","func","timeout","timer","args","clearTimeout","apply","this","handleErrors","response","ok","Error","statusText","async","graciouslyFetch","additionalHeaders","fetch","headers","undefined","e","console","error","shouldMorph","fromEl","toEl","shouldMorphCallbacks","includes","didMorph","el","didMorphCallbacks","verifyNotMutable","isEqualNode","verifyNotContentEditable","isContentEditable","verifyNotPermanent","permanentAttributeName","permanent","closest","ignore","value","attributes","attribute","setAttribute","Operations","append","html","focusSelector","insertAdjacentHTML","graft","parent","parentElement","appendChild","innerHtml","innerHTML","insertAdjacentHtml","position","insertAdjacentText","morph","template","createElement","String","trim","content","ordinal","children","indexOf","childrenOnly","morphdom","onBeforeElUpdated","onElUpdated","outerHtml","outerHTML","prepend","remove","replace","textContent","addCssClass","classList","add","removeAttribute","removeCssClass","setDatasetProperty","dataset","setProperty","setStyle","style","setStyles","styles","Object","entries","setValue","setMeta","meta","head","clearStorage","sessionStorage","localStorage","clear","go","delta","history","pushState","state","title","redirectTo","action","Turbo","visit","Turbolinks","location","href","reload","removeStorageItem","key","removeItem","replaceState","scrollIntoView","setCookie","cookie","setFocus","setStorageItem","setItem","consoleLog","message","level","log","consoleTable","data","columns","table","notification","options","Notification","requestPermission","then","result","permission","operations","newOperations","OperationStore","all","perform","emitMissingElementWarnings","batches","batch","cableReadyOperation","warn","consumer","BACKOFF","getConsumerWithRetry","retry","length","ms","Promise","resolve","CableConsumer","setConsumer","SubscribingElement","HTMLElement","disconnectedCallback","channel","unsubscribe","createSubscription","receivedCallback","subscriptions","create","identifier","received","preview","documentElement","hasAttribute","getAttribute","StreamFromElement","getConsumer","performOperations","cableReady","UpdatesForElement","constructor","super","attachShadow","mode","update","bind","blocks","querySelectorAll","query","Block","uniqueUrls","Set","block","hasOwnProperty","index","process","parseInt","shouldUpdate","blockIndex","resolveTurboFrames","fragments","_","documentFragment","reloadingTurboFrames","frame","frameResponse","id","frameTemplate","ignoresInnerUpdates","hasChangesSelectedForUpdate","only","changed","some","recursiveMarkUpdatesForElements","leaf","closestUpdatesFor","recursiveUnmarkUpdatesForElements","global","performAsync","reject","err","initialize","initializeOptions","addEventListener","event","customElements","get","define","addOperation","addOperations","version","packageInfo","cable","DOMOperations","CableReady"],"mappings":"gYAAO,MAAMA,EAAY,CACvBC,OAAO,EACPC,UAAU,EACVC,QAAQ,GAGGC,EAAc,CACzBH,OAAO,EACPC,UAAU,EACVG,QAAQ,GAGGC,EAAiB,CAC5B,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,MAAM,EACNC,KAAK,EACLC,MAAM,GC9BR,IAAIC,EAEW,IAAAC,EAAA,CACTC,cACF,OAAOF,GAETG,IAAKD,GACHF,EAAgBE,ICFpB,MAAME,EAAcF,GACXxB,EAAUwB,EAAQG,UAAYrB,EAAekB,EAAQI,MAOxDC,EAAcC,IAClB,MAIMC,GAHJD,GAAYA,EAASE,WAAaC,KAAKC,aACnCJ,EACAK,SAASC,cAAcN,KACGP,EAAcC,QAC1CO,GAAgBA,EAAaM,OAAON,EAAaM,SASjDC,EAAW,CAACd,EAASe,EAAMC,EAAS,MACxC,MACMC,EAAM,IAAIC,YAAYH,EADf,CAAEI,SAAS,EAAMC,YAAY,EAAMJ,OAAQA,IAExDhB,EAAQqB,cAAcJ,GAClBK,OAAOC,QAAQD,OAAOC,OAAOvB,GAASwB,QAAQT,EAAMC,IAKpDS,EAAiBC,GACdf,SAASgB,SACdD,EACAf,SACA,KACAiB,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QJ,EAAYN,IAC5B,MAAOsF,GACPD,EAAOC,OM/CXhM,qBAAAA,EACAI,kBAAAA,EACA6L,WCpBiB,CAACC,EAAoB,MACtC,MAAMxE,SAAEA,GAAawE,EFPrBzQ,SAAS0Q,iBAAiB,0BAA0BC,IAClDX,EAAgCW,EAAMtQ,OAAOhB,YAG/CW,SAAS0Q,iBAAiB,yBAAyBC,IACjDjO,YAAW,KACTyN,EAAkCQ,EAAMtQ,OAAOhB,eAInDW,SAAS0Q,iBAAiB,sBAAsBC,IAC9CX,EAAgCW,EAAM/N,WAGxC5C,SAAS0Q,iBAAiB,oBAAoBC,IAC5CjO,YAAW,KACTyN,EAAkCQ,EAAM/N,cELxCqJ,EACFQ,EAAcC,YAAYT,GAE1B/H,QAAQC,MACN,4PAICyM,eAAeC,IAAI,gBACtBD,eAAeE,OAAO,cAAepD,GAGlCkD,eAAeC,IAAI,gBACtBD,eAAeE,OAAO,cAAehD,IDGvCiD,aPhBmB,CAAC3Q,EAAMqB,KAC1B,MAAM8J,EAAa,GACnBA,EAAWnL,GAAQqB,EAEnBmG,EAAI2D,IOaJyF,cPrBoBzF,IACpB3D,EAAI2D,IOqBJ0F,QAASC,EACTC,MAAO1E,EACH2E,oBAIF,OAHAlN,QAAQ8H,KACN,wFAEKP,EAAeC,KAEpBH,iBACF,OAAOE,EAAeC,KAEpBO,eACF,OAAOQ,EAAcR,WAIzBtL,OAAO0Q,WAAajB"}
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CableReadyHelper
4
- include CableReady::Compoundable
5
- include CableReady::StreamIdentifier
6
-
7
- def stream_from(*keys, html_options: {})
8
- tag.stream_from(**build_options(*keys, html_options))
9
- end
10
-
11
- def updates_for(*keys, url: nil, debounce: nil, only: nil, ignore_inner_updates: false, html_options: {}, &block)
12
- options = build_options(*keys, html_options)
13
- options[:url] = url if url
14
- options[:debounce] = debounce if debounce
15
- options[:only] = only if only
16
- options[:"ignore-inner-updates"] = "" if ignore_inner_updates
17
- tag.updates_for(**options) { capture(&block) }
18
- end
19
-
20
- private
21
-
22
- def build_options(*keys, html_options)
23
- keys.select!(&:itself)
24
- {identifier: signed_stream_identifier(compound(keys))}.merge(html_options)
25
- end
26
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CableReadyBroadcastJob < (defined?(ActiveJob::Base) ? ActiveJob::Base : Object)
4
- include CableReady::Broadcaster
5
- queue_as :default if defined?(ActiveJob::Base)
6
-
7
- def perform(identifier:, operations:, model: nil)
8
- if model.present?
9
- cable_ready[identifier.safe_constantize].apply!(operations).broadcast_to(model)
10
- else
11
- cable_ready[identifier].apply!(operations).broadcast
12
- end
13
- end
14
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rails/generators"
4
- require "fileutils"
5
-
6
- module CableReady
7
- class HelpersGenerator < Rails::Generators::Base
8
- desc "Initializes CableReady with a reference to the shared ActionCable consumer"
9
- source_root File.expand_path("templates", __dir__)
10
-
11
- def copy_controller_file
12
- main_folder = defined?(Webpacker) ? Webpacker.config.source_path.to_s.gsub("#{Rails.root}/", "") : "app/javascript"
13
-
14
- filepath = [
15
- "#{main_folder}/controllers/index.js",
16
- "#{main_folder}/controllers/index.ts",
17
- "#{main_folder}/packs/application.js",
18
- "#{main_folder}/packs/application.ts"
19
- ]
20
- .select { |path| File.exist?(path) }
21
- .map { |path| Rails.root.join(path) }
22
- .first
23
-
24
- lines = File.open(filepath, "r") { |f| f.readlines }
25
-
26
- unless lines.find { |line| line.start_with?("import CableReady") }
27
- matches = lines.select { |line| line =~ /\A(require|import)/ }
28
- lines.insert lines.index(matches.last).to_i + 1, "import CableReady from 'cable_ready'\n"
29
- File.open(filepath, "w") { |f| f.write lines.join }
30
- end
31
-
32
- unless lines.find { |line| line.start_with?("import consumer") }
33
- matches = lines.select { |line| line =~ /\A(require|import)/ }
34
- lines.insert lines.index(matches.last).to_i + 1, "import consumer from '../channels/consumer'\n"
35
- File.open(filepath, "w") { |f| f.write lines.join }
36
- end
37
-
38
- unless lines.find { |line| line.include?("CableReady.initialize({ consumer })") }
39
- append_to_file filepath, "CableReady.initialize({ consumer })"
40
- end
41
- end
42
- end
43
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rails/generators"
4
-
5
- module CableReady
6
- class InitializerGenerator < Rails::Generators::Base
7
- desc "Creates a CableReady initializer template in config/initializers"
8
- source_root File.expand_path("templates", __dir__)
9
-
10
- def copy_initializer_file
11
- copy_file "config/initializers/cable_ready.rb"
12
- end
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,7 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- # Automatically retry jobs that encountered a deadlock
3
- # retry_on ActiveRecord::Deadlocked
4
-
5
- # Most jobs are safe to ignore if the underlying records are no longer available
6
- # discard_on ActiveJob::DeserializationError
7
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
@@ -1,4 +0,0 @@
1
- class Dugong < ApplicationRecord
2
- include CableReady::Updatable
3
- has_many_attached :images, enable_updates: true
4
- end
@@ -1,16 +0,0 @@
1
- class GlobalIdableEntity
2
- include GlobalID::Identification
3
- include CableReady::Updatable
4
-
5
- def id
6
- "fake-id"
7
- end
8
-
9
- def self.find(id)
10
- new if id == "fake-id"
11
- end
12
-
13
- def fake_update
14
- ModelUpdatableCallbacks.new(:update).after_commit(self)
15
- end
16
- end
@@ -1,4 +0,0 @@
1
- class Post < ApplicationRecord
2
- include CableReady::Updatable
3
- belongs_to :user
4
- end
@@ -1,6 +0,0 @@
1
- class Section < ApplicationRecord
2
- include CableReady::Updatable
3
- enable_updates if: -> { updates_enabled }
4
-
5
- attribute :updates_enabled, :boolean, default: false
6
- end
@@ -1,6 +0,0 @@
1
- class Team < ApplicationRecord
2
- include CableReady::Updatable
3
- enable_updates
4
-
5
- has_many :users, enable_updates: true
6
- end
@@ -1,4 +0,0 @@
1
- class Topic < ApplicationRecord
2
- include CableReady::Updatable
3
- enable_updates on: :create
4
- end
@@ -1,7 +0,0 @@
1
- class User < ApplicationRecord
2
- include CableReady::Updatable
3
- enable_updates
4
-
5
- has_many :posts, enable_updates: true
6
- belongs_to :team, optional: true, touch: true
7
- end
@@ -1,22 +0,0 @@
1
- require_relative "boot"
2
-
3
- require "rails/all"
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(*Rails.groups)
8
- require "cable_ready"
9
-
10
- module Dummy
11
- class Application < Rails::Application
12
- config.load_defaults Rails::VERSION::STRING.to_f
13
-
14
- # Configuration for the application, engines, and railties goes here.
15
- #
16
- # These settings can be overridden in specific environments using the files
17
- # in config/environments, which are processed later.
18
- #
19
- # config.time_zone = "Central Time (US & Canada)"
20
- # config.eager_load_paths << Rails.root.join("extras")
21
- end
22
- end
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
-
4
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
5
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require_relative "application"
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,76 +0,0 @@
1
- require "active_support/core_ext/integer/time"
2
-
3
- Rails.application.configure do
4
- # Settings specified here will take precedence over those in config/application.rb.
5
-
6
- # In the development environment your application's code is reloaded any time
7
- # it changes. This slows down response time but is perfect for development
8
- # since you don't have to restart the web server when you make code changes.
9
- config.cache_classes = false
10
-
11
- # Do not eager load code on boot.
12
- config.eager_load = false
13
-
14
- # Show full error reports.
15
- config.consider_all_requests_local = true
16
-
17
- # Enable/disable caching. By default caching is disabled.
18
- # Run rails dev:cache to toggle caching.
19
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
- config.action_controller.perform_caching = true
21
- config.action_controller.enable_fragment_cache_logging = true
22
-
23
- config.cache_store = :memory_store
24
- config.public_file_server.headers = {
25
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26
- }
27
- else
28
- config.action_controller.perform_caching = false
29
-
30
- config.cache_store = :null_store
31
- end
32
-
33
- # Store uploaded files on the local file system (see config/storage.yml for options).
34
- config.active_storage.service = :local
35
-
36
- # Don't care if the mailer can't send.
37
- config.action_mailer.raise_delivery_errors = false
38
-
39
- config.action_mailer.perform_caching = false
40
-
41
- # Print deprecation notices to the Rails logger.
42
- config.active_support.deprecation = :log
43
-
44
- # Raise exceptions for disallowed deprecations.
45
- config.active_support.disallowed_deprecation = :raise
46
-
47
- # Tell Active Support which deprecation messages to disallow.
48
- config.active_support.disallowed_deprecation_warnings = []
49
-
50
- # Raise an error on page load if there are pending migrations.
51
- config.active_record.migration_error = :page_load
52
-
53
- # Highlight code that triggered database queries in logs.
54
- config.active_record.verbose_query_logs = true
55
-
56
- # Debug mode disables concatenation and preprocessing of assets.
57
- # This option may cause significant delays in view rendering with a large
58
- # number of complex assets.
59
- config.assets.debug = true
60
-
61
- # Suppress logger output for asset requests.
62
- config.assets.quiet = true
63
-
64
- # Raises error for missing translations.
65
- # config.i18n.raise_on_missing_translations = true
66
-
67
- # Annotate rendered view with file names.
68
- # config.action_view.annotate_rendered_view_with_filenames = true
69
-
70
- # Use an evented file watcher to asynchronously detect changes in source code,
71
- # routes, locales, etc. This feature depends on the listen gem.
72
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
73
-
74
- # Uncomment if you wish to allow Action Cable access from any origin.
75
- # config.action_cable.disable_request_forgery_protection = true
76
- end
@@ -1,120 +0,0 @@
1
- require "active_support/core_ext/integer/time"
2
-
3
- Rails.application.configure do
4
- # Settings specified here will take precedence over those in config/application.rb.
5
-
6
- # Code is not reloaded between requests.
7
- config.cache_classes = true
8
-
9
- # Eager load code on boot. This eager loads most of Rails and
10
- # your application in memory, allowing both threaded web servers
11
- # and those relying on copy on write to perform better.
12
- # Rake tasks automatically ignore this option for performance.
13
- config.eager_load = true
14
-
15
- # Full error reports are disabled and caching is turned on.
16
- config.consider_all_requests_local = false
17
- config.action_controller.perform_caching = true
18
-
19
- # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
- # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
- # config.require_master_key = true
22
-
23
- # Disable serving static files from the `/public` folder by default since
24
- # Apache or NGINX already handles this.
25
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
-
27
- # Compress CSS using a preprocessor.
28
- # config.assets.css_compressor = :sass
29
-
30
- # Do not fallback to assets pipeline if a precompiled asset is missed.
31
- config.assets.compile = false
32
-
33
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
34
- # config.asset_host = 'http://assets.example.com'
35
-
36
- # Specifies the header that your server uses for sending files.
37
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
38
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
39
-
40
- # Store uploaded files on the local file system (see config/storage.yml for options).
41
- config.active_storage.service = :local
42
-
43
- # Mount Action Cable outside main process or domain.
44
- # config.action_cable.mount_path = nil
45
- # config.action_cable.url = 'wss://example.com/cable'
46
- # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
47
-
48
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49
- # config.force_ssl = true
50
-
51
- # Include generic and useful information about system operation, but avoid logging too much
52
- # information to avoid inadvertent exposure of personally identifiable information (PII).
53
- config.log_level = :info
54
-
55
- # Prepend all log lines with the following tags.
56
- config.log_tags = [ :request_id ]
57
-
58
- # Use a different cache store in production.
59
- # config.cache_store = :mem_cache_store
60
-
61
- # Use a real queuing backend for Active Job (and separate queues per environment).
62
- # config.active_job.queue_adapter = :resque
63
- # config.active_job.queue_name_prefix = "dummy_production"
64
-
65
- config.action_mailer.perform_caching = false
66
-
67
- # Ignore bad email addresses and do not raise email delivery errors.
68
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
69
- # config.action_mailer.raise_delivery_errors = false
70
-
71
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72
- # the I18n.default_locale when a translation cannot be found).
73
- config.i18n.fallbacks = true
74
-
75
- # Send deprecation notices to registered listeners.
76
- config.active_support.deprecation = :notify
77
-
78
- # Log disallowed deprecations.
79
- config.active_support.disallowed_deprecation = :log
80
-
81
- # Tell Active Support which deprecation messages to disallow.
82
- config.active_support.disallowed_deprecation_warnings = []
83
-
84
- # Use default logging formatter so that PID and timestamp are not suppressed.
85
- config.log_formatter = ::Logger::Formatter.new
86
-
87
- # Use a different logger for distributed setups.
88
- # require "syslog/logger"
89
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
90
-
91
- if ENV["RAILS_LOG_TO_STDOUT"].present?
92
- logger = ActiveSupport::Logger.new(STDOUT)
93
- logger.formatter = config.log_formatter
94
- config.logger = ActiveSupport::TaggedLogging.new(logger)
95
- end
96
-
97
- # Do not dump schema after migrations.
98
- config.active_record.dump_schema_after_migration = false
99
-
100
- # Inserts middleware to perform automatic connection switching.
101
- # The `database_selector` hash is used to pass options to the DatabaseSelector
102
- # middleware. The `delay` is used to determine how long to wait after a write
103
- # to send a subsequent read to the primary.
104
- #
105
- # The `database_resolver` class is used by the middleware to determine which
106
- # database is appropriate to use based on the time delay.
107
- #
108
- # The `database_resolver_context` class is used by the middleware to set
109
- # timestamps for the last write to the primary. The resolver uses the context
110
- # class timestamps to determine how long to wait before reading from the
111
- # replica.
112
- #
113
- # By default Rails will store a last write timestamp in the session. The
114
- # DatabaseSelector middleware is designed as such you can define your own
115
- # strategy for connection switching and pass that into the middleware through
116
- # these configuration options.
117
- # config.active_record.database_selector = { delay: 2.seconds }
118
- # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
119
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
120
- end
@@ -1,59 +0,0 @@
1
- require "active_support/core_ext/integer/time"
2
-
3
- # The test environment is used exclusively to run your application's
4
- # test suite. You never need to work with it otherwise. Remember that
5
- # your test database is "scratch space" for the test suite and is wiped
6
- # and recreated between test runs. Don't rely on the data there!
7
-
8
- Rails.application.configure do
9
- # Settings specified here will take precedence over those in config/application.rb.
10
-
11
- config.cache_classes = true
12
-
13
- # Do not eager load code on boot. This avoids loading your whole application
14
- # just for the purpose of running a single test. If you are using a tool that
15
- # preloads Rails for running tests, you may have to set it to true.
16
- config.eager_load = false
17
-
18
- # Configure public file server for tests with Cache-Control for performance.
19
- config.public_file_server.enabled = true
20
- config.public_file_server.headers = {
21
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
22
- }
23
-
24
- # Show full error reports and disable caching.
25
- config.consider_all_requests_local = true
26
- config.action_controller.perform_caching = false
27
- config.cache_store = :null_store
28
-
29
- # Raise exceptions instead of rendering exception templates.
30
- config.action_dispatch.show_exceptions = false
31
-
32
- # Disable request forgery protection in test environment.
33
- config.action_controller.allow_forgery_protection = false
34
-
35
- # Store uploaded files on the local file system in a temporary directory.
36
- config.active_storage.service = :test
37
-
38
- config.action_mailer.perform_caching = false
39
-
40
- # Tell Action Mailer not to deliver emails to the real world.
41
- # The :test delivery method accumulates sent emails in the
42
- # ActionMailer::Base.deliveries array.
43
- config.action_mailer.delivery_method = :test
44
-
45
- # Print deprecation notices to the stderr.
46
- config.active_support.deprecation = :stderr
47
-
48
- # Raise exceptions for disallowed deprecations.
49
- config.active_support.disallowed_deprecation = :raise
50
-
51
- # Tell Active Support which deprecation messages to disallow.
52
- config.active_support.disallowed_deprecation_warnings = []
53
-
54
- # Raises error for missing translations.
55
- # config.i18n.raise_on_missing_translations = true
56
-
57
- # Annotate rendered view with file names.
58
- # config.action_view.annotate_rendered_view_with_filenames = true
59
- end
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # ActiveSupport::Reloader.to_prepare do
4
- # ApplicationController.renderer.defaults.merge!(
5
- # http_host: 'example.org',
6
- # https: false
7
- # )
8
- # end