blog_app 0.0.1

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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +67 -0
  3. data/README.md +24 -0
  4. data/Rakefile +6 -0
  5. data/config/application.rb +22 -0
  6. data/config/boot.rb +4 -0
  7. data/config/cable.yml +10 -0
  8. data/config/credentials.yml.enc +1 -0
  9. data/config/database.yml +29 -0
  10. data/config/environment.rb +5 -0
  11. data/config/environments/development.rb +66 -0
  12. data/config/environments/production.rb +112 -0
  13. data/config/environments/test.rb +49 -0
  14. data/config/initializers/application_controller_renderer.rb +8 -0
  15. data/config/initializers/assets.rb +14 -0
  16. data/config/initializers/backtrace_silencers.rb +7 -0
  17. data/config/initializers/content_security_policy.rb +30 -0
  18. data/config/initializers/cookies_serializer.rb +5 -0
  19. data/config/initializers/devise.rb +311 -0
  20. data/config/initializers/filter_parameter_logging.rb +4 -0
  21. data/config/initializers/inflections.rb +16 -0
  22. data/config/initializers/mime_types.rb +4 -0
  23. data/config/initializers/wrap_parameters.rb +14 -0
  24. data/config/locales/devise.en.yml +65 -0
  25. data/config/locales/en.yml +33 -0
  26. data/config/puma.rb +38 -0
  27. data/config/routes.rb +12 -0
  28. data/config/spring.rb +6 -0
  29. data/config/storage.yml +34 -0
  30. data/config/webpack/development.js +5 -0
  31. data/config/webpack/environment.js +11 -0
  32. data/config/webpack/production.js +5 -0
  33. data/config/webpack/test.js +5 -0
  34. data/config/webpacker.yml +96 -0
  35. data/db/migrate/20220803091536_create_articles.rb +10 -0
  36. data/db/migrate/20220803160125_create_comments.rb +11 -0
  37. data/db/migrate/20220810064022_devise_create_users.rb +44 -0
  38. data/db/migrate/20220819063129_add_user_ref_to_comments.rb +5 -0
  39. data/db/migrate/20220819064210_changes_in_table.rb +6 -0
  40. data/db/migrate/20220907114823_create_active_storage_tables.active_storage.rb +27 -0
  41. data/db/migrate/20220908072238_add_omniauth_to_users.rb +5 -0
  42. data/db/schema.rb +80 -0
  43. data/db/seeds.rb +1018 -0
  44. data/lib/app/assets/config/manifest.js +2 -0
  45. data/lib/app/assets/stylesheets/application.css +15 -0
  46. data/lib/app/assets/stylesheets/articles.scss +3 -0
  47. data/lib/app/assets/stylesheets/comments.scss +3 -0
  48. data/lib/app/assets/stylesheets/custom.css +30 -0
  49. data/lib/app/channels/application_cable/channel.rb +4 -0
  50. data/lib/app/channels/application_cable/connection.rb +4 -0
  51. data/lib/app/controllers/application_controller.rb +11 -0
  52. data/lib/app/controllers/articles_controller.rb +50 -0
  53. data/lib/app/controllers/comments_controller.rb +25 -0
  54. data/lib/app/controllers/users/omniauth_callbacks_controller.rb +14 -0
  55. data/lib/app/helpers/application_helper.rb +2 -0
  56. data/lib/app/helpers/articles_helper.rb +2 -0
  57. data/lib/app/helpers/comments_helper.rb +2 -0
  58. data/lib/app/javascript/channels/consumer.js +6 -0
  59. data/lib/app/javascript/channels/index.js +5 -0
  60. data/lib/app/javascript/css/application.scss +2 -0
  61. data/lib/app/javascript/packs/application.js +18 -0
  62. data/lib/app/jobs/application_job.rb +7 -0
  63. data/lib/app/mailers/application_mailer.rb +4 -0
  64. data/lib/app/mailers/user_mailer.rb +11 -0
  65. data/lib/app/models/application_record.rb +3 -0
  66. data/lib/app/models/article.rb +5 -0
  67. data/lib/app/models/comment.rb +4 -0
  68. data/lib/app/models/user.rb +42 -0
  69. data/lib/app/views/articles/_form.html.erb +31 -0
  70. data/lib/app/views/articles/edit.html.erb +8 -0
  71. data/lib/app/views/articles/index.html.erb +26 -0
  72. data/lib/app/views/articles/new.html.erb +8 -0
  73. data/lib/app/views/articles/show.html.erb +26 -0
  74. data/lib/app/views/comments/_comment.html.erb +16 -0
  75. data/lib/app/views/comments/_form.html.erb +15 -0
  76. data/lib/app/views/header_and_footer/_header.html.erb +34 -0
  77. data/lib/app/views/layouts/application.html.erb +23 -0
  78. data/lib/app/views/layouts/authentication.html.erb +0 -0
  79. data/lib/app/views/layouts/mailer.html.erb +13 -0
  80. data/lib/app/views/layouts/mailer.text.erb +1 -0
  81. data/lib/app/views/user_mailer/welcome_email.html.erb +10 -0
  82. data/lib/app/views/user_mailer/welcome_email.text.erb +13 -0
  83. data/lib/app/views/users/confirmations/new.html.erb +16 -0
  84. data/lib/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  85. data/lib/app/views/users/mailer/email_changed.html.erb +7 -0
  86. data/lib/app/views/users/mailer/password_change.html.erb +3 -0
  87. data/lib/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  88. data/lib/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  89. data/lib/app/views/users/passwords/edit.html.erb +27 -0
  90. data/lib/app/views/users/passwords/new.html.erb +18 -0
  91. data/lib/app/views/users/registrations/edit.html.erb +77 -0
  92. data/lib/app/views/users/registrations/new.html.erb +40 -0
  93. data/lib/app/views/users/sessions/new.html.erb +28 -0
  94. data/lib/app/views/users/shared/_error_messages.html.erb +15 -0
  95. data/lib/app/views/users/shared/_links.html.erb +26 -0
  96. data/lib/app/views/users/unlocks/new.html.erb +16 -0
  97. metadata +151 -0
