firetail 0.0.1.pre.alpha → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +11 -0
  3. data/.gitignore +13 -13
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +8 -6
  6. data/README.md +24 -10
  7. data/examples/rails/.gitattributes +8 -0
  8. data/examples/rails/.gitignore +31 -0
  9. data/examples/rails/.rspec +1 -0
  10. data/examples/rails/.ruby-version +1 -0
  11. data/examples/rails/Gemfile +44 -0
  12. data/examples/rails/Gemfile.lock +240 -0
  13. data/examples/rails/README.md +24 -0
  14. data/examples/rails/Rakefile +6 -0
  15. data/examples/rails/app/channels/application_cable/channel.rb +4 -0
  16. data/examples/rails/app/channels/application_cable/connection.rb +4 -0
  17. data/examples/rails/app/controllers/application_controller.rb +2 -0
  18. data/examples/rails/app/controllers/comments_controller.rb +52 -0
  19. data/examples/rails/app/controllers/concerns/.keep +0 -0
  20. data/examples/rails/app/controllers/posts_controller.rb +51 -0
  21. data/examples/rails/app/jobs/application_job.rb +7 -0
  22. data/examples/rails/app/mailers/application_mailer.rb +4 -0
  23. data/examples/rails/app/models/application_record.rb +3 -0
  24. data/examples/rails/app/models/comment.rb +4 -0
  25. data/examples/rails/app/models/concerns/.keep +0 -0
  26. data/examples/rails/app/models/post.rb +5 -0
  27. data/examples/rails/app/views/layouts/mailer.html.erb +13 -0
  28. data/examples/rails/app/views/layouts/mailer.text.erb +1 -0
  29. data/examples/rails/bin/bundle +114 -0
  30. data/examples/rails/bin/rails +5 -0
  31. data/examples/rails/bin/rake +5 -0
  32. data/examples/rails/bin/setup +33 -0
  33. data/examples/rails/bin/spring +14 -0
  34. data/examples/rails/config/application.rb +41 -0
  35. data/examples/rails/config/boot.rb +4 -0
  36. data/examples/rails/config/cable.yml +10 -0
  37. data/examples/rails/config/credentials.yml.enc +1 -0
  38. data/examples/rails/config/database.yml +25 -0
  39. data/examples/rails/config/environment.rb +5 -0
  40. data/examples/rails/config/environments/development.rb +66 -0
  41. data/examples/rails/config/environments/production.rb +113 -0
  42. data/examples/rails/config/environments/test.rb +60 -0
  43. data/examples/rails/config/firetail.yml +2 -0
  44. data/examples/rails/config/initializers/application_controller_renderer.rb +8 -0
  45. data/examples/rails/config/initializers/backtrace_silencers.rb +8 -0
  46. data/examples/rails/config/initializers/cors.rb +16 -0
  47. data/examples/rails/config/initializers/filter_parameter_logging.rb +6 -0
  48. data/examples/rails/config/initializers/inflections.rb +16 -0
  49. data/examples/rails/config/initializers/mime_types.rb +4 -0
  50. data/examples/rails/config/initializers/wrap_parameters.rb +14 -0
  51. data/examples/rails/config/locales/en.yml +33 -0
  52. data/examples/rails/config/puma.rb +43 -0
  53. data/examples/rails/config/routes.rb +6 -0
  54. data/examples/rails/config/schema.json +431 -0
  55. data/examples/rails/config/spring.rb +6 -0
  56. data/examples/rails/config/storage.yml +34 -0
  57. data/examples/rails/config.ru +6 -0
  58. data/examples/rails/db/migrate/20230730163722_create_posts.rb +8 -0
  59. data/examples/rails/db/migrate/20230730163741_create_comments.rb +9 -0
  60. data/examples/rails/db/migrate/20230730164121_add_fields_to_post.rb +6 -0
  61. data/examples/rails/db/migrate/20230730164214_add_fields_to_comments.rb +6 -0
  62. data/examples/rails/db/schema.rb +30 -0
  63. data/examples/rails/db/seeds.rb +7 -0
  64. data/examples/rails/lib/tasks/.keep +0 -0
  65. data/examples/rails/log/.keep +0 -0
  66. data/examples/rails/public/robots.txt +1 -0
  67. data/examples/rails/spec/models/comment_spec.rb +5 -0
  68. data/examples/rails/spec/models/post_spec.rb +5 -0
  69. data/examples/rails/spec/rails_helper.rb +63 -0
  70. data/examples/rails/spec/requests/comments_spec.rb +127 -0
  71. data/examples/rails/spec/requests/posts_spec.rb +127 -0
  72. data/examples/rails/spec/routing/comments_routing_spec.rb +30 -0
  73. data/examples/rails/spec/routing/posts_routing_spec.rb +30 -0
  74. data/examples/rails/spec/spec_helper.rb +94 -0
  75. data/examples/rails/storage/.keep +0 -0
  76. data/examples/rails/test/channels/application_cable/connection_test.rb +11 -0
  77. data/examples/rails/test/controllers/.keep +0 -0
  78. data/examples/rails/test/fixtures/files/.keep +0 -0
  79. data/examples/rails/test/integration/.keep +0 -0
  80. data/examples/rails/test/mailers/.keep +0 -0
  81. data/examples/rails/test/models/.keep +0 -0
  82. data/examples/rails/test/test_helper.rb +13 -0
  83. data/examples/rails/tmp/.keep +0 -0
  84. data/examples/rails/tmp/pids/.keep +0 -0
  85. data/examples/rails/vendor/.keep +0 -0
  86. data/firetail.gemspec +1 -1
  87. data/lib/backend.rb +0 -3
  88. data/lib/firetail/version.rb +1 -1
  89. data/lib/firetail.rb +2 -5
  90. data/lib/generators/firetail/install/templates/firetail.yml +2 -2
  91. data/lib/railtie.rb +3 -4
  92. metadata +90 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c2911c879eebc409df8cd9ef8effa8339a7225e7626a896a602ffed00c02504
