cubism 0.1.0.pre12 → 0.1.0.pre13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +16 -0
  3. data/Appraisals~ +16 -0
  4. data/CHANGELOG.md +87 -0
  5. data/Gemfile +7 -0
  6. data/Gemfile.lock +220 -0
  7. data/Gemfile~ +9 -0
  8. data/README.md +32 -12
  9. data/README.md~ +191 -0
  10. data/app/assets/javascripts/cubism.js +141 -0
  11. data/app/assets/javascripts/cubism.min.js +2 -0
  12. data/app/assets/javascripts/cubism.min.js.map +1 -0
  13. data/app/assets/javascripts/cubism.umd.js +149 -0
  14. data/app/assets/javascripts/cubism.umd.min.js +2 -0
  15. data/app/assets/javascripts/cubism.umd.min.js.map +1 -0
  16. data/bin/rails +14 -0
  17. data/bin/standardize +4 -0
  18. data/bin/test +5 -0
  19. data/cubism.gemspec +36 -0
  20. data/cubism.gemspec~ +28 -0
  21. data/lib/cubism/engine.rb +20 -0
  22. data/lib/cubism/importmap.rb +2 -0
  23. data/lib/cubism/version.rb +1 -1
  24. data/package.json +43 -0
  25. data/package.json~ +33 -0
  26. data/rollup.config.js +77 -0
  27. data/{lib/cubism/cubicle_source_store.rb~ → rollup.config.js~} +0 -0
  28. data/test/block_container_test.rb +105 -0
  29. data/test/block_source_test.rb +102 -0
  30. data/test/broadcaster_test.rb +66 -0
  31. data/test/channels/cubism/presence_channel_test.rb +72 -0
  32. data/test/cubicle_store_test.rb +34 -0
  33. data/test/cubism_test.rb +7 -0
  34. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  35. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  36. data/test/dummy/app/controllers/application_controller.rb +2 -0
  37. data/test/dummy/app/helpers/application_helper.rb +2 -0
  38. data/test/dummy/app/jobs/application_job.rb +7 -0
  39. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  40. data/test/dummy/app/models/application_record.rb +3 -0
  41. data/test/dummy/app/models/post.rb +3 -0
  42. data/test/dummy/app/models/user.rb +3 -0
  43. data/test/dummy/config/application.rb +22 -0
  44. data/test/dummy/config/boot.rb +5 -0
  45. data/test/dummy/config/environment.rb +5 -0
  46. data/test/dummy/config/environments/development.rb +76 -0
  47. data/test/dummy/config/environments/production.rb +120 -0
  48. data/test/dummy/config/environments/test.rb +59 -0
  49. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  50. data/test/dummy/config/initializers/assets.rb +12 -0
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
  52. data/test/dummy/config/initializers/content_security_policy.rb +28 -0
  53. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  54. data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  55. data/test/dummy/config/initializers/inflections.rb +16 -0
  56. data/test/dummy/config/initializers/mime_types.rb +4 -0
  57. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  58. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/test/dummy/config/puma.rb +43 -0
  60. data/test/dummy/config/routes.rb +3 -0
  61. data/test/dummy/db/migrate/20220102072929_create_posts.rb +10 -0
  62. data/test/dummy/db/migrate/20220102073003_create_users.rb +9 -0
  63. data/test/dummy/db/schema.rb +26 -0
  64. data/test/dummy/test/models/post_test.rb +7 -0
  65. data/test/dummy/test/models/user_test.rb +7 -0
  66. data/test/helpers/cubism_helper_test.rb +39 -0
  67. data/test/integration/navigation_test.rb +7 -0
  68. data/test/models/concerns/presence_test.rb +25 -0
  69. data/test/models/concerns/user_test.rb +9 -0
  70. data/test/rendering/preprocessor_test.rb +61 -0
  71. data/test/test_helper.rb +16 -0
  72. data/yarn.lock +2814 -0
  73. metadata +117 -19
  74. data/app/channels/cubism/presence_channel.rb~ +0 -61
  75. data/app/helpers/cubism_helper.rb~ +0 -36
  76. data/app/models/concerns/cubism/presence.rb~ +0 -20
  77. data/config/routes.rb +0 -2
  78. data/lib/cubism/broadcaster.rb~ +0 -37
  79. data/lib/cubism/cubicle_block_store.rb~ +0 -56
  80. data/lib/cubism/cubicle_store.rb~ +0 -141
  81. data/lib/cubism/engine.rb~ +0 -7
  82. data/lib/cubism/parser.rb~ +0 -0
  83. data/lib/cubism/preprocessor.rb~ +0 -30
  84. data/lib/cubism/version.rb~ +0 -3
  85. data/lib/cubism.rb~ +0 -18
  86. data/lib/tasks/cubism_tasks.rake +0 -4