@@ -0,0 +1,96 @@
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/javascript
5
+ source_entry_path: packs
6
+ public_root_path: public
7
+ public_output_path: packs
8
+ cache_path: tmp/cache/webpacker
9
+ check_yarn_integrity: false
10
+ webpack_compile_output: true
11
+
12
+ # Additional paths webpack should lookup modules
13
+ # ['app/assets', 'engine/foo/app/assets']
14
+ resolved_paths: []
15
+
16
+ # Reload manifest.json on all requests so we reload latest compiled packs
17
+ cache_manifest: false
18
+
19
+ # Extract and emit a css file
20
+ extract_css: false
21
+
22
+ static_assets_extensions:
23
+ - .jpg
24
+ - .jpeg
25
+ - .png
26
+ - .gif
27
+ - .tiff
28
+ - .ico
29
+ - .svg
30
+ - .eot
31
+ - .otf
32
+ - .ttf
33
+ - .woff
34
+ - .woff2
35
+
36
+ extensions:
37
+ - .mjs
38
+ - .js
39
+ - .sass
40
+ - .scss
41
+ - .css
42
+ - .module.sass
43
+ - .module.scss
44
+ - .module.css
45
+ - .png
46
+ - .svg
47
+ - .gif
48
+ - .jpeg
49
+ - .jpg
50
+
51
+ development:
52
+ <<: *default
53
+ compile: true
54
+
55
+ # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
56
+ check_yarn_integrity: true
57
+
58
+ # Reference: https://webpack.js.org/configuration/dev-server/
59
+ dev_server:
60
+ https: false
61
+ host: localhost
62
+ port: 3035
63
+ public: localhost:3035
64
+ hmr: false
65
+ # Inline should be set to true if using HMR
66
+ inline: true
67
+ overlay: true
68
+ compress: true
69
+ disable_host_check: true
70
+ use_local_ip: false
71
+ quiet: false
72
+ pretty: false
73
+ headers:
74
+ 'Access-Control-Allow-Origin': '*'
75
+ watch_options:
76
+ ignored: '**/node_modules/**'
77
+
78
+
79
+ test:
80
+ <<: *default
81
+ compile: true
82
+
83
+ # Compile test packs to a separate directory
84
+ public_output_path: packs-test
85
+
86
+ production:
87
+ <<: *default
88
+
89
+ # Production depends on precompilation of packs prior to booting for performance.
90
+ compile: false
91
+
92
+ # Extract and emit a css file
93
+ extract_css: true
94
+
95
+ # Cache manifest.json for performance
96
+ cache_manifest: true
@@ -0,0 +1,10 @@
1
+ class CreateArticles < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.text :text
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class CreateComments < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :comments do |t|
4
+ t.string :commenter
5
+ t.text :body
6
+ t.references :article, null: false, foreign_key: true
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateUsers < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :users do |t|
6
+ ## Database authenticatable
7
+ t.string :email, null: false, default: ""
8
+ t.string :encrypted_password, null: false, default: ""
9
+
10
+ ## Recoverable
11
+ t.string :reset_password_token
12
+ t.datetime :reset_password_sent_at
13
+
14
+ ## Rememberable
15
+ t.datetime :remember_created_at
16
+
17
+ # Trackable
18
+ t.integer :sign_in_count, default: 0, null: false
19
+ t.datetime :current_sign_in_at
20
+ t.datetime :last_sign_in_at
21
+ t.inet :current_sign_in_ip
22
+ t.inet :last_sign_in_ip
23
+
24
+ ## Confirmable
25
+ # t.string :confirmation_token
26
+ # t.datetime :confirmed_at
27
+ # t.datetime :confirmation_sent_at
28
+ # t.string :unconfirmed_email # Only if using reconfirmable
29
+
30
+ ## Lockable
31
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
33
+ # t.datetime :locked_at
34
+
35
+
36
+ t.timestamps null: false
37
+ end
38
+
39
+ add_index :users, :email, unique: true
40
+ add_index :users, :reset_password_token, unique: true
41
+ # add_index :users, :confirmation_token, unique: true
42
+ # add_index :users, :unlock_token, unique: true
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ class AddUserRefToComments < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_reference :comments, :user, null: false, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class ChangesInTable < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :first_name, :string
4
+ add_column :users, :last_name, :string
5
+ end
6
+ end
@@ -0,0 +1,27 @@
1
+ # This migration comes from active_storage (originally 20170806125915)
2
+ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3
+ def change
4
+ create_table :active_storage_blobs do |t|
5
+ t.string :key, null: false
6
+ t.string :filename, null: false
7
+ t.string :content_type
8
+ t.text :metadata
9
+ t.bigint :byte_size, null: false
10
+ t.string :checksum, null: false
11
+ t.datetime :created_at, null: false
12
+
13
+ t.index [ :key ], unique: true
14
+ end
15
+
16
+ create_table :active_storage_attachments do |t|
17
+ t.string :name, null: false
18
+ t.references :record, null: false, polymorphic: true, index: false
19
+ t.references :blob, null: false
20
+
21
+ t.datetime :created_at, null: false
22
+
23
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24
+ t.foreign_key :active_storage_blobs, column: :blob_id
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ class AddOmniauthToUsers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :image, :string
4
+ end
5
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,80 @@
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 `rails
6
+ # db:schema:load`. When creating a new database, `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.define(version: 2022_09_08_072238) do
14
+
15
+ # These are extensions that must be enabled in order to support this database
16
+ enable_extension "plpgsql"
17
+
18
+ create_table "active_storage_attachments", force: :cascade do |t|
19
+ t.string "name", null: false
20
+ t.string "record_type", null: false
21
+ t.bigint "record_id", null: false
22
+ t.bigint "blob_id", null: false
23
+ t.datetime "created_at", null: false
24
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
25
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
26
+ end
27
+
28
+ create_table "active_storage_blobs", force: :cascade do |t|
29
+ t.string "key", null: false
30
+ t.string "filename", null: false
31
+ t.string "content_type"
32
+ t.text "metadata"
33
+ t.bigint "byte_size", null: false
34
+ t.string "checksum", null: false
35
+ t.datetime "created_at", null: false
36
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
37
+ end
38
+
39
+ create_table "articles", force: :cascade do |t|
40
+ t.string "title"
41
+ t.text "text"
42
+ t.datetime "created_at", precision: 6, null: false
43
+ t.datetime "updated_at", precision: 6, null: false
44
+ end
45
+
46
+ create_table "comments", force: :cascade do |t|
47
+ t.string "commenter"
48
+ t.text "body"
49
+ t.bigint "article_id", null: false
50
+ t.datetime "created_at", precision: 6, null: false
51
+ t.datetime "updated_at", precision: 6, null: false
52
+ t.bigint "user_id", null: false
53
+ t.index ["article_id"], name: "index_comments_on_article_id"
54
+ t.index ["user_id"], name: "index_comments_on_user_id"
55
+ end
56
+
57
+ create_table "users", force: :cascade do |t|
58
+ t.string "email", default: "", null: false
59
+ t.string "encrypted_password", default: "", null: false
60
+ t.string "reset_password_token"
61
+ t.datetime "reset_password_sent_at"
62
+ t.datetime "remember_created_at"
63
+ t.integer "sign_in_count", default: 0, null: false
64
+ t.datetime "current_sign_in_at"
65
+ t.datetime "last_sign_in_at"
66
+ t.inet "current_sign_in_ip"
67
+ t.inet "last_sign_in_ip"
68
+ t.datetime "created_at", precision: 6, null: false
69
+ t.datetime "updated_at", precision: 6, null: false
70
+ t.string "first_name"
71
+ t.string "last_name"
72
+ t.string "image"
73
+ t.index ["email"], name: "index_users_on_email", unique: true
74
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
75
+ end
76
+
77
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
78
+ add_foreign_key "comments", "articles"
79
+ add_foreign_key "comments", "users"
80
+ end