snapcher 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +13 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +5 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/Gemfile +12 -0
  8. data/Gemfile.lock +63 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +39 -0
  11. data/Rakefile +12 -0
  12. data/lib/generators/snapcher/install/install_generator.rb +36 -0
  13. data/lib/generators/snapcher/templates/install.rb +20 -0
  14. data/lib/snapcher/junker.rb +127 -0
  15. data/lib/snapcher/railtie.rb +16 -0
  16. data/lib/snapcher/scanning.rb +11 -0
  17. data/lib/snapcher/sweeper.rb +42 -0
  18. data/lib/snapcher/version.rb +5 -0
  19. data/lib/snapcher.rb +30 -0
  20. data/sample-app/.dockerignore +37 -0
  21. data/sample-app/.gitattributes +9 -0
  22. data/sample-app/.gitignore +35 -0
  23. data/sample-app/.ruby-version +1 -0
  24. data/sample-app/Dockerfile +62 -0
  25. data/sample-app/Gemfile +23 -0
  26. data/sample-app/Gemfile.lock +233 -0
  27. data/sample-app/README.md +24 -0
  28. data/sample-app/Rakefile +6 -0
  29. data/sample-app/app/assets/config/manifest.js +2 -0
  30. data/sample-app/app/assets/images/.keep +0 -0
  31. data/sample-app/app/assets/stylesheets/application.css +15 -0
  32. data/sample-app/app/controllers/application_controller.rb +2 -0
  33. data/sample-app/app/controllers/concerns/.keep +0 -0
  34. data/sample-app/app/helpers/application_helper.rb +2 -0
  35. data/sample-app/app/jobs/application_job.rb +7 -0
  36. data/sample-app/app/models/application_record.rb +3 -0
  37. data/sample-app/app/models/concerns/.keep +0 -0
  38. data/sample-app/app/models/user.rb +5 -0
  39. data/sample-app/app/views/layouts/application.html.erb +15 -0
  40. data/sample-app/bin/bundle +109 -0
  41. data/sample-app/bin/docker-entrypoint +8 -0
  42. data/sample-app/bin/rails +4 -0
  43. data/sample-app/bin/rake +4 -0
  44. data/sample-app/bin/setup +33 -0
  45. data/sample-app/config/application.rb +42 -0
  46. data/sample-app/config/boot.rb +4 -0
  47. data/sample-app/config/credentials.yml.enc +1 -0
  48. data/sample-app/config/database.yml +25 -0
  49. data/sample-app/config/environment.rb +5 -0
  50. data/sample-app/config/environments/development.rb +65 -0
  51. data/sample-app/config/environments/production.rb +83 -0
  52. data/sample-app/config/environments/test.rb +54 -0
  53. data/sample-app/config/initializers/assets.rb +12 -0
  54. data/sample-app/config/initializers/content_security_policy.rb +25 -0
  55. data/sample-app/config/initializers/filter_parameter_logging.rb +8 -0
  56. data/sample-app/config/initializers/inflections.rb +16 -0
  57. data/sample-app/config/initializers/permissions_policy.rb +13 -0
  58. data/sample-app/config/locales/en.yml +31 -0
  59. data/sample-app/config/puma.rb +35 -0
  60. data/sample-app/config/routes.rb +10 -0
  61. data/sample-app/config.ru +6 -0
  62. data/sample-app/db/migrate/20231019150803_create_users.rb +15 -0
  63. data/sample-app/db/migrate/20231019151334_install_snapcher.rb +20 -0
  64. data/sample-app/db/schema.rb +37 -0
  65. data/sample-app/db/seeds.rb +9 -0
  66. data/sample-app/lib/assets/.keep +0 -0
  67. data/sample-app/lib/tasks/.keep +0 -0
  68. data/sample-app/log/.keep +0 -0
  69. data/sample-app/public/404.html +67 -0
  70. data/sample-app/public/422.html +67 -0
  71. data/sample-app/public/500.html +66 -0
  72. data/sample-app/public/apple-touch-icon-precomposed.png +0 -0
  73. data/sample-app/public/apple-touch-icon.png +0 -0
  74. data/sample-app/public/favicon.ico +0 -0
  75. data/sample-app/public/robots.txt +1 -0
  76. data/sample-app/storage/.keep +0 -0
  77. data/sample-app/tmp/.keep +0 -0
  78. data/sample-app/tmp/pids/.keep +0 -0
  79. data/sample-app/tmp/storage/.keep +0 -0
  80. data/sample-app/vendor/.keep +0 -0
  81. data/sig/snapcher.rbs +4 -0
  82. metadata +125 -0
