ruby2html 1.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 (74) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +48 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +13 -0
  5. data/.ruby-version +1 -0
  6. data/Dockerfile +71 -0
  7. data/README.md +264 -0
  8. data/Rakefile +8 -0
  9. data/app/assets/config/manifest.js +2 -0
  10. data/app/assets/images/.keep +0 -0
  11. data/app/assets/stylesheets/application.css +15 -0
  12. data/app/channels/application_cable/channel.rb +6 -0
  13. data/app/channels/application_cable/connection.rb +6 -0
  14. data/app/components/application_component.rb +5 -0
  15. data/app/components/first_component.html.erb +9 -0
  16. data/app/components/first_component.rb +7 -0
  17. data/app/components/second_component.rb +12 -0
  18. data/app/controllers/application_controller.rb +7 -0
  19. data/app/controllers/concerns/.keep +0 -0
  20. data/app/controllers/home_controller.rb +12 -0
  21. data/app/helpers/application_helper.rb +4 -0
  22. data/app/jobs/application_job.rb +9 -0
  23. data/app/mailers/application_mailer.rb +6 -0
  24. data/app/models/application_record.rb +5 -0
  25. data/app/models/concerns/.keep +0 -0
  26. data/app/views/home/index.html.erb +36 -0
  27. data/app/views/layouts/application.html.erb +22 -0
  28. data/app/views/layouts/mailer.html.erb +13 -0
  29. data/app/views/layouts/mailer.text.erb +1 -0
  30. data/app/views/pwa/manifest.json.erb +22 -0
  31. data/app/views/pwa/service-worker.js +26 -0
  32. data/app/views/shared/_navbar.html.erb +1 -0
  33. data/config/application.rb +45 -0
  34. data/config/boot.rb +6 -0
  35. data/config/cable.yml +10 -0
  36. data/config/credentials.yml.enc +1 -0
  37. data/config/database.yml +32 -0
  38. data/config/environment.rb +7 -0
  39. data/config/environments/development.rb +83 -0
  40. data/config/environments/production.rb +104 -0
  41. data/config/environments/test.rb +69 -0
  42. data/config/initializers/assets.rb +14 -0
  43. data/config/initializers/content_security_policy.rb +27 -0
  44. data/config/initializers/filter_parameter_logging.rb +10 -0
  45. data/config/initializers/inflections.rb +18 -0
  46. data/config/initializers/permissions_policy.rb +15 -0
  47. data/config/locales/en.yml +31 -0
  48. data/config/puma.rb +56 -0
  49. data/config/routes.rb +17 -0
  50. data/config/storage.yml +34 -0
  51. data/config.ru +8 -0
  52. data/db/seeds.rb +11 -0
  53. data/lefthook.yml +8 -0
  54. data/lib/assets/.keep +0 -0
  55. data/lib/gem/ruby2html/component_helper.rb +9 -0
  56. data/lib/gem/ruby2html/rails_helper.rb +13 -0
  57. data/lib/gem/ruby2html/render.rb +134 -0
  58. data/lib/gem/ruby2html/version.rb +5 -0
  59. data/lib/gem/ruby2html.rb +9 -0
  60. data/lib/tasks/.keep +0 -0
  61. data/log/.keep +0 -0
  62. data/public/404.html +67 -0
  63. data/public/406-unsupported-browser.html +66 -0
  64. data/public/422.html +67 -0
  65. data/public/500.html +66 -0
  66. data/public/icon.png +0 -0
  67. data/public/icon.svg +3 -0
  68. data/public/robots.txt +1 -0
  69. data/storage/.keep +0 -0
  70. data/tmp/.keep +0 -0
  71. data/tmp/pids/.keep +0 -0
  72. data/tmp/storage/.keep +0 -0
  73. data/vendor/.keep +0 -0
  74. metadata +120 -0
