impressionist-cody 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +25 -0
  3. data/.gitignore +17 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +27 -0
  6. data/.rubocop_todo.yml +660 -0
  7. data/CHANGELOG.rdoc +96 -0
  8. data/Gemfile +22 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.md +265 -0
  11. data/Rakefile +20 -0
  12. data/UPGRADE_GUIDE.md +13 -0
  13. data/app/assets/config/manifest.js +3 -0
  14. data/app/controllers/impressionist_controller.rb +166 -0
  15. data/app/models/impression.rb +2 -0
  16. data/app/models/impressionist/bots.rb +1468 -0
  17. data/app/models/impressionist/impressionable.rb +62 -0
  18. data/impressionist.gemspec +30 -0
  19. data/lib/generators/active_record/impressionist_generator.rb +22 -0
  20. data/lib/generators/active_record/templates/create_impressions_table.rb.erb +32 -0
  21. data/lib/generators/impressionist_generator.rb +13 -0
  22. data/lib/generators/mongo_mapper/impressionist_generator.rb +8 -0
  23. data/lib/generators/mongoid/impressionist_generator.rb +8 -0
  24. data/lib/generators/templates/impression.rb.erb +8 -0
  25. data/lib/impressionist/bots.rb +21 -0
  26. data/lib/impressionist/controllers/mongoid/impressionist_controller.rb +10 -0
  27. data/lib/impressionist/counter_cache.rb +76 -0
  28. data/lib/impressionist/engine.rb +45 -0
  29. data/lib/impressionist/is_impressionable.rb +23 -0
  30. data/lib/impressionist/load.rb +11 -0
  31. data/lib/impressionist/models/active_record/impression.rb +14 -0
  32. data/lib/impressionist/models/active_record/impressionist/impressionable.rb +12 -0
  33. data/lib/impressionist/models/mongo_mapper/impression.rb +18 -0
  34. data/lib/impressionist/models/mongo_mapper/impressionist/impressionable.rb +21 -0
  35. data/lib/impressionist/models/mongoid/impression.rb +26 -0
  36. data/lib/impressionist/models/mongoid/impressionist/impressionable.rb +28 -0
  37. data/lib/impressionist/rails_toggle.rb +26 -0
  38. data/lib/impressionist/setup_association.rb +53 -0
  39. data/lib/impressionist/update_counters.rb +77 -0
  40. data/lib/impressionist/version.rb +3 -0
  41. data/lib/impressionist.rb +12 -0
  42. data/logo.png +0 -0
  43. data/spec/controllers/articles_controller_spec.rb +113 -0
  44. data/spec/controllers/dummy_controller_spec.rb +13 -0
  45. data/spec/controllers/impressionist_uniqueness_spec.rb +463 -0
  46. data/spec/controllers/posts_controller_spec.rb +36 -0
  47. data/spec/controllers/widgets_controller_spec.rb +103 -0
  48. data/spec/counter_caching_spec.rb +49 -0
  49. data/spec/dummy/.ruby-version +1 -0
  50. data/spec/dummy/Rakefile +6 -0
  51. data/spec/dummy/app/assets/config/manifest.js +1 -0
  52. data/spec/dummy/app/assets/images/.keep +0 -0
  53. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  54. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  55. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  56. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  57. data/spec/dummy/app/controllers/articles_controller.rb +22 -0
  58. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  59. data/spec/dummy/app/controllers/dummy_controller.rb +6 -0
  60. data/spec/dummy/app/controllers/posts_controller.rb +23 -0
  61. data/spec/dummy/app/controllers/profiles_controller.rb +14 -0
  62. data/spec/dummy/app/controllers/widgets_controller.rb +12 -0
  63. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  64. data/spec/dummy/app/javascript/packs/application.js +15 -0
  65. data/spec/dummy/app/jobs/application_job.rb +7 -0
  66. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  67. data/spec/dummy/app/models/application_record.rb +3 -0
  68. data/spec/dummy/app/models/article.rb +3 -0
  69. data/spec/dummy/app/models/concerns/.keep +0 -0
  70. data/spec/dummy/app/models/dummy.rb +7 -0
  71. data/spec/dummy/app/models/post.rb +3 -0
  72. data/spec/dummy/app/models/profile.rb +6 -0
  73. data/spec/dummy/app/models/user.rb +3 -0
  74. data/spec/dummy/app/models/widget.rb +3 -0
  75. data/spec/dummy/app/views/articles/index.html.erb +1 -0
  76. data/spec/dummy/app/views/articles/show.html.erb +1 -0
  77. data/spec/dummy/app/views/dummy/index.html.erb +0 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  79. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  80. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  81. data/spec/dummy/app/views/posts/edit.html.erb +0 -0
  82. data/spec/dummy/app/views/posts/index.html.erb +0 -0
  83. data/spec/dummy/app/views/posts/show.html.erb +0 -0
  84. data/spec/dummy/app/views/profiles/show.html.erb +3 -0
  85. data/spec/dummy/app/views/widgets/index.html.erb +0 -0
  86. data/spec/dummy/app/views/widgets/new.html.erb +0 -0
  87. data/spec/dummy/app/views/widgets/show.html.erb +0 -0
  88. data/spec/dummy/bin/rails +4 -0
  89. data/spec/dummy/bin/rake +4 -0
  90. data/spec/dummy/bin/setup +33 -0
  91. data/spec/dummy/config/application.rb +20 -0
  92. data/spec/dummy/config/boot.rb +5 -0
  93. data/spec/dummy/config/cable.yml +10 -0
  94. data/spec/dummy/config/database.yml +25 -0
  95. data/spec/dummy/config/environment.rb +5 -0
  96. data/spec/dummy/config/environments/development.rb +62 -0
  97. data/spec/dummy/config/environments/production.rb +112 -0
  98. data/spec/dummy/config/environments/test.rb +49 -0
  99. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  100. data/spec/dummy/config/initializers/assets.rb +12 -0
  101. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  102. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  103. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  104. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  105. data/spec/dummy/config/initializers/impression.rb +8 -0
  106. data/spec/dummy/config/initializers/inflections.rb +16 -0
  107. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  108. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  109. data/spec/dummy/config/locales/en.yml +33 -0
  110. data/spec/dummy/config/puma.rb +38 -0
  111. data/spec/dummy/config/routes.rb +4 -0
  112. data/spec/dummy/config/spring.rb +6 -0
  113. data/spec/dummy/config/storage.yml +34 -0
  114. data/spec/dummy/config.ru +5 -0
  115. data/spec/dummy/config.ru2 +4 -0
  116. data/spec/dummy/db/development.sqlite3 +0 -0
  117. data/spec/dummy/db/migrate/20110201153144_create_articles.rb +13 -0
  118. data/spec/dummy/db/migrate/20110210205028_create_posts.rb +13 -0
  119. data/spec/dummy/db/migrate/20111127184039_create_widgets.rb +15 -0
  120. data/spec/dummy/db/migrate/20150207135825_create_profiles.rb +10 -0
  121. data/spec/dummy/db/migrate/20150207140310_create_friendly_id_slugs.rb +18 -0
  122. data/spec/dummy/db/migrate/20200720143817_create_impressions_table.rb +32 -0
  123. data/spec/dummy/db/schema.rb +77 -0
  124. data/spec/dummy/lib/assets/.keep +0 -0
  125. data/spec/dummy/log/.keep +0 -0
  126. data/spec/dummy/log/development.log +129 -0
  127. data/spec/dummy/public/404.html +67 -0
  128. data/spec/dummy/public/422.html +67 -0
  129. data/spec/dummy/public/500.html +66 -0
  130. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  131. data/spec/dummy/public/apple-touch-icon.png +0 -0
  132. data/spec/dummy/public/favicon.ico +0 -0
  133. data/spec/dummy/storage/.keep +0 -0
  134. data/spec/fixtures/articles.yml +3 -0
  135. data/spec/fixtures/impressions.yml +43 -0
  136. data/spec/fixtures/posts.yml +3 -0
  137. data/spec/fixtures/profiles.yml +4 -0
  138. data/spec/fixtures/widgets.yml +4 -0
  139. data/spec/initializers_spec.rb +21 -0
  140. data/spec/models/bots_spec.rb +25 -0
  141. data/spec/models/impression_spec.rb +66 -0
  142. data/spec/rails_generators/rails_generators_spec.rb +23 -0
  143. data/spec/rails_helper.rb +11 -0
  144. data/spec/rails_toggle_spec.rb +31 -0
  145. data/spec/setup_association_spec.rb +48 -0
  146. data/spec/spec_helper.rb +43 -0
  147. data/upgrade_migrations/version_0_3_0.rb +27 -0
  148. data/upgrade_migrations/version_0_4_0.rb +9 -0
  149. data/upgrade_migrations/version_1_5_2.rb +12 -0
  150. metadata +302 -0
