n_base_rails 0.1.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 (139) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +49 -0
  8. data/Rakefile +4 -0
  9. data/bin/console +15 -0
  10. data/bin/setup +8 -0
  11. data/lib/.env +4 -0
  12. data/lib/.rspec +1 -0
  13. data/lib/.rubocop.yml +288 -0
  14. data/lib/.rubocop_disabled.yml +31 -0
  15. data/lib/.rubocop_enabled.yml +0 -0
  16. data/lib/Capfile +46 -0
  17. data/lib/Gemfile +51 -0
  18. data/lib/config/database.yml +24 -0
  19. data/lib/config/deploy/development.rb +85 -0
  20. data/lib/config/deploy/production.rb +63 -0
  21. data/lib/config/deploy/staging.rb +56 -0
  22. data/lib/config/deploy.rb +7 -0
  23. data/lib/config/initializers/devise.rb +315 -0
  24. data/lib/config/locales/devise.en.yml +65 -0
  25. data/lib/config/locales/en.yml +33 -0
  26. data/lib/config/locales/errors.en.yml +57 -0
  27. data/lib/config/routes.rb +26 -0
  28. data/lib/config/settings.yml +22 -0
  29. data/lib/controllers/api/admin/base_controller.rb +5 -0
  30. data/lib/controllers/api/admin/sessions_controller.rb +39 -0
  31. data/lib/controllers/api/admin/users_controller.rb +9 -0
  32. data/lib/controllers/api/v1/base_controller.rb +5 -0
  33. data/lib/controllers/api/v1/sessions_controller.rb +39 -0
  34. data/lib/controllers/api/v1/users_controller.rb +7 -0
  35. data/lib/controllers/application_controller.rb +30 -0
  36. data/lib/controllers/concerns/.DS_Store +0 -0
  37. data/lib/controllers/concerns/.keep +0 -0
  38. data/lib/controllers/concerns/base_concern.rb +9 -0
  39. data/lib/controllers/concerns/json_renderer.rb +76 -0
  40. data/lib/controllers/concerns/pagination.rb +32 -0
  41. data/lib/controllers/concerns/rescue_exception.rb +73 -0
  42. data/lib/db/migrate/20220721091426_devise_create_users.rb +46 -0
  43. data/lib/db/migrate/20230113072522_create_devices.rb +13 -0
  44. data/lib/db/migrate/20230227135020_create_posts.rb +15 -0
  45. data/lib/db/migrate/20230303165318_devise_create_admins.rb +46 -0
  46. data/lib/db/schema.rb +62 -0
  47. data/lib/db/seeds.rb +7 -0
  48. data/lib/generators/n_base_rails/install_generator.rb +42 -0
  49. data/lib/lib/.DS_Store +0 -0
  50. data/lib/lib/active_record_validation/error.rb +33 -0
  51. data/lib/lib/api/error.rb +63 -0
  52. data/lib/lib/json_web_token.rb +13 -0
  53. data/lib/log/.keep +0 -0
  54. data/lib/log/capistrano.log +28367 -0
  55. data/lib/log/development.log +30201 -0
  56. data/lib/log/test.log +11768 -0
  57. data/lib/models/admin.rb +10 -0
  58. data/lib/models/application_record.rb +5 -0
  59. data/lib/models/concerns/.keep +0 -0
  60. data/lib/models/device.rb +11 -0
  61. data/lib/models/post.rb +5 -0
  62. data/lib/models/user.rb +9 -0
  63. data/lib/n_base_rails/version.rb +5 -0
  64. data/lib/n_base_rails.rb +9 -0
  65. data/lib/public/404.html +67 -0
  66. data/lib/public/422.html +67 -0
  67. data/lib/public/500.html +66 -0
  68. data/lib/public/apple-touch-icon-precomposed.png +0 -0
  69. data/lib/public/apple-touch-icon.png +0 -0
  70. data/lib/public/docs/api/admin/definitions/users.yaml +15 -0
  71. data/lib/public/docs/api/admin/paths/index.yaml +29 -0
  72. data/lib/public/docs/api/admin/paths/sessions.yaml +121 -0
  73. data/lib/public/docs/api/admin/paths/users.yaml +39 -0
  74. data/lib/public/docs/api/shared/meta_infos.yaml +41 -0
  75. data/lib/public/docs/api/shared/unauthorized_response.yaml +31 -0
  76. data/lib/public/docs/api/v1/definitions/users.yaml +13 -0
  77. data/lib/public/docs/api/v1/paths/example.yaml +431 -0
  78. data/lib/public/docs/api/v1/paths/index.yaml +28 -0
  79. data/lib/public/docs/api/v1/paths/sessions.yaml +121 -0
  80. data/lib/public/docs/api/v1/paths/users.yaml +24 -0
  81. data/lib/public/favicon.ico +0 -0
  82. data/lib/public/robots.txt +1 -0
  83. data/lib/public/swagger/admin/admin-swagger-initializer.js +24 -0
  84. data/lib/public/swagger/admin/admin.html +19 -0
  85. data/lib/public/swagger/favicon-16x16.png +0 -0
  86. data/lib/public/swagger/favicon-32x32.png +0 -0
  87. data/lib/public/swagger/index.css +16 -0
  88. data/lib/public/swagger/oauth2-redirect.html +79 -0
  89. data/lib/public/swagger/swagger-ui-bundle.js +3 -0
  90. data/lib/public/swagger/swagger-ui-bundle.js.map +1 -0
  91. data/lib/public/swagger/swagger-ui-es-bundle-core.js +2 -0
  92. data/lib/public/swagger/swagger-ui-es-bundle-core.js.map +1 -0
  93. data/lib/public/swagger/swagger-ui-es-bundle.js +3 -0
  94. data/lib/public/swagger/swagger-ui-es-bundle.js.map +1 -0
  95. data/lib/public/swagger/swagger-ui-standalone-preset.js +3 -0
  96. data/lib/public/swagger/swagger-ui-standalone-preset.js.map +1 -0
  97. data/lib/public/swagger/swagger-ui.css +4 -0
  98. data/lib/public/swagger/swagger-ui.css.map +1 -0
  99. data/lib/public/swagger/swagger-ui.js +2 -0
  100. data/lib/public/swagger/swagger-ui.js.map +1 -0
  101. data/lib/public/swagger/v1/app.html +19 -0
  102. data/lib/public/swagger/v1/swagger-initializer.js +25 -0
  103. data/lib/serializers/.DS_Store +0 -0
  104. data/lib/serializers/action_not_allowed_serializer.rb +18 -0
  105. data/lib/serializers/api/.DS_Store +0 -0
  106. data/lib/serializers/api/admin/base_serializer.rb +14 -0
  107. data/lib/serializers/api/admin/hash_serializer.rb +22 -0
  108. data/lib/serializers/api/admin/user_serializer.rb +9 -0
  109. data/lib/serializers/api/v1/base_serializer.rb +14 -0
  110. data/lib/serializers/api/v1/hash_serializer.rb +22 -0
  111. data/lib/serializers/api/v1/user_serializer.rb +9 -0
  112. data/lib/serializers/record_not_found_serializer.rb +28 -0
  113. data/lib/serializers/validation_error_serializer.rb +45 -0
  114. data/lib/services/api/admin/generate_access_token_service.rb +34 -0
  115. data/lib/services/api/admin/generate_refresh_token_service.rb +24 -0
  116. data/lib/services/api/authorize_request_service.rb +35 -0
  117. data/lib/services/api/v1/generate_access_token_service.rb +34 -0
  118. data/lib/services/api/v1/generate_refresh_token_service.rb +24 -0
  119. data/lib/spec/controllers/api/admin/sessions_controller_spec.rb +125 -0
  120. data/lib/spec/controllers/api/admin/users_controller_spec.rb +35 -0
  121. data/lib/spec/controllers/api/v1/sessions_controller_spec.rb +125 -0
  122. data/lib/spec/controllers/api/v1/users_controller_spec.rb +23 -0
  123. data/lib/spec/factories/admins.rb +8 -0
  124. data/lib/spec/factories/devices.rb +7 -0
  125. data/lib/spec/factories/posts.rb +6 -0
  126. data/lib/spec/factories/users.rb +8 -0
  127. data/lib/spec/helpers/request_helpers.rb +7 -0
  128. data/lib/spec/models/admin_spec.rb +9 -0
  129. data/lib/spec/models/device_spec.rb +13 -0
  130. data/lib/spec/models/post_spec.rb +6 -0
  131. data/lib/spec/models/user_spec.rb +9 -0
  132. data/lib/spec/rails_helper.rb +66 -0
  133. data/lib/spec/serializers/api/admin/user_serializer.rb +20 -0
  134. data/lib/spec/serializers/api/v1/user_serializer.rb +20 -0
  135. data/lib/spec/spec_helper.rb +94 -0
  136. data/lib/spec/supports/shared_context.rb +19 -0
  137. data/lib/spec/supports/shared_example/admin_authentication.rb +47 -0
  138. data/lib/spec/supports/shared_example/user_authentication.rb +47 -0
  139. metadata +181 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 61aa2b2b00c2ce847133b0c8451cad985890e578b2d4f7004d8143f91cb03d79