@@ -0,0 +1,62 @@
1
+ # syntax = docker/dockerfile:1
2
+
3
+ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4
+ ARG RUBY_VERSION=3.2.2
5
+ FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
6
+
7
+ # Rails app lives here
8
+ WORKDIR /rails
9
+
10
+ # Set production environment
11
+ ENV RAILS_ENV="production" \
12
+ BUNDLE_DEPLOYMENT="1" \
13
+ BUNDLE_PATH="/usr/local/bundle" \
14
+ BUNDLE_WITHOUT="development"
15
+
16
+
17
+ # Throw-away build stage to reduce size of final image
18
+ FROM base as build
19
+
20
+ # Install packages needed to build gems
21
+ RUN apt-get update -qq && \
22
+ apt-get install --no-install-recommends -y build-essential git pkg-config
23
+
24
+ # Install application gems
25
+ COPY Gemfile Gemfile.lock ./
26
+ RUN bundle install && \
27
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
28
+ bundle exec bootsnap precompile --gemfile
29
+
30
+ # Copy application code
31
+ COPY . .
32
+
33
+ # Precompile bootsnap code for faster boot times
34
+ RUN bundle exec bootsnap precompile app/ lib/
35
+
36
+ # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
37
+ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
38
+
39
+
40
+ # Final stage for app image
41
+ FROM base
42
+
43
+ # Install packages needed for deployment
44
+ RUN apt-get update -qq && \
45
+ apt-get install --no-install-recommends -y curl libsqlite3-0 && \
46
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
47
+
48
+ # Copy built artifacts: gems, application
49
+ COPY --from=build /usr/local/bundle /usr/local/bundle
50
+ COPY --from=build /rails /rails
51
+
52
+ # Run and own only the runtime files as a non-root user for security
53
+ RUN useradd rails --create-home --shell /bin/bash && \
54
+ chown -R rails:rails db log storage tmp
55
+ USER rails:rails
56
+
57
+ # Entrypoint prepares the database.
58
+ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
59
+
60
+ # Start the server by default, this can be overwritten at runtime
61
+ EXPOSE 3000
62
+ CMD ["./bin/rails", "server"]
@@ -0,0 +1,23 @@
1
+ source "https://rubygems.org"
2
+
3
+ ruby "3.2.2"
4
+
5
+ gem "rails", "~> 7.1.1"
6
+ gem "sprockets-rails"
7
+ gem "sqlite3", "~> 1.4"
8
+ gem "puma", ">= 5.0"
9
+ gem "jbuilder"
10
+
11
+ gem "snapcher", path: "../"
12
+
13
+ gem "tzinfo-data", platforms: %i[ windows jruby ]
14
+ gem "bootsnap", require: false
15
+
16
+ group :development, :test do
17
+ gem "debug", platforms: %i[ mri windows ]
18
+ end
19
+
20
+ group :development do
21
+ gem "web-console"
22
+ end
23
+
@@ -0,0 +1,233 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ snapcher (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (7.1.1)
10
+ actionpack (= 7.1.1)
11
+ activesupport (= 7.1.1)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ zeitwerk (~> 2.6)
15
+ actionmailbox (7.1.1)
16
+ actionpack (= 7.1.1)
17
+ activejob (= 7.1.1)
18
+ activerecord (= 7.1.1)
19
+ activestorage (= 7.1.1)
20
+ activesupport (= 7.1.1)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.1.1)
26
+ actionpack (= 7.1.1)
27
+ actionview (= 7.1.1)
28
+ activejob (= 7.1.1)
29
+ activesupport (= 7.1.1)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.2)
35
+ actionpack (7.1.1)
36
+ actionview (= 7.1.1)
37
+ activesupport (= 7.1.1)
38
+ nokogiri (>= 1.8.5)
39
+ rack (>= 2.2.4)
40
+ rack-session (>= 1.0.1)
41
+ rack-test (>= 0.6.3)
42
+ rails-dom-testing (~> 2.2)
43
+ rails-html-sanitizer (~> 1.6)
44
+ actiontext (7.1.1)
45
+ actionpack (= 7.1.1)
46
+ activerecord (= 7.1.1)
47
+ activestorage (= 7.1.1)
48
+ activesupport (= 7.1.1)
49
+ globalid (>= 0.6.0)
50
+ nokogiri (>= 1.8.5)
51
+ actionview (7.1.1)
52
+ activesupport (= 7.1.1)
53
+ builder (~> 3.1)
54
+ erubi (~> 1.11)
55
+ rails-dom-testing (~> 2.2)
56
+ rails-html-sanitizer (~> 1.6)
57
+ activejob (7.1.1)
58
+ activesupport (= 7.1.1)
59
+ globalid (>= 0.3.6)
60
+ activemodel (7.1.1)
61
+ activesupport (= 7.1.1)
62
+ activerecord (7.1.1)
63
+ activemodel (= 7.1.1)
64
+ activesupport (= 7.1.1)
65
+ timeout (>= 0.4.0)
66
+ activestorage (7.1.1)
67
+ actionpack (= 7.1.1)
68
+ activejob (= 7.1.1)
69
+ activerecord (= 7.1.1)
70
+ activesupport (= 7.1.1)
71
+ marcel (~> 1.0)
72
+ activesupport (7.1.1)
73
+ base64
74
+ bigdecimal
75
+ concurrent-ruby (~> 1.0, >= 1.0.2)
76
+ connection_pool (>= 2.2.5)
77
+ drb
78
+ i18n (>= 1.6, < 2)
79
+ minitest (>= 5.1)
80
+ mutex_m
81
+ tzinfo (~> 2.0)
82
+ base64 (0.1.1)
83
+ bigdecimal (3.1.4)
84
+ bindex (0.8.1)
85
+ bootsnap (1.16.0)
86
+ msgpack (~> 1.2)
87
+ builder (3.2.4)
88
+ concurrent-ruby (1.2.2)
89
+ connection_pool (2.4.1)
90
+ crass (1.0.6)
91
+ date (3.3.3)
92
+ debug (1.8.0)
93
+ irb (>= 1.5.0)
94
+ reline (>= 0.3.1)
95
+ drb (2.1.1)
96
+ ruby2_keywords
97
+ erubi (1.12.0)
98
+ globalid (1.2.1)
99
+ activesupport (>= 6.1)
100
+ i18n (1.14.1)
101
+ concurrent-ruby (~> 1.0)
102
+ io-console (0.6.0)
103
+ irb (1.8.3)
104
+ rdoc
105
+ reline (>= 0.3.8)
106
+ jbuilder (2.11.5)
107
+ actionview (>= 5.0.0)
108
+ activesupport (>= 5.0.0)
109
+ loofah (2.21.4)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.12.0)
112
+ mail (2.8.1)
113
+ mini_mime (>= 0.1.1)
114
+ net-imap
115
+ net-pop
116
+ net-smtp
117
+ marcel (1.0.2)
118
+ mini_mime (1.1.5)
119
+ minitest (5.20.0)
120
+ msgpack (1.7.2)
121
+ mutex_m (0.1.2)
122
+ net-imap (0.4.1)
123
+ date
124
+ net-protocol
125
+ net-pop (0.1.2)
126
+ net-protocol
127
+ net-protocol (0.2.1)
128
+ timeout
129
+ net-smtp (0.4.0)
130
+ net-protocol
131
+ nio4r (2.5.9)
132
+ nokogiri (1.15.4-aarch64-linux)
133
+ racc (~> 1.4)
134
+ nokogiri (1.15.4-arm64-darwin)
135
+ racc (~> 1.4)
136
+ nokogiri (1.15.4-x86_64-linux)
137
+ racc (~> 1.4)
138
+ psych (5.1.1.1)
139
+ stringio
140
+ puma (6.4.0)
141
+ nio4r (~> 2.0)
142
+ racc (1.7.1)
143
+ rack (3.0.8)
144
+ rack-session (2.0.0)
145
+ rack (>= 3.0.0)
146
+ rack-test (2.1.0)
147
+ rack (>= 1.3)
148
+ rackup (2.1.0)
149
+ rack (>= 3)
150
+ webrick (~> 1.8)
151
+ rails (7.1.1)
152
+ actioncable (= 7.1.1)
153
+ actionmailbox (= 7.1.1)
154
+ actionmailer (= 7.1.1)
155
+ actionpack (= 7.1.1)
156
+ actiontext (= 7.1.1)
157
+ actionview (= 7.1.1)
158
+ activejob (= 7.1.1)
159
+ activemodel (= 7.1.1)
160
+ activerecord (= 7.1.1)
161
+ activestorage (= 7.1.1)
162
+ activesupport (= 7.1.1)
163
+ bundler (>= 1.15.0)
164
+ railties (= 7.1.1)
165
+ rails-dom-testing (2.2.0)
166
+ activesupport (>= 5.0.0)
167
+ minitest
168
+ nokogiri (>= 1.6)
169
+ rails-html-sanitizer (1.6.0)
170
+ loofah (~> 2.21)
171
+ nokogiri (~> 1.14)
172
+ railties (7.1.1)
173
+ actionpack (= 7.1.1)
174
+ activesupport (= 7.1.1)
175
+ irb
176
+ rackup (>= 1.0.0)
177
+ rake (>= 12.2)
178
+ thor (~> 1.0, >= 1.2.2)
179
+ zeitwerk (~> 2.6)
180
+ rake (13.0.6)
181
+ rdoc (6.5.0)
182
+ psych (>= 4.0.0)
183
+ reline (0.3.9)
184
+ io-console (~> 0.5)
185
+ ruby2_keywords (0.0.5)
186
+ sprockets (4.2.1)
187
+ concurrent-ruby (~> 1.0)
188
+ rack (>= 2.2.4, < 4)
189
+ sprockets-rails (3.4.2)
190
+ actionpack (>= 5.2)
191
+ activesupport (>= 5.2)
192
+ sprockets (>= 3.0.0)
193
+ sqlite3 (1.6.7-aarch64-linux)
194
+ sqlite3 (1.6.7-arm64-darwin)
195
+ sqlite3 (1.6.7-x86_64-linux)
196
+ stringio (3.0.8)
197
+ thor (1.3.0)
198
+ timeout (0.4.0)
199
+ tzinfo (2.0.6)
200
+ concurrent-ruby (~> 1.0)
201
+ web-console (4.2.1)
202
+ actionview (>= 6.0.0)
203
+ activemodel (>= 6.0.0)
204
+ bindex (>= 0.4.0)
205
+ railties (>= 6.0.0)
206
+ webrick (1.8.1)
207
+ websocket-driver (0.7.6)
208
+ websocket-extensions (>= 0.1.0)
209
+ websocket-extensions (0.1.5)
210
+ zeitwerk (2.6.12)
211
+
212
+ PLATFORMS
213
+ aarch64-linux
214
+ arm64-darwin-22
215
+ x86_64-linux
216
+
217
+ DEPENDENCIES
218
+ bootsnap
219
+ debug
220
+ jbuilder
221
+ puma (>= 5.0)
222
+ rails (~> 7.1.1)
223
+ snapcher!
224
+ sprockets-rails
225
+ sqlite3 (~> 1.4)
226
+ tzinfo-data
227
+ web-console
228
+
229
+ RUBY VERSION
230
+ ruby 3.2.2p53
231
+
232
+ BUNDLED WITH
233
+ 2.4.10
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -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,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .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, 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,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -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,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ class User < ApplicationRecord
2
+ scanning column_name: "role"
3
+
4
+ enum :role, { normal: 0, admin: 1 }
5
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SampleApp</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,8 @@
1
+ #!/bin/bash -e
2
+
3
+ # If running the rails server then create or migrate existing database
4
+ if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
5
+ ./bin/rails db:prepare
6
+ fi
7
+
8
+ exec "${@}"
@@ -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, 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 SampleApp
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,4 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1 @@
1
+ 71+fmEBIPdjqaL2SMjCG+cP43o8F8EWil1wqE2/mtmG1/GRIlAMvaOpiRUxmB+qrXKK7VNfAUcdOM1KPz4G61Avem1hRuxt2CCfE+DUBjd7rP277zUzrvB3fMlwYs3yMVGiqWNRC84vZtWiqFMR/mGf78fA3A2q6s310jgfw+9qYfjXjRh9aX4tdWIJoyfZQCbrKGbgH8glAyb9K//tS1WGOFsTX6AEmwVflg4858f0lxnn5GJez58SEPcAQWL4cz2fbx0YMm10VGJ3fTlnyKSUtVbWdMhWhCngy6tc08FR4BVnosNNKa8MAYBGP3Jl+1bOhPVW5ngQvQ/MytrMB/2w/f3aUguKOyHeaVEy7xzcYoHj9MER5pG4G6yhhW7HFevNKIonbdxv7MC+F5UAHczMuLBVu--/U4V/UVHmb/m8e/p--viDXEsauGYe/8m6xvkPG8w==
@@ -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: storage/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: storage/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: storage/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!