eve-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.better-html.yml +1 -0
  3. data/.editorconfig +9 -0
  4. data/.erb-lint.yml +31 -0
  5. data/.eslintignore +4 -0
  6. data/.eslintrc.js +17 -0
  7. data/.husky/pre-commit +9 -0
  8. data/.mdlrc +2 -0
  9. data/.node-version +1 -0
  10. data/.prettier.config.js +3 -0
  11. data/.prettierignore +5 -0
  12. data/.rspec +3 -0
  13. data/.rubocop.yml +48 -0
  14. data/.ruby-version +1 -0
  15. data/.tool-versions +1 -0
  16. data/.vscode/settings.json +23 -0
  17. data/.yardext.rb +18 -0
  18. data/.yardopts +18 -0
  19. data/CHANGELOG.md +7 -0
  20. data/CODE_OF_CONDUCT.md +84 -0
  21. data/CONTRIBUTING.md +1 -0
  22. data/Gemfile +59 -0
  23. data/Gemfile.lock +467 -0
  24. data/LICENSE.txt +21 -0
  25. data/Procfile.dev +3 -0
  26. data/README.md +23 -0
  27. data/Rakefile +5 -0
  28. data/SECURITY.md +1 -0
  29. data/app/controllers/eve/rails/application_controller.rb +8 -0
  30. data/app/helpers/eve/rails/application_helper.rb +9 -0
  31. data/config/i18n-tasks.yml +156 -0
  32. data/config/initializers/inflections.rb +10 -0
  33. data/config/locales/en.yml +2 -0
  34. data/demo/app/assets/config/manifest.js +2 -0
  35. data/demo/app/assets/images/.keep +0 -0
  36. data/demo/app/assets/stylesheets/application.tailwind.css +3 -0
  37. data/demo/app/channels/application_cable/channel.rb +6 -0
  38. data/demo/app/channels/application_cable/connection.rb +6 -0
  39. data/demo/app/controllers/application_controller.rb +4 -0
  40. data/demo/app/controllers/concerns/.keep +0 -0
  41. data/demo/app/helpers/application_helper.rb +4 -0
  42. data/demo/app/javascript/application.js +3 -0
  43. data/demo/app/javascript/controllers/application.js +9 -0
  44. data/demo/app/javascript/controllers/hello_controller.js +7 -0
  45. data/demo/app/javascript/controllers/index.js +8 -0
  46. data/demo/app/jobs/application_job.rb +9 -0
  47. data/demo/app/mailers/application_mailer.rb +6 -0
  48. data/demo/app/models/application_record.rb +5 -0
  49. data/demo/app/models/concerns/.keep +0 -0
  50. data/demo/app/views/layouts/application.html.erb +16 -0
  51. data/demo/app/views/layouts/mailer.html.erb +13 -0
  52. data/demo/app/views/layouts/mailer.text.erb +1 -0
  53. data/demo/config/application.rb +24 -0
  54. data/demo/config/boot.rb +6 -0
  55. data/demo/config/cable.yml +11 -0
  56. data/demo/config/database.yml +24 -0
  57. data/demo/config/environment.rb +7 -0
  58. data/demo/config/environments/development.rb +72 -0
  59. data/demo/config/environments/production.rb +95 -0
  60. data/demo/config/environments/test.rb +62 -0
  61. data/demo/config/initializers/assets.rb +14 -0
  62. data/demo/config/initializers/content_security_policy.rb +26 -0
  63. data/demo/config/initializers/filter_parameter_logging.rb +10 -0
  64. data/demo/config/initializers/inflections.rb +17 -0
  65. data/demo/config/initializers/permissions_policy.rb +12 -0
  66. data/demo/config/locales/en.yml +33 -0
  67. data/demo/config/puma.rb +45 -0
  68. data/demo/config/routes.rb +8 -0
  69. data/demo/config/storage.yml +33 -0
  70. data/demo/config.ru +8 -0
  71. data/demo/db/schema.rb +17 -0
  72. data/demo/db/seeds.rb +8 -0
  73. data/demo/lib/assets/.keep +0 -0
  74. data/demo/lib/tasks/.keep +0 -0
  75. data/demo/log/.keep +0 -0
  76. data/demo/public/404.html +69 -0
  77. data/demo/public/422.html +69 -0
  78. data/demo/public/500.html +68 -0
  79. data/demo/public/apple-touch-icon-precomposed.png +0 -0
  80. data/demo/public/apple-touch-icon.png +0 -0
  81. data/demo/public/favicon.ico +0 -0
  82. data/demo/public/robots.txt +1 -0
  83. data/demo/storage/.keep +0 -0
  84. data/demo/tmp/.keep +0 -0
  85. data/demo/tmp/pids/.keep +0 -0
  86. data/demo/vendor/.keep +0 -0
  87. data/lib/eve/rails/config.rb +9 -0
  88. data/lib/eve/rails/engine.rb +17 -0
  89. data/lib/eve/rails/errors.rb +7 -0
  90. data/lib/eve/rails/tasks/setup.rake +6 -0
  91. data/lib/eve/rails/version.rb +7 -0
  92. data/lib/eve/rails.rb +12 -0
  93. data/lib/eve-rails.rb +3 -0
  94. data/lib/ext/database_cleaner/active_record/base.rb +13 -0
  95. data/lib/generators/eve/rails/install_generator.rb +11 -0
  96. data/lib/generators/eve/rails/templates/.keep +0 -0
  97. data/lib/tasks/docs.rake +6 -0
  98. data/lib/tasks/gem.rake +3 -0
  99. data/package.json +47 -0
  100. data/tailwind.config.js +12 -0
  101. data/yarn.lock +1653 -0
  102. metadata +206 -0