4
- data.tar.gz: dde8fb62f7c0c770938b2c37a3f7440ce6ac1dba3450ce57f67a6186c9b2491d
3
+ metadata.gz: d72650eb852608c74233aa661dc8e0f900654e068769e6c09c29de37682e9642
4
+ data.tar.gz: 3538cbdb1c798756553b73921bbab9b3a7ab076b3b3c91b3a7b6e0142bbf7a7a
5
5
  SHA512:
6
- metadata.gz: a4e2d329a58d5d324c9ea7edd3502cf5379caa3408c970ab92a20b9c6218c5c4ef4d3fbd331c633cf80976ed6f2e394b6973fa608fd056e7978e0f78785a1436
7
- data.tar.gz: 14515df3e82951f12c813105627d59c18579bbe967a297212a71844ec4dab4cf940a8973df8621ae930d1efb8b6a47feaa414b64e8f10f7d037543fd00b21870
6
+ metadata.gz: 41dbd5ad76e2b78381794166cf9df5dae4c3f0afea1375fb3b4b47b6e1b5feb4bb01faa72e6749627f8e47170c92e68acc2af5ed3395d4f29f414ed4b0a5467c
7
+ data.tar.gz: e4cb860d75a1bf262e7a351595370db8746e1018dff7f745deb70ed11cc766840922042549a3f93112a6591803ddf9ec0c3f688c954844cbeb46cc50c6a52d11
@@ -0,0 +1,11 @@
1
+ ## Describe your changes
2
+
3
+ ## Issue ticket number and link
4
+
5
+ ## Checklist before requesting a review
6
+
7
+ - [ ] I have resolved any merge conflicts
8
+ - [ ] I have run tests locally and they pass
9
+ - [ ] I have linted and auto-formatted the code
10
+ - [ ] If there is new or changed functionality, I have added/updated the tests
11
+ - [ ] If there is new or changed functionality, I have added/updated the documentation
data/.gitignore CHANGED
@@ -13,27 +13,27 @@
13
13
  /ext/target
14
14
 
15
15
  # Ignore bundler config.
