neetob 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/.semaphore/semaphore.yml +4 -5
- data/CHANGELOG.md +21 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +15 -1
- data/README.md +197 -118
- data/bookmarks.md +30 -0
- data/data/branch-protection-rules.json +1 -1
- data/data/github-labels.json +54 -29
- data/images/commit-message-update.png +0 -0
- data/lib/neetob/cli/base.rb +22 -10
- data/lib/neetob/cli/fetchorupdate_repos/execute.rb +5 -3
- data/lib/neetob/cli/github/auth.rb +3 -3
- data/lib/neetob/cli/github/base.rb +7 -0
- data/lib/neetob/cli/github/commands.rb +6 -2
- data/lib/neetob/cli/github/labels/commands.rb +18 -10
- data/lib/neetob/cli/github/labels/delete.rb +5 -3
- data/lib/neetob/cli/github/labels/delete_all.rb +5 -3
- data/lib/neetob/cli/github/labels/list.rb +5 -3
- data/lib/neetob/cli/github/labels/show.rb +5 -3
- data/lib/neetob/cli/github/labels/update.rb +16 -4
- data/lib/neetob/cli/github/labels/upsert.rb +43 -7
- data/lib/neetob/cli/github/make_pr/base.rb +2 -1
- data/lib/neetob/cli/github/make_pr/commands.rb +4 -1
- data/lib/neetob/cli/github/make_pr/compliance_fix.rb +6 -1
- data/lib/neetob/cli/github/make_pr/script.rb +4 -3
- data/lib/neetob/cli/github/protect_branch.rb +5 -3
- data/lib/neetob/cli/heroku/config_vars/upsert.rb +6 -2
- data/lib/neetob/cli/heroku/execute.rb +2 -2
- data/lib/neetob/cli/ui.rb +1 -1
- data/lib/neetob/cli/users/commands.rb +3 -1
- data/lib/neetob/cli/users/commits.rb +71 -22
- data/lib/neetob/cli.rb +3 -1
- data/lib/neetob/exception_handler.rb +3 -1
- data/lib/neetob/version.rb +1 -1
- data/neetob.gemspec +1 -1
- metadata +8 -57
- data/LICENSE.txt +0 -21
- data/env.sample +0 -1
- data/neeto_compliance/lib/neeto_compliance/github_access.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +0 -35
- data/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +0 -16
- data/neeto_compliance/lib/neeto_compliance/runner.rb +0 -35
- data/neeto_compliance/lib/neeto_compliance/skippable.rb +0 -19
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +0 -32
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +0 -35
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +0 -33
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +0 -36
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +0 -38
- data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +0 -36
- data/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +0 -72
- data/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +0 -53
- data/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +0 -46
- data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +0 -38
- data/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +0 -38
- data/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +0 -34
- data/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +0 -39
- data/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +0 -100
- data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +0 -20
- data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +0 -42
- data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +0 -24
- data/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +0 -63
- data/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +0 -62
- data/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +0 -39
- data/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +0 -22
- data/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +0 -162
- data/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +0 -34
- data/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +0 -28
- data/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +0 -25
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +0 -28
- data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +0 -31
- data/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +0 -44
- data/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +0 -29
- data/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +0 -61
- data/neeto_compliance/lib/neeto_compliance/version.rb +0 -5
@@ -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
|
data/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb
DELETED
@@ -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
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NeetoCompliance
|
4
|
-
class GemVersionVerifier
|
5
|
-
attr_reader :gem_name, :repo_name, :latest_version
|
6
|
-
|
7
|
-
def initialize(gem_name, repo_name, latest_version)
|
8
|
-
@gem_name = gem_name
|
9
|
-
@repo_name = repo_name
|
10
|
-
@latest_version = latest_version
|
11
|
-
end
|
12
|
-
|
13
|
-
def current_version
|
14
|
-
bundler_specs.find { |s| s.name == gem_name }.extension_dir.split("-").last rescue nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def bundler_specs
|
18
|
-
Bundler.definition.specs
|
19
|
-
end
|
20
|
-
|
21
|
-
# def latest_version
|
22
|
-
# uri = "https://api.github.com/repos/#{repo_name}/commits/master"
|
23
|
-
# GithubAccess.latest_commit_sha(uri)
|
24
|
-
# end
|
25
|
-
|
26
|
-
def gem_installed?
|
27
|
-
!current_version.nil?
|
28
|
-
end
|
29
|
-
|
30
|
-
def latest_version_installed?
|
31
|
-
current_version.to_s[0..6] == latest_version.to_s[0..6]
|
32
|
-
end
|
33
|
-
|
34
|
-
def valid?
|
35
|
-
gem_installed? && latest_version_installed?
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NeetoCompliance
|
4
|
-
class GemsVerifierBase < Base
|
5
|
-
def gems
|
6
|
-
[]
|
7
|
-
end
|
8
|
-
|
9
|
-
def latest_versions
|
10
|
-
@_latest_versions ||= _latest_versions
|
11
|
-
end
|
12
|
-
|
13
|
-
def _latest_versions
|
14
|
-
JSON.parse(Net::HTTP.get_response(URI("https://neeto-library-stable-versions.herokuapp.com/versions")).body)
|
15
|
-
end
|
16
|
-
|
17
|
-
def valid?
|
18
|
-
@failed_gems = []
|
19
|
-
|
20
|
-
gems.map do |gem|
|
21
|
-
gv = GemVersionVerifier.new(gem[:name], gem[:repo], latest_versions[gem[:repo]])
|
22
|
-
unless gv.valid?
|
23
|
-
@failed_gems << gem[:name]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
@failed_gems.empty?
|
28
|
-
end
|
29
|
-
|
30
|
-
def autofix_command
|
31
|
-
"bundle update #{@failed_gems.join(' ')}"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NeetoCompliance
|
4
|
-
class GitignoreFileVerifier < Base
|
5
|
-
def local_copy
|
6
|
-
".gitignore"
|
7
|
-
end
|
8
|
-
|
9
|
-
def commons_copy
|
10
|
-
NeetoCompliance::NeetoCommons.path.join "common_files", local_copy
|
11
|
-
end
|
12
|
-
|
13
|
-
def verify_command
|
14
|
-
"diff #{commons_copy} #{local_copy}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def valid?
|
18
|
-
local_gitignore = process_data File.read(local_copy)
|
19
|
-
common_gitignore = process_data File.read(NeetoCompliance::GitignoreFileVerifier.new.commons_copy)
|
20
|
-
common_gitignore.map { |line| return false unless local_gitignore.include?(line) }
|
21
|
-
true
|
22
|
-
end
|
23
|
-
|
24
|
-
def process_data(gitignore_data)
|
25
|
-
gitignore_data.split("\n").map { |line| line.gsub(/^#.*/, "") }
|
26
|
-
end
|
27
|
-
|
28
|
-
def autofix_command
|
29
|
-
"cp #{commons_copy} #{local_copy}"
|
30
|
-
end
|
31
|
-
|
32
|
-
def auto_correct!
|
33
|
-
end
|
34
|
-
|
35
|
-
def autofix_suggestion
|
36
|
-
"Make sure #{local_copy} contains all lines from #{commons_copy.to_s}".yellow
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|