data/rollup.config.js ADDED
@@ -0,0 +1,77 @@
1
+ import resolve from '@rollup/plugin-node-resolve'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import json from '@rollup/plugin-json'
4
+ import { terser } from 'rollup-plugin-terser'
5
+
6
+ const pretty = () => {
7
+ return terser({
8
+ mangle: false,
9
+ compress: false,
10
+ format: {
11
+ beautify: true,
12
+ indent_level: 2
13
+ }
14
+ })
15
+ }
16
+
17
+ const minify = () => {
18
+ return terser({
19
+ mangle: true,
20
+ compress: true
21
+ })
22
+ }
23
+
24
+ const esConfig = {
25
+ format: 'es',
26
+ inlineDynamicImports: true
27
+ }
28
+
29
+ const umdConfig = {
30
+ name: 'Cubism',
31
+ format: 'umd',
32
+ exports: 'named',
33
+ globals: {
34
+ cable_ready: 'CableReady'
35
+ }
36
+ }
37
+
38
+ const distFolders = ['dist/', 'app/assets/javascripts/']
39
+
40
+ const output = distFolders
41
+ .map(distFolder => [
42
+ {
43
+ ...esConfig,
44
+ file: `${distFolder}/cubism.js`,
45
+ plugins: [pretty()]
46
+ },
47
+ {
48
+ ...esConfig,
49
+ file: `${distFolder}/cubism.min.js`,
50
+ sourcemap: true,
51
+ plugins: [minify()]
52
+ },
53
+ {
54
+ ...umdConfig,
55
+ file: `${distFolder}/cubism.umd.js`,
56
+ plugins: [pretty()]
57
+ },
58
+ {
59
+ ...umdConfig,
60
+ file: `${distFolder}/cubism.umd.min.js`,
61
+ sourcemap: true,
62
+ plugins: [minify()]
63
+ }
64
+ ])
65
+ .flat()
66
+
67
+ export default [
68
+ {
69
+ external: ['cable_ready'],
70
+ input: 'javascript/index.js',
71
+ output,
72
+ plugins: [commonjs(), resolve(), json()],
73
+ watch: {
74
+ include: 'javascript/**'
75
+ }
76
+ }
77
+ ]
@@ -0,0 +1,105 @@
1
+ require "test_helper"
2
+
3
+ class BlockContainerTest < ActiveSupport::TestCase
4
+ FIXTURES_DIR = File.expand_path("./fixtures", __dir__)
5
+
6
+ setup do
7
+ @cwd = Dir.pwd
8
+ @tmp_dir = Dir.mktmpdir
9
+
10
+ FileUtils.cp_r FIXTURES_DIR, @tmp_dir
11
+ Dir.chdir @tmp_dir
12
+
13
+ @post = posts(:one)
14
+ @user = users(:one)
15
+ end
16
+
17
+ teardown do
18
+ Dir.chdir @cwd
19
+ FileUtils.rm_r @tmp_dir
20
+ end
21
+
22
+ test "block container digest changes when file contents change" do
23
+ template = "fixtures/_cubicle_partial"
24
+
25
+ digest1 = Cubism::BlockContainer.new(
26
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
27
+ resource_gid: @post.to_gid.to_s,
28
+ user_gid: @user.to_gid.to_s
29
+ ).digest
30
+
31
+ change_template(template)
32
+
33
+ digest2 = Cubism::BlockContainer.new(
34
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
35
+ resource_gid: @post.to_gid.to_s,
36
+ user_gid: @user.to_gid.to_s
37
+ ).digest
38
+
39
+ refute_equal digest1, digest2
40
+ end
41
+
42
+ test "block container digest changes when user changes" do
43
+ template = "fixtures/_cubicle_partial"
44
+
45
+ digest1 = Cubism::BlockContainer.new(
46
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
47
+ resource_gid: @post.to_gid.to_s,
48
+ user_gid: @user.to_gid.to_s
49
+ ).digest
50
+
51
+ digest2 = Cubism::BlockContainer.new(
52
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
53
+ resource_gid: @post.to_gid.to_s,
54
+ user_gid: users(:two).to_gid.to_s
55
+ ).digest
56
+
57
+ refute_equal digest1, digest2
58
+ end
59
+
60
+ test "block container digest changes when resource changes" do
61
+ template = "fixtures/_cubicle_partial"
62
+
63
+ digest1 = Cubism::BlockContainer.new(
64
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
65
+ resource_gid: @post.to_gid.to_s,
66
+ user_gid: @user.to_gid.to_s
67
+ ).digest
68
+
69
+ digest2 = Cubism::BlockContainer.new(
70
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
71
+ resource_gid: posts(:two).to_gid.to_s,
72
+ user_gid: @user.to_gid.to_s
73
+ ).digest
74
+
75
+ refute_equal digest1, digest2
76
+ end
77
+
78
+ test "block container digest changes when block_location changes" do
79
+ template = "fixtures/_cubicle_partial"
80
+
81
+ digest1 = Cubism::BlockContainer.new(
82
+ block_location: "#{template_tmp_path(template)}.html.erb:1",
83
+ resource_gid: @post.to_gid.to_s,
84
+ user_gid: @user.to_gid.to_s
85
+ ).digest
86
+
87
+ digest2 = Cubism::BlockContainer.new(
88
+ block_location: "#{template_tmp_path(template)}.html.erb:2",
89
+ resource_gid: @post.to_gid.to_s,
90
+ user_gid: @user.to_gid.to_s
91
+ ).digest
92
+
93
+ refute_equal digest1, digest2
94
+ end
95
+
96
+ private
97
+
98
+ def template_tmp_path(template)
99
+ Pathname.new(@tmp_dir).join(template).to_path
100
+ end
101
+
102
+ def change_template(template)
103
+ File.write("#{template}.html.erb", "\nTHIS WAS CHANGED!")
104
+ end
105
+ end
@@ -0,0 +1,102 @@
1
+ require "test_helper"
2
+
3
+ class BlockSourceTest < ActionView::TestCase
4
+ FIXTURES_DIR = File.expand_path("./fixtures", __dir__)
5
+
6
+ setup do
7
+ @cwd = Dir.pwd
8
+ @tmp_dir = Dir.mktmpdir
9
+
10
+ FileUtils.cp_r FIXTURES_DIR, @tmp_dir
11
+ Dir.chdir @tmp_dir
12
+
13
+ @post = posts(:one)
14
+ @user = users(:one)
15
+ end
16
+
17
+ teardown do
18
+ Dir.chdir @cwd
19
+ FileUtils.rm_r @tmp_dir
20
+ end
21
+
22
+ test "block source digest changes when file contents change" do
23
+ template = "fixtures/_cubicle_partial"
24
+
25
+ digest1 = Cubism::BlockSource.new(
26
+ location: "#{template_tmp_path(template)}.html.erb:1",
27
+ view_context: self
28
+ ).digest
29
+
30
+ change_template(template)
31
+
32
+ digest2 = Cubism::BlockSource.new(
33
+ location: "#{template_tmp_path(template)}.html.erb:1",
34
+ view_context: self
35
+ ).digest
36
+
37
+ refute_equal digest1, digest2
38
+ end
39
+
40
+ test "block source digest changes when block_location changes" do
41
+ template = "fixtures/_cubicle_partial"
42
+
43
+ digest1 = Cubism::BlockSource.new(
44
+ location: "#{template_tmp_path(template)}.html.erb:1",
45
+ view_context: self
46
+ ).digest
47
+
48
+ digest2 = Cubism::BlockSource.new(
49
+ location: "#{template_tmp_path(template)}.html.erb:2",
50
+ view_context: self
51
+ ).digest
52
+
53
+ refute_equal digest1, digest2
54
+ end
55
+
56
+ test "can be created in the store by source location" do
57
+ template = "fixtures/_cubicle_partial"
58
+
59
+ assert_equal 0, Cubism.source_store.size
60
+
61
+ Cubism::BlockSource.any_instance.expects(:parse!).once
62
+
63
+ Cubism::BlockSource.find_or_create(
64
+ location: "#{template_tmp_path(template)}.html.erb:1",
65
+ view_context: self
66
+ )
67
+
68
+ assert_equal 1, Cubism.source_store.size
69
+ end
70
+
71
+ test "existing block source is returned and not parsed" do
72
+ template = "fixtures/_cubicle_partial"
73
+
74
+ instance = Cubism::BlockSource.new(
75
+ location: "#{template_tmp_path(template)}.html.erb:1",
76
+ view_context: self
77
+ )
78
+
79
+ Cubism.source_store[instance.digest] = instance
80
+
81
+ assert_equal 1, Cubism.source_store.size
82
+
83
+ Cubism::BlockSource.any_instance.expects(:parse!).never
84
+
85
+ Cubism::BlockSource.find_or_create(
86
+ location: "#{template_tmp_path(template)}.html.erb:1",
87
+ view_context: self
88
+ )
89
+
90
+ assert_equal 1, Cubism.source_store.size
91
+ end
92
+
93
+ private
94
+
95
+ def template_tmp_path(template)
96
+ Pathname.new(@tmp_dir).join(template).to_path
97
+ end
98
+
99
+ def change_template(template)
100
+ File.write("#{template}.html.erb", "\nTHIS WAS CHANGED!")
101
+ end
102
+ end
@@ -0,0 +1,66 @@
1
+ require "test_helper"
2
+
3
+ class BroadcasterTest < ActionView::TestCase
4
+ include CableReady::StreamIdentifier
5
+
6
+ setup do
7
+ @post = posts(:one)
8
+ @post.stubs(:cubicle_element_ids).returns(%w[foo bar])
9
+ @post.stubs(:present_users_for_element_id_and_scope).with("foo", "").returns([users(:one)])
10
+ @post.stubs(:present_users_for_element_id_and_scope).with("bar", "").returns([users(:two)])
11
+
12
+ @post_2 = posts(:two)
13
+ @post_2.stubs(:cubicle_element_ids).returns(%w[baz])
14
+ @post_2.stubs(:present_users_for_element_id_and_scope).with("baz", :edit).returns([users(:one)])
15
+ @post_2.stubs(:present_users_for_element_id_and_scope).with("baz", :show).returns([])
16
+
17
+ block_source_foo = Cubism::BlockSource.new(location: "test:1", variable_name: "users", source: "<div><%= users.map(&:username).to_sentence %></div>", view_context: self)
18
+ block_source_bar = Cubism::BlockSource.new(location: "test:1", variable_name: "present_users", source: "<div><%= present_users.map(&:username).to_sentence %></div>", view_context: self)
19
+
20
+ Cubism.stubs(:block_store).returns({
21
+ "foo" => Cubism::BlockContainer.new(block_location: "test:1", block_source: block_source_foo, user_gid: users(:one).to_gid.to_s, resource_gid: posts(:one).to_gid.to_s),
22
+ "bar" => Cubism::BlockContainer.new(block_location: "test:1", block_source: block_source_bar, user_gid: users(:two).to_gid.to_s, resource_gid: posts(:one).to_gid.to_s),
23
+ "baz" => Cubism::BlockContainer.new(block_location: "test:1", block_source: block_source_foo, user_gid: users(:one).to_gid.to_s, resource_gid: posts(:two).to_gid.to_s, scope: :edit)
24
+ })
25
+ end
26
+
27
+ test "it broadcasts to all registered element ids with default scopes" do
28
+ with_mocked_cable_ready({"foo" => {"" => users(:one)}, "bar" => {"" => users(:two)}}, @post) do |cable_ready_mock|
29
+ @broadcaster = Cubism::Broadcaster.new(resource: @post)
30
+
31
+ @broadcaster.expects(:cable_ready).returns(cable_ready_mock).times(3)
32
+
33
+ @broadcaster.broadcast
34
+ end
35
+ end
36
+
37
+ test "it broadcasts to all registered element ids and respects scopes" do
38
+ with_mocked_cable_ready({"baz" => {"edit" => users(:one)}}, @post_2) do |cable_ready_mock|
39
+ @broadcaster = Cubism::Broadcaster.new(resource: @post_2)
40
+
41
+ @broadcaster.expects(:cable_ready).returns(cable_ready_mock).twice
42
+
43
+ @broadcaster.broadcast
44
+ end
45
+ end
46
+ end
47
+
48
+ def with_mocked_cable_ready(elements_with_users_and_scopes, resource)
49
+ cable_ready_mock = mock
50
+ cable_ready_mock.expects(:broadcast).once
51
+
52
+ elements_with_users_and_scopes.each do |element_id, scoped_users|
53
+ cable_ready_channel = mock
54
+ scoped_users.each do |scope, user|
55
+ cable_ready_channel
56
+ .expects(:inner_html)
57
+ .with({
58
+ selector: "cubicle-element#cubicle-#{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']",
59
+ html: "<div>#{user.username}</div>"
60
+ })
61
+ end
62
+ cable_ready_mock.expects(:[]).with(element_id).returns(cable_ready_channel)
63
+ end
64
+
65
+ yield cable_ready_mock
66
+ end
@@ -0,0 +1,72 @@
1
+ require "test_helper"
2
+
3
+ class Cubism::PresenceChannelTest < ActionCable::Channel::TestCase
4
+ include CableReady::StreamIdentifier
5
+
6
+ setup do
7
+ @post = posts(:one)
8
+ @user = users(:one)
9
+
10
+ Post.any_instance.stubs(:cubicle_element_ids).returns([])
11
+ Post.any_instance.stubs(:excluded_user_id_for_element_id).returns({})
12
+ Post.any_instance.stubs(:present_users).returns({})
13
+
14
+ Cubism.stubs(:block_store).returns({
15
+ "foo" => Cubism::BlockContainer.new(block_location: "test:1", user_gid: @user.to_gid.to_s, resource_gid: @post.to_gid.to_s, scope: ""),
16
+ "bar" => Cubism::BlockContainer.new(block_location: "test:1", user_gid: @user.to_gid.to_s, resource_gid: @post.to_gid.to_s, scope: "edit")
17
+ })
18
+ end
19
+
20
+ test "rejects a subscription for invalid identifiers" do
21
+ subscribe identifier: "foo", element_id: "cubicle-bar"
22
+
23
+ assert subscription.rejected?
24
+ end
25
+
26
+ test "confirms a subscription for valid identifiers" do
27
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "cubicle-bar"
28
+
29
+ assert subscription.confirmed?
30
+
31
+ assert_has_stream "bar"
32
+ assert_equal 1, @post.cubicle_element_ids.size
33
+ end
34
+
35
+ test "adds user_id to the excluded users hash if the exclude_current_user param is passed" do
36
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "cubicle-bar", exclude_current_user: true
37
+
38
+ assert_equal({"bar" => @user.id}, @post.excluded_user_id_for_element_id)
39
+ end
40
+
41
+ test "adds a user to the present users list when appear is called" do
42
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "cubicle-foo"
43
+ perform :appear
44
+
45
+ assert_equal [@user.id], @post.present_users_for_scope("").to_a
46
+ end
47
+
48
+ test "adds a user to a scope in the present users list when appear is called with a scope parameter" do
49
+ assert_equal [], @post.present_users_for_scope("edit").to_a
50
+ assert_equal [], @post.present_users_for_scope("show").to_a
51
+
52
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "cubicle-bar", scope: "edit"
53
+ perform :appear
54
+
55
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "bar", scope: "show"
56
+
57
+ assert_equal [@user.id], @post.present_users_for_scope("edit").to_a
58
+ assert_equal [], @post.present_users_for_scope("show").to_a
59
+ end
60
+
61
+ test "removes a user from the present users list when disappear is called" do
62
+ subscribe identifier: signed_stream_identifier(@post.to_gid.to_s), element_id: "cubicle-foo"
63
+
64
+ perform :appear
65
+
66
+ assert_equal [@user.id], @post.present_users_for_scope("").to_a
67
+
68
+ perform :disappear
69
+
70
+ assert_equal [], @post.present_users_for_scope("").to_a
71
+ end
72
+ end
@@ -0,0 +1,34 @@
1
+ require "test_helper"
2
+
3
+ class CubicleStoreTest < ActiveSupport::TestCase
4
+ setup do
5
+ @store = Cubism::CubicleStore.new("cubism-test")
6
+ end
7
+
8
+ test "empty value just retrieves the key" do
9
+ @store["foo"] = "bar"
10
+
11
+ value = @store.fetch("foo")
12
+
13
+ refute_nil @store["foo"]
14
+ assert_equal "bar", value
15
+ end
16
+
17
+ test "fetch assigns value to empty key" do
18
+ assert_nil @store["foo"]
19
+
20
+ value = @store.fetch("foo", "bar")
21
+
22
+ refute_nil @store["foo"]
23
+ assert_equal "bar", value
24
+ end
25
+
26
+ test "fetch retrieves value for existing key, and does not overwrite it" do
27
+ @store["foo"] = "baz"
28
+
29
+ value = @store.fetch("foo", "bar")
30
+
31
+ refute_nil @store["foo"]
32
+ assert_equal "baz", value
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ require "test_helper"
2
+
3
+ class CubismTest < ActiveSupport::TestCase
4
+ test "it has a version number" do
5
+ assert Cubism::VERSION
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ApplicationRecord
2
+ include Cubism::Presence
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ApplicationRecord
2
+ include Cubism::User
3
+ end
@@ -0,0 +1,22 @@
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 "cubism"
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
@@ -0,0 +1,5 @@
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__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative "application"
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,76 @@
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