@@ -0,0 +1,26 @@
1
+ // Add a service worker for processing Web Push notifications:
2
+ //
3
+ // self.addEventListener("push", async (event) => {
4
+ // const { title, options } = await event.data.json()
5
+ // event.waitUntil(self.registration.showNotification(title, options))
6
+ // })
7
+ //
8
+ // self.addEventListener("notificationclick", function(event) {
9
+ // event.notification.close()
10
+ // event.waitUntil(
11
+ // clients.matchAll({ type: "window" }).then((clientList) => {
12
+ // for (let i = 0; i < clientList.length; i++) {
13
+ // let client = clientList[i]
14
+ // let clientPath = (new URL(client.url)).pathname
15
+ //
16
+ // if (clientPath == event.notification.data.path && "focus" in client) {
17
+ // return client.focus()
18
+ // }
19
+ // }
20
+ //
21
+ // if (clients.openWindow) {
22
+ // return clients.openWindow(event.notification.data.path)
23
+ // }
24
+ // })
25
+ // )
26
+ // })
@@ -0,0 +1 @@
1
+ <h1>Navbar</h1>
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails'
6
+ # Pick the frameworks you want:
7
+ require 'active_model/railtie'
8
+ require 'active_job/railtie'
9
+ require 'active_record/railtie'
10
+ require 'active_storage/engine'
11
+ require 'action_controller/railtie'
12
+ require 'action_mailer/railtie'
13
+ require 'action_mailbox/engine'
14
+ require 'action_text/engine'
15
+ require 'action_view/railtie'
16
+ require 'action_cable/engine'
17
+ # require "rails/test_unit/railtie"
18
+
19
+ # Require the gems listed in Gemfile, including any gems
20
+ # you've limited to :test, :development, or :production.
21
+ Bundler.require(*Rails.groups)
22
+ require_relative '../lib/gem/ruby2html'
23
+
24
+ module Ruby2html
25
+ class Application < Rails::Application
26
+ # Initialize configuration defaults for originally generated Rails version.
27
+ config.load_defaults 7.2
28
+
29
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
30
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
31
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
32
+ config.autoload_lib(ignore: %w[gem assets tasks])
33
+
34
+ # Configuration for the application, engines, and railties goes here.
35
+ #
36
+ # These settings can be overridden in specific environments using the files
37
+ # in config/environments, which are processed later.
38
+ #
39
+ # config.time_zone = "Central Time (US & Canada)"
40
+ # config.eager_load_paths << Rails.root.join("extras")
41
+
42
+ # Don't generate system test files.
43
+ config.generators.system_tests = nil
44
+ end
45
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
6
+ require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
data/config/cable.yml ADDED
@@ -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: ruby2html_production
@@ -0,0 +1 @@
1
+ syxIQNjKjMQTCYgIrZXzklAmWupRucx5oAblyiO1h4pPn+S9KZSUmxjnZ1ntCzFRMDGgbeIAUI5WoEsnKk6uRhX1DTULIOuW4ODNbxRWkWf5WOBXF7zxu9v1b0jcfsBO8mYHRoFxulDbxhsOIS8opAH1pzhLAB65uV8w3BPuG9547t/CHvarEzipOceugWaVjK1cF4lqkB72xWz5IQ1zxJmX+pSEj36jFfhSK5bbUlnC2h/TDBYc9tEz7GZPYnHw+xrGnhayz+6pLUBmHFwwnfQjZE9VYEm4Y0vLZLjveSmvV6LX+4QsX/r6wD0gWxDdG0jarO6i7u18Vg8aLcSQRII5bTjEdyn4NuF6E61HUhkuaSBNb9hcGCX7eGOlYziZHrOZdNg8lxIrjc2gauGz0M3bWUkJ--l6VJIq9MkwuXzeWl--MuF7LY4aYyUOZwMPsBdsBQ==
@@ -0,0 +1,32 @@
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
+
24
+ # SQLite3 write its data on the local filesystem, as such it requires
25
+ # persistent disks. If you are deploying to a managed service, you should
26
+ # make sure it provides disk persistence, as many don't.
27
+ #
28
+ # Similarly, if you deploy your application as a Docker container, you must
29
+ # ensure the database is located in a persisted volume.
30
+ production:
31
+ <<: *default
32
+ # database: path/to/persistent/storage/production.sqlite3
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
10
+ # since you don't have to restart the web server when you make code changes.
11
+ config.enable_reloading = true
12
+
13
+ # Do not eager load code on boot.
14
+ config.eager_load = false
15
+
16
+ # Show full error reports.
17
+ config.consider_all_requests_local = true
18
+
19
+ # Enable server timing.
20
+ config.server_timing = true
21
+
22
+ # Enable/disable caching. By default caching is disabled.
23
+ # Run rails dev:cache to toggle caching.
24
+ if Rails.root.join('tmp/caching-dev.txt').exist?
25
+ config.action_controller.perform_caching = true
26
+ config.action_controller.enable_fragment_cache_logging = true
27
+
28
+ config.cache_store = :memory_store
29
+ config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" }
30
+ else
31
+ config.action_controller.perform_caching = false
32
+
33
+ config.cache_store = :null_store
34
+ end
35
+
36
+ # Store uploaded files on the local file system (see config/storage.yml for options).
37
+ config.active_storage.service = :local
38
+
39
+ # Don't care if the mailer can't send.
40
+ config.action_mailer.raise_delivery_errors = false
41
+
42
+ # Disable caching for Action Mailer templates even if Action Controller
43
+ # caching is enabled.
44
+ config.action_mailer.perform_caching = false
45
+
46
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
47
+
48
+ # Print deprecation notices to the Rails logger.
49
+ config.active_support.deprecation = :log
50
+
51
+ # Raise exceptions for disallowed deprecations.
52
+ config.active_support.disallowed_deprecation = :raise
53
+
54
+ # Tell Active Support which deprecation messages to disallow.
55
+ config.active_support.disallowed_deprecation_warnings = []
56
+
57
+ # Raise an error on page load if there are pending migrations.
58
+ config.active_record.migration_error = :page_load
59
+
60
+ # Highlight code that triggered database queries in logs.
61
+ config.active_record.verbose_query_logs = true
62
+
63
+ # Highlight code that enqueued background job in logs.
64
+ config.active_job.verbose_enqueue_logs = true
65
+
66
+ # Suppress logger output for asset requests.
67
+ config.assets.quiet = true
68
+
69
+ # Raises error for missing translations.
70
+ # config.i18n.raise_on_missing_translations = true
71
+
72
+ # Annotate rendered view with file names.
73
+ config.action_view.annotate_rendered_view_with_filenames = true
74
+
75
+ # Uncomment if you wish to allow Action Cable access from any origin.
76
+ # config.action_cable.disable_request_forgery_protection = true
77
+
78
+ # Raise error when a before_action's only/except options reference missing actions.
79
+ config.action_controller.raise_on_missing_callback_actions = true
80
+
81
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
82
+ # config.generators.apply_rubocop_autocorrect_after_generate!
83
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Code is not reloaded between requests.
9
+ config.enable_reloading = false
10
+
11
+ # Eager load code on boot. This eager loads most of Rails and
12
+ # your application in memory, allowing both threaded web servers
13
+ # and those relying on copy on write to perform better.
14
+ # Rake tasks automatically ignore this option for performance.
15
+ config.eager_load = true
16
+
17
+ # Full error reports are disabled and caching is turned on.
18
+ config.consider_all_requests_local = false
19
+ config.action_controller.perform_caching = true
20
+
21
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
22
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
25
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
26
+ # config.public_file_server.enabled = false
27
+
28
+ # Compress CSS using a preprocessor.
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fall back to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35
+ # config.asset_host = "http://assets.example.com"
36
+
37
+ # Specifies the header that your server uses for sending files.
38
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
39
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
40
+
41
+ # Store uploaded files on the local file system (see config/storage.yml for options).
42
+ config.active_storage.service = :local
43
+
44
+ # Mount Action Cable outside main process or domain.
45
+ # config.action_cable.mount_path = nil
46
+ # config.action_cable.url = "wss://example.com/cable"
47
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
48
+
49
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
50
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
51
+ # config.assume_ssl = true
52
+
53
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
54
+ config.force_ssl = true
55
+
56
+ # Skip http-to-https redirect for the default health check endpoint.
57
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
58
+
59
+ # Log to STDOUT by default
60
+ config.logger = ActiveSupport::Logger.new(STDOUT)
61
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
62
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
63
+
64
+ # Prepend all log lines with the following tags.
65
+ config.log_tags = [ :request_id ]
66
+
67
+ # "info" includes generic and useful information about system operation, but avoids logging too much
68
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
69
+ # want to log everything, set the level to "debug".
70
+ config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
71
+
72
+ # Use a different cache store in production.
73
+ # config.cache_store = :mem_cache_store
74
+
75
+ # Use a real queuing backend for Active Job (and separate queues per environment).
76
+ # config.active_job.queue_adapter = :resque
77
+ # config.active_job.queue_name_prefix = "ruby2html_production"
78
+
79
+ # Disable caching for Action Mailer templates even if Action Controller
80
+ # caching is enabled.
81
+ config.action_mailer.perform_caching = false
82
+
83
+ # Ignore bad email addresses and do not raise email delivery errors.
84
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
85
+ # config.action_mailer.raise_delivery_errors = false
86
+
87
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
88
+ # the I18n.default_locale when a translation cannot be found).
89
+ config.i18n.fallbacks = true
90
+
91
+ # Don't log any deprecations.
92
+ config.active_support.report_deprecations = false
93
+
94
+ # Do not dump schema after migrations.
95
+ config.active_record.dump_schema_after_migration = false
96
+
97
+ # Enable DNS rebinding protection and other `Host` header attacks.
98
+ # config.hosts = [
99
+ # "example.com", # Allow requests from example.com
100
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
101
+ # ]
102
+ # Skip DNS rebinding protection for the default health check endpoint.
103
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
104
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+
10
+ Rails.application.configure do
11
+ # Settings specified here will take precedence over those in config/application.rb.
12
+
13
+ # While tests run files are not watched, reloading is not necessary.
14
+ config.enable_reloading = false
15
+
16
+ # Eager loading loads your entire application. When running a single test locally,
17
+ # this is usually not necessary, and can slow down your test suite. However, it's
18
+ # recommended that you enable it in continuous integration systems to ensure eager
19
+ # loading is working properly before deploying your code.
20
+ config.eager_load = ENV['CI'].present?
21
+
22
+ # Configure public file server for tests with Cache-Control for performance.
23
+ config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" }
24
+
25
+ # Show full error reports and disable caching.
26
+ config.consider_all_requests_local = true
27
+ config.action_controller.perform_caching = false
28
+ config.cache_store = :null_store
29
+
30
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
31
+ config.action_dispatch.show_exceptions = :rescuable
32
+
33
+ # Disable request forgery protection in test environment.
34
+ config.action_controller.allow_forgery_protection = false
35
+
36
+ # Store uploaded files on the local file system in a temporary directory.
37
+ config.active_storage.service = :test
38
+
39
+ # Disable caching for Action Mailer templates even if Action Controller
40
+ # caching is enabled.
41
+ config.action_mailer.perform_caching = false
42
+
43
+ # Tell Action Mailer not to deliver emails to the real world.
44
+ # The :test delivery method accumulates sent emails in the
45
+ # ActionMailer::Base.deliveries array.
46
+ config.action_mailer.delivery_method = :test
47
+
48
+ # Unlike controllers, the mailer instance doesn't have any context about the
49
+ # incoming request so you'll need to provide the :host parameter yourself.
50
+ config.action_mailer.default_url_options = { host: 'www.example.com' }
51
+
52
+ # Print deprecation notices to the stderr.
53
+ config.active_support.deprecation = :stderr
54
+
55
+ # Raise exceptions for disallowed deprecations.
56
+ config.active_support.disallowed_deprecation = :raise
57
+
58
+ # Tell Active Support which deprecation messages to disallow.
59
+ config.active_support.disallowed_deprecation_warnings = []
60
+
61
+ # Raises error for missing translations.
62
+ # config.i18n.raise_on_missing_translations = true
63
+
64
+ # Annotate rendered view with file names.
65
+ # config.action_view.annotate_rendered_view_with_filenames = true
66
+
67
+ # Raise error when a before_action's only/except options reference missing actions.
68
+ config.action_controller.raise_on_missing_callback_actions = true
69
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
6
+ Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Define an application-wide content security policy.
6
+ # See the Securing Rails Applications Guide for more information:
7
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
8
+
9
+ # Rails.application.configure do
10
+ # config.content_security_policy do |policy|
11
+ # policy.default_src :self, :https
12
+ # policy.font_src :self, :https, :data
13
+ # policy.img_src :self, :https, :data
14
+ # policy.object_src :none
15
+ # policy.script_src :self, :https
16
+ # policy.style_src :self, :https
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+ #
21
+ # # Generate session nonces for permitted importmap, inline scripts, and inline styles.
22
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
23
+ # config.content_security_policy_nonce_directives = %w(script-src style-src)
24
+ #
25
+ # # Report violations without enforcing the policy.
26
+ # # config.content_security_policy_report_only = true
27
+ # end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
6
+ # Use this to limit dissemination of sensitive information.
7
+ # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
8
+ Rails.application.config.filter_parameters += [
9
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
10
+ ]
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new inflection rules using the following format. Inflections
6
+ # are locale specific, and you may define rules for as many different
7
+ # locales as you wish. All of these examples are active by default:
8
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
9
+ # inflect.plural /^(ox)$/i, "\\1en"
10
+ # inflect.singular /^(ox)en/i, "\\1"
11
+ # inflect.irregular "person", "people"
12
+ # inflect.uncountable %w( fish sheep )
13
+ # end
14
+
15
+ # These inflection rules are supported but not enabled by default:
16
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
17
+ # inflect.acronym "RESTful"
18
+ # end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Define an application-wide HTTP permissions policy. For further
6
+ # information see: https://developers.google.com/web/updates/2018/06/feature-policy
7
+
8
+ # Rails.application.config.permissions_policy do |policy|
9
+ # policy.camera :none
10
+ # policy.gyroscope :none
11
+ # policy.microphone :none
12
+ # policy.usb :none
13
+ # policy.fullscreen :self
14
+ # policy.payment :self, "https://secure.example.com"
15
+ # end
@@ -0,0 +1,31 @@
1
+ # Files in the config/locales directory are used for internationalization and
2
+ # are automatically loaded by Rails. If you want to use locales other than
3
+ # English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t "hello"
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t("hello") %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more about the API, please read the Rails Internationalization guide
20
+ # at https://guides.rubyonrails.org/i18n.html.
21
+ #
22
+ # Be aware that YAML interprets the following case-insensitive strings as
23
+ # booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24
+ # must be quoted to be interpreted as strings. For example:
25
+ #
26
+ # en:
27
+ # "yes": yup
28
+ # enabled: "ON"
29
+
30
+ en:
31
+ hello: "Hello world"
data/config/puma.rb ADDED
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This configuration file will be evaluated by Puma. The top-level methods that
4
+ # are invoked here are part of Puma's configuration DSL. For more information
5
+ # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
6
+
7
+ # Puma starts a configurable number of processes (workers) and each process
8
+ # serves each request in a thread from an internal thread pool.
9
+ #
10
+ # The ideal number of threads per worker depends both on how much time the
11
+ # application spends waiting for IO operations and on how much you wish to
12
+ # to prioritize throughput over latency.
13
+ #
14
+ # As a rule of thumb, increasing the number of threads will increase how much
15
+ # traffic a given process can handle (throughput), but due to CRuby's
16
+ # Global VM Lock (GVL) it has diminishing returns and will degrade the
17
+ # response time (latency) of the application.
18
+ #
19
+ # The default is set to 3 threads as it's deemed a decent compromise between
20
+ # throughput and latency for the average Rails application.
21
+ #
22
+ # Any libraries that use a connection pool or another resource pool should
23
+ # be configured to provide at least as many connections as the number of
24
+ # threads. This includes Active Record's `pool` parameter in `database.yml`.
25
+ threads_count = ENV.fetch('RAILS_MAX_THREADS', 3)
26
+ threads threads_count, threads_count
27
+
28
+ # Specifies the `environment` that Puma will run in.
29
+ rails_env = ENV.fetch('RAILS_ENV', 'development')
30
+ environment rails_env
31
+
32
+ case rails_env
33
+ when 'production'
34
+ # If you are running more than 1 thread per process, the workers count
35
+ # should be equal to the number of processors (CPU cores) in production.
36
+ #
37
+ # Automatically detect the number of available processors in production.
38
+ require 'concurrent-ruby'
39
+ workers_count = Integer(ENV.fetch('WEB_CONCURRENCY') { Concurrent.available_processor_count })
40
+ workers workers_count if workers_count > 1
41
+
42
+ preload_app!
43
+ when 'development'
44
+ # Specifies a very generous `worker_timeout` so that the worker
45
+ # isn't killed by Puma when suspended by a debugger.
46
+ worker_timeout 3600
47
+ end
48
+
49
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
50
+ port ENV.fetch('PORT', 3000)
51
+
52
+ # Allow puma to be restarted by `bin/rails restart` command.
53
+ plugin :tmp_restart
54
+
55
+ # Only use a pidfile when requested
56
+ pidfile ENV['PIDFILE'] if ENV['PIDFILE']
data/config/routes.rb ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ root to: 'home#index'
5
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
6
+
7
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
8
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
9
+ get 'up' => 'rails/health#show', as: :rails_health_check
10
+
11
+ # Render dynamic PWA files from app/views/pwa/*
12
+ get 'service-worker' => 'rails/pwa#service_worker', as: :pwa_service_worker
13
+ get 'manifest' => 'rails/pwa#manifest', as: :pwa_manifest
14
+
15
+ # Defines the root path route ("/")
16
+ # root "posts#index"
17
+ end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
+
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name-<%= Rails.env %>
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/config.ru ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
8
+ Rails.application.load_server
data/db/seeds.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file should ensure the existence of records required to run the application in every environment (production,
4
+ # development, test). The code here should be idempotent so that it can be executed at any point in every environment.
5
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
6
+ #
7
+ # Example:
8
+ #
9
+ # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
10
+ # MovieGenre.find_or_create_by!(name: genre_name)
11
+ # end
data/lefthook.yml ADDED
@@ -0,0 +1,8 @@
1
+ pre-commit:
2
+ commands:
3
+ rubocop:
4
+ run: bundle exec rubocop -A
5
+ skip:
6
+ - merge
7
+ - rebase
8
+ stage_fixed: true
data/lib/assets/.keep ADDED
File without changes