neetob 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +3 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +17 -4
- data/README.md +64 -36
- data/bookmarks.md +5 -0
- data/data/branch-protection-rules.json +1 -1
- data/data/github-labels.json +7 -2
- data/lib/neetob/cli/base.rb +22 -10
- data/lib/neetob/cli/fetchorupdate_repos/execute.rb +5 -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 +5 -3
- data/lib/neetob/cli/github/labels/upsert.rb +41 -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/users/commands.rb +3 -1
- data/lib/neetob/cli/users/commits.rb +71 -22
- data/lib/neetob/cli.rb +3 -1
- data/lib/neetob/version.rb +1 -1
- data/neetob.gemspec +50 -0
- metadata +7 -56
- data/LICENSE.txt +0 -21
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/github_access.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +0 -35
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +0 -16
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/runner.rb +0 -35
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/skippable.rb +0 -19
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +0 -32
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +0 -35
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +0 -33
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +0 -36
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +0 -38
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +0 -36
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +0 -72
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +0 -53
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +0 -46
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +0 -38
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +0 -38
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +0 -34
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +0 -39
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +0 -100
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +0 -20
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +0 -42
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +0 -24
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +0 -63
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +0 -62
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +0 -39
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +0 -22
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +0 -162
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +0 -34
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +0 -28
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +0 -25
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +0 -28
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +0 -31
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +0 -44
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +0 -29
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +0 -61
- data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/version.rb +0 -5
- data/env.sample +0 -1
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2022 Udai Gupta
|
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.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "base64"
|
4
|
-
|
5
|
-
module NeetoCompliance
|
6
|
-
class GithubAccess
|
7
|
-
def self.token
|
8
|
-
Base64.decode64(
|
9
|
-
File.read("Gemfile.common.rb")
|
10
|
-
.split("encoded_github_auth_string =")[1]
|
11
|
-
.split("%{")[1]
|
12
|
-
.split("}")[0]
|
13
|
-
.gsub("\\r", "\r")
|
14
|
-
.gsub("\\n", "\n")
|
15
|
-
).split(":")[1]
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.latest_commit_sha(uri)
|
19
|
-
JSON.parse(get(uri))["sha"]
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.get(uri)
|
23
|
-
response = Net::HTTP.get_response(
|
24
|
-
URI(uri), {
|
25
|
-
"Authorization" => "Bearer #{token}"
|
26
|
-
}).body
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NeetoCompliance
|
4
|
-
class NeetoApps
|
5
|
-
def self.list
|
6
|
-
[ "neetoWheel",
|
7
|
-
"neetoChat",
|
8
|
-
"neetoDesk",
|
9
|
-
"neetoKB",
|
10
|
-
"neetoForm",
|
11
|
-
"neetoInvoice",
|
12
|
-
"neetoChangelog",
|
13
|
-
"neetoInvisible",
|
14
|
-
"neetoSocial",
|
15
|
-
"neetoWireframe",
|
16
|
-
"neetoRunner",
|
17
|
-
"neetoPlanner",
|
18
|
-
"neetoCourse",
|
19
|
-
"neetoCrm",
|
20
|
-
"neetoCal",
|
21
|
-
"neetoAuth",
|
22
|
-
"neetoReplay",
|
23
|
-
"neetoQuiz",
|
24
|
-
"neetoTestify",
|
25
|
-
"neetoSite",
|
26
|
-
"neetoDeploy",
|
27
|
-
"neetoMonitor",
|
28
|
-
"neetoCI",
|
29
|
-
"neetoSign",
|
30
|
-
"neetoBugtrap",
|
31
|
-
"neetoGit"
|
32
|
-
]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -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
|