@@ -0,0 +1,33 @@
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
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
9
+ # amazon:
10
+ # service: S3
11
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
12
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
13
+ # region: us-east-1
14
+ # bucket: your_own_bucket-<%= Rails.env %>
15
+
16
+ # Remember not to checkin your GCS keyfile to a repository
17
+ # google:
18
+ # service: GCS
19
+ # project: your_project
20
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
21
+ # bucket: your_own_bucket-<%= Rails.env %>
22
+
23
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
24
+ # microsoft:
25
+ # service: AzureStorage
26
+ # storage_account_name: your_account_name
27
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
28
+ # container: your_container_name-<%= Rails.env %>
29
+
30
+ # mirror:
31
+ # service: Mirror
32
+ # primary: local
33
+ # mirrors: [ amazon, google, microsoft ]
data/demo/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/demo/db/schema.rb ADDED
@@ -0,0 +1,17 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.0].define(version: 0) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+
17
+ end
data/demo/db/seeds.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # This file should contain all the record creation needed to seed the database with its default values.
3
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4
+ #
5
+ # Examples:
6
+ #
7
+ # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
8
+ # Character.create(name: "Luke", movie: movies.first)
File without changes
File without changes
data/demo/log/.keep ADDED
File without changes
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #efefef;
9
+ color: #2e2f30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #ccc;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #bbb;
26
+ border-top: #b00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730e15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #f7f7f7;
44
+ border: 1px solid #ccc;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #dadada;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>
65
+ If you are the application owner check the logs for more information.
66
+ </p>
67
+ </div>
68
+ </body>
69
+ </html>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #efefef;
9
+ color: #2e2f30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #ccc;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #bbb;
26
+ border-top: #b00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730e15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #f7f7f7;
44
+ border: 1px solid #ccc;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #dadada;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>
65
+ If you are the application owner check the logs for more information.
66
+ </p>
67
+ </div>
68
+ </body>
69
+ </html>
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #efefef;
9
+ color: #2e2f30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #ccc;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #bbb;
26
+ border-top: #b00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730e15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #f7f7f7;
44
+ border: 1px solid #ccc;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #dadada;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>
64
+ If you are the application owner check the logs for more information.
65
+ </p>
66
+ </div>
67
+ </body>
68
+ </html>
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
File without changes
data/demo/tmp/.keep ADDED
File without changes
File without changes
data/demo/vendor/.keep ADDED
File without changes
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/configurable'
4
+
5
+ module EVE
6
+ module Rails
7
+ extend Dry::Configurable
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/engine'
4
+
5
+ module EVE
6
+ module Rails
7
+ # Rails engine for EVE on Rails.
8
+ class Engine < ::Rails::Engine
9
+ rake_tasks do
10
+ glob = File.join(File.absolute_path(__dir__), 'rake', '*.rake')
11
+ Dir[glob].each do |rake_file|
12
+ load rake_file
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EVE
4
+ module Rails
5
+ class Error < StandardError; end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :eve do
4
+ task setup: :environment do # rubocop:disable Lint/EmptyBlock, Rake/Desc
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EVE
4
+ module Rails
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
data/lib/eve/rails.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eve/rails/version'
4
+ require 'eve/rails/config'
5
+ require 'eve/rails/errors'
6
+ require 'eve/rails/engine'
7
+
8
+ module EVE
9
+ # Main namespace for EVE on Rails.
10
+ module Rails
11
+ end
12
+ end
data/lib/eve-rails.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eve/rails'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'database_cleaner/active_record'
4
+
5
+ module DatabaseCleaner
6
+ module ActiveRecord
7
+ class Base < DatabaseCleaner::Strategy
8
+ def self.migration_table_name
9
+ ::ActiveRecord::Base.connection.schema_migration.table_name
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EVE
4
+ module Rails
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('templates', __dir__)
7
+
8
+ namespace 'eve_rails:install'
9
+ end
10
+ end
11
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yard'
4
+ require 'yard/rake/yardoc_task'
5
+
6
+ YARD::Rake::YardocTask.new(:docs)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
data/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "eve-rails",
3
+ "private": "true",
4
+ "dependencies": {
5
+ "@hotwired/stimulus": "^3.2.1",
6
+ "@hotwired/turbo-rails": "^7.2.4",
7
+ "@tailwindcss/forms": "^0.5.3",
8
+ "autoprefixer": "^10.4.13",
9
+ "esbuild": "^0.16.16",
10
+ "postcss": "^8.4.21",
11
+ "tailwindcss": "^3.2.4"
12
+ },
13
+ "scripts": {
14
+ "build": "esbuild demo/app/javascript/*.* --bundle --sourcemap --outdir=demo/app/assets/builds --public-path=assets",
15
+ "build:css": "tailwindcss -i ./demo/app/assets/stylesheets/application.tailwind.css -o ./demo/app/assets/builds/application.css --minify",
16
+ "lint": "eslint .",
17
+ "lint:fix": "eslint . --fix",
18
+ "prepare": "is-ci || husky install"
19
+ },
20
+ "devDependencies": {
21
+ "eslint": "^8.31.0",
22
+ "eslint-config-prettier": "^8.6.0",
23
+ "eslint-plugin-prettier": "^4.2.1",
24
+ "eslint-plugin-tailwindcss": "^3.8.0",
25
+ "husky": "^8.0.0",
26
+ "is-ci": "^3.0.1",
27
+ "lint-staged": "^13.1.0",
28
+ "prettier": "^2.8.2",
29
+ "prettier-plugin-tailwindcss": "^0.2.1"
30
+ },
31
+ "lint-staged": {
32
+ "*.css": "yarn:prettier --write",
33
+ "*.html": "yarn:prettier --write",
34
+ "*.js": [
35
+ "yarn:prettier --write",
36
+ "yarn lint:fix"
37
+ ],
38
+ "*.json": "yarn prettier --write",
39
+ "*.rb": "bin/rubocop -A",
40
+ "*.md": [
41
+ "yarn prettier --write",
42
+ "bin/mdl"
43
+ ],
44
+ "*.yml": "yarn prettier --write",
45
+ "app/**/*.erb": "bin/erblint -a"
46
+ }
47
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ content: [
3
+ "./app/views/**/*.html.erb",
4
+ "./app/helpers/**/*.rb",
5
+ "./app/assets/stylesheets/**/*.css",
6
+ "./app/javascript/**/*.js",
7
+ "./demo/app/views/**/*.html.erb",
8
+ "./demo/app/helpers/**/*.rb",
9
+ "./demo/app/assets/stylesheets/**/*.css",
10
+ "./demo/app/javascript/**/*.js",
11
+ ],
12
+ };