@@ -0,0 +1,103 @@
1
+ require 'spec_helper'
2
+
3
+ describe WidgetsController do
4
+ before do
5
+ @widget = Widget.find(1)
6
+ allow(Widget).to receive(:find).and_return(@widget)
7
+ end
8
+
9
+ it "logs impression at the per action level" do
10
+ get :show, params: { id: 1 }
11
+ expect(Impression.all.size).to eq 12
12
+
13
+ get :index
14
+
15
+ expect(Impression.all.size).to eq 13
16
+
17
+ get :new
18
+
19
+ expect(Impression.all.size).to eq 13
20
+ end
21
+
22
+ it "does not log impression when user-agent is in wildcard list" do
23
+ request.env['HTTP_USER_AGENT'] = 'somebot'
24
+
25
+ get :show, params: { id: 1 }
26
+ expect(Impression.all.size).to eq 11
27
+ end
28
+
29
+ it "does not log impression when user-agent is in the bot list" do
30
+ request.env['HTTP_USER_AGENT'] = 'Acoon Robot v1.50.001'
31
+
32
+ get :show, params: { id: 1 }
33
+ expect(Impression.all.size).to eq 11
34
+ end
35
+
36
+ context "impressionist unique options" do
37
+ it "logs unique impressions at the per action level" do
38
+ get :show, params: { id: 1 }
39
+ expect(Impression.all.size).to eq 12
40
+ get :show, params: { id: 2 }
41
+ expect(Impression.all.size).to eq 13
42
+ get :show, params: { id: 2 }
43
+ expect(Impression.all.size).to eq 13
44
+ get :index
45
+ expect(Impression.all.size).to eq 14
46
+ end
47
+
48
+ it "logs unique impressions only once per id" do
49
+ get :show, params: { id: 1 }
50
+ expect(Impression.all.size).to eq 12
51
+ get :show, params: { id: 2 }
52
+ expect(Impression.all.size).to eq 13
53
+
54
+ get :show, params: { id: 2 }
55
+ expect(Impression.all.size).to eq 13
56
+
57
+ get :index
58
+ expect(Impression.all.size).to eq 14
59
+ end
60
+ end
61
+
62
+ context "Impresionist unique params options" do
63
+ it "logs unique impressions at the per action and params level" do
64
+ get :show, params: { id: 1 }
65
+ expect(Impression.all.size).to eq 12
66
+
67
+ get :show, params: { id: 2, checked: true }
68
+ expect(Impression.all.size).to eq 13
69
+
70
+ get :show, params: { id: 2, checked: false }
71
+ expect(Impression.all.size).to eq 14
72
+
73
+ get :index
74
+ expect(Impression.all.size).to eq 15
75
+ end
76
+
77
+ it "does not log impression for same params and same id" do
78
+ get :show, params: { id: 1 }
79
+ expect(Impression.all.size).to eq 12
80
+
81
+ get :show, params: { id: 1 }
82
+ expect(Impression.all.size).to eq 12
83
+
84
+ get :show, params: { id: 1, checked: true }
85
+ expect(Impression.all.size).to eq 13
86
+
87
+ get :show, params: { id: 1, checked: false }
88
+ expect(Impression.all.size).to eq 14
89
+
90
+ get :show, params: { id: 1, checked: true }
91
+ expect(Impression.all.size).to eq 14
92
+
93
+ get :show, params: { id: 1, checked: false }
94
+ expect(Impression.all.size).to eq 14
95
+
96
+ get :show, params: { id: 1 }
97
+ expect(Impression.all.size).to eq 14
98
+
99
+ get :show, params: { id: 2 }
100
+ expect(Impression.all.size).to eq 15
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Impression do
4
+ fixtures :widgets
5
+
6
+ let(:widget) { Widget.find(1) }
7
+
8
+ before do
9
+ described_class.destroy_all
10
+ end
11
+
12
+ describe "self#impressionist_counter_caching?" do
13
+ it "knows when counter caching is enabled" do
14
+ expect(Widget).to be_impressionist_counter_caching
15
+ end
16
+
17
+ it "knows when counter caching is disabled" do
18
+ expect(Article).not_to be_impressionist_counter_caching
19
+ end
20
+ end
21
+
22
+ describe "self#counter_caching?" do
23
+ it "knows when counter caching is enabled" do
24
+ allow(ActiveSupport::Deprecation).to receive(:warn)
25
+ expect(Widget).to be_counter_caching
26
+ end
27
+
28
+ it "knows when counter caching is disabled" do
29
+ allow(ActiveSupport::Deprecation).to receive(:warn)
30
+ expect(Article).not_to be_counter_caching
31
+ end
32
+ end
33
+
34
+ describe "#update_impressionist_counter_cache" do
35
+ it "updates the counter cache column to reflect the correct number of impressions" do
36
+ expect do
37
+ widget.impressions.create(:request_hash => 'abcd1234')
38
+ widget.reload
39
+ end.to change(widget, :impressions_count).from(0).to(1)
40
+ end
41
+
42
+ it "does not update the timestamp on the impressable" do
43
+ expect do
44
+ widget.impressions.create(:request_hash => 'abcd1234')
45
+ widget.reload
46
+ end.not_to change(widget, :updated_at)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1 @@
1
+ //= link application.css
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -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,22 @@
1
+ class ArticlesController < ApplicationController
2
+ if Rails::VERSION::MAJOR >= 5
3
+ before_action :test_current_user_var
4
+ else
5
+ before_filter :test_current_user_var
6
+ end
7
+
8
+ def test_current_user_var
9
+ if session[:user_id]
10
+ @current_user = User.new
11
+ @current_user.id = session[:user_id]
12
+ end
13
+ end
14
+
15
+ def index
16
+ impressionist(Article.first,"this is a test article impression")
17
+ end
18
+
19
+ def show
20
+ impressionist(Article.first)
21
+ end
22
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ # This controller imports the impressionist module to make the modules methods available for testing
2
+ class DummyController < ApplicationController
3
+ impressionist
4
+
5
+ def index; end
6
+ end
@@ -0,0 +1,23 @@
1
+ class PostsController < ApplicationController
2
+ helper_method :current_user
3
+ impressionist
4
+ def index
5
+
6
+ end
7
+
8
+ def show
9
+
10
+ end
11
+
12
+ def edit
13
+
14
+ end
15
+
16
+ def current_user
17
+ if session[:user_id]
18
+ user = User.new
19
+ user.id = session[:user_id]
20
+ @current_user ||= user
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ class ProfilesController < ApplicationController
2
+ helper_method :current_user
3
+
4
+ def show
5
+ end
6
+
7
+ def current_user
8
+ if session[:user_id]
9
+ user = User.new
10
+ user.id = session[:user_id]
11
+ @current_user ||= user
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class WidgetsController < ApplicationController
2
+ impressionist :actions=>[:show, :index], :unique => [:controller_name, :action_name, :impressionable_id, :params]
3
+
4
+ def show
5
+ end
6
+
7
+ def index
8
+ end
9
+
10
+ def new
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require rails-ujs
14
+ //= require activestorage
15
+ //= require_tree .
@@ -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 Article < ActiveRecord::Base
2
+ is_impressionable
3
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # We don't really care about this model. It's just being used to test the uniqueness controller
2
+ # specs. Nevertheless, we need a model because the counter caching functionality expects it.
3
+ #
4
+ class Dummy < ActiveRecord::Base
5
+ self.abstract_class = true # doesn't need to be backed by an actual table
6
+ is_impressionable
7
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ is_impressionable
3
+ end
@@ -0,0 +1,6 @@
1
+ class Profile < ActiveRecord::Base
2
+ extend FriendlyId
3
+
4
+ friendly_id :username, use: :slugged
5
+ is_impressionable
6
+ end
@@ -0,0 +1,3 @@
1
+ class User
2
+ attr_accessor :id
3
+ end
@@ -0,0 +1,3 @@
1
+ class Widget < ActiveRecord::Base
2
+ is_impressionable :counter_cache => true, :unique => :request_hash
3
+ end
@@ -0,0 +1 @@
1
+ <%=@impressionist_hash==nil%>
@@ -0,0 +1 @@
1
+ <%=link_to "Same Page", article_url(Article.first)%>
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ <h2>User Public Profile</h2>
2
+
3
+ <p>User Name: <%= @profile.username %></p>
File without changes
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to setup or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?('config/database.yml')
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! 'bin/rails db:prepare'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! 'bin/rails restart'
33
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ # FIXME
7
+ require "impressionist"
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 6.0
13
+
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration can go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded after loading
17
+ # the framework and any gems in your application.
18
+ end
19
+ end
20
+
@@ -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,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -0,0 +1,25 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -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,62 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+ config.action_controller.enable_fragment_cache_logging = true
20
+
21
+ config.cache_store = :memory_store
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
24
+ }
25
+ else
26
+ config.action_controller.perform_caching = false
27
+
28
+ config.cache_store = :null_store
29
+ end
30
+
31
+ # Store uploaded files on the local file system (see config/storage.yml for options).
32
+ config.active_storage.service = :local
33
+
34
+ # Don't care if the mailer can't send.
35
+ config.action_mailer.raise_delivery_errors = false
36
+
37
+ config.action_mailer.perform_caching = false
38
+
39
+ # Print deprecation notices to the Rails logger.
40
+ config.active_support.deprecation = :log
41
+
42
+ # Raise an error on page load if there are pending migrations.
43
+ config.active_record.migration_error = :page_load
44
+
45
+ # Highlight code that triggered database queries in logs.
46
+ config.active_record.verbose_query_logs = true
47
+
48
+ # Debug mode disables concatenation and preprocessing of assets.
49
+ # This option may cause significant delays in view rendering with a large
50
+ # number of complex assets.
51
+ config.assets.debug = true
52
+
53
+ # Suppress logger output for asset requests.
54
+ config.assets.quiet = true
55
+
56
+ # Raises error for missing translations.
57
+ # config.action_view.raise_on_missing_translations = true
58
+
59
+ # Use an evented file watcher to asynchronously detect changes in source code,
60
+ # routes, locales, etc. This feature depends on the listen gem.
61
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
62
+ end