neetob 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +3 -4
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +15 -2
  6. data/README.md +64 -36
  7. data/bookmarks.md +5 -0
  8. data/data/branch-protection-rules.json +1 -1
  9. data/data/github-labels.json +7 -2
  10. data/lib/neetob/cli/base.rb +22 -10
  11. data/lib/neetob/cli/fetchorupdate_repos/execute.rb +5 -3
  12. data/lib/neetob/cli/github/base.rb +7 -0
  13. data/lib/neetob/cli/github/commands.rb +6 -2
  14. data/lib/neetob/cli/github/labels/commands.rb +18 -10
  15. data/lib/neetob/cli/github/labels/delete.rb +5 -3
  16. data/lib/neetob/cli/github/labels/delete_all.rb +5 -3
  17. data/lib/neetob/cli/github/labels/list.rb +5 -3
  18. data/lib/neetob/cli/github/labels/show.rb +5 -3
  19. data/lib/neetob/cli/github/labels/update.rb +5 -3
  20. data/lib/neetob/cli/github/labels/upsert.rb +41 -7
  21. data/lib/neetob/cli/github/make_pr/base.rb +2 -1
  22. data/lib/neetob/cli/github/make_pr/commands.rb +4 -1
  23. data/lib/neetob/cli/github/make_pr/compliance_fix.rb +6 -1
  24. data/lib/neetob/cli/github/make_pr/script.rb +4 -3
  25. data/lib/neetob/cli/github/protect_branch.rb +5 -3
  26. data/lib/neetob/cli/heroku/config_vars/upsert.rb +6 -2
  27. data/lib/neetob/cli/heroku/execute.rb +2 -2
  28. data/lib/neetob/cli/users/commands.rb +3 -1
  29. data/lib/neetob/cli/users/commits.rb +71 -22
  30. data/lib/neetob/cli.rb +3 -1
  31. data/lib/neetob/version.rb +1 -1
  32. data/neetob.gemspec +1 -1
  33. metadata +7 -57
  34. data/LICENSE.txt +0 -21
  35. data/env.sample +0 -1
  36. data/neeto_compliance/lib/neeto_compliance/github_access.rb +0 -29
  37. data/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +0 -35
  38. data/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +0 -16
  39. data/neeto_compliance/lib/neeto_compliance/runner.rb +0 -35
  40. data/neeto_compliance/lib/neeto_compliance/skippable.rb +0 -19
  41. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +0 -32
  42. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +0 -35
  43. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +0 -33
  44. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +0 -36
  45. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +0 -38
  46. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +0 -36
  47. data/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +0 -25
  48. data/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +0 -72
  49. data/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +0 -53
  50. data/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +0 -25
  51. data/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +0 -25
  52. data/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +0 -25
  53. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +0 -46
  54. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +0 -25
  55. data/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +0 -25
  56. data/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +0 -38
  57. data/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +0 -38
  58. data/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +0 -34
  59. data/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +0 -39
  60. data/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +0 -100
  61. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +0 -20
  62. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +0 -42
  63. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +0 -24
  64. data/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +0 -25
  65. data/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +0 -63
  66. data/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +0 -62
  67. data/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +0 -39
  68. data/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +0 -22
  69. data/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +0 -25
  70. data/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +0 -162
  71. data/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +0 -34
  72. data/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +0 -28
  73. data/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +0 -29
  74. data/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +0 -25
  75. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +0 -29
  76. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +0 -29
  77. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +0 -29
  78. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +0 -29
  79. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +0 -28
  80. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +0 -31
  81. data/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +0 -44
  82. data/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +0 -29
  83. data/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +0 -61
  84. data/neeto_compliance/lib/neeto_compliance/version.rb +0 -5
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "base64"
4
-
5
- module NeetoCompliance
6
- class NeetoCommons
7
- def self.path
8
- @@_neeto_commons_path ||= get_path
9
- end
10
-
11
- def self.get_path
12
- path = `bundle info neeto-commons-backend`.split(" ").last
13
- Pathname.new(path).join("lib", "neeto_commons_backend")
14
- end
15
- end
16
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class Runner
5
- def verifiers
6
- app_name == "neeto-auth-web" ? VerifiersList.neeto_auth : VerifiersList.neeto_apps
7
- end
8
-
9
- def process
10
- results = verifiers.map do |verifier|
11
- verifier.new.process
12
- end
13
-
14
- results.all? ? exit(0) : exit(1)
15
- end
16
-
17
- def auto_correct
18
- puts "Running auto_correct ...".yellow
19
- results = verifiers.map do |verifier|
20
- verifier.new.auto_correct!
21
- end
22
-
23
- puts %(
24
- Auto fixing got completed \n
25
- Please run bundle exec neeto-audit once again to fix other errors manually if any \n
26
- ).yellow
27
-
28
- results.all? ? exit(0) : exit(1)
29
- end
30
-
31
- def app_name
32
- @_app_name ||= `git config --get remote.origin.url`.split("/").last.strip.split(".git").first
33
- end
34
- end
35
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Skippable
4
- def self.included(base)
5
- base.class_eval do
6
- include InstanceMethods
7
- end
8
- end
9
-
10
- module InstanceMethods
11
- def skip?
12
- `git config --get remote.origin.url`.split("/").last.strip.include? "neeto-auth-web"
13
- end
14
-
15
- def app_is?(git_repo)
16
- `git config --get remote.origin.url`.split("/").last.strip.include? "#{git_repo}"
17
- end
18
- end
19
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/github_access"
4
- require "neeto_compliance/sync_neeto_commons"
5
-
6
- module NeetoCompliance
7
- class SyncNeetoCommons
8
- class SyncBin
9
- def self.BIN_FILES
10
- [
11
- "bin/bundle",
12
- "bin/setup",
13
- "bin/update",
14
- "bin/webpacker",
15
- "bin/webpacker-dev-server",
16
- "bin/yarn"
17
- ]
18
- end
19
-
20
- def self.process
21
- sync_bin_files
22
- end
23
-
24
- def self.sync_bin_files
25
- self.BIN_FILES.each do |file|
26
- print "Downloading #{file}...\n"
27
- system(`cp #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} #{file}`)
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/github_access"
4
- require "neeto_compliance/sync_neeto_commons"
5
-
6
- module NeetoCompliance
7
- class SyncNeetoCommons
8
- class SyncFormatters
9
- def self.CONFIG_FILES
10
- [
11
- ".eslintrc.js",
12
- ".eslintignore",
13
- ".eslint-rules/helpers/index.js",
14
- ".eslint-rules/imports/enforced.js",
15
- ".eslint-rules/imports/order.js",
16
- ".eslint-rules/globals.js",
17
- ".eslint-rules/overrides.js",
18
- ".eslint-rules/promise.js",
19
- ".eslint-rules/react.js",
20
- # ".rubocop.yml",
21
- ".prettierrc.js",
22
- "cypress-tests/.eslintrc.js",
23
- ".erb-lint.yml",
24
- ]
25
- end
26
-
27
- def self.process
28
- self.CONFIG_FILES.each do |file|
29
- print "Copying #{file}...\n"
30
- system(`cp #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} #{file}`)
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/github_access"
4
- require "neeto_compliance/sync_neeto_commons"
5
-
6
- module NeetoCompliance
7
- class SyncNeetoCommons
8
- class SyncHusky
9
- def self.HUSKY_FILES
10
- [
11
- ".husky/pre-push",
12
- ".husky/pre-commit",
13
- ".husky/helpers/lint_staged.sh",
14
- ".husky/helpers/prevent_conflict_markers.sh",
15
- ".husky/helpers/prevent_pushing_to_main.sh",
16
- ".husky/helpers/verify_neeto_audit.sh"
17
- ]
18
- end
19
-
20
- def self.process
21
- sync_with_husky_files_in_neeto_commons
22
- end
23
-
24
- def self.sync_with_husky_files_in_neeto_commons
25
- self.HUSKY_FILES.each do |file|
26
- print "Downloading #{file}...\n"
27
- system(`cp #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} #{file}`)
28
- system("chmod +x #{file}")
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/github_access"
4
- require "neeto_compliance/sync_neeto_commons"
5
-
6
- module NeetoCompliance
7
- class SyncNeetoCommons
8
- class SyncMisc
9
- def self.MISC_FILES
10
- [
11
- ".editorconfig",
12
- ".vscode/extensions.json",
13
- ".vscode/settings.json",
14
- ".semaphore/commands/run_eslint_on_modified_files.sh",
15
- ".node-version",
16
- ".nvmrc",
17
- ".ruby-version",
18
- ".postcssrc.yml",
19
- "babel.config.js",
20
- "app/javascript/src/types.d.ts"
21
- ]
22
- end
23
-
24
- def self.process
25
- sync_misc_files
26
- end
27
-
28
- def self.sync_misc_files
29
- self.MISC_FILES.each do |file|
30
- print "Downloading #{file}...\n"
31
- system(`cp #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} #{file}`)
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/github_access"
4
- require "neeto_compliance/sync_neeto_commons"
5
- require "fileutils"
6
-
7
- module NeetoCompliance
8
- class SyncNeetoCommons
9
- class SyncTestSupport
10
- SUPPORT_DIR = "test/support"
11
-
12
- def self.SUPPORT_FILES
13
- [
14
- "test/support/assertion_support.rb"
15
- ]
16
- end
17
-
18
- def self.process
19
- ensure_test_support_folder_exists
20
- sync_support_files
21
- end
22
-
23
- def self.ensure_test_support_folder_exists
24
- unless File.directory?(SUPPORT_DIR)
25
- puts "Creating test support directory..."
26
- FileUtils.mkdir_p SUPPORT_DIR
27
- end
28
- end
29
-
30
- def self.sync_support_files
31
- self.SUPPORT_FILES.each do |file|
32
- print "Copying #{file}...\n"
33
- system(`cp #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} #{file}`)
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "neeto_compliance/sync_neeto_commons/sync_bin"
4
- require "neeto_compliance/sync_neeto_commons/sync_formatters"
5
- require "neeto_compliance/sync_neeto_commons/sync_husky"
6
- require "neeto_compliance/sync_neeto_commons/sync_misc"
7
- require "neeto_compliance/sync_neeto_commons/sync_test_support"
8
- require "neeto_compliance/neeto_commons"
9
-
10
- module NeetoCompliance
11
- class SyncNeetoCommons
12
- def self.neeto_commons_url
13
- NeetoCompliance::NeetoCommons.path.join "common_files/"
14
- end
15
-
16
- def process
17
- sync_with_neeto_commons
18
- end
19
-
20
- private
21
-
22
- def sync_with_neeto_commons
23
- syncers = [
24
- SyncBin,
25
- SyncFormatters,
26
- SyncHusky,
27
- SyncMisc,
28
- SyncTestSupport
29
- ]
30
-
31
- syncers.each do |syncer|
32
- syncer.process
33
- end
34
- end
35
- end
36
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class AutoUpdatePrsWithLatestMasterVerifier < Base
5
- def local_copy
6
- ".github/workflows/auto_update_prs_with_latest_master.yml"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "common_files/github/workflows/auto_update_prs_with_latest_master.yml"
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "net/http"
4
- require "json"
5
- require "yaml"
6
- require "set"
7
-
8
- module NeetoCompliance
9
- class Base
10
- def process
11
- return true if app_is_exception?
12
-
13
- # preload the path
14
- NeetoCompliance::NeetoCommons.path
15
-
16
- success, errors = audit
17
-
18
- unless success
19
- errors.each do |error|
20
- puts error
21
- end
22
- else
23
- print "[PASS]\n".green
24
- end
25
-
26
- success
27
- end
28
-
29
- def verifier_name
30
- self.class.to_s
31
- end
32
-
33
- def print_description
34
- print "%-80s" % [verifier_name]
35
- end
36
-
37
- def auto_correct!
38
- unless valid?
39
- puts autofix_command
40
- system autofix_command
41
- end
42
- end
43
-
44
- def autofix_suggestion
45
- "To fix run: #{autofix_command.yellow}"
46
- end
47
-
48
- def error_message
49
- "[FAIL]".red
50
- end
51
-
52
- def audit
53
- print_description
54
- errors = []
55
-
56
- unless valid?
57
- errors << [error_message, autofix_suggestion, "\n"].join("\n")
58
- end
59
-
60
- [errors.length == 0, errors]
61
- end
62
-
63
- def app_is_exception?
64
- current_app = `git config --get remote.origin.url`.split("/").last.strip
65
- apps_exception_list.include?(current_app)
66
- end
67
-
68
- def apps_exception_list
69
- []
70
- end
71
- end
72
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class BundlerVersionVerifier < Base
5
- def latest_bundler_version
6
- @_latest_bundler_version ||= _latest_bundler_version
7
- end
8
-
9
- def _latest_bundler_version
10
- response = Net::HTTP.get(URI("https://rubygems.org/api/v1/versions/bundler.json"))
11
- JSON.parse(response)[0]["number"]
12
- end
13
-
14
- def current_bundler_version
15
- `tail -n 1 ./Gemfile.lock`.strip
16
- end
17
-
18
- def latest_version_being_used?
19
- latest_bundler_version == current_bundler_version
20
- end
21
-
22
- def valid?
23
- unless latest_version_being_used?
24
- @error = %{
25
- Please update the bundler version on your machine to #{latest_bundler_version}
26
- You can follow the following steps:
27
-
28
- 1. Install the latest bundler version:
29
- - gem install bundler
30
- 2. Open Gemfile.lock of the project:
31
- - vim ./Gemfile.lock
32
- 3. Delete the last line that contains the bundler version.
33
- 4. Run:
34
- - bundle install
35
-
36
- You can also watch the following video that contains the same steps:
37
- - https://youtu.be/vqAUIQehbKw
38
- }
39
- return false
40
- end
41
-
42
- true
43
- end
44
-
45
- def autofix_suggestion
46
- @error.yellow
47
- end
48
-
49
- def autofix_command
50
- "gem install bundler; perl -p -i -e 's/#{current_bundler_version}(\n*)\\Z/#{latest_bundler_version}\n/m' Gemfile.lock"
51
- end
52
- end
53
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class CircleciConfigVerifier < Base
5
- def local_copy
6
- ".circleci/config.yml"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join local_copy
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class CommonGemfileVerifier < Base
5
- def local_copy
6
- "Gemfile.common.rb"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "gemfiles", local_copy
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class CommonInitializersVerifier < Base
5
- def local_copy
6
- "config/initializers/common.rb"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "initializers/common.rb"
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class CypressConfigVerifier < Base
5
- def cypress_config_files
6
- @_cypress_config_files ||= {
7
- "cypress-tests/package.json" => NeetoCompliance::NeetoCommons.path.join("cypress/package.json"),
8
- "cypress-tests/cypress/jsconfig.json" => NeetoCompliance::NeetoCommons.path.join("cypress/jsconfig.json"),
9
- "cypress-tests/cypress/webpack.config.js" => NeetoCompliance::NeetoCommons.path.join("cypress/webpack.config.js"),
10
- "cypress-tests/cypress/config/cypress.review.json" => NeetoCompliance::NeetoCommons.path.join("cypress/cypress.review.json"),
11
- "cypress-tests/cypress/resolve.js" => NeetoCompliance::NeetoCommons.path.join("cypress/resolve.js")
12
- }
13
- end
14
-
15
- def auto_correct!
16
- unless valid?
17
- @autofix_commands.each do |command|
18
- puts command
19
- system command
20
- end
21
- end
22
- end
23
-
24
- def autofix_suggestion
25
- @autofix_commands.join("\n").yellow
26
- end
27
-
28
- def valid?
29
- @autofix_commands = []
30
-
31
- cypress_config_files.each_pair do |local_file, common_file|
32
- unless same_file?(local_file, common_file)
33
- @autofix_commands << "cp #{common_file.to_s} #{local_file}"
34
- @autofix_commands << "cd cypress-tests && yarn" if local_file == "cypress-tests/package.json"
35
- end
36
- end
37
-
38
- @autofix_commands.length == 0
39
- end
40
-
41
- def same_file?(local_file, common_file)
42
- File.exist?(local_file) &&
43
- `diff #{local_file} #{common_file.to_s}`.empty?
44
- end
45
- end
46
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class CypressPluginsIndexVerifier < Base
5
- def local_copy
6
- "cypress-tests/cypress/plugins/index.js"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "common_files/cypress-tests/cypress/plugins/index.js"
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class DockerFileDevVerifier < Base
5
- def local_copy
6
- "Dockerfile.dev"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "common_files/Dockerfile.dev"
11
- end
12
-
13
- def verify_command
14
- "diff -N #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- `#{verify_command}`.empty?
19
- end
20
-
21
- def autofix_command
22
- "cp #{commons_copy} #{local_copy}"
23
- end
24
- end
25
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class EnvironmentConfigVerifier < Base
5
- def environment_configs
6
- @_environment_configs ||= {
7
- "config/environments/development.rb": "NeetoCommonsBackend::Environments.development(config)",
8
- "config/environments/test.rb": "NeetoCommonsBackend::Environments.test(config)",
9
- "config/environments/heroku.rb": "NeetoCommonsBackend::Environments.heroku(config)",
10
- "config/environments/staging.rb": "NeetoCommonsBackend::Environments.staging(config)",
11
- "config/environments/production.rb": "NeetoCommonsBackend::Environments.production(config)",
12
- "config/application.rb": "NeetoCommonsBackend::Environments.application(config)"
13
- }
14
- end
15
-
16
- def auto_correct!
17
- end
18
-
19
- def valid?
20
- @errors = []
21
- environment_configs.each_pair do |file, command|
22
- unless config_missing?(file, command)
23
- @errors << "Add #{command} to #{file}"
24
- end
25
- end
26
-
27
- @errors.empty?
28
- end
29
-
30
- def config_missing?(file, command)
31
- system("cat #{file} | grep -q '#{command}'")
32
- end
33
-
34
- def autofix_suggestion
35
- @errors.join("\n").yellow
36
- end
37
- end
38
- end