16
- /rails_example/.bundle
16
+ /examples/rails/.bundle
17
17
 
18
18
  # Ignore the default SQLite database.
19
- /rails_example/db/*.sqlite3
19
+ /example/rails/db/*.sqlite3
20
20
  /db/*.sqlite3-*
21
21
 
22
22
  # Ignore all logfiles and tempfiles.
23
- /rails/log/*
24
- /rails/tmp/*
25
- !/rails/log/.keep
26
- !/rails/tmp/.keep
23
+ /examples/rails/log/*
24
+ /examples/rails/tmp/*
25
+ !/examples/rails/log/.keep
26
+ !/examples/rails/tmp/.keep
27
27
 
28
28
  # Ignore pidfiles, but keep the directory.
29
- /rails/tmp/pids/*
30
- !/rails/tmp/pids/
31
- !/rails/tmp/pids/.keep
29
+ /examples/rails/tmp/pids/*
30
+ !/examples/rails/tmp/pids/
31
+ !/examples/rails/tmp/pids/.keep
32
32
 
33
33
  # Ignore uploaded files in development.
34
- /rails/storage/*
35
- !/rails/storage/.keep
36
- /rails/.byebug_history
34
+ /examples/rails/storage/*
35
+ !/examples/rails/storage/.keep
36
+ /examples/rails/.byebug_history
37
37
 
38
38
  # Ignore master key for decrypting credentials and more.
39
- /rails/config/master.key
39
+ /examples/rails/config/master.key
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in firetail.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rack', "~> 3.0.4.2"
6
+ gem 'rack', "~> 3.0.6.1"
7
7
  group :development, :test do
8
8
  gem "webmock", "~> 3.18"
9
9
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firetail (0.0.0)
4
+ firetail (0.0.1.pre.alpha)
5
5
  async (~> 1.30.3)
6
6
  committee_firetail (~> 5.0.0)
7
7
  json-schema (~> 3.0.0)
@@ -20,22 +20,24 @@ GEM
20
20
  json_schema (~> 0.14, >= 0.14.3)
21
21
  openapi_parser_firetail (~> 1.0)
22
22
  rack (>= 1.5)
23
- console (1.16.2)
23
+ console (1.19.0)
24
+ fiber-annotation
24
25
  fiber-local
25
26
  crack (0.4.5)
26
27
  rexml
27
28
  diff-lcs (1.5.0)
29
+ fiber-annotation (0.2.0)
28
30
  fiber-local (1.0.0)
29
31
  hashdiff (1.0.1)
30
32
  json-schema (3.0.0)
31
33
  addressable (>= 2.8)
32
34
  json_schema (0.21.0)
33
- jwt (2.7.0)
34
- nio4r (2.5.8)
35
+ jwt (2.7.1)
36
+ nio4r (2.5.9)
35
37
  openapi_parser_firetail (1.0.0)
36
38
  jwt (~> 2.5)
37
39
  public_suffix (5.0.1)
38
- rack (3.0.4.2)
40
+ rack (3.0.6.1)
39
41
  rake (13.0.6)
40
42
  rexml (3.2.5)
41
43
  rspec (3.12.0)
@@ -63,7 +65,7 @@ PLATFORMS
63
65
  DEPENDENCIES
64
66
  bundler (~> 2.0)
65
67
  firetail!
66
- rack (~> 3.0.4.2)
68
+ rack (~> 3.0.6.1)
67
69
  rake (~> 13.0)
68
70
  rspec (~> 3.0)
69
71
  webmock (~> 3.18)
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Firetail
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/firetail`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Welcome to the Firetail Ruby gem. Before we start, ensure that your ruby version is 2.7 or greater. We do not support ruby versions lower than 2.7.
6
4
 
7
5
  ## Installation
8
6
 
@@ -14,15 +12,31 @@ gem 'firetail'
14
12
 
15
13
  And then execute:
16
14
 
17
- $ bundle
15
+ $ `bundle install`
16
+
17
+ Or install it yourself with:
18
+
19
+ $ `gem install firetail`
20
+
21
+ Finally, if you are using Rails, run:
22
+
23
+ $ `rails g firetail:install`
24
+
25
+ This will configure your Rails app to use Firetail gem as middleware and generate configuration and json schema template.
26
+
27
+ Finally, if you are using Rails, run:
18
28
 
19
- Or install it yourself as:
29
+ $ rails g firetail:install
20
30
 
21
- $ gem install firetail
31
+ This will configure your Rails app to use the Firetail gem as middleware, and generate configuration and json schema templates.
22
32
 
23
33
  ## Usage
24
34
 
25
- TODO: Write usage instructions here
35
+ 1. Setup your Firetail key by setting environment variable `FIRETAIL_API_KEY`
36
+ 2. Setup Firetail backend URL by setting the environment variable `FIRETAIL_URL`
37
+ **NOTE** For US based customers, use `https://api.logging.us-east-2.prod.us.firetail.app` for `FIRETAIL_URL`. By default `FIRETAIL_URL` uses **EUROPE(EU)** servers.
38
+ 3. Update `config/schema.json` to match your API endpoints.
39
+ 4. That's it! Happy coding!
26
40
 
27
41
  ## Development
28
42
 
@@ -32,12 +46,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
46
 
33
47
  ## Contributing
34
48
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/firetail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/firetail-io/firetail-ruby-lib. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
50
 
37
51
  ## License
38
52
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
53
+ The gem is available as open source under the terms of the LGPL License.
40
54
 
41
55
  ## Code of Conduct
42
56
 
43
- Everyone interacting in the Firetail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/firetail/blob/master/CODE_OF_CONDUCT.md).
57
+ Everyone interacting in the Firetail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/firetail-io/firetail-ruby-lib/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,8 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+
7
+ # Mark any vendored files as having been vendored.
8
+ vendor/* linguist-vendored
@@ -0,0 +1,31 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+ .byebug_history
29
+
30
+ # Ignore master key for decrypting credentials and more.
31
+ /config/master.key
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1 @@
1
+ ruby-2.7.7
@@ -0,0 +1,44 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '3.2.3'
5
+
6
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
7
+ gem 'rails', '~> 6.1.7', '>= 6.1.7.4'
8
+ # Use sqlite3 as the database for Active Record
9
+ gem 'sqlite3', '~> 1.4'
10
+ # Use Puma as the app server
11
+ gem 'puma', '~> 5.0'
12
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
13
+ # gem 'jbuilder', '~> 2.7'
14
+ # Use Redis adapter to run Action Cable in production
15
+ # gem 'redis', '~> 4.0'
16
+ # Use Active Model has_secure_password
17
+ # gem 'bcrypt', '~> 3.1.7'
18
+
19
+ # Use Active Storage variant
20
+ # gem 'image_processing', '~> 1.2'
21
+
22
+ # Reduces boot times through caching; required in config/boot.rb
23
+ gem 'bootsnap', '>= 1.4.4', require: false
24
+
25
+ # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
26
+ # gem 'rack-cors'
27
+
28
+ group :development, :test do
29
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
30
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
31
+ gem "rspec", "= 3.12"
32
+ gem "rspec-rails"
33
+ end
34
+
35
+ group :development do
36
+ gem 'listen', '~> 3.3'
37
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
38
+ gem 'spring'
39
+ end
40
+
41
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
42
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
43
+
44
+ gem "firetail", "~> 1.0.1"
@@ -0,0 +1,240 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ firetail (0.0.1.pre.alpha)
5
+ async (~> 1.30.3)
6
+ committee_firetail (~> 5.0.1)
7
+ json-schema (~> 3.0.0)
8
+ jwt (~> 2.5)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actioncable (6.1.7.4)
14
+ actionpack (= 6.1.7.4)
15
+ activesupport (= 6.1.7.4)
16
+ nio4r (~> 2.0)
17
+ websocket-driver (>= 0.6.1)
18
+ actionmailbox (6.1.7.4)
19
+ actionpack (= 6.1.7.4)
20
+ activejob (= 6.1.7.4)
21
+ activerecord (= 6.1.7.4)
22
+ activestorage (= 6.1.7.4)
23
+ activesupport (= 6.1.7.4)
24
+ mail (>= 2.7.1)
25
+ actionmailer (6.1.7.4)
26
+ actionpack (= 6.1.7.4)
27
+ actionview (= 6.1.7.4)
28
+ activejob (= 6.1.7.4)
29
+ activesupport (= 6.1.7.4)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ rails-dom-testing (~> 2.0)
32
+ actionpack (6.1.7.4)
33
+ actionview (= 6.1.7.4)
34
+ activesupport (= 6.1.7.4)
35
+ rack (~> 2.0, >= 2.0.9)
36
+ rack-test (>= 0.6.3)
37
+ rails-dom-testing (~> 2.0)
38
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
39
+ actiontext (6.1.7.4)
40
+ actionpack (= 6.1.7.4)
41
+ activerecord (= 6.1.7.4)
42
+ activestorage (= 6.1.7.4)
43
+ activesupport (= 6.1.7.4)
44
+ nokogiri (>= 1.8.5)
45
+ actionview (6.1.7.4)
46
+ activesupport (= 6.1.7.4)
47
+ builder (~> 3.1)
48
+ erubi (~> 1.4)
49
+ rails-dom-testing (~> 2.0)
50
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
+ activejob (6.1.7.4)
52
+ activesupport (= 6.1.7.4)
53
+ globalid (>= 0.3.6)
54
+ activemodel (6.1.7.4)
55
+ activesupport (= 6.1.7.4)
56
+ activerecord (6.1.7.4)
57
+ activemodel (= 6.1.7.4)
58
+ activesupport (= 6.1.7.4)
59
+ activestorage (6.1.7.4)
60
+ actionpack (= 6.1.7.4)
61
+ activejob (= 6.1.7.4)
62
+ activerecord (= 6.1.7.4)
63
+ activesupport (= 6.1.7.4)
64
+ marcel (~> 1.0)
65
+ mini_mime (>= 1.1.0)
66
+ activesupport (6.1.7.4)
67
+ concurrent-ruby (~> 1.0, >= 1.0.2)
68
+ i18n (>= 1.6, < 2)
69
+ minitest (>= 5.1)
70
+ tzinfo (~> 2.0)
71
+ zeitwerk (~> 2.3)
72
+ addressable (2.8.6)
73
+ public_suffix (>= 2.0.2, < 6.0)
74
+ async (1.30.3)
75
+ console (~> 1.10)
76
+ nio4r (~> 2.3)
77
+ timers (~> 4.1)
78
+ base64 (0.2.0)
79
+ bootsnap (1.16.0)
80
+ msgpack (~> 1.2)
81
+ builder (3.2.4)
82
+ byebug (11.1.3)
83
+ committee_firetail (5.0.1)
84
+ json_schema (~> 0.14, >= 0.14.3)
85
+ openapi_parser (~> 2.1.0)
86
+ rack (>= 1.5)
87
+ concurrent-ruby (1.2.2)
88
+ console (1.24.0)
89
+ fiber-annotation
90
+ fiber-local
91
+ json
92
+ crass (1.0.6)
93
+ date (3.3.3)
94
+ diff-lcs (1.5.0)
95
+ erubi (1.12.0)
96
+ ffi (1.15.5)
97
+ fiber-annotation (0.2.0)
98
+ fiber-local (1.0.0)
99
+ globalid (1.1.0)
100
+ activesupport (>= 5.0)
101
+ i18n (1.14.1)
102
+ concurrent-ruby (~> 1.0)
103
+ json (2.7.2)
104
+ json-schema (3.0.0)
105
+ addressable (>= 2.8)
106
+ json_schema (0.21.0)
107
+ jwt (2.8.1)
108
+ base64
109
+ listen (3.8.0)
110
+ rb-fsevent (~> 0.10, >= 0.10.3)
111
+ rb-inotify (~> 0.9, >= 0.9.10)
112
+ loofah (2.21.3)
113
+ crass (~> 1.0.2)
114
+ nokogiri (>= 1.12.0)
115
+ mail (2.8.1)
116
+ mini_mime (>= 0.1.1)
117
+ net-imap
118
+ net-pop
119
+ net-smtp
120
+ marcel (1.0.2)
121
+ method_source (1.0.0)
122
+ mini_mime (1.1.2)
123
+ mini_portile2 (2.8.4)
124
+ minitest (5.19.0)
125
+ msgpack (1.7.2)
126
+ net-imap (0.3.7)
127
+ date
128
+ net-protocol
129
+ net-pop (0.1.2)
130
+ net-protocol
131
+ net-protocol (0.2.1)
132
+ timeout
133
+ net-smtp (0.3.3)
134
+ net-protocol
135
+ nio4r (2.5.9)
136
+ nokogiri (1.15.3)
137
+ mini_portile2 (~> 2.8.2)
138
+ racc (~> 1.4)
139
+ openapi_parser (2.1.0)
140
+ public_suffix (5.0.5)
141
+ puma (5.6.6)
142
+ nio4r (~> 2.0)
143
+ racc (1.7.1)
144
+ rack (2.2.7)
145
+ rack-test (2.1.0)
146
+ rack (>= 1.3)
147
+ rails (6.1.7.4)
148
+ actioncable (= 6.1.7.4)
149
+ actionmailbox (= 6.1.7.4)
150
+ actionmailer (= 6.1.7.4)
151
+ actionpack (= 6.1.7.4)
152
+ actiontext (= 6.1.7.4)
153
+ actionview (= 6.1.7.4)
154
+ activejob (= 6.1.7.4)
155
+ activemodel (= 6.1.7.4)
156
+ activerecord (= 6.1.7.4)
157
+ activestorage (= 6.1.7.4)
158
+ activesupport (= 6.1.7.4)
159
+ bundler (>= 1.15.0)
160
+ railties (= 6.1.7.4)
161
+ sprockets-rails (>= 2.0.0)
162
+ rails-dom-testing (2.1.1)
163
+ activesupport (>= 5.0.0)
164
+ minitest
165
+ nokogiri (>= 1.6)
166
+ rails-html-sanitizer (1.6.0)
167
+ loofah (~> 2.21)
168
+ nokogiri (~> 1.14)
169
+ railties (6.1.7.4)
170
+ actionpack (= 6.1.7.4)
171
+ activesupport (= 6.1.7.4)
172
+ method_source
173
+ rake (>= 12.2)
174
+ thor (~> 1.0)
175
+ rake (13.0.6)
176
+ rb-fsevent (0.11.2)
177
+ rb-inotify (0.10.1)
178
+ ffi (~> 1.0)
179
+ rspec (3.12.0)
180
+ rspec-core (~> 3.12.0)
181
+ rspec-expectations (~> 3.12.0)
182
+ rspec-mocks (~> 3.12.0)
183
+ rspec-core (3.12.2)
184
+ rspec-support (~> 3.12.0)
185
+ rspec-expectations (3.12.3)
186
+ diff-lcs (>= 1.2.0, < 2.0)
187
+ rspec-support (~> 3.12.0)
188
+ rspec-mocks (3.12.6)
189
+ diff-lcs (>= 1.2.0, < 2.0)
190
+ rspec-support (~> 3.12.0)
191
+ rspec-rails (6.0.3)
192
+ actionpack (>= 6.1)
193
+ activesupport (>= 6.1)
194
+ railties (>= 6.1)
195
+ rspec-core (~> 3.12)
196
+ rspec-expectations (~> 3.12)
197
+ rspec-mocks (~> 3.12)
198
+ rspec-support (~> 3.12)
199
+ rspec-support (3.12.1)
200
+ spring (4.1.1)
201
+ sprockets (4.2.0)
202
+ concurrent-ruby (~> 1.0)
203
+ rack (>= 2.2.4, < 4)
204
+ sprockets-rails (3.4.2)
205
+ actionpack (>= 5.2)
206
+ activesupport (>= 5.2)
207
+ sprockets (>= 3.0.0)
208
+ sqlite3 (1.6.3)
209
+ mini_portile2 (~> 2.8.0)
210
+ thor (1.2.2)
211
+ timeout (0.4.0)
212
+ timers (4.3.5)
213
+ tzinfo (2.0.6)
214
+ concurrent-ruby (~> 1.0)
215
+ websocket-driver (0.7.6)
216
+ websocket-extensions (>= 0.1.0)
217
+ websocket-extensions (0.1.5)
218
+ zeitwerk (2.6.9)
219
+
220
+ PLATFORMS
221
+ ruby
222
+
223
+ DEPENDENCIES
224
+ bootsnap (>= 1.4.4)
225
+ byebug
226
+ firetail!
227
+ listen (~> 3.3)
228
+ puma (~> 5.0)
229
+ rails (~> 6.1.7, >= 6.1.7.4)
230
+ rspec (= 3.12)
231
+ rspec-rails
232
+ spring
233
+ sqlite3 (~> 1.4)
234
+ tzinfo-data
235
+
236
+ RUBY VERSION
237
+ ruby 3.2.3p157
238
+
239
+ BUNDLED WITH
240
+ 2.1.4
@@ -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,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::API
2
+ end
@@ -0,0 +1,52 @@
1
+ class CommentsController < ApplicationController
2
+ before_action :set_comment, only: [:show, :update, :destroy]
3
+
4
+ # GET /comments
5
+ def index
6
+ @comments = Comment.all
7
+
8
+ render json: @comments
9
+ end
10
+
11
+ # GET /comments/1
12
+ def show
13
+ render json: @comment
14
+ end
15
+
16
+ # POST /comments
17
+ def create
18
+ @post = Post.find(params[:post_id])
19
+ @comment = @post.comments.new(comment_params)
20
+
21
+ if @comment.save
22
+ render json: @comment, status: :created
23
+ else
24
+ render json: @comment.errors, status: :unprocessable_entity
25
+ end
26
+ end
27
+
28
+ # PATCH/PUT /comments/1
29
+ def update
30
+ if @comment.update(comment_params)
31
+ render json: @comment
32
+ else
33
+ render json: @comment.errors, status: :unprocessable_entity
34
+ end
35
+ end
36
+
37
+ # DELETE /comments/1
38
+ def destroy
39
+ @comment.destroy
40
+ end
41
+
42
+ private
43
+ # Use callbacks to share common setup or constraints between actions.
44
+ def set_comment
45
+ @comment = Comment.find(params[:id])
46
+ end
47
+
48
+ # Only allow a list of trusted parameters through.
49
+ def comment_params
50
+ params.require(:comment).permit(:message, :post_id)
51
+ end
52
+ end
File without changes
@@ -0,0 +1,51 @@
1
+ class PostsController < ApplicationController
2
+ before_action :set_post, only: [:show, :update, :destroy]
3
+
4
+ # GET /posts
5
+ def index
6
+ @posts = Post.all
7
+
8
+ render json: @posts
9
+ end
10
+
11
+ # GET /posts/1
12
+ def show
13
+ render json: @post
14
+ end
15
+
16
+ # POST /posts
17
+ def create
18
+ @post = Post.new(post_params)
19
+
20
+ if @post.save
21
+ render json: @post, status: :created, location: @post
22
+ else
23
+ render json: @post.errors, status: :unprocessable_entity
24
+ end
25
+ end
26
+
27
+ # PATCH/PUT /posts/1
28
+ def update
29
+ if @post.update(post_params)
30
+ render json: @post
31
+ else
32
+ render json: @post.errors, status: :unprocessable_entity
33
+ end
34
+ end
35
+
36
+ # DELETE /posts/1
37
+ def destroy
38
+ @post.destroy
39
+ end
40
+
41
+ private
42
+ # Use callbacks to share common setup or constraints between actions.
43
+ def set_post
44
+ @post = Post.find(params[:id])
45
+ end
46
+
47
+ # Only allow a list of trusted parameters through.
48
+ def post_params
49
+ params.require(:post).permit(:title, :content, comments: [:message])
50
+ end
51
+ 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