4
+ data.tar.gz: b83eaccd62bdc8fbb784b5f6e4d73eaae8a625bab439596e50438cbacf7b5001
5
+ SHA512:
6
+ metadata.gz: ef7b61e6d21fde2fffa212b3c9c9eb0836cbdc04df19c0129867ebcee603987c95a4b95f5cb86cca52aec6ee17b29cc748ae541008f7dac4294738750cfaabe8
7
+ data.tar.gz: eb7bc390fb1883853f0f38cd523418621c95e2f771e3a74b0c7913ccb67f433728d084987b31500666660b505eed5d7d46df16d13f785c22f484568d0219f3cb
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-04-01
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at thanhdh@nal.vn. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in n_base_rails.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Do Huy Thanh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # NBaseRails
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/n_base_rails`. 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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'n_base_rails'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install n_base_rails
22
+
23
+ ## Usage
24
+
25
+ TODO:
26
+ $ rails generate n_base_rails:install
27
+ $ bundle install
28
+
29
+ Update:
30
+ * database yml -> Change database name default
31
+ * update ENV
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/n_base_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/n_base_rails/blob/master/CODE_OF_CONDUCT.md).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Code of Conduct
48
+
49
+ Everyone interacting in the NBaseRails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/n_base_rails/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "n_base_rails"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/.env ADDED
@@ -0,0 +1,4 @@
1
+ RAILS_SECRET_KEY: 503b54f9a2a322513a153ec7c7d9f5079e03cfd354fb40d68bbdffc2289f4cf35e559d773b305f5837dffac3a6eea577a578d39f1b923a03e367cf2b572cd149
2
+ DATABASE_USER: root
3
+ ALLOW_HOST: localhost
4
+ DATABASE_NAME: example
data/lib/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/lib/.rubocop.yml ADDED
@@ -0,0 +1,288 @@
1
+ require: rubocop-rails
2
+
3
+ inherit_from:
4
+ - .rubocop_enabled.yml
5
+ - .rubocop_disabled.yml
6
+
7
+ AllCops:
8
+ Include:
9
+ - 'app/**/*'
10
+ - 'lib/**/*'
11
+ - '**/*.gemspec'
12
+ - 'Gemfile'
13
+ - 'spec/**/*'
14
+ Exclude:
15
+ - 'vendor/**/*'
16
+ - 'config/unicorn.rb'
17
+ - 'bin/*'
18
+ - 'db/**/*'
19
+ - 'script/rails'
20
+ - 'config/**/*'
21
+ - 'app/views/**/*'
22
+ - 'app/assets/**/*'
23
+ - 'app/javascript/**/*'
24
+ - '.idea/**/*'
25
+ - '**/.DS_Store'
26
+ - '**/.keep'
27
+
28
+ Layout/AccessModifierIndentation:
29
+ EnforcedStyle: indent
30
+ SupportedStyles:
31
+ - outdent
32
+ - indent
33
+
34
+ Layout/HashAlignment:
35
+ EnforcedHashRocketStyle: key
36
+ EnforcedColonStyle: key
37
+ EnforcedLastArgumentHashStyle: ignore_implicit
38
+ SupportedLastArgumentHashStyles:
39
+ - always_inspect
40
+ - always_ignore
41
+ - ignore_implicit
42
+ - ignore_explicit
43
+
44
+ Layout/ParameterAlignment:
45
+ EnforcedStyle: with_first_parameter
46
+ SupportedStyles:
47
+ - with_first_parameter
48
+ - with_fixed_indentation
49
+
50
+ Layout/CaseIndentation:
51
+ EnforcedStyle: case
52
+ SupportedStyles:
53
+ - case
54
+ - end
55
+
56
+ Metrics/BlockNesting:
57
+ Max: 3
58
+
59
+ Metrics/AbcSize:
60
+ Max: 100
61
+
62
+ Metrics/BlockLength:
63
+ Max: 1000
64
+
65
+ Metrics/ModuleLength:
66
+ Max: 1000
67
+
68
+ Metrics/ParameterLists:
69
+ Max: 10
70
+
71
+
72
+ Style/StringLiterals:
73
+ EnforcedStyle: double_quotes
74
+ SupportedStyles:
75
+ - single_quotes
76
+ - double_quotes
77
+
78
+ Style/ClassAndModuleChildren:
79
+ EnforcedStyle: nested
80
+ SupportedStyles:
81
+ - nested
82
+ - compact
83
+
84
+ Style/ClassCheck:
85
+ EnforcedStyle: is_a?
86
+ SupportedStyles:
87
+ - is_a?
88
+ - kind_of?
89
+
90
+ Style/CollectionMethods:
91
+ PreferredMethods:
92
+ collect: 'map'
93
+ collect!: 'map!'
94
+ inject: 'reduce'
95
+ detect: 'find'
96
+ find_all: 'select'
97
+
98
+ Style/CommentAnnotation:
99
+ Keywords:
100
+ - TODO
101
+ - FIXME
102
+ - OPTIMIZE
103
+ - REVIEW
104
+
105
+ Metrics/CyclomaticComplexity:
106
+ Max: 20
107
+
108
+ Metrics/PerceivedComplexity:
109
+ Max: 20
110
+
111
+ Layout/EmptyLineBetweenDefs:
112
+ EmptyLineBetweenMethodDefs: true
113
+ EmptyLineBetweenClassDefs: true
114
+ EmptyLineBetweenModuleDefs: true
115
+ AllowAdjacentOneLineDefs: true
116
+
117
+ Layout/EmptyLinesAroundBlockBody:
118
+ EnforcedStyle: no_empty_lines
119
+ SupportedStyles:
120
+ - no_empty_lines
121
+ - empty_lines
122
+
123
+ Layout/EmptyLinesAroundClassBody:
124
+ EnforcedStyle: no_empty_lines
125
+ SupportedStyles:
126
+ - no_empty_lines
127
+ - empty_lines
128
+
129
+ Layout/EmptyLinesAroundModuleBody:
130
+ EnforcedStyle: no_empty_lines
131
+ SupportedStyles:
132
+ - no_empty_lines
133
+ - empty_lines
134
+
135
+ Naming/FileName:
136
+ Exclude:
137
+ - '**/Rakefile'
138
+ - '**/Gemfile'
139
+ - '**/Capfile'
140
+
141
+ Style/HashSyntax:
142
+ EnforcedStyle: ruby19_no_mixed_keys
143
+ SupportedStyles:
144
+ - ruby19
145
+ - hash_rockets
146
+ - no_mixed_keys
147
+ - ruby19_no_mixed_keys
148
+
149
+ Style/LambdaCall:
150
+ EnforcedStyle: call
151
+ SupportedStyles:
152
+ - call
153
+ - braces
154
+
155
+ Metrics/LineLength:
156
+ Max: 120
157
+
158
+ Style/NonNilCheck:
159
+ IncludeSemanticChanges: false
160
+
161
+ Style/MethodDefParentheses:
162
+ EnforcedStyle: require_parentheses
163
+ SupportedStyles:
164
+ - require_parentheses
165
+ - require_no_parentheses
166
+ - require_no_parentheses_except_multiline
167
+
168
+ Metrics/MethodLength:
169
+ CountComments: false
170
+ Max: 60
171
+
172
+ Naming/MethodName:
173
+ EnforcedStyle: snake_case
174
+ SupportedStyles:
175
+ - snake_case
176
+ - camelCase
177
+
178
+ Style/RaiseArgs:
179
+ EnforcedStyle: exploded
180
+ SupportedStyles:
181
+ - compact
182
+ - exploded
183
+
184
+ Style/SingleLineBlockParams:
185
+ Methods:
186
+ - reduce:
187
+ - a
188
+ - e
189
+ - inject:
190
+ - a
191
+ - e
192
+
193
+ Style/Semicolon:
194
+ AllowAsExpressionSeparator: false
195
+
196
+ Style/SingleLineMethods:
197
+ AllowIfMethodIsEmpty: true
198
+
199
+ Layout/SpaceAroundEqualsInParameterDefault:
200
+ EnforcedStyle: space
201
+ SupportedStyles:
202
+ - space
203
+ - no_space
204
+
205
+ Layout/SpaceBeforeBlockBraces:
206
+ EnforcedStyle: space
207
+ SupportedStyles:
208
+ - space
209
+ - no_space
210
+
211
+ Layout/SpaceInsideBlockBraces:
212
+ EnforcedStyle: no_space
213
+ SupportedStyles:
214
+ - space
215
+ - no_space
216
+ EnforcedStyleForEmptyBraces: no_space
217
+ SpaceBeforeBlockParameters: false
218
+
219
+ Layout/SpaceInsideHashLiteralBraces:
220
+ EnforcedStyle: no_space
221
+ EnforcedStyleForEmptyBraces: no_space
222
+ SupportedStyles:
223
+ - space
224
+ - no_space
225
+
226
+ Layout/TrailingEmptyLines:
227
+ EnforcedStyle: final_newline
228
+ SupportedStyles:
229
+ - final_newline
230
+ - final_blank_line
231
+
232
+ Style/TrailingCommaInArrayLiteral:
233
+ EnforcedStyleForMultiline: no_comma
234
+ SupportedStylesForMultiline:
235
+ - comma
236
+ - consistent_comma
237
+ - no_comma
238
+
239
+ Style/TrailingCommaInHashLiteral:
240
+ EnforcedStyleForMultiline: no_comma
241
+ SupportedStylesForMultiline:
242
+ - comma
243
+ - consistent_comma
244
+ - no_comma
245
+
246
+ Style/TrivialAccessors:
247
+ ExactNameMatch: false
248
+ AllowPredicates: false
249
+ AllowDSLWriters: false
250
+
251
+ Naming/VariableName:
252
+ EnforcedStyle: snake_case
253
+ SupportedStyles:
254
+ - snake_case
255
+ - camelCase
256
+
257
+ Naming/VariableNumber:
258
+ EnforcedStyle: snake_case
259
+ SupportedStyles:
260
+ - snake_case
261
+ - camelCase
262
+
263
+ Style/WordArray:
264
+ EnforcedStyle: percent
265
+ SupportedStyles:
266
+ - percent
267
+ - brackets
268
+
269
+ Lint/AssignmentInCondition:
270
+ AllowSafeAssignment: true
271
+
272
+ Layout/EndAlignment:
273
+ EnforcedStyleAlignWith: keyword
274
+
275
+ Layout/DefEndAlignment:
276
+ EnforcedStyleAlignWith: def
277
+
278
+ Rails/HasAndBelongsToMany:
279
+ Include:
280
+ - app/models/**/*.rb
281
+
282
+ Rails/ReadWriteAttribute:
283
+ Include:
284
+ - app/models/**/*.rb
285
+
286
+ Rails/ScopeArgs:
287
+ Include:
288
+ - app/models/**/*.rb
@@ -0,0 +1,31 @@
1
+ Style/ClassAndModuleChildren:
2
+ Description: "Checks style of children classes and modules."
3
+ Enabled: false
4
+
5
+ Style/Documentation:
6
+ Description: "Document classes and non-namespace modules."
7
+ Enabled: false
8
+
9
+ Rails/SkipsModelValidations:
10
+ Description: "Skip validations"
11
+ Enabled: false
12
+
13
+ Lint/MissingSuper:
14
+ Description: "Super when inherit"
15
+ Enabled: false
16
+
17
+ Style/SymbolArray:
18
+ Description: "Use %i or %I for arrays of symbols."
19
+ Enabled: false
20
+
21
+ Rails/UniqueValidationWithoutIndex:
22
+ Description: "Uniq validation without index"
23
+ Enabled: false
24
+
25
+ Metrics/ClassLength:
26
+ Description: "Length of class"
27
+ Enabled: false
28
+
29
+ Naming/VariableNumber:
30
+ Description: "Number in variable"
31
+ Enabled: false
File without changes
data/lib/Capfile ADDED
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load DSL and set up stages
4
+
5
+ require 'capistrano/setup'
6
+
7
+ # Include default deployment tasks
8
+ require 'capistrano/deploy'
9
+
10
+ # Load the SCM plugin appropriate to your project:
11
+ #
12
+ # require "capistrano/scm/hg"
13
+ # install_plugin Capistrano::SCM::Hg
14
+ # or
15
+ # require "capistrano/scm/svn"
16
+ # install_plugin Capistrano::SCM::Svn
17
+ # or
18
+ require 'capistrano/scm/git'
19
+ install_plugin Capistrano::SCM::Git
20
+
21
+ # Include tasks from other gems included in your Gemfile
22
+ #
23
+ # For documentation on these, see for example:
24
+ #
25
+ # https://github.com/capistrano/rvm
26
+ # https://github.com/capistrano/rbenv
27
+ # https://github.com/capistrano/chruby
28
+ # https://github.com/capistrano/bundler
29
+ # https://github.com/capistrano/rails
30
+ # https://github.com/capistrano/passenger
31
+ #
32
+ require 'capistrano/rvm'
33
+ # require "capistrano/rbenv"
34
+ require 'capistrano/dotenv'
35
+
36
+ # require "capistrano/chruby"
37
+ require 'capistrano/bundler'
38
+ require 'capistrano/rails/migrations'
39
+ # require "capistrano/passenger"
40
+ require 'capistrano/puma'
41
+
42
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
43
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
44
+
45
+ install_plugin Capistrano::Puma
46
+ install_plugin Capistrano::Puma::Systemd
data/lib/Gemfile ADDED
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ git_source(:github) {|repo| "https://github.com/#{repo}.git"}
5
+
6
+ ruby "3.0.0"
7
+
8
+ gem "active_model_serializers"
9
+ gem "bootsnap", require: false
10
+ gem "config"
11
+ gem "devise"
12
+ gem "dotenv-rails"
13
+ gem "jwt"
14
+ gem "mysql2"
15
+ gem "pagy"
16
+ gem "paranoia"
17
+ gem "puma", "~> 5.0"
18
+ gem "rack-cors"
19
+ gem "rails", "~> 7.0.0"
20
+
21
+ # gem "image_processing", "~> 1.2"
22
+ gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
23
+
24
+ group :development, :test do
25
+ gem "brakeman", require: false
26
+ gem "factory_bot_rails"
27
+ gem "faker"
28
+ gem "pry-rails"
29
+ gem "rails_best_practices"
30
+ gem "reek"
31
+ gem "rspec-rails"
32
+ gem "rubocop", require: false
33
+ gem "rubocop-checkstyle_formatter", require: false
34
+ gem "rubocop-rails"
35
+ gem "shoulda-matchers"
36
+ gem "simplecov"
37
+ gem "simplecov-json"
38
+ gem "simplecov-rcov"
39
+ end
40
+
41
+ group :development do
42
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
43
+ # gem "spring"
44
+ gem "capistrano"
45
+ gem "capistrano3-puma"
46
+ gem "capistrano-bundler", require: false
47
+ gem "capistrano-dotenv", require: false
48
+ gem "capistrano-passenger", ">= 0.1.1"
49
+ gem "capistrano-rails", require: false
50
+ gem "capistrano-rvm"
51
+ end
@@ -0,0 +1,24 @@
1
+ default: &default
2
+ adapter: mysql2
3
+ encoding: utf8mb4
4
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
5
+ username: <%= ENV.fetch("DATABASE_USER") { "root" } %>
6
+ password: <%= ENV.fetch("DATABASE_PASSWORD") { "" } %>
7
+ port: 3306
8
+ host: <%= ENV.fetch("DATABASE_HOST") { "127.0.0.1" } %>
9
+ socket: /tmp/mysql.sock
10
+
11
+ development:
12
+ <<: *default
13
+ database: <%= ENV.fetch("DATABASE_NANE") { "project_name_dev" } %>
14
+
15
+ test:
16
+ <<: *default
17
+ database: project_name_test
18
+
19
+
20
+ staging:
21
+ <<: *default
22
+
23
+ production:
24
+ <<: *default