neetob 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +10 -0
  3. data/.env +1 -0
  4. data/.rubocop.yml +596 -0
  5. data/.ruby-version +1 -0
  6. data/.semaphore/semaphore.yml +31 -0
  7. data/CHANGELOG.md +5 -0
  8. data/CODE_OF_CONDUCT.md +84 -0
  9. data/Gemfile +26 -0
  10. data/Gemfile.lock +249 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +381 -0
  13. data/Rakefile +16 -0
  14. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/github_access.rb +29 -0
  15. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +35 -0
  16. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +16 -0
  17. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/runner.rb +35 -0
  18. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/skippable.rb +19 -0
  19. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +32 -0
  20. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +35 -0
  21. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +33 -0
  22. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +36 -0
  23. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +38 -0
  24. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +36 -0
  25. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +25 -0
  26. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +72 -0
  27. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +53 -0
  28. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +25 -0
  29. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +25 -0
  30. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +25 -0
  31. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +46 -0
  32. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +25 -0
  33. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +25 -0
  34. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +38 -0
  35. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +38 -0
  36. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +34 -0
  37. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +39 -0
  38. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +100 -0
  39. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +20 -0
  40. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +42 -0
  41. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +24 -0
  42. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +25 -0
  43. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +63 -0
  44. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +62 -0
  45. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +39 -0
  46. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +22 -0
  47. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +25 -0
  48. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +162 -0
  49. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +34 -0
  50. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +28 -0
  51. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +29 -0
  52. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +25 -0
  53. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +29 -0
  54. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +29 -0
  55. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +29 -0
  56. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +29 -0
  57. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +28 -0
  58. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +31 -0
  59. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +44 -0
  60. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +29 -0
  61. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +61 -0
  62. data/Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/version.rb +5 -0
  63. data/data/branch-protection-rules.json +25 -0
  64. data/data/config-vars-audit.json +18 -0
  65. data/data/config-vars-list.json +1 -0
  66. data/data/config-vars-upsert.json +3 -0
  67. data/data/github-labels.json +192 -0
  68. data/env.sample +1 -0
  69. data/exe/neetob +25 -0
  70. data/install.sh +21 -0
  71. data/lib/neetob/cli/base.rb +85 -0
  72. data/lib/neetob/cli/fetchorupdate_repos/execute.rb +53 -0
  73. data/lib/neetob/cli/github/auth.rb +134 -0
  74. data/lib/neetob/cli/github/base.rb +35 -0
  75. data/lib/neetob/cli/github/commands.rb +50 -0
  76. data/lib/neetob/cli/github/issues/commands.rb +51 -0
  77. data/lib/neetob/cli/github/issues/create.rb +42 -0
  78. data/lib/neetob/cli/github/issues/list.rb +94 -0
  79. data/lib/neetob/cli/github/labels/commands.rb +62 -0
  80. data/lib/neetob/cli/github/labels/delete.rb +44 -0
  81. data/lib/neetob/cli/github/labels/delete_all.rb +48 -0
  82. data/lib/neetob/cli/github/labels/list.rb +36 -0
  83. data/lib/neetob/cli/github/labels/show.rb +37 -0
  84. data/lib/neetob/cli/github/labels/update.rb +40 -0
  85. data/lib/neetob/cli/github/labels/upsert.rb +62 -0
  86. data/lib/neetob/cli/github/login.rb +16 -0
  87. data/lib/neetob/cli/github/make_pr/base.rb +72 -0
  88. data/lib/neetob/cli/github/make_pr/commands.rb +37 -0
  89. data/lib/neetob/cli/github/make_pr/compliance_fix.rb +49 -0
  90. data/lib/neetob/cli/github/make_pr/script.rb +55 -0
  91. data/lib/neetob/cli/github/protect_branch.rb +46 -0
  92. data/lib/neetob/cli/github/search.rb +38 -0
  93. data/lib/neetob/cli/heroku/access/add.rb +38 -0
  94. data/lib/neetob/cli/heroku/access/commands.rb +41 -0
  95. data/lib/neetob/cli/heroku/access/list.rb +36 -0
  96. data/lib/neetob/cli/heroku/access/remove.rb +38 -0
  97. data/lib/neetob/cli/heroku/commands.rb +28 -0
  98. data/lib/neetob/cli/heroku/config_vars/audit.rb +64 -0
  99. data/lib/neetob/cli/heroku/config_vars/base.rb +19 -0
  100. data/lib/neetob/cli/heroku/config_vars/commands.rb +49 -0
  101. data/lib/neetob/cli/heroku/config_vars/list.rb +56 -0
  102. data/lib/neetob/cli/heroku/config_vars/remove.rb +39 -0
  103. data/lib/neetob/cli/heroku/config_vars/upsert.rb +80 -0
  104. data/lib/neetob/cli/heroku/execute.rb +37 -0
  105. data/lib/neetob/cli/local/commands.rb +19 -0
  106. data/lib/neetob/cli/local/ls.rb +29 -0
  107. data/lib/neetob/cli/sub_command_base.rb +17 -0
  108. data/lib/neetob/cli/ui.rb +41 -0
  109. data/lib/neetob/cli/users/audit.rb +121 -0
  110. data/lib/neetob/cli/users/commands.rb +28 -0
  111. data/lib/neetob/cli/users/commits.rb +125 -0
  112. data/lib/neetob/cli.rb +40 -0
  113. data/lib/neetob/exception_handler.rb +58 -0
  114. data/lib/neetob/utils.rb +16 -0
  115. data/lib/neetob/version.rb +5 -0
  116. data/lib/neetob.rb +10 -0
  117. data/overcommit.yml +43 -0
  118. data/scripts/delete_unused_assets.rb +67 -0
  119. metadata +235 -0
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ require "neeto_compliance/sync_neeto_commons"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ class MiscFilesVerifier
12
+ def process
13
+ non_complied_misc_files = find_non_complied_misc_files
14
+
15
+ return false if non_complied_misc_files.any?
16
+
17
+ true
18
+ end
19
+
20
+ private
21
+
22
+ def find_non_complied_misc_files
23
+ NeetoCompliance::SyncNeetoCommons::SyncMisc.MISC_FILES.select do |file|
24
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "neeto_compliance/sync_neeto_commons"
4
+ require "neeto_compliance/sync_neeto_commons/sync_test_support"
5
+
6
+ module NeetoCompliance
7
+ class SyncNeetoCommonsVerifier < Base
8
+ class TestSupportFilesVerifier
9
+ def process
10
+ return false unless support_folder_exist?
11
+
12
+ non_complied_test_support_files.empty?
13
+ end
14
+
15
+ private
16
+
17
+ def support_folder_exist?
18
+ File.directory?(NeetoCompliance::SyncNeetoCommons::SyncTestSupport::SUPPORT_DIR)
19
+ end
20
+
21
+ def non_complied_test_support_files
22
+ NeetoCompliance::SyncNeetoCommons::SyncTestSupport.SUPPORT_FILES.select do |file|
23
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier"
4
+ require "neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier"
5
+ require "neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier"
6
+ require "neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier"
7
+ require "neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ def valid?
12
+ verifiers = [
13
+ BinFilesVerifier,
14
+ FormatterFilesVerifier,
15
+ HuskyFilesVerifier,
16
+ MiscFilesVerifier,
17
+ TestSupportFilesVerifier
18
+ ]
19
+
20
+ results = verifiers.map do |verifier|
21
+ verifier.new.process
22
+ end
23
+
24
+ success = results.all?
25
+ end
26
+
27
+ def autofix_command
28
+ "bundle exec sync-with-neeto-commons"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class WebpackConfigurationVerifier < Base
5
+ def files_to_sync
6
+ @_files_to_sync ||= {
7
+ "config/webpack/development.js" => NeetoCompliance::NeetoCommons.path.join("webpack/development.js"),
8
+ "config/webpack/production.js" => NeetoCompliance::NeetoCommons.path.join("webpack/production.js"),
9
+ "config/webpack/staging.js" => NeetoCompliance::NeetoCommons.path.join("webpack/staging.js"),
10
+ "config/webpack/test.js" => NeetoCompliance::NeetoCommons.path.join("webpack/test.js")
11
+ }
12
+ end
13
+
14
+ def auto_correct!
15
+ unless valid?
16
+ @autofix_commands.each do |command|
17
+ puts command
18
+ system(command)
19
+ end
20
+ end
21
+ end
22
+
23
+ def autofix_suggestion
24
+ @autofix_commands.join("\n").yellow
25
+ end
26
+
27
+ def valid?
28
+ @autofix_commands = []
29
+
30
+ files_to_sync.each_pair do |local_file, common_file|
31
+ unless same_file?(local_file, common_file)
32
+ @autofix_commands << "cp #{common_file.to_s} #{local_file}"
33
+ end
34
+ end
35
+
36
+ @autofix_commands.length == 0
37
+ end
38
+
39
+ def same_file?(local_file, common_file)
40
+ File.exist?(local_file) &&
41
+ `diff #{local_file} #{common_file.to_s}`.empty?
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class WebpackerConfigVerifier < Base
5
+ def local_copy
6
+ "config/webpacker.yml"
7
+ end
8
+
9
+ def commons_copy
10
+ NeetoCompliance::NeetoCommons.path.join "common_files/webpacker.yml"
11
+ end
12
+
13
+ def compare_files
14
+ @file_difference = `diff #{commons_copy} #{local_copy} | grep '<'`
15
+ end
16
+
17
+ def valid?
18
+ compare_files
19
+ @file_difference.empty?
20
+ end
21
+
22
+ def autofix_suggestion
23
+ warning = "Following configuration lines are missing in webpacker config (config/webpacker.yml). Please refer #{commons_copy}"
24
+ .yellow
25
+ missing_lines = @file_difference.delete("<").red
26
+ "#{warning}\n\n#{missing_lines}"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class VerifiersList
5
+ def self.neeto_auth
6
+ [
7
+ NeetoAuthGemsVerifier,
8
+ CircleciConfigVerifier,
9
+ SitemapConfigVerifier,
10
+ # CommonInitializersVerifier,
11
+ NewrelicVerifier,
12
+ RubyVersionVerifier,
13
+ DockerFileDevVerifier,
14
+ NodeVersionVerifier,
15
+ SlugignoreFileVerifier,
16
+ GitignoreFileVerifier,
17
+ WebpackConfigurationVerifier,
18
+ SidekiqQueuesVerifier,
19
+ SimplecovConfigVerifier,
20
+ PackageDependenciesVersionVerifier,
21
+ PackageJsonVerifier,
22
+ CypressConfigVerifier,
23
+ # BundlerVersionVerifier,
24
+ SyncNeetoCommonsVerifier,
25
+ CypressPluginsIndexVerifier,
26
+ WebpackerConfigVerifier
27
+ ]
28
+ end
29
+
30
+ def self.neeto_apps
31
+ [
32
+ NeetoGemsVerifier,
33
+ CircleciConfigVerifier,
34
+ SitemapConfigVerifier,
35
+ CommonGemfileVerifier,
36
+ CommonInitializersVerifier,
37
+ NewrelicVerifier,
38
+ RubyVersionVerifier,
39
+ DockerFileDevVerifier,
40
+ NodeVersionVerifier,
41
+ SlugignoreFileVerifier,
42
+ GitignoreFileVerifier,
43
+ SemaphoreciConfigVerifier,
44
+ EnvironmentConfigVerifier,
45
+ WebpackConfigurationVerifier,
46
+ SidekiqQueuesVerifier,
47
+ SimplecovConfigVerifier,
48
+ PackageDependenciesVersionVerifier,
49
+ PackageJsonVerifier,
50
+ CypressConfigVerifier,
51
+ # BundlerVersionVerifier,
52
+ SyncNeetoCommonsVerifier,
53
+ RolesVerifier,
54
+ JsconfigVerifier,
55
+ AutoUpdatePrsWithLatestMasterVerifier,
56
+ CypressPluginsIndexVerifier,
57
+ WebpackerConfigVerifier
58
+ ]
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ VERSION = "2.0.0"
5
+ end
@@ -0,0 +1,25 @@
1
+ // Check out the official [documentation](https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection)
2
+ // by Github to know about all the available parameters or options to update different branch protection rules.
3
+ {
4
+ "required_status_checks": {
5
+ "strict": true,
6
+ "contexts": ["ci/semaphoreci/push: cicheck"]
7
+ },
8
+ "required_conversation_resolution": true,
9
+ "has_required_deployments": true,
10
+ "required_pull_request_reviews": {
11
+ "dismiss_stale_reviews": false,
12
+ "require_last_push_approval": false,
13
+ "require_code_owner_reviews": false,
14
+ "required_approving_review_count": 0
15
+ },
16
+ "required_signatures": false,
17
+ "enforce_admins": false,
18
+ "required_linear_history": false,
19
+ "allow_force_pushes": false,
20
+ "allow_deletions": true,
21
+ "block_creations": false,
22
+ "lock_branch": false,
23
+ "allow_fork_syncing": false,
24
+ "restrictions": null
25
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "RACK_ENV": "production",
3
+ "RAILS_ENV": "production",
4
+ "AWS_REGION": "us-east-1",
5
+ "DEFAULT_SUBDOMAIN": "app",
6
+ "ENABLE_SSO": "true",
7
+ "NODE_MODULES_CACHE": "true",
8
+ "RAILS_LOG_TO_STDOUT": "enabled",
9
+ "RAILS_SERVE_STATIC_FILES": "enabled",
10
+ "SIDEKIQ_WEB_PASSWORD": "oneringtorulethemall",
11
+ "SPARKPOST_ADDRESS": "smtp.sparkpostmail.com",
12
+ "SPARKPOST_DOMAIN": "neeto.com",
13
+ "YARN_CACHE": "true",
14
+ "YARN_PRODUCTION": "true",
15
+ "ZEROBOUNCE_API_KEY": "b74debc37c9747fc84e79d7fb4dbdd68",
16
+ "AREA51_AUTHORIZED_EMAILS":"neeraj@bigbinary.com,unnikrishnan.kp@bigbinary.com,subin.siby@bigbinary.com"
17
+
18
+ }
@@ -0,0 +1 @@
1
+ ["key1"]
@@ -0,0 +1,3 @@
1
+ {
2
+ "key1": "value 1"
3
+ }
@@ -0,0 +1,192 @@
1
+ [
2
+ {
3
+ "name": "0.25D",
4
+ "description": "Estimate - 2 hours",
5
+ "color": "B0C4DE"
6
+ },
7
+ {
8
+ "name": "0.5D",
9
+ "description": "Estimate - 4 hours",
10
+ "color": "B0C4DE"
11
+ },
12
+ {
13
+ "name": "0.75D",
14
+ "description": "Estimate - 6 hours",
15
+ "color": "B0C4DE"
16
+ },
17
+ {
18
+ "name": "1D",
19
+ "description": "Estimate - 8 hours",
20
+ "color": "B0C4DE"
21
+ },
22
+ {
23
+ "name": "1.25D",
24
+ "description": "Estimate - 10 hours",
25
+ "color": "B0C4DE"
26
+ },
27
+ {
28
+ "name": "1.5D",
29
+ "description": "Estimate - 12 hours",
30
+ "color": "B0C4DE"
31
+ },
32
+ {
33
+ "name": "1.75D",
34
+ "description": "Estimate - 14 hours",
35
+ "color": "B0C4DE"
36
+ },
37
+ {
38
+ "name": "2D",
39
+ "description": "Estimate - 16 hours",
40
+ "color": "B0C4DE"
41
+ },
42
+ {
43
+ "name": "accepted",
44
+ "description": "The issue has been reviewed and considered a valid issue.",
45
+ "color": "A2D9CE"
46
+ },
47
+ {
48
+ "name": "backend",
49
+ "description": "Deals with Ruby & Rails code majorly.",
50
+ "color": "C2E0C6"
51
+ },
52
+ {
53
+ "name": "bug",
54
+ "description": "Something isn't working.",
55
+ "color": "D73A4A"
56
+ },
57
+ {
58
+ "name": "cypress-completed",
59
+ "description": "Cypress tests have finished running.",
60
+ "color": "FEF2C0"
61
+ },
62
+ {
63
+ "name": "cypress-flaky-test",
64
+ "description": "Fix cypress flaky tests.",
65
+ "color": "FEF2C0"
66
+ },
67
+ {
68
+ "name": "cypress-happy-path-completed",
69
+ "description": "Cypress happy path tests have finished running.",
70
+ "color": "FEF2C0"
71
+ },
72
+ {
73
+ "name": "cypress-happy-path-run",
74
+ "description": "Run the Cypress tests with the tag happy-path.",
75
+ "color": "FEF2C0"
76
+ },
77
+ {
78
+ "name": "cypress-happy-path-triggered",
79
+ "description": "Cypress happy path tests have been triggered.",
80
+ "color": "FEF2C0"
81
+ },
82
+ {
83
+ "name": "cypress-needed",
84
+ "description": "Cypress tests need to be written.",
85
+ "color": "FEF2C0"
86
+ },
87
+ {
88
+ "name": "cypress-run",
89
+ "description": "Run the Cypress tests.",
90
+ "color": "FEF2C0"
91
+ },
92
+ {
93
+ "name": "cypress-triggered",
94
+ "description": "Cypress tests have been triggered.",
95
+ "color": "FEF2C0"
96
+ },
97
+ {
98
+ "name": "documentation",
99
+ "description": "Improvements or additions to documentation.",
100
+ "color": "0075CA"
101
+ },
102
+ {
103
+ "name": "enhancement",
104
+ "description": "Enhancement or feature request.",
105
+ "color": "A2EEEF"
106
+ },
107
+ {
108
+ "name": "epic",
109
+ "description": "Will get closed when sub-issues fixed and this issue tracked in monthly milestone.",
110
+ "color": "6A5ACD"
111
+ },
112
+ {
113
+ "name": "frontend",
114
+ "description": "Deals with JS(React or JS configs etc) code majorly.",
115
+ "color": "C2E0C6"
116
+ },
117
+ {
118
+ "name": "high-priority",
119
+ "description": "Urgent fix required. Should be done within a day at max.",
120
+ "color": "B60205"
121
+ },
122
+ {
123
+ "name": "honeybadger",
124
+ "description": "Issue created by honeybadger.",
125
+ "color": "D3D3D3"
126
+ },
127
+ {
128
+ "name": "low-priority",
129
+ "description": "Other open issues can be taken up before this one.",
130
+ "color": "BFDADC"
131
+ },
132
+ {
133
+ "name": "neeto*-dependent",
134
+ "description": "This issue depends upon some other issue from neeto engines/frontend packages.",
135
+ "color": "E54D82"
136
+ },
137
+ {
138
+ "name": "on-hold",
139
+ "description": "Reason should be specified as a comment before putting issue/PR on-hold.",
140
+ "color": "E54D82"
141
+ },
142
+ {
143
+ "name": "perf-optimization",
144
+ "description": "Performance improvements, load testing, profiling etc.",
145
+ "color": "CAEE3E"
146
+ },
147
+ {
148
+ "name": "POC",
149
+ "description": "Proof of concept or doing spike work.",
150
+ "color": "008080"
151
+ },
152
+ {
153
+ "name": "PR",
154
+ "description": "The issue has a PR associated with it.",
155
+ "color": "D4C5F9"
156
+ },
157
+ {
158
+ "name": "priority",
159
+ "description": "Means I am waiting for this issue to be fixed in order to take care of other issues.",
160
+ "color": "BA080D"
161
+ },
162
+ {
163
+ "name": "refactoring",
164
+ "description": "Code changes, better way to organize code etc.",
165
+ "color": "CAEE3E"
166
+ },
167
+ {
168
+ "name": "security",
169
+ "description": "Vulnerabilities, security concerns etc.",
170
+ "color": "BA080D"
171
+ },
172
+ {
173
+ "name": "UI",
174
+ "description": "UI/CSS work needed.",
175
+ "color": "8250df"
176
+ },
177
+ {
178
+ "name": "UI-weekly-milestone",
179
+ "description": "This issue is part of the UI weekly milestone.",
180
+ "color": "F9D0C4"
181
+ },
182
+ {
183
+ "name": "UX-design-needed",
184
+ "description": "This issue is part of the UI weekly milestone.",
185
+ "color": "366FB9"
186
+ },
187
+ {
188
+ "name": "working",
189
+ "description": "This issue is part of the UI weekly milestone.",
190
+ "color": "D0ECE7"
191
+ }
192
+ ]
data/env.sample ADDED
@@ -0,0 +1 @@
1
+ AUTH_PARAMS='{"provider": "github","client_id": "9aefff37f98713262fd0","grant_type": "urn:ietf:params:oauth:grant-type:device_code","auth_uris": {"auth_req": "https://github.com/login/device/code","token_req": "https://github.com/login/oauth/access_token"},"scope": "repo,user"}'
data/exe/neetob ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "dotenv"
5
+ require "bundler/setup"
6
+
7
+ Dotenv.load(
8
+ File.expand_path("../.env", __dir__)
9
+ )
10
+
11
+ base_path = File.expand_path("../lib", __dir__)
12
+
13
+ if File.exist?(base_path)
14
+ require_relative "../lib/neetob"
15
+ else
16
+ require "neetob"
17
+ end
18
+
19
+ args = ARGV
20
+
21
+ begin
22
+ Neetob::CLI.start(args, debug: true)
23
+ rescue Exception => e
24
+ Neetob::ExceptionHandler.new(e).process
25
+ end
data/install.sh ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ last_wd=$(pwd)
4
+ cd "/tmp/neetob/"
5
+ bundle install
6
+ echo "Building gem..."
7
+ bundle exec rake build
8
+ echo -e "\nHold tight! The next step might take some time..."
9
+ gem install "/tmp/neetob/pkg/neetob*.gem"
10
+ cd "${last_wd}"
11
+ rm -rf "/tmp/neetob/"
12
+ echo -e "\n"
13
+ cat <<EOF
14
+ =========================
15
+ _ _
16
+ ___ ___ ___| |_ ___| |_
17
+ | | -_| -_| _| . | . |
18
+ |_|_|___|___|_| |___|___|
19
+ =========================
20
+ EOF
21
+ neetob help
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ui"
4
+ require_relative "../utils"
5
+ require_relative "../../../neeto_compliance/lib/neeto_compliance/neeto_apps.rb"
6
+
7
+ module Neetob
8
+ class CLI::Base
9
+ include Utils
10
+
11
+ NEETO_APPS_LIST_LINK = "https://github.com/bigbinary/neeto-compliance/blob/main/lib/neeto_compliance/neeto_apps.rb"
12
+
13
+ attr_reader :ui
14
+
15
+ def initialize
16
+ @ui = CLI::UI.new
17
+ end
18
+
19
+ private
20
+
21
+ def find_all_matching_apps(apps, platform_name, sandbox_mode, quiet = false)
22
+ inform_about_current_working_mode(sandbox_mode, quiet)
23
+ all_available_apps = sandbox_mode ?
24
+ testing_apps(platform_name) :
25
+ build_app_list_from_neeto_compliance(platform_name)
26
+ matching_apps = match_apps(apps, all_available_apps)
27
+ if matching_apps.length == 0
28
+ error_msg = sandbox_mode ?
29
+ "Only \"neeto-dummy\" app is available for sandbox mode. Remove the \"--sandbox\" flag to run the given command for all the neeto applications." :
30
+ "No matching app is found in the neeto apps list maintained at \"#{NEETO_APPS_LIST_LINK}\""
31
+ ui.error(error_msg)
32
+ exit
33
+ end
34
+
35
+ matching_apps
36
+ end
37
+
38
+ def match_apps(required_apps, available_apps)
39
+ apps = required_apps.map { |app| Regexp.new "#{app.gsub("*", "[-a-zA-Z0-9]*")}" }
40
+ available_apps.select do |available_app|
41
+ apps.any? { |app| app.match?(available_app) }
42
+ end
43
+ end
44
+
45
+ def read_json_file(path)
46
+ file = File.read(path)
47
+ JSON.parse(file)
48
+ end
49
+
50
+ def build_app_list_from_neeto_compliance(platform_name)
51
+ apps = NeetoCompliance::NeetoApps.list.map { |app| camel_case_to_slug(app) }
52
+ all_web_apps = suffix_slug(apps, :web)
53
+ platform_name == :heroku ? add_env_suffix(all_web_apps) : prefix_org_name(all_web_apps)
54
+ end
55
+
56
+ def add_env_suffix(apps)
57
+ [
58
+ suffix_slug(apps, :staging),
59
+ suffix_slug(apps, :production)
60
+ ].flatten.sort
61
+ end
62
+
63
+ def suffix_slug(apps, suffix)
64
+ apps.map { |app| "#{app}-#{suffix}" }
65
+ end
66
+
67
+ def prefix_org_name(apps)
68
+ apps.map { |app| "bigbinary/#{app}" }
69
+ end
70
+
71
+ def testing_apps(platform_name)
72
+ platform_name == :heroku ? ["neeto-dummy"] : ["bigbinary/neeto-dummy"]
73
+ end
74
+
75
+ def inform_about_current_working_mode(sandbox_mode, quiet)
76
+ return if quiet
77
+
78
+ callout_message = "Running in the sandbox mode. \nOnly \"neeto-dummy\" app will be available."
79
+ unless sandbox_mode
80
+ callout_message = "Running in non-sandbox mode. \nAll neeto applications are available. Some of the actions are irreversible."
81
+ end
82
+ ui.say(callout_message)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../base"
4
+
5
+ module Neetob
6
+ class CLI
7
+ module FetchorupdateRepos
8
+ class Execute < Base
9
+ attr_accessor :sandbox, :apps
10
+
11
+ def initialize(sandbox = false, apps = ["*"])
12
+ super()
13
+ @sandbox = sandbox
14
+ @apps = apps
15
+ end
16
+
17
+ def run
18
+ neeto_apps = find_all_matching_apps(apps, :github, sandbox)
19
+ neeto_apps.each do |app|
20
+ app_name = app.split("/").last
21
+ if directory_exists(app_name)
22
+ checkout_to_main_and_fetch_commits(app_name)
23
+ else
24
+ clone_repo(app_name)
25
+ end
26
+ end
27
+ end
28
+
29
+ def directory_exists(app_name)
30
+ File.directory?(app_name)
31
+ end
32
+
33
+ def checkout_to_main_and_fetch_commits(app_name)
34
+ %x[ cd #{app_name} && git checkout main && git pull origin main ]
35
+ if $?.success?
36
+ puts "------Successfully pulled main branch of #{app_name}------"
37
+ else
38
+ puts "------Unable to pull the main branch of #{app_name} due to conflicts------"
39
+ end
40
+ end
41
+
42
+ def clone_repo(app_name)
43
+ `git clone git@github.com:bigbinary/#{app_name}.git`
44
+ if $?.success?
45
+ puts "------Done cloning #{app_name}------"
46
+ else
47
+ puts "------Failed cloning #{app_name}------"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end