recommender 0.1.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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/lib/recommender/recommendation.rb +79 -0
- data/lib/recommender/version.rb +5 -0
- data/lib/recommender.rb +10 -0
- data/sig/recommender.rbs +4 -0
- data/spec/factories/albums.rb +23 -0
- data/spec/factories/movie_likes.rb +8 -0
- data/spec/factories/movies.rb +7 -0
- data/spec/factories/users.rb +27 -0
- data/spec/recommender/recommendation_spec.rb +99 -0
- data/spec/spec_helper.rb +43 -0
- data/spec/test_app/Dockerfile +58 -0
- data/spec/test_app/Gemfile +41 -0
- data/spec/test_app/Gemfile.lock +240 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/config/manifest.js +2 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/controllers/application_controller.rb +2 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/jobs/application_job.rb +7 -0
- data/spec/test_app/app/models/album.rb +8 -0
- data/spec/test_app/app/models/application_record.rb +3 -0
- data/spec/test_app/app/models/movie.rb +7 -0
- data/spec/test_app/app/models/movie_like.rb +4 -0
- data/spec/test_app/app/models/user.rb +10 -0
- data/spec/test_app/app/views/layouts/application.html.erb +15 -0
- data/spec/test_app/bin/bundle +109 -0
- data/spec/test_app/bin/docker-entrypoint +8 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/bin/setup +33 -0
- data/spec/test_app/config/application.rb +42 -0
- data/spec/test_app/config/boot.rb +3 -0
- data/spec/test_app/config/credentials.yml.enc +1 -0
- data/spec/test_app/config/database.yml +84 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +65 -0
- data/spec/test_app/config/environments/production.rb +83 -0
- data/spec/test_app/config/environments/test.rb +54 -0
- data/spec/test_app/config/initializers/assets.rb +12 -0
- data/spec/test_app/config/initializers/content_security_policy.rb +25 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/permissions_policy.rb +13 -0
- data/spec/test_app/config/locales/en.yml +31 -0
- data/spec/test_app/config/master.key +1 -0
- data/spec/test_app/config/puma.rb +35 -0
- data/spec/test_app/config/routes.rb +10 -0
- data/spec/test_app/config.ru +6 -0
- data/spec/test_app/db/migrate/20240619132144_create_users.rb +9 -0
- data/spec/test_app/db/migrate/20240619132155_create_movies.rb +9 -0
- data/spec/test_app/db/migrate/20240619190825_create_movie_likes.rb +10 -0
- data/spec/test_app/db/migrate/20240620062947_add_unique_index_to_movies.rb +5 -0
- data/spec/test_app/db/migrate/20240620063520_change_name_column_null_on_movies.rb +5 -0
- data/spec/test_app/db/migrate/20240620063651_change_name_column_null_on_users.rb +5 -0
- data/spec/test_app/db/migrate/20240620063952_add_unique_index_to_users.rb +5 -0
- data/spec/test_app/db/migrate/20240621102016_create_albums.rb +10 -0
- data/spec/test_app/db/migrate/20240621102359_create_join_table_album_user.rb +8 -0
- data/spec/test_app/db/migrate/20240621102813_change_column_null_on_albums.rb +5 -0
- data/spec/test_app/db/schema.rb +56 -0
- data/spec/test_app/db/seeds.rb +9 -0
- data/spec/test_app/log/development.log +23616 -0
- data/spec/test_app/log/test.log +0 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/public/robots.txt +1 -0
- data/spec/test_app/tmp/local_secret.txt +1 -0
- data/spec/test_app/tmp/restart.txt +0 -0
- metadata +304 -0
@@ -0,0 +1,240 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../..
|
3
|
+
specs:
|
4
|
+
recommender (0.1.0)
|
5
|
+
activesupport (>= 3.0.0)
|
6
|
+
database_cleaner-active_record
|
7
|
+
faker (~> 2.21)
|
8
|
+
pry-rails
|
9
|
+
rails (~> 7.1.3)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
actioncable (7.1.3.4)
|
15
|
+
actionpack (= 7.1.3.4)
|
16
|
+
activesupport (= 7.1.3.4)
|
17
|
+
nio4r (~> 2.0)
|
18
|
+
websocket-driver (>= 0.6.1)
|
19
|
+
zeitwerk (~> 2.6)
|
20
|
+
actionmailbox (7.1.3.4)
|
21
|
+
actionpack (= 7.1.3.4)
|
22
|
+
activejob (= 7.1.3.4)
|
23
|
+
activerecord (= 7.1.3.4)
|
24
|
+
activestorage (= 7.1.3.4)
|
25
|
+
activesupport (= 7.1.3.4)
|
26
|
+
mail (>= 2.7.1)
|
27
|
+
net-imap
|
28
|
+
net-pop
|
29
|
+
net-smtp
|
30
|
+
actionmailer (7.1.3.4)
|
31
|
+
actionpack (= 7.1.3.4)
|
32
|
+
actionview (= 7.1.3.4)
|
33
|
+
activejob (= 7.1.3.4)
|
34
|
+
activesupport (= 7.1.3.4)
|
35
|
+
mail (~> 2.5, >= 2.5.4)
|
36
|
+
net-imap
|
37
|
+
net-pop
|
38
|
+
net-smtp
|
39
|
+
rails-dom-testing (~> 2.2)
|
40
|
+
actionpack (7.1.3.4)
|
41
|
+
actionview (= 7.1.3.4)
|
42
|
+
activesupport (= 7.1.3.4)
|
43
|
+
nokogiri (>= 1.8.5)
|
44
|
+
racc
|
45
|
+
rack (>= 2.2.4)
|
46
|
+
rack-session (>= 1.0.1)
|
47
|
+
rack-test (>= 0.6.3)
|
48
|
+
rails-dom-testing (~> 2.2)
|
49
|
+
rails-html-sanitizer (~> 1.6)
|
50
|
+
actiontext (7.1.3.4)
|
51
|
+
actionpack (= 7.1.3.4)
|
52
|
+
activerecord (= 7.1.3.4)
|
53
|
+
activestorage (= 7.1.3.4)
|
54
|
+
activesupport (= 7.1.3.4)
|
55
|
+
globalid (>= 0.6.0)
|
56
|
+
nokogiri (>= 1.8.5)
|
57
|
+
actionview (7.1.3.4)
|
58
|
+
activesupport (= 7.1.3.4)
|
59
|
+
builder (~> 3.1)
|
60
|
+
erubi (~> 1.11)
|
61
|
+
rails-dom-testing (~> 2.2)
|
62
|
+
rails-html-sanitizer (~> 1.6)
|
63
|
+
activejob (7.1.3.4)
|
64
|
+
activesupport (= 7.1.3.4)
|
65
|
+
globalid (>= 0.3.6)
|
66
|
+
activemodel (7.1.3.4)
|
67
|
+
activesupport (= 7.1.3.4)
|
68
|
+
activerecord (7.1.3.4)
|
69
|
+
activemodel (= 7.1.3.4)
|
70
|
+
activesupport (= 7.1.3.4)
|
71
|
+
timeout (>= 0.4.0)
|
72
|
+
activestorage (7.1.3.4)
|
73
|
+
actionpack (= 7.1.3.4)
|
74
|
+
activejob (= 7.1.3.4)
|
75
|
+
activerecord (= 7.1.3.4)
|
76
|
+
activesupport (= 7.1.3.4)
|
77
|
+
marcel (~> 1.0)
|
78
|
+
activesupport (7.1.3.4)
|
79
|
+
base64
|
80
|
+
bigdecimal
|
81
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
82
|
+
connection_pool (>= 2.2.5)
|
83
|
+
drb
|
84
|
+
i18n (>= 1.6, < 2)
|
85
|
+
minitest (>= 5.1)
|
86
|
+
mutex_m
|
87
|
+
tzinfo (~> 2.0)
|
88
|
+
base64 (0.2.0)
|
89
|
+
bigdecimal (3.1.8)
|
90
|
+
bindex (0.8.1)
|
91
|
+
builder (3.3.0)
|
92
|
+
coderay (1.1.3)
|
93
|
+
concurrent-ruby (1.3.3)
|
94
|
+
connection_pool (2.4.1)
|
95
|
+
crass (1.0.6)
|
96
|
+
database_cleaner-active_record (2.1.0)
|
97
|
+
activerecord (>= 5.a)
|
98
|
+
database_cleaner-core (~> 2.0.0)
|
99
|
+
database_cleaner-core (2.0.1)
|
100
|
+
date (3.3.4)
|
101
|
+
debug (1.9.2)
|
102
|
+
irb (~> 1.10)
|
103
|
+
reline (>= 0.3.8)
|
104
|
+
drb (2.2.1)
|
105
|
+
erubi (1.13.0)
|
106
|
+
faker (2.23.0)
|
107
|
+
i18n (>= 1.8.11, < 2)
|
108
|
+
globalid (1.2.1)
|
109
|
+
activesupport (>= 6.1)
|
110
|
+
i18n (1.14.5)
|
111
|
+
concurrent-ruby (~> 1.0)
|
112
|
+
io-console (0.7.2)
|
113
|
+
irb (1.13.2)
|
114
|
+
rdoc (>= 4.0.0)
|
115
|
+
reline (>= 0.4.2)
|
116
|
+
loofah (2.22.0)
|
117
|
+
crass (~> 1.0.2)
|
118
|
+
nokogiri (>= 1.12.0)
|
119
|
+
mail (2.8.1)
|
120
|
+
mini_mime (>= 0.1.1)
|
121
|
+
net-imap
|
122
|
+
net-pop
|
123
|
+
net-smtp
|
124
|
+
marcel (1.0.4)
|
125
|
+
method_source (1.1.0)
|
126
|
+
mini_mime (1.1.5)
|
127
|
+
minitest (5.24.0)
|
128
|
+
mutex_m (0.2.0)
|
129
|
+
net-imap (0.4.13)
|
130
|
+
date
|
131
|
+
net-protocol
|
132
|
+
net-pop (0.1.2)
|
133
|
+
net-protocol
|
134
|
+
net-protocol (0.2.2)
|
135
|
+
timeout
|
136
|
+
net-smtp (0.5.0)
|
137
|
+
net-protocol
|
138
|
+
nio4r (2.7.3)
|
139
|
+
nokogiri (1.16.6-aarch64-linux)
|
140
|
+
racc (~> 1.4)
|
141
|
+
nokogiri (1.16.6-arm64-darwin)
|
142
|
+
racc (~> 1.4)
|
143
|
+
nokogiri (1.16.6-x86_64-linux)
|
144
|
+
racc (~> 1.4)
|
145
|
+
pg (1.5.6)
|
146
|
+
pry (0.14.2)
|
147
|
+
coderay (~> 1.1)
|
148
|
+
method_source (~> 1.0)
|
149
|
+
pry-rails (0.3.9)
|
150
|
+
pry (>= 0.10.4)
|
151
|
+
psych (5.1.2)
|
152
|
+
stringio
|
153
|
+
puma (6.4.2)
|
154
|
+
nio4r (~> 2.0)
|
155
|
+
racc (1.8.0)
|
156
|
+
rack (3.1.3)
|
157
|
+
rack-session (2.0.0)
|
158
|
+
rack (>= 3.0.0)
|
159
|
+
rack-test (2.1.0)
|
160
|
+
rack (>= 1.3)
|
161
|
+
rackup (2.1.0)
|
162
|
+
rack (>= 3)
|
163
|
+
webrick (~> 1.8)
|
164
|
+
rails (7.1.3.4)
|
165
|
+
actioncable (= 7.1.3.4)
|
166
|
+
actionmailbox (= 7.1.3.4)
|
167
|
+
actionmailer (= 7.1.3.4)
|
168
|
+
actionpack (= 7.1.3.4)
|
169
|
+
actiontext (= 7.1.3.4)
|
170
|
+
actionview (= 7.1.3.4)
|
171
|
+
activejob (= 7.1.3.4)
|
172
|
+
activemodel (= 7.1.3.4)
|
173
|
+
activerecord (= 7.1.3.4)
|
174
|
+
activestorage (= 7.1.3.4)
|
175
|
+
activesupport (= 7.1.3.4)
|
176
|
+
bundler (>= 1.15.0)
|
177
|
+
railties (= 7.1.3.4)
|
178
|
+
rails-dom-testing (2.2.0)
|
179
|
+
activesupport (>= 5.0.0)
|
180
|
+
minitest
|
181
|
+
nokogiri (>= 1.6)
|
182
|
+
rails-html-sanitizer (1.6.0)
|
183
|
+
loofah (~> 2.21)
|
184
|
+
nokogiri (~> 1.14)
|
185
|
+
railties (7.1.3.4)
|
186
|
+
actionpack (= 7.1.3.4)
|
187
|
+
activesupport (= 7.1.3.4)
|
188
|
+
irb
|
189
|
+
rackup (>= 1.0.0)
|
190
|
+
rake (>= 12.2)
|
191
|
+
thor (~> 1.0, >= 1.2.2)
|
192
|
+
zeitwerk (~> 2.6)
|
193
|
+
rake (13.2.1)
|
194
|
+
rdoc (6.7.0)
|
195
|
+
psych (>= 4.0.0)
|
196
|
+
reline (0.5.9)
|
197
|
+
io-console (~> 0.5)
|
198
|
+
sprockets (4.2.1)
|
199
|
+
concurrent-ruby (~> 1.0)
|
200
|
+
rack (>= 2.2.4, < 4)
|
201
|
+
sprockets-rails (3.5.1)
|
202
|
+
actionpack (>= 6.1)
|
203
|
+
activesupport (>= 6.1)
|
204
|
+
sprockets (>= 3.0.0)
|
205
|
+
stringio (3.1.1)
|
206
|
+
thor (1.3.1)
|
207
|
+
timeout (0.4.1)
|
208
|
+
tzinfo (2.0.6)
|
209
|
+
concurrent-ruby (~> 1.0)
|
210
|
+
web-console (4.2.1)
|
211
|
+
actionview (>= 6.0.0)
|
212
|
+
activemodel (>= 6.0.0)
|
213
|
+
bindex (>= 0.4.0)
|
214
|
+
railties (>= 6.0.0)
|
215
|
+
webrick (1.8.1)
|
216
|
+
websocket-driver (0.7.6)
|
217
|
+
websocket-extensions (>= 0.1.0)
|
218
|
+
websocket-extensions (0.1.5)
|
219
|
+
zeitwerk (2.6.16)
|
220
|
+
|
221
|
+
PLATFORMS
|
222
|
+
aarch64-linux
|
223
|
+
arm64-darwin-23
|
224
|
+
x86_64-linux
|
225
|
+
|
226
|
+
DEPENDENCIES
|
227
|
+
debug
|
228
|
+
pg (~> 1.1)
|
229
|
+
puma (>= 5.0)
|
230
|
+
rails (~> 7.1.3, >= 7.1.3.4)
|
231
|
+
recommender!
|
232
|
+
sprockets-rails
|
233
|
+
tzinfo-data
|
234
|
+
web-console
|
235
|
+
|
236
|
+
RUBY VERSION
|
237
|
+
ruby 3.2.2p53
|
238
|
+
|
239
|
+
BUNDLED WITH
|
240
|
+
2.4.19
|
@@ -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, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
|
6
|
+
* 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
|
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,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,10 @@
|
|
1
|
+
class User < ApplicationRecord
|
2
|
+
include Recommender::Recommendation
|
3
|
+
|
4
|
+
has_many :movie_likes, dependent: :destroy
|
5
|
+
has_many :movies, through: :movie_likes
|
6
|
+
has_and_belongs_to_many :albums
|
7
|
+
|
8
|
+
validates :name, presence: true, uniqueness: { case_sensitive: false }
|
9
|
+
set_association :movies
|
10
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>TestApp</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "application" %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../Gemfile", __dir__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_requirement
|
64
|
+
@bundler_requirement ||=
|
65
|
+
env_var_version ||
|
66
|
+
cli_arg_version ||
|
67
|
+
bundler_requirement_for(lockfile_version)
|
68
|
+
end
|
69
|
+
|
70
|
+
def bundler_requirement_for(version)
|
71
|
+
return "#{Gem::Requirement.default}.a" unless version
|
72
|
+
|
73
|
+
bundler_gem_version = Gem::Version.new(version)
|
74
|
+
|
75
|
+
bundler_gem_version.approximate_recommendation
|
76
|
+
end
|
77
|
+
|
78
|
+
def load_bundler!
|
79
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
80
|
+
|
81
|
+
activate_bundler
|
82
|
+
end
|
83
|
+
|
84
|
+
def activate_bundler
|
85
|
+
gem_error = activation_error_handling do
|
86
|
+
gem "bundler", bundler_requirement
|
87
|
+
end
|
88
|
+
return if gem_error.nil?
|
89
|
+
require_error = activation_error_handling do
|
90
|
+
require "bundler/version"
|
91
|
+
end
|
92
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
93
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
94
|
+
exit 42
|
95
|
+
end
|
96
|
+
|
97
|
+
def activation_error_handling
|
98
|
+
yield
|
99
|
+
nil
|
100
|
+
rescue StandardError, LoadError => e
|
101
|
+
e
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
m.load_bundler!
|
106
|
+
|
107
|
+
if m.invoked_as_script?
|
108
|
+
load Gem.bin_path("bundler", "bundle")
|
109
|
+
end
|
@@ -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, exception: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time 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,42 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
# require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
# require "action_mailer/railtie"
|
11
|
+
# require "action_mailbox/engine"
|
12
|
+
# require "action_text/engine"
|
13
|
+
require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
# require "rails/test_unit/railtie"
|
16
|
+
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
18
|
+
# you've limited to :test, :development, or :production.
|
19
|
+
Bundler.require(*Rails.groups)
|
20
|
+
|
21
|
+
module TestApp
|
22
|
+
class Application < Rails::Application
|
23
|
+
# Initialize configuration defaults for originally generated Rails version.
|
24
|
+
config.load_defaults 7.1
|
25
|
+
|
26
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
27
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
28
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
29
|
+
config.autoload_lib(ignore: %w(assets tasks))
|
30
|
+
|
31
|
+
# Configuration for the application, engines, and railties goes here.
|
32
|
+
#
|
33
|
+
# These settings can be overridden in specific environments using the files
|
34
|
+
# in config/environments, which are processed later.
|
35
|
+
#
|
36
|
+
# config.time_zone = "Central Time (US & Canada)"
|
37
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
38
|
+
|
39
|
+
# Don't generate system test files.
|
40
|
+
config.generators.system_tests = nil
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
BXvivnVTJMWZuA9U/WVwD4iXiBqRf2Z5qSMVg4Gq0e0MGBD5Io+JThAagV95TlZGbal9WwQciiE5qt6bwPr4Fjk9d33f6Tn8BGYPGVV+ZHy2A5F1qvPmVWl9BSnAZqMIjYaP8ngm0wA4U6pxXUWlfiNkdcZv7zQ6bjBElMx9tx7XF501gUSq0NvB9dzmujdtgtT+Q80+rQ1UiEJ1JxVEIB4bMpJY+I3/khzF/zIJQbq4lRRsgoBguMbmkVOFKTOKJ1pCxlReHgs/CKxlOixB69gJ7e4wgQPluRTpqwEj96h9E8sFbe9Q2cdPm9pBe7NbeKCYuhGgimU/2wm3hhV7nblXVRNRDUTH/ZAXEFe12vF6D57rurJdYwOaxAcG0CpGVX3ATDRl1CTKFuXh4MtkptcipT29--/YfetaJSC0hUs1s4--TFdNCkzSEZ6zGx9X9PPHwQ==
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
+
#
|
3
|
+
# Install the pg driver:
|
4
|
+
# gem install pg
|
5
|
+
# On macOS with Homebrew:
|
6
|
+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
+
# On Windows:
|
8
|
+
# gem install pg
|
9
|
+
# Choose the win32 build.
|
10
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
11
|
+
#
|
12
|
+
# Configure Using Gemfile
|
13
|
+
# gem "pg"
|
14
|
+
#
|
15
|
+
default: &default
|
16
|
+
adapter: postgresql
|
17
|
+
encoding: unicode
|
18
|
+
# For details on connection pooling, see Rails configuration guide
|
19
|
+
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
20
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
21
|
+
|
22
|
+
development:
|
23
|
+
<<: *default
|
24
|
+
database: test_app_development
|
25
|
+
|
26
|
+
# The specified database role being used to connect to PostgreSQL.
|
27
|
+
# To create additional roles in PostgreSQL see `$ createuser --help`.
|
28
|
+
# When left blank, PostgreSQL will use the default role. This is
|
29
|
+
# the same name as the operating system user running Rails.
|
30
|
+
#username: test_app
|
31
|
+
|
32
|
+
# The password associated with the PostgreSQL role (username).
|
33
|
+
#password:
|
34
|
+
|
35
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
36
|
+
# domain socket that doesn't need configuration. Windows does not have
|
37
|
+
# domain sockets, so uncomment these lines.
|
38
|
+
#host: localhost
|
39
|
+
|
40
|
+
# The TCP port the server listens on. Defaults to 5432.
|
41
|
+
# If your server runs on a different port number, change accordingly.
|
42
|
+
#port: 5432
|
43
|
+
|
44
|
+
# Schema search path. The server defaults to $user,public
|
45
|
+
#schema_search_path: myapp,sharedapp,public
|
46
|
+
|
47
|
+
# Minimum log levels, in increasing order:
|
48
|
+
# debug5, debug4, debug3, debug2, debug1,
|
49
|
+
# log, notice, warning, error, fatal, and panic
|
50
|
+
# Defaults to warning.
|
51
|
+
#min_messages: notice
|
52
|
+
|
53
|
+
# Warning: The database defined as "test" will be erased and
|
54
|
+
# re-generated from your development database when you run "rake".
|
55
|
+
# Do not set this db to the same as development or production.
|
56
|
+
test:
|
57
|
+
<<: *default
|
58
|
+
database: test_app_test
|
59
|
+
|
60
|
+
# As with config/credentials.yml, you never want to store sensitive information,
|
61
|
+
# like your database password, in your source code. If your source code is
|
62
|
+
# ever seen by anyone, they now have access to your database.
|
63
|
+
#
|
64
|
+
# Instead, provide the password or a full connection URL as an environment
|
65
|
+
# variable when you boot the app. For example:
|
66
|
+
#
|
67
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
68
|
+
#
|
69
|
+
# If the connection URL is provided in the special DATABASE_URL environment
|
70
|
+
# variable, Rails will automatically merge its configuration values on top of
|
71
|
+
# the values provided in this file. Alternatively, you can specify a connection
|
72
|
+
# URL environment variable explicitly:
|
73
|
+
#
|
74
|
+
# production:
|
75
|
+
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
76
|
+
#
|
77
|
+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
78
|
+
# for a full overview on how database connection configuration can be specified.
|
79
|
+
#
|
80
|
+
production:
|
81
|
+
<<: *default
|
82
|
+
database: test_app_production
|
83
|
+
username: test_app
|
84
|
+
password: <%= ENV["TEST_APP_DATABASE_PASSWORD"] %>
|