neeto-commons-backend 1.0.89
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintignore +14 -0
- data/.eslintrc.js +87 -0
- data/.husky/helpers/verify_neeto_audit.sh +18 -0
- data/.husky/pre-push +5 -0
- data/.neetoci/neetoci.yml +26 -0
- data/.prettierrc.js +15 -0
- data/.rubocop.yml +626 -0
- data/.ruby-version +1 -0
- data/.semaphore/semaphore.yml +32 -0
- data/.semaphore/staging-deploy.yml +23 -0
- data/Gemfile +92 -0
- data/Gemfile.lock +461 -0
- data/README.md +286 -0
- data/Rakefile +18 -0
- data/app/controllers/api/base_controller.rb +6 -0
- data/app/controllers/neeto_commons_backend/api/base_controller.rb +9 -0
- data/app/controllers/neeto_commons_backend/api/direct_uploads_controller.rb +57 -0
- data/app/controllers/neeto_commons_backend/app_versions_controller.rb +20 -0
- data/app/controllers/neeto_commons_backend/failures_controller.rb +29 -0
- data/app/controllers/neeto_commons_backend/health_check_controller.rb +9 -0
- data/app/controllers/neeto_commons_backend/well_knowns_controller.rb +13 -0
- data/app/mailers/neeto_commons_backend/application_mailer.rb +22 -0
- data/app/models/concerns/neeto_commons_backend/sluggable.rb +27 -0
- data/app/models/concerns/neeto_commons_backend/soft_deletable.rb +20 -0
- data/app/services/neeto_commons_backend/sample_data/common/admin_service.rb +26 -0
- data/app/services/neeto_commons_backend/sample_data/common/app_organization_service.rb +11 -0
- data/app/services/neeto_commons_backend/sample_data/common/base.rb +49 -0
- data/app/services/neeto_commons_backend/sample_data/common/database_cleanup_service.rb +13 -0
- data/app/services/neeto_commons_backend/sample_data/common/loader_service.rb +30 -0
- data/app/services/neeto_commons_backend/sample_data/common/neeto_team_members_service.rb +16 -0
- data/app/services/neeto_commons_backend/sample_data/common/organization_base.rb +36 -0
- data/app/services/neeto_commons_backend/sample_data/common/organization_service.rb +11 -0
- data/app/services/neeto_commons_backend/source_map_publish_service.rb +47 -0
- data/app/views/neeto_commons_backend/failures/show.html.erb +1 -0
- data/app/views/shared/_common.html.erb +8 -0
- data/app/views/shared/_neeto_engineering_replay_widget.html.erb +31 -0
- data/app/views/shared/_neeto_widget.html.erb +30 -0
- data/app/workers/neeto_commons_backend/base_workers/auth.rb +9 -0
- data/app/workers/neeto_commons_backend/base_workers/base.rb +52 -0
- data/app/workers/neeto_commons_backend/base_workers/default.rb +8 -0
- data/app/workers/neeto_commons_backend/base_workers/low.rb +9 -0
- data/app/workers/neeto_commons_backend/base_workers/urgent.rb +9 -0
- data/app/workers/neeto_commons_backend/purge_unattached_files_worker.rb +11 -0
- data/babel.config.js +47 -0
- data/bin/console +15 -0
- data/bin/rails +16 -0
- data/bin/setup +8 -0
- data/config/brakeman.ignore +52 -0
- data/config/locales/en.yml +5 -0
- data/docs/carriers/README.md +5 -0
- data/docs/controller_concerns/README.md +34 -0
- data/docs/controllers/README.md +27 -0
- data/docs/gemfiles/README.md +5 -0
- data/docs/helpers/README.md +21 -0
- data/docs/mailers/README.md +5 -0
- data/docs/model_concerns/README.md +39 -0
- data/docs/routes/README.md +44 -0
- data/docs/scripts/README.md +5 -0
- data/docs/semaphore/README.md +5 -0
- data/docs/services/README.md +23 -0
- data/docs/workers/README.md +32 -0
- data/docs/workflows/README.md +9 -0
- data/lib/Rakefile +4 -0
- data/lib/neeto-commons-backend.rb +62 -0
- data/lib/neeto_commons_backend/.circleci/config.yml +84 -0
- data/lib/neeto_commons_backend/.slugignore +17 -0
- data/lib/neeto_commons_backend/carriers/app_url_carrier.rb +71 -0
- data/lib/neeto_commons_backend/common_files/.bundler-version +1 -0
- data/lib/neeto_commons_backend/common_files/.editorconfig +10 -0
- data/lib/neeto_commons_backend/common_files/.erb-lint.yml +20 -0
- data/lib/neeto_commons_backend/common_files/.eslintignore +14 -0
- data/lib/neeto_commons_backend/common_files/.eslintrc.js +2 -0
- data/lib/neeto_commons_backend/common_files/.gitignore +132 -0
- data/lib/neeto_commons_backend/common_files/.husky/helpers/lint_staged.sh +5 -0
- data/lib/neeto_commons_backend/common_files/.husky/helpers/prevent_conflict_markers.sh +35 -0
- data/lib/neeto_commons_backend/common_files/.husky/helpers/prevent_pushing_to_main.sh +24 -0
- data/lib/neeto_commons_backend/common_files/.husky/helpers/verify_neeto_audit.sh +17 -0
- data/lib/neeto_commons_backend/common_files/.husky/pre-commit +9 -0
- data/lib/neeto_commons_backend/common_files/.husky/pre-push +7 -0
- data/lib/neeto_commons_backend/common_files/.node-version +1 -0
- data/lib/neeto_commons_backend/common_files/.nvmrc +1 -0
- data/lib/neeto_commons_backend/common_files/.postcssrc.yml +6 -0
- data/lib/neeto_commons_backend/common_files/.prettierrc.js +1 -0
- data/lib/neeto_commons_backend/common_files/.rubocop.yml +625 -0
- data/lib/neeto_commons_backend/common_files/.ruby-version +1 -0
- data/lib/neeto_commons_backend/common_files/.semaphore/commands/run_eslint_on_modified_files.sh +5 -0
- data/lib/neeto_commons_backend/common_files/.vscode/extensions.json +10 -0
- data/lib/neeto_commons_backend/common_files/.vscode/settings.json +21 -0
- data/lib/neeto_commons_backend/common_files/Dockerfile.dev +50 -0
- data/lib/neeto_commons_backend/common_files/app/javascript/jsconfig.json +62 -0
- data/lib/neeto_commons_backend/common_files/app/javascript/src/types.d.ts +36 -0
- data/lib/neeto_commons_backend/common_files/babel.config.js +1 -0
- data/lib/neeto_commons_backend/common_files/bin/bundle +5 -0
- data/lib/neeto_commons_backend/common_files/bin/rails +6 -0
- data/lib/neeto_commons_backend/common_files/bin/rake +6 -0
- data/lib/neeto_commons_backend/common_files/bin/setup +40 -0
- data/lib/neeto_commons_backend/common_files/bin/update +33 -0
- data/lib/neeto_commons_backend/common_files/bin/webpacker +17 -0
- data/lib/neeto_commons_backend/common_files/bin/webpacker-dev-server +17 -0
- data/lib/neeto_commons_backend/common_files/bin/yarn +19 -0
- data/lib/neeto_commons_backend/common_files/cypress-tests/.eslintrc.js +57 -0
- data/lib/neeto_commons_backend/common_files/cypress-tests/cypress/plugins/index.js +63 -0
- data/lib/neeto_commons_backend/common_files/github/workflows/auto_update_prs_with_latest_master.yml +21 -0
- data/lib/neeto_commons_backend/common_files/neeto_gems/github/workflows/bump_version.yml +51 -0
- data/lib/neeto_commons_backend/common_files/newrelic.yml +31 -0
- data/lib/neeto_commons_backend/common_files/package-common.json +119 -0
- data/lib/neeto_commons_backend/common_files/roles.yml +34 -0
- data/lib/neeto_commons_backend/common_files/semaphore/semaphore.yml +58 -0
- data/lib/neeto_commons_backend/common_files/sitemap.xml +15 -0
- data/lib/neeto_commons_backend/common_files/test/support/assertion_support.rb +9 -0
- data/lib/neeto_commons_backend/common_files/webpacker.yml +90 -0
- data/lib/neeto_commons_backend/config/secrets.yml +169 -0
- data/lib/neeto_commons_backend/controllers/concerns/api_exceptions.rb +83 -0
- data/lib/neeto_commons_backend/controllers/concerns/api_helpers.rb +9 -0
- data/lib/neeto_commons_backend/controllers/concerns/api_responders.rb +33 -0
- data/lib/neeto_commons_backend/controllers/concerns/authenticatable.rb +51 -0
- data/lib/neeto_commons_backend/controllers/concerns/honeybadger_context.rb +17 -0
- data/lib/neeto_commons_backend/controllers/concerns/store_user_location.rb +23 -0
- data/lib/neeto_commons_backend/cypress/cypress.review.json +13 -0
- data/lib/neeto_commons_backend/cypress/jsconfig.json +17 -0
- data/lib/neeto_commons_backend/cypress/package.json +51 -0
- data/lib/neeto_commons_backend/cypress/resolve.js +16 -0
- data/lib/neeto_commons_backend/cypress/webpack.config.js +21 -0
- data/lib/neeto_commons_backend/engine.rb +6 -0
- data/lib/neeto_commons_backend/environments/application.rb +33 -0
- data/lib/neeto_commons_backend/environments/development.rb +46 -0
- data/lib/neeto_commons_backend/environments/heroku.rb +35 -0
- data/lib/neeto_commons_backend/environments/production.rb +45 -0
- data/lib/neeto_commons_backend/environments/staging.rb +43 -0
- data/lib/neeto_commons_backend/environments/test.rb +29 -0
- data/lib/neeto_commons_backend/gemfiles/Gemfile.common.rb +240 -0
- data/lib/neeto_commons_backend/helpers/auth_server_api.rb +92 -0
- data/lib/neeto_commons_backend/helpers/favicon.rb +18 -0
- data/lib/neeto_commons_backend/helpers/global_props.rb +76 -0
- data/lib/neeto_commons_backend/helpers/neeto_widget_helper.rb +19 -0
- data/lib/neeto_commons_backend/helpers/test_helper.rb +90 -0
- data/lib/neeto_commons_backend/initializers/_enable_extension_hack.rb +32 -0
- data/lib/neeto_commons_backend/initializers/assets.rb +11 -0
- data/lib/neeto_commons_backend/initializers/bullet.rb +26 -0
- data/lib/neeto_commons_backend/initializers/cache_store.rb +27 -0
- data/lib/neeto_commons_backend/initializers/common.rb +33 -0
- data/lib/neeto_commons_backend/initializers/cookies_serializer.rb +11 -0
- data/lib/neeto_commons_backend/initializers/cors.rb +16 -0
- data/lib/neeto_commons_backend/initializers/database_cleaner.rb +11 -0
- data/lib/neeto_commons_backend/initializers/datetime.rb +14 -0
- data/lib/neeto_commons_backend/initializers/email_setup.rb +25 -0
- data/lib/neeto_commons_backend/initializers/filter_parameter_logging.rb +11 -0
- data/lib/neeto_commons_backend/initializers/honeybadger.rb +23 -0
- data/lib/neeto_commons_backend/initializers/kaminari_config.rb +13 -0
- data/lib/neeto_commons_backend/initializers/mime_types.rb +12 -0
- data/lib/neeto_commons_backend/initializers/mini_profiler.rb +14 -0
- data/lib/neeto_commons_backend/initializers/neeto_email_prefixer.rb +40 -0
- data/lib/neeto_commons_backend/initializers/neeto_mail_interceptor.rb +35 -0
- data/lib/neeto_commons_backend/initializers/post_compilation.rb +17 -0
- data/lib/neeto_commons_backend/initializers/rack_attack.rb +38 -0
- data/lib/neeto_commons_backend/initializers/rack_deflater.rb +11 -0
- data/lib/neeto_commons_backend/initializers/rack_timeout.rb +15 -0
- data/lib/neeto_commons_backend/initializers/rails_email_preview.rb +21 -0
- data/lib/neeto_commons_backend/initializers/redis_client_patch.rb +18 -0
- data/lib/neeto_commons_backend/initializers/remove_backtrace_silencers.rb +11 -0
- data/lib/neeto_commons_backend/initializers/session_store.rb +21 -0
- data/lib/neeto_commons_backend/initializers/shared_redis.rb +13 -0
- data/lib/neeto_commons_backend/initializers/sidekiq.rb +46 -0
- data/lib/neeto_commons_backend/initializers/strong_migrations.rb +13 -0
- data/lib/neeto_commons_backend/initializers/wrap_parameters.rb +13 -0
- data/lib/neeto_commons_backend/models/concerns/devise_validator.rb +19 -0
- data/lib/neeto_commons_backend/railtie.rb +20 -0
- data/lib/neeto_commons_backend/routes/catch_all.rb +9 -0
- data/lib/neeto_commons_backend/routes/devise.rb +16 -0
- data/lib/neeto_commons_backend/routes/direct_uploads.rb +9 -0
- data/lib/neeto_commons_backend/routes/draw.rb +29 -0
- data/lib/neeto_commons_backend/routes/email_previews.rb +5 -0
- data/lib/neeto_commons_backend/routes/errors.rb +7 -0
- data/lib/neeto_commons_backend/routes/health.rb +8 -0
- data/lib/neeto_commons_backend/routes/letter_opener.rb +5 -0
- data/lib/neeto_commons_backend/routes/sidekiq.rb +22 -0
- data/lib/neeto_commons_backend/routes/well_knowns.rb +10 -0
- data/lib/neeto_commons_backend/scripts/sync_with_wheel.sh +54 -0
- data/lib/neeto_commons_backend/secrets_management.rb +41 -0
- data/lib/neeto_commons_backend/services/custom_domain_service.rb +40 -0
- data/lib/neeto_commons_backend/tasks/assets.rake +27 -0
- data/lib/neeto_commons_backend/tasks/before_assets_precompile.rake +13 -0
- data/lib/neeto_commons_backend/tasks/simplecov_coverage.rake +25 -0
- data/lib/neeto_commons_backend/version.rb +5 -0
- data/neeto-commons-backend.gemspec +52 -0
- data/package.json +31 -0
- data/yarn.lock +2530 -0
- metadata +497 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
# Helpers
|
2
|
+
|
3
|
+
- #### [sample_data](https://github.com/bigbinary/neeto-commons-backend/tree/main/app/services/neeto_commons_backend/sample_data/common)
|
4
|
+
|
5
|
+
These services helps in setting up the common sample data.
|
6
|
+
|
7
|
+
1. [Admin service](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/sample_data/common/admin_service.rb)
|
8
|
+
|
9
|
+
2. [App organization service](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/sample_data/common/app_organization_service.rb)
|
10
|
+
|
11
|
+
3. [Database cleanup service](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/sample_data/common/database_cleanup_service.rb)
|
12
|
+
|
13
|
+
4. [Neeto team members service](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/sample_data/common/neeto_team_members_service.rb)
|
14
|
+
|
15
|
+
5. [Organization service](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/sample_data/common/organization_base.rb)
|
16
|
+
|
17
|
+
- #### [NeetoCommonsBackend::SourceMapPublishService](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/services/neeto_commons_backend/source_map_publish_service.rb)
|
18
|
+
|
19
|
+
Service to upload SourceMap files to Honeybadger during Heroku deployment process, once the bin/webpack step is completed.
|
20
|
+
|
21
|
+
- #### [NeetoCommonsBackend::Services::CustomDomain](https://github.com/bigbinary/neeto-commons-backend/blob/main/lib/neeto_commons_backend/services/custom_domain_service.rb)
|
22
|
+
|
23
|
+
This service helps in creating and deleting custom domains.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Workers
|
2
|
+
|
3
|
+
- #### [NeetoCommonsBackend::BaseWorkers::Base](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/base_workers/base.rb)
|
4
|
+
|
5
|
+
This worker adds the basic config for Sidekiq logger and adds the following methods for a worker:
|
6
|
+
|
7
|
+
1. `perform_unique_async`
|
8
|
+
2. `perform_unique_in`
|
9
|
+
3. `perform_unique_at`
|
10
|
+
4. `delete_matched`
|
11
|
+
|
12
|
+
This worker also setups Honeybadger to report any exception or errors after Sidekiq reties are exhausted.
|
13
|
+
|
14
|
+
- #### [NeetoCommonsBackend::BaseWorkers::Auth](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/base_workers/auth.rb)
|
15
|
+
|
16
|
+
This adds the base worker for `auth` queue.
|
17
|
+
|
18
|
+
- #### [NeetoCommonsBackend::BaseWorkers::Default](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/base_workers/default.rb)
|
19
|
+
|
20
|
+
This adds the base worker for `default` queue.
|
21
|
+
|
22
|
+
- #### [NeetoCommonsBackend::BaseWorkers::Low](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/base_workers/low.rb)
|
23
|
+
|
24
|
+
This adds the base worker for `low` queue.
|
25
|
+
|
26
|
+
- #### [NeetoCommonsBackend::BaseWorkers::Urgent](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/base_workers/urgent.rb)
|
27
|
+
|
28
|
+
This adds the base worker for `urgent` queue.
|
29
|
+
|
30
|
+
- #### [NeetoCommonsBackend::PurgeUnattachedFilesWorker](https://github.com/bigbinary/neeto-commons-backend/blob/main/app/workers/neeto_commons_backend/purge_unattached_files_worker.rb)
|
31
|
+
|
32
|
+
This worker purges all unattached files from one week ago.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Workflows
|
2
|
+
|
3
|
+
- #### [auto_update_prs_with_latest_master](https://github.com/bigbinary/neeto-commons-backend/blob/main/.github/workflows/auto_update_prs_with_latest_master.yml)
|
4
|
+
|
5
|
+
This is the common workflow used by all the neeto products and nanos to auto update PRs with latest `main`.
|
6
|
+
|
7
|
+
- #### [bump_version](https://github.com/bigbinary/neeto-commons-backend/blob/main/.github/workflows/bump_version.yml)
|
8
|
+
|
9
|
+
This is the common workflow used by all the neeto nanos to auto bump the gem version when a new commit is added into `main` branch.
|
data/lib/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FILE_PATHS = [
|
4
|
+
{ path: "neeto_commons_backend/secrets_management" },
|
5
|
+
{ path: "neeto_commons_backend/helpers/favicon" },
|
6
|
+
{ path: "neeto_commons_backend/helpers/auth_server_api.rb", condition: defined?(Rails) },
|
7
|
+
{ path: "neeto_commons_backend/helpers/test_helper.rb", condition: defined?(Rails) && Rails.env.test? },
|
8
|
+
{ path: "neeto_commons_backend/helpers/neeto_widget_helper", condition: defined?(Rails) },
|
9
|
+
{ path: "neeto_commons_backend/helpers/global_props", condition: defined?(Rails) },
|
10
|
+
{ path: "neeto_commons_backend/routes/draw" },
|
11
|
+
{ path: "neeto_commons_backend/railtie", condition: defined?(Rails) },
|
12
|
+
{ path: "neeto_commons_backend/engine", condition: defined?(Rails) },
|
13
|
+
{ path: "neeto_commons_backend/initializers/_enable_extension_hack" },
|
14
|
+
{ path: "neeto_commons_backend/initializers/datetime" },
|
15
|
+
{ path: "neeto_commons_backend/initializers/strong_migrations" },
|
16
|
+
{ path: "neeto_commons_backend/initializers/assets" },
|
17
|
+
{ path: "neeto_commons_backend/initializers/remove_backtrace_silencers" },
|
18
|
+
{ path: "neeto_commons_backend/initializers/bullet" },
|
19
|
+
{ path: "neeto_commons_backend/initializers/cache_store" },
|
20
|
+
{ path: "neeto_commons_backend/initializers/cookies_serializer" },
|
21
|
+
{ path: "neeto_commons_backend/initializers/cors" },
|
22
|
+
{ path: "neeto_commons_backend/initializers/database_cleaner" },
|
23
|
+
{ path: "neeto_commons_backend/initializers/email_setup" },
|
24
|
+
{ path: "neeto_commons_backend/initializers/neeto_email_prefixer" },
|
25
|
+
{ path: "neeto_commons_backend/initializers/filter_parameter_logging" },
|
26
|
+
{ path: "neeto_commons_backend/initializers/honeybadger" },
|
27
|
+
{ path: "neeto_commons_backend/initializers/kaminari_config" },
|
28
|
+
{ path: "neeto_commons_backend/initializers/neeto_mail_interceptor" },
|
29
|
+
{ path: "neeto_commons_backend/initializers/mime_types" },
|
30
|
+
{ path: "neeto_commons_backend/initializers/mini_profiler" },
|
31
|
+
{ path: "neeto_commons_backend/initializers/rack_attack" },
|
32
|
+
{ path: "neeto_commons_backend/initializers/rack_deflater" },
|
33
|
+
{ path: "neeto_commons_backend/initializers/rack_timeout" },
|
34
|
+
{ path: "neeto_commons_backend/initializers/rails_email_preview" },
|
35
|
+
{ path: "neeto_commons_backend/initializers/session_store" },
|
36
|
+
{ path: "neeto_commons_backend/initializers/sidekiq" },
|
37
|
+
{ path: "neeto_commons_backend/initializers/shared_redis" },
|
38
|
+
{ path: "neeto_commons_backend/initializers/wrap_parameters" },
|
39
|
+
{ path: "neeto_commons_backend/initializers/redis_client_patch" },
|
40
|
+
{ path: "neeto_commons_backend/environments/staging" },
|
41
|
+
{ path: "neeto_commons_backend/environments/development" },
|
42
|
+
{ path: "neeto_commons_backend/environments/test" },
|
43
|
+
{ path: "neeto_commons_backend/environments/production" },
|
44
|
+
{ path: "neeto_commons_backend/environments/heroku" },
|
45
|
+
{ path: "neeto_commons_backend/environments/application" },
|
46
|
+
{ path: "neeto_commons_backend/models/concerns/devise_validator" },
|
47
|
+
{ path: "neeto_commons_backend/controllers/concerns/api_helpers" },
|
48
|
+
{ path: "neeto_commons_backend/controllers/concerns/api_exceptions" },
|
49
|
+
{ path: "neeto_commons_backend/controllers/concerns/api_responders" },
|
50
|
+
{ path: "neeto_commons_backend/controllers/concerns/honeybadger_context" },
|
51
|
+
{ path: "neeto_commons_backend/controllers/concerns/authenticatable" },
|
52
|
+
{ path: "neeto_commons_backend/controllers/concerns/store_user_location" },
|
53
|
+
{ path: "neeto_commons_backend/services/custom_domain_service" },
|
54
|
+
{ path: "neeto_commons_backend/carriers/app_url_carrier" }
|
55
|
+
]
|
56
|
+
|
57
|
+
FILE_PATHS.each do |file|
|
58
|
+
require_relative file[:path] if file[:condition].nil? || file[:condition]
|
59
|
+
end
|
60
|
+
|
61
|
+
module NeetoCommonsBackend
|
62
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
workflows:
|
4
|
+
version: 2
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
cypress-ci:
|
8
|
+
parallelism: 1
|
9
|
+
docker:
|
10
|
+
- image: "cypress/included:10.0.0"
|
11
|
+
working_directory: ~/app
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
- restore_cache:
|
15
|
+
keys:
|
16
|
+
- node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
17
|
+
- run:
|
18
|
+
name: Install Packages
|
19
|
+
command: |
|
20
|
+
cd cypress-tests
|
21
|
+
npm install --legacy-peer-deps
|
22
|
+
- save_cache:
|
23
|
+
key: node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
24
|
+
paths:
|
25
|
+
- ~/cypress-tests/.npm
|
26
|
+
- run:
|
27
|
+
name: Execute cypress
|
28
|
+
command: |
|
29
|
+
cd cypress-tests
|
30
|
+
npm run cy:run --ENVIRONMENT="review" --START_URL=${START_URL} --RECORD_KEY=${RECORD_KEY}
|
31
|
+
- store_artifacts:
|
32
|
+
path: cypress-tests/coverage/lcov-report
|
33
|
+
cypress-ci-happy-path:
|
34
|
+
parallelism: 1
|
35
|
+
docker:
|
36
|
+
- image: "cypress/included:10.0.0"
|
37
|
+
working_directory: ~/app
|
38
|
+
steps:
|
39
|
+
- checkout
|
40
|
+
- restore_cache:
|
41
|
+
keys:
|
42
|
+
- node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
43
|
+
- run:
|
44
|
+
name: Install Packages
|
45
|
+
command: |
|
46
|
+
cd cypress-tests
|
47
|
+
npm install --legacy-peer-deps
|
48
|
+
- save_cache:
|
49
|
+
key: node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
50
|
+
paths:
|
51
|
+
- ~/cypress-tests/.npm
|
52
|
+
- run:
|
53
|
+
name: Execute cypress
|
54
|
+
command: |
|
55
|
+
cd cypress-tests
|
56
|
+
npm run cy:run:happypath --ENVIRONMENT="review" --START_URL=${START_URL} --RECORD_KEY=${RECORD_KEY}
|
57
|
+
- store_artifacts:
|
58
|
+
path: cypress-tests/coverage/lcov-report
|
59
|
+
cypress-ci-nightly-test:
|
60
|
+
parallelism: 1
|
61
|
+
docker:
|
62
|
+
- image: "cypress/included:10.0.0"
|
63
|
+
working_directory: ~/app
|
64
|
+
steps:
|
65
|
+
- checkout
|
66
|
+
- restore_cache:
|
67
|
+
keys:
|
68
|
+
- node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
69
|
+
- run:
|
70
|
+
name: Install Packages
|
71
|
+
command: |
|
72
|
+
cd cypress-tests
|
73
|
+
npm install --legacy-peer-deps
|
74
|
+
- save_cache:
|
75
|
+
key: node-deps-v1-{{ .Branch }}-{{ checksum "cypress-tests/yarn.lock" }}
|
76
|
+
paths:
|
77
|
+
- ~/cypress-tests/.npm
|
78
|
+
- run:
|
79
|
+
name: Execute cypress
|
80
|
+
command: |
|
81
|
+
cd cypress-tests
|
82
|
+
npm run cy:run:nightly --STAGING_URL=${STAGING_URL} --ENVIRONMENT="staging" --RECORD_KEY=${RECORD_KEY}
|
83
|
+
- store_artifacts:
|
84
|
+
path: cypress-tests/coverage/lcov-report
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/test
|
2
|
+
/spec
|
3
|
+
/docs
|
4
|
+
/cypress-tests
|
5
|
+
/selenium-tests
|
6
|
+
/doc
|
7
|
+
/tmp/cache
|
8
|
+
/.cache/yarn
|
9
|
+
/.semaphore
|
10
|
+
/.rubocop.yml
|
11
|
+
/README.md
|
12
|
+
/Procfile.dev
|
13
|
+
/.editorconfig
|
14
|
+
/.dockerignore
|
15
|
+
/Dockerfile.dev
|
16
|
+
/docker-entrypoint.sh
|
17
|
+
/docker-compose.yml
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NeetoCommonsBackend
|
4
|
+
class AppUrlCarrier
|
5
|
+
def self.app_url(request = nil)
|
6
|
+
return URI(request.base_url) if request.present?
|
7
|
+
|
8
|
+
# APP URL for review apps
|
9
|
+
return review_app_url if Rails.env.heroku?
|
10
|
+
|
11
|
+
host_url = app_secrets.host
|
12
|
+
return URI(host_url) if host_url.present?
|
13
|
+
|
14
|
+
URI "http://#{app_secrets.local_domain}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.root_url(subdomain)
|
18
|
+
if Rails.env.heroku?
|
19
|
+
review_app_url.to_s
|
20
|
+
else
|
21
|
+
app_protocol + subdomain + "." + app_url.host.sub(
|
22
|
+
/(\A#{Organization::PLATFORM_SUBDOMAINS.join('|')})./,
|
23
|
+
"") + app_port
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.websocket_url(subdomain)
|
28
|
+
if Rails.env.heroku?
|
29
|
+
uri = review_app_url
|
30
|
+
uri.scheme = "wss"
|
31
|
+
uri.path = "/cable"
|
32
|
+
uri.to_s
|
33
|
+
else
|
34
|
+
ws_protocol + subdomain + "." + app_url.host.sub(/(\A#{Organization::PLATFORM_SUBDOMAINS.join('|')})./, "") + app_port + "/cable"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.review_app_url
|
39
|
+
heroku = app_secrets.heroku
|
40
|
+
if heroku[:app_name].present?
|
41
|
+
URI("https://#{heroku[:app_name]}.#{heroku[:domain_name]}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.domain_url(organization)
|
46
|
+
custom_domain = organization.custom_domains&.where(status: "active").first
|
47
|
+
|
48
|
+
if custom_domain.present?
|
49
|
+
"#{app_protocol}#{custom_domain.hostname}"
|
50
|
+
else
|
51
|
+
root_url(organization.subdomain)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.app_port
|
56
|
+
app_secrets[:app_port_string] || ""
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.app_protocol
|
60
|
+
app_secrets[:app_protocol]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.ws_protocol
|
64
|
+
app_secrets[:ws_protocol]
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.app_secrets
|
68
|
+
@_app_secrets ||= Rails.application.secrets
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2.4.8
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
glob: "app/views/**/*.{html}{+*,}.erb"
|
3
|
+
exclude:
|
4
|
+
- '**/vendor/**/*'
|
5
|
+
- '**/node_modules/**/*'
|
6
|
+
EnableDefaultLinters: true
|
7
|
+
linters:
|
8
|
+
PartialInstanceVariable:
|
9
|
+
enabled: true
|
10
|
+
ErbSafety:
|
11
|
+
enabled: true
|
12
|
+
Rubocop:
|
13
|
+
enabled: true
|
14
|
+
rubocop_config:
|
15
|
+
inherit_from:
|
16
|
+
- .rubocop.yml
|
17
|
+
Style/FrozenStringLiteralComment:
|
18
|
+
Enabled: false
|
19
|
+
Layout/TrailingEmptyLines:
|
20
|
+
Enabled: false
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# Ignore bundler config
|
2
|
+
/.bundle
|
3
|
+
|
4
|
+
# Ignore all SQLite databases
|
5
|
+
/db/*.sqlite3*
|
6
|
+
|
7
|
+
# Ignore database.yml file
|
8
|
+
/config/database.yml
|
9
|
+
|
10
|
+
# Ignore all logfiles
|
11
|
+
/log/*
|
12
|
+
/tmp
|
13
|
+
/db/backups
|
14
|
+
/public/uploads
|
15
|
+
*.DS_Store
|
16
|
+
coverage
|
17
|
+
.*swp
|
18
|
+
/uploads/*
|
19
|
+
.byebug_history
|
20
|
+
|
21
|
+
# Ignore node packages
|
22
|
+
node_modules
|
23
|
+
|
24
|
+
# Rails specific ignores
|
25
|
+
/storage
|
26
|
+
/vendor
|
27
|
+
test/reports
|
28
|
+
test/fixtures/*
|
29
|
+
!test/fixtures/files
|
30
|
+
/public/packs
|
31
|
+
/public/assets
|
32
|
+
/public/packs-test
|
33
|
+
|
34
|
+
# Ignore master key for decrypting credentials and more
|
35
|
+
/config/master.key
|
36
|
+
|
37
|
+
# Ignore environment variables
|
38
|
+
/.env
|
39
|
+
|
40
|
+
#---------------------------------------#
|
41
|
+
# IDEs & Editors Ignores #
|
42
|
+
#---------------------------------------#
|
43
|
+
# Sublime Text
|
44
|
+
*.sublime*
|
45
|
+
.sublime-gulp.cache
|
46
|
+
# JetBrains IDEs
|
47
|
+
.idea/
|
48
|
+
# VIM
|
49
|
+
## Session
|
50
|
+
Session.vim
|
51
|
+
Sessionx.vim
|
52
|
+
## Temporary
|
53
|
+
.netrwhist
|
54
|
+
## Backup and swap files
|
55
|
+
*~
|
56
|
+
## Auto-generated tag files
|
57
|
+
/tags
|
58
|
+
# Vscode
|
59
|
+
.vscode-test
|
60
|
+
|
61
|
+
#---------------------------------------#
|
62
|
+
# Linux Ignores #
|
63
|
+
#---------------------------------------#
|
64
|
+
# directory preferences
|
65
|
+
.directory
|
66
|
+
|
67
|
+
#---------------------------------------#
|
68
|
+
# OSX Ignores #
|
69
|
+
#---------------------------------------#
|
70
|
+
.DS_Store
|
71
|
+
.AppleDouble
|
72
|
+
.LSOverride
|
73
|
+
.localized
|
74
|
+
|
75
|
+
#---------------------------------------#
|
76
|
+
# Windows Ignores #
|
77
|
+
#---------------------------------------#
|
78
|
+
# Windows image file caches
|
79
|
+
Thumbs.db
|
80
|
+
ehthumbs.db
|
81
|
+
# Folder config file
|
82
|
+
Desktop.ini
|
83
|
+
# Recycle Bin used on file shares
|
84
|
+
$RECYCLE.BIN/
|
85
|
+
# Files that might appear on external disk
|
86
|
+
.Spotlight-V100
|
87
|
+
.Trashes
|
88
|
+
|
89
|
+
#---------------------------------------#
|
90
|
+
# Tools and Package specific ignores #
|
91
|
+
#---------------------------------------#
|
92
|
+
.eslintcache
|
93
|
+
yarn-error.log
|
94
|
+
yarn-debug.log*
|
95
|
+
.yarn-integrity
|
96
|
+
.yarnrc
|
97
|
+
yarn-1.22.5.cjs
|
98
|
+
yarn-1.22.5.js
|
99
|
+
|
100
|
+
# Ignore node_modules in cypress folder
|
101
|
+
cypress-tests/node_modules
|
102
|
+
|
103
|
+
# Ignore package-lock.json in cypress folder
|
104
|
+
cypress-tests/package-lock.json
|
105
|
+
|
106
|
+
# Ignore all logfiles and tempfiles in cypress folder
|
107
|
+
cypress-tests/cypress/results
|
108
|
+
cypress-tests/debug.log
|
109
|
+
|
110
|
+
# Ignore IDE related files in cypress folder
|
111
|
+
cypress-tests/.vscode
|
112
|
+
|
113
|
+
# Ignore cypress screenshots and videos
|
114
|
+
cypress-tests/cypress/artifacts/screenshots/
|
115
|
+
cypress-tests/cypress/artifacts/videos/
|
116
|
+
cypress-tests/cypress/screenshots/
|
117
|
+
cypress-tests/cypress/videos/
|
118
|
+
|
119
|
+
# Ignore redis dump file
|
120
|
+
dump.rdb
|
121
|
+
*.dump
|
122
|
+
|
123
|
+
# Ignore yalc generated files
|
124
|
+
yalc.lock
|
125
|
+
/.yalc
|
126
|
+
|
127
|
+
|
128
|
+
# Ignore overwritten env file
|
129
|
+
.env*.local
|
130
|
+
|
131
|
+
# cypress code coverage
|
132
|
+
.nyc_output
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
3
|
+
repeat() {
|
4
|
+
char="$1"
|
5
|
+
times="$2"
|
6
|
+
text=""
|
7
|
+
i=0
|
8
|
+
|
9
|
+
while [ $i -lt $times ]
|
10
|
+
do
|
11
|
+
text="${text}${char}"
|
12
|
+
i=$((i+1))
|
13
|
+
done
|
14
|
+
echo "$text"
|
15
|
+
}
|
16
|
+
|
17
|
+
prevent_conflict_markers() {
|
18
|
+
TERM="xterm-256color"
|
19
|
+
RED=$(tput setab 1)
|
20
|
+
NORMAL=$(tput sgr0)
|
21
|
+
|
22
|
+
left_arrow=$(repeat '<' 7)
|
23
|
+
right_arrow=$(repeat '>' 7)
|
24
|
+
equal_symbol=$(repeat '=' 7)
|
25
|
+
|
26
|
+
CONFLICT_MARKERS="${left_arrow}|${equal_symbol}|${right_arrow}"
|
27
|
+
occurrences_count=$(git --no-pager diff --staged --ignore-blank-lines --name-only -G"$CONFLICT_MARKERS" | wc -l)
|
28
|
+
if [ "$occurrences_count" -gt 0 ]
|
29
|
+
then
|
30
|
+
echo "$RED ERROR $NORMAL Found ${CONFLICT_MARKERS} symbols in staged files."
|
31
|
+
echo "Conflict markers should be removed from the following files before committing:"
|
32
|
+
git --no-pager diff --staged --ignore-blank-lines --name-only -G"$CONFLICT_MARKERS"
|
33
|
+
exit 1;
|
34
|
+
fi
|
35
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
prevent_pushing_to_main() {
|
4
|
+
current_branch=`git symbolic-ref HEAD`
|
5
|
+
current_origin=`git remote`
|
6
|
+
if [ current_origin = "origin" -o "$current_branch" = "refs/heads/master" -o "$current_branch" = "refs/heads/main" ]
|
7
|
+
then
|
8
|
+
cat <<EOT
|
9
|
+
--------------------------------------------------------------------------------------
|
10
|
+
You are not authorized to push/commit directly to master/main branch in origin remote.
|
11
|
+
Push from a new branch and make the PR.
|
12
|
+
|
13
|
+
Or if you are 100% sure you want to push/commit to master/main branch,
|
14
|
+
then pass in the optional --no-verify option with the git command.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
# Warning: pushing to main is not recommended
|
18
|
+
git push origin main --no-verify
|
19
|
+
--------------------------------------------------------------------------------------
|
20
|
+
EOT
|
21
|
+
echo "";
|
22
|
+
exit 1;
|
23
|
+
fi
|
24
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
print_running_neeto_audit() {
|
4
|
+
cat <<EOT
|
5
|
+
======================================================================================
|
6
|
+
Running:
|
7
|
+
|
8
|
+
bundle exec neeto-audit
|
9
|
+
======================================================================================
|
10
|
+
EOT
|
11
|
+
}
|
12
|
+
|
13
|
+
verify_neeto_audit() {
|
14
|
+
print_running_neeto_audit
|
15
|
+
|
16
|
+
bundle exec neeto-audit
|
17
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. "$(dirname "$0")/_/husky.sh"
|
3
|
+
. "$(dirname "$0")/helpers/lint_staged.sh"
|
4
|
+
. "$(dirname "$0")/helpers/prevent_pushing_to_main.sh"
|
5
|
+
. "$(dirname "$0")/helpers/prevent_conflict_markers.sh"
|
6
|
+
|
7
|
+
prevent_pushing_to_main
|
8
|
+
prevent_conflict_markers
|
9
|
+
lint_staged_files
|
@@ -0,0 +1 @@
|
|
1
|
+
18.12
|
@@ -0,0 +1 @@
|
|
1
|
+
18.12
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require("@bigbinary/neeto-commons-frontend/configs/prettier.js");
|