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
data/bookmarks.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
[All UI issues](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Abigbinary+label%3Aui)
|
2
|
+
|
3
|
+
[All UX issues](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Abigbinary+label%3Aux)
|
4
|
+
|
5
|
+
[Engineer needed](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Abigbinary+label%3Aengineer-needed)
|
6
|
+
|
7
|
+
- [ ] neeto-chat-web
|
8
|
+
- [ ] neeto-desk-web
|
9
|
+
- [ ] neeto-kb-web
|
10
|
+
- [ ] neeto-invoice-web
|
11
|
+
- [ ] neeto-form-web
|
12
|
+
- [ ] neeto-cal-web
|
13
|
+
- [ ] neeto-planner-web
|
14
|
+
- [ ] neeto-course-web
|
15
|
+
- [ ] neeto-runner-web
|
16
|
+
- [ ] neeto-social-web
|
17
|
+
- [ ] neeto-wireframe-web
|
18
|
+
- [ ] neeto-changelog-web
|
19
|
+
- [ ] neeto-quiz-web
|
20
|
+
- [ ] neeto-site-web
|
21
|
+
- [ ] neeto-crm-web
|
22
|
+
- [ ] neeto-replay-web
|
23
|
+
- [ ] neeto-invisible-web
|
24
|
+
- [ ] neeto-testify-web
|
25
|
+
- [ ] neeto-deploy-web
|
26
|
+
- [ ] neeto-bugtrap-web
|
27
|
+
- [ ] neeto-sign-web
|
28
|
+
- [ ] neeto-monitor-web
|
29
|
+
- [ ] neeto-ci-web
|
30
|
+
- [ ] neeto-git-web
|
data/data/github-labels.json
CHANGED
@@ -44,11 +44,6 @@
|
|
44
44
|
"description": "The issue has been reviewed and considered a valid issue.",
|
45
45
|
"color": "A2D9CE"
|
46
46
|
},
|
47
|
-
{
|
48
|
-
"name": "backend",
|
49
|
-
"description": "Deals with Ruby & Rails code majorly.",
|
50
|
-
"color": "C2E0C6"
|
51
|
-
},
|
52
47
|
{
|
53
48
|
"name": "bug",
|
54
49
|
"description": "Something isn't working.",
|
@@ -106,37 +101,62 @@
|
|
106
101
|
},
|
107
102
|
{
|
108
103
|
"name": "epic",
|
109
|
-
"description": "Will get closed when sub-issues fixed and this issue tracked in monthly milestone.",
|
110
|
-
"color": "6A5ACD"
|
104
|
+
"description": "Will get closed when sub-issues are fixed and this issue is tracked in a monthly milestone.",
|
105
|
+
"color": "6A5ACD"
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"name": "backend",
|
109
|
+
"description": "Deals with Ruby & Rails code majorly.",
|
110
|
+
"color": "C2E0C6"
|
111
111
|
},
|
112
112
|
{
|
113
113
|
"name": "frontend",
|
114
|
-
"description": "Deals with JS(React or JS configs etc) code majorly.",
|
114
|
+
"description": "Deals with JS(React or JS configs etc) code majorly. It can also include UI fixes without the help of the UI team.",
|
115
115
|
"color": "C2E0C6"
|
116
116
|
},
|
117
|
+
{
|
118
|
+
"name": "UI",
|
119
|
+
"description": "UI/CSS work needed.",
|
120
|
+
"color": "8250df"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"name": "UX",
|
124
|
+
"description": "UX design needed.",
|
125
|
+
"color": "366FB9"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"name": "fullstack",
|
129
|
+
"description": "This issue is not just frontend or backend but it's fullstack",
|
130
|
+
"color": "D0ECE7"
|
131
|
+
},
|
117
132
|
{
|
118
133
|
"name": "high-priority",
|
119
134
|
"description": "Urgent fix required. Should be done within a day at max.",
|
120
135
|
"color": "B60205"
|
121
136
|
},
|
122
137
|
{
|
123
|
-
"name": "
|
124
|
-
"description": "
|
125
|
-
"color": "
|
138
|
+
"name": "priority",
|
139
|
+
"description": "Means I am waiting for this issue to be fixed in order to take care of other issues.",
|
140
|
+
"color": "BA080D"
|
126
141
|
},
|
127
142
|
{
|
128
143
|
"name": "low-priority",
|
129
144
|
"description": "Other open issues can be taken up before this one.",
|
130
145
|
"color": "BFDADC"
|
131
146
|
},
|
147
|
+
{
|
148
|
+
"name": "honeybadger",
|
149
|
+
"description": "Issue created by honeybadger.",
|
150
|
+
"color": "D3D3D3"
|
151
|
+
},
|
132
152
|
{
|
133
153
|
"name": "neeto*-dependent",
|
134
|
-
"description": "This issue depends upon some other issue from
|
154
|
+
"description": "This issue depends upon some other issue from nano (engines/frontend packages).",
|
135
155
|
"color": "E54D82"
|
136
156
|
},
|
137
157
|
{
|
138
158
|
"name": "on-hold",
|
139
|
-
"description": "
|
159
|
+
"description": "The issue is on hold as per provided reason. The reason should be specified as a comment before putting the issue/PR on-hold.",
|
140
160
|
"color": "E54D82"
|
141
161
|
},
|
142
162
|
{
|
@@ -147,18 +167,13 @@
|
|
147
167
|
{
|
148
168
|
"name": "POC",
|
149
169
|
"description": "Proof of concept or doing spike work.",
|
150
|
-
"color": "008080"
|
170
|
+
"color": "008080"
|
151
171
|
},
|
152
172
|
{
|
153
173
|
"name": "PR",
|
154
174
|
"description": "The issue has a PR associated with it.",
|
155
175
|
"color": "D4C5F9"
|
156
176
|
},
|
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
177
|
{
|
163
178
|
"name": "refactoring",
|
164
179
|
"description": "Code changes, better way to organize code etc.",
|
@@ -169,24 +184,34 @@
|
|
169
184
|
"description": "Vulnerabilities, security concerns etc.",
|
170
185
|
"color": "BA080D"
|
171
186
|
},
|
172
|
-
{
|
173
|
-
"name": "UI",
|
174
|
-
"description": "UI/CSS work needed.",
|
175
|
-
"color": "8250df"
|
176
|
-
},
|
177
187
|
{
|
178
188
|
"name": "UI-weekly-milestone",
|
179
|
-
"description": "This issue is part of the UI weekly milestone.",
|
189
|
+
"description": "This issue is part of the currently ongoing UI weekly milestone.",
|
180
190
|
"color": "F9D0C4"
|
181
191
|
},
|
182
192
|
{
|
183
|
-
"name": "
|
184
|
-
"description": "
|
185
|
-
"color": "
|
193
|
+
"name": "engineer-needed",
|
194
|
+
"description": "Engineer is needed to work on the issue",
|
195
|
+
"color": "B0C4DE"
|
186
196
|
},
|
187
197
|
{
|
188
198
|
"name": "working",
|
189
|
-
"description": "
|
199
|
+
"description": "A branch associated with this issue is created.",
|
190
200
|
"color": "D0ECE7"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"name": "product-analysis",
|
204
|
+
"description": "This issue is related to product analysis",
|
205
|
+
"color": "D0ECE7"
|
206
|
+
},
|
207
|
+
{
|
208
|
+
"name": "manual-qa-needed",
|
209
|
+
"description": "Manual QA is needed to verify the changes.",
|
210
|
+
"color": "CCDDCD"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"name": "manual-qa-completed",
|
214
|
+
"description": "Manual QA team has finished verifying the changes.",
|
215
|
+
"color": "CCDDCD"
|
191
216
|
}
|
192
217
|
]
|
Binary file
|
data/lib/neetob/cli/base.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "neeto-compliance"
|
4
|
+
|
3
5
|
require_relative "ui"
|
4
6
|
require_relative "../utils"
|
5
|
-
require_relative "../../../neeto_compliance/lib/neeto_compliance/neeto_apps.rb"
|
6
7
|
|
7
8
|
module Neetob
|
8
9
|
class CLI::Base
|
@@ -18,12 +19,12 @@ module Neetob
|
|
18
19
|
|
19
20
|
private
|
20
21
|
|
21
|
-
def find_all_matching_apps(apps, platform_name, sandbox_mode, quiet = false)
|
22
|
+
def find_all_matching_apps(apps, platform_name, sandbox_mode, quiet = false, all_neeto_repos = false)
|
22
23
|
inform_about_current_working_mode(sandbox_mode, quiet)
|
23
24
|
all_available_apps = sandbox_mode ?
|
24
25
|
testing_apps(platform_name) :
|
25
|
-
build_app_list_from_neeto_compliance(platform_name)
|
26
|
-
matching_apps = match_apps(apps, all_available_apps)
|
26
|
+
build_app_list_from_neeto_compliance(platform_name, all_neeto_repos)
|
27
|
+
matching_apps = match_apps(apps || ["*"], all_available_apps)
|
27
28
|
if matching_apps.length == 0
|
28
29
|
error_msg = sandbox_mode ?
|
29
30
|
"Only \"neeto-dummy\" app is available for sandbox mode. Remove the \"--sandbox\" flag to run the given command for all the neeto applications." :
|
@@ -36,9 +37,9 @@ module Neetob
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def match_apps(required_apps, available_apps)
|
39
|
-
apps = required_apps
|
40
|
+
apps = required_apps&.map { |app| Regexp.new "#{app.gsub("*", "[-a-zA-Z0-9]*")}" }
|
40
41
|
available_apps.select do |available_app|
|
41
|
-
apps
|
42
|
+
apps&.any? { |app| app.match?(available_app) }
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -47,10 +48,9 @@ module Neetob
|
|
47
48
|
JSON.parse(file)
|
48
49
|
end
|
49
50
|
|
50
|
-
def build_app_list_from_neeto_compliance(platform_name)
|
51
|
-
apps = NeetoCompliance::
|
52
|
-
|
53
|
-
platform_name == :heroku ? add_env_suffix(all_web_apps) : prefix_org_name(all_web_apps)
|
51
|
+
def build_app_list_from_neeto_compliance(platform_name, all_neeto_repos)
|
52
|
+
apps = all_neeto_repos ? fetch_all_neeto_repos : NeetoCompliance::NeetoRepos.products.keys
|
53
|
+
platform_name == :heroku ? add_env_suffix(apps) : prefix_org_name(apps)
|
54
54
|
end
|
55
55
|
|
56
56
|
def add_env_suffix(apps)
|
@@ -81,5 +81,17 @@ module Neetob
|
|
81
81
|
end
|
82
82
|
ui.say(callout_message)
|
83
83
|
end
|
84
|
+
|
85
|
+
def fetch_all_neeto_repos
|
86
|
+
NeetoCompliance::NeetoRepos::products.keys +
|
87
|
+
NeetoCompliance::NeetoRepos::nanos +
|
88
|
+
NeetoCompliance::NeetoRepos::widgets +
|
89
|
+
NeetoCompliance::NeetoRepos::chrome_extensions +
|
90
|
+
NeetoCompliance::NeetoRepos::helper_packages +
|
91
|
+
NeetoCompliance::NeetoRepos::electron_apps +
|
92
|
+
NeetoCompliance::NeetoRepos::executables +
|
93
|
+
NeetoCompliance::NeetoRepos::mobile_apps +
|
94
|
+
NeetoCompliance::NeetoRepos::other_repos
|
95
|
+
end
|
84
96
|
end
|
85
97
|
end
|
@@ -6,18 +6,20 @@ module Neetob
|
|
6
6
|
class CLI
|
7
7
|
module FetchorupdateRepos
|
8
8
|
class Execute < Base
|
9
|
-
attr_accessor :sandbox, :apps
|
9
|
+
attr_accessor :sandbox, :apps, :all_neeto_repos
|
10
10
|
|
11
|
-
def initialize(sandbox = false, apps = ["*"])
|
11
|
+
def initialize(sandbox = false, all_neeto_repos = false, apps = ["*"])
|
12
12
|
super()
|
13
13
|
@sandbox = sandbox
|
14
14
|
@apps = apps
|
15
|
+
@all_neeto_repos = all_neeto_repos
|
15
16
|
end
|
16
17
|
|
17
18
|
def run
|
18
|
-
neeto_apps = find_all_matching_apps(apps, :github, sandbox)
|
19
|
+
neeto_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
19
20
|
neeto_apps.each do |app|
|
20
21
|
app_name = app.split("/").last
|
22
|
+
ui.info("\nWorking on #{app_name}\n")
|
21
23
|
if directory_exists(app_name)
|
22
24
|
checkout_to_main_and_fetch_commits(app_name)
|
23
25
|
else
|
@@ -41,7 +41,7 @@ module Neetob
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def request_authorization
|
44
|
-
post(uris["auth_req"], params: { client_id
|
44
|
+
post(uris["auth_req"], params: { client_id:, scope: })
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
@@ -87,9 +87,9 @@ module Neetob
|
|
87
87
|
res = post(
|
88
88
|
uris["token_req"],
|
89
89
|
params: {
|
90
|
-
client_id
|
90
|
+
client_id:,
|
91
91
|
device_code: auth_data[:device_code],
|
92
|
-
grant_type:
|
92
|
+
grant_type:
|
93
93
|
}
|
94
94
|
)
|
95
95
|
|
@@ -23,6 +23,13 @@ module Neetob
|
|
23
23
|
@client = Octokit::Client.new(access_token: auth_client.access_token)
|
24
24
|
end
|
25
25
|
|
26
|
+
def check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
27
|
+
if (apps.nil? && !all_neeto_repos) || (!apps.nil? && all_neeto_repos)
|
28
|
+
ui.error("Please provide either \"apps\" or \"all-neeto-repos\" option.")
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
private
|
27
34
|
|
28
35
|
def read_and_parse_auth_params_from_env
|
@@ -40,9 +40,13 @@ module Neetob
|
|
40
40
|
desc: "Name of the branch whose protections rules needs to be updated", required: true
|
41
41
|
option :path, type: :string, aliases: "-p",
|
42
42
|
desc: "The JSON file path which specify all the required rules for branch protection"
|
43
|
-
option :apps, type: :array, aliases: "-a",
|
43
|
+
option :apps, type: :array, aliases: "-a", desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
|
44
|
+
option :all_neeto_repos, type: :boolean, aliases: "--all",
|
45
|
+
desc: "Use this flag for working with all neeto repos", default: false
|
44
46
|
def protect_branch
|
45
|
-
ProtectBranch.new(
|
47
|
+
ProtectBranch.new(
|
48
|
+
options[:branch], options[:apps], options[:path], options[:sandbox],
|
49
|
+
options[:all_neeto_repos]).run
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -16,44 +16,52 @@ module Neetob
|
|
16
16
|
module Labels
|
17
17
|
class Commands < SubCommandBase
|
18
18
|
class_option :apps,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
type: :array, aliases: "-a",
|
20
|
+
desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
|
21
|
+
class_option :all_neeto_repos,
|
22
|
+
type: :boolean, aliases: "--all", default: false,
|
23
|
+
desc: "Use this flag for working with all neeto repos"
|
23
24
|
|
24
25
|
desc "list", "List all the labels in the Github repos"
|
25
26
|
def list
|
26
|
-
List.new(options[:apps], options[:sandbox]).run
|
27
|
+
List.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run
|
27
28
|
end
|
28
29
|
|
29
30
|
desc "show", "Show details about the given label in the Github repos"
|
30
31
|
option :name, type: :string, aliases: "-n", required: true, desc: "Name of the label"
|
31
32
|
def show
|
32
|
-
Show.new(options[:apps], options[:name], options[:sandbox]).run
|
33
|
+
Show.new(options[:apps], options[:name], options[:sandbox], options[:all_neeto_repos]).run
|
33
34
|
end
|
34
35
|
|
35
36
|
desc "upsert", "Create and update labels in the Github repos"
|
36
37
|
option :path, type: :string, aliases: "-p", desc: "The JSON file path which has a list of all the required labels. Each label should have name. The color and description are optional"
|
38
|
+
option :name, type: :string, desc: "Name of the label you want to upsert"
|
39
|
+
option :color, type: :string, desc: "Color of the label you want to upsert"
|
40
|
+
option :description, type: :string, desc: "Description of the label you want to upsert"
|
37
41
|
def upsert
|
38
|
-
Upsert.new(
|
42
|
+
Upsert.new(
|
43
|
+
options[:apps], options[:path], options[:sandbox], options[:all_neeto_repos], options[:name],
|
44
|
+
options[:color], options[:description]).run
|
39
45
|
end
|
40
46
|
|
41
47
|
desc "delete_all", "Delete all the labels from the Github repos"
|
42
48
|
def delete_all
|
43
|
-
DeleteAll.new(options[:apps], options[:sandbox]).run
|
49
|
+
DeleteAll.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run
|
44
50
|
end
|
45
51
|
|
46
52
|
desc "delete", "Delete some labels from the Github repos"
|
47
53
|
option :labels, type: :array, required: true, desc: "Labels you want to delete from the repos."
|
48
54
|
def delete
|
49
|
-
Delete.new(options[:apps], options[:labels], options[:sandbox]).run
|
55
|
+
Delete.new(options[:apps], options[:labels], options[:sandbox], options[:all_neeto_repos]).run
|
50
56
|
end
|
51
57
|
|
52
58
|
desc "update", "Update a label name in Github repos"
|
53
59
|
option :old_name, type: :string, required: true, desc: "Current label name which needs to be updated"
|
54
60
|
option :new_name, type: :string, required: true, desc: "New name for the updated label"
|
55
61
|
def update
|
56
|
-
Update.new(
|
62
|
+
Update.new(
|
63
|
+
options[:apps], options[:old_name], options[:new_name], options[:sandbox],
|
64
|
+
options[:all_neeto_repos]).run
|
57
65
|
end
|
58
66
|
end
|
59
67
|
end
|
@@ -9,17 +9,19 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class Delete < Base
|
12
|
-
attr_accessor :apps, :sandbox, :labels
|
12
|
+
attr_accessor :apps, :sandbox, :labels, :all_neeto_repos
|
13
13
|
|
14
|
-
def initialize(apps, labels, sandbox = false)
|
14
|
+
def initialize(apps, labels, sandbox = false, all_neeto_repos = false)
|
15
15
|
super()
|
16
16
|
@labels = labels
|
17
17
|
@apps = apps
|
18
18
|
@sandbox = sandbox
|
19
|
+
@all_neeto_repos = all_neeto_repos
|
19
20
|
end
|
20
21
|
|
21
22
|
def run
|
22
|
-
|
23
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
24
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
23
25
|
matching_apps.each do |app|
|
24
26
|
ui.info("\n Deleting labels from #{app} repo \n")
|
25
27
|
labels.each do |label|
|
@@ -9,16 +9,18 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class DeleteAll < Base
|
12
|
-
attr_accessor :apps, :sandbox
|
12
|
+
attr_accessor :apps, :sandbox, :all_neeto_repos
|
13
13
|
|
14
|
-
def initialize(apps, sandbox = false)
|
14
|
+
def initialize(apps, sandbox = false, all_neeto_repos = false)
|
15
15
|
super()
|
16
16
|
@apps = apps
|
17
17
|
@sandbox = sandbox
|
18
|
+
@all_neeto_repos = all_neeto_repos
|
18
19
|
end
|
19
20
|
|
20
21
|
def run
|
21
|
-
|
22
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
23
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
22
24
|
matching_apps.each do |app|
|
23
25
|
ui.info("\n Working on #{app} repo \n")
|
24
26
|
begin
|
@@ -9,16 +9,18 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class List < Base
|
12
|
-
attr_accessor :apps, :sandbox
|
12
|
+
attr_accessor :apps, :sandbox, :all_neeto_repos
|
13
13
|
|
14
|
-
def initialize(apps, sandbox = false)
|
14
|
+
def initialize(apps, sandbox = false, all_neeto_repos = false)
|
15
15
|
super()
|
16
16
|
@apps = apps
|
17
17
|
@sandbox = sandbox
|
18
|
+
@all_neeto_repos = all_neeto_repos
|
18
19
|
end
|
19
20
|
|
20
21
|
def run
|
21
|
-
|
22
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
23
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
22
24
|
matching_apps.each do |app|
|
23
25
|
ui.info("\n Labels of #{app} \n")
|
24
26
|
begin
|
@@ -9,17 +9,19 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class Show < Base
|
12
|
-
attr_accessor :apps, :label_name, :sandbox
|
12
|
+
attr_accessor :apps, :label_name, :sandbox, :all_neeto_repos
|
13
13
|
|
14
|
-
def initialize(apps, label_name, sandbox = false)
|
14
|
+
def initialize(apps, label_name, sandbox = false, all_neeto_repos = false)
|
15
15
|
super()
|
16
16
|
@apps = apps
|
17
17
|
@label_name = label_name
|
18
18
|
@sandbox = sandbox
|
19
|
+
@all_neeto_repos = all_neeto_repos
|
19
20
|
end
|
20
21
|
|
21
22
|
def run
|
22
|
-
|
23
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
24
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
23
25
|
matching_apps.each do |app|
|
24
26
|
ui.info("\n \"#{label_name}\" label details from #{app} \n")
|
25
27
|
begin
|
@@ -9,29 +9,41 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class Update < Base
|
12
|
-
attr_accessor :apps, :sandbox, :old_name, :new_name
|
12
|
+
attr_accessor :apps, :sandbox, :old_name, :new_name, :all_neeto_repos
|
13
13
|
|
14
|
-
def initialize(apps, old_name, new_name, sandbox = false)
|
14
|
+
def initialize(apps, old_name, new_name, sandbox = false, all_neeto_repos = false)
|
15
15
|
super()
|
16
16
|
@apps = apps
|
17
17
|
@sandbox = sandbox
|
18
18
|
@old_name = old_name
|
19
19
|
@new_name = new_name
|
20
|
+
@all_neeto_repos = all_neeto_repos
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
23
|
-
|
24
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
25
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
24
26
|
matching_apps.each do |app|
|
25
27
|
ui.info("\n Updating label for #{app} repo \n")
|
26
|
-
|
28
|
+
begin
|
29
|
+
update_label!(app, old_name, new_name)
|
30
|
+
rescue StandardError => e
|
31
|
+
ExceptionHandler.new(e).process
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
36
|
private
|
31
37
|
|
32
38
|
def update_label!(app, old_name, new_name)
|
39
|
+
client.label(app, new_name)
|
40
|
+
ui.error("Label with name \"#{new_name}\" already exists.")
|
41
|
+
nil
|
42
|
+
rescue Octokit::NotFound
|
33
43
|
client.update_label(app, old_name, { name: new_name })
|
34
44
|
ui.success("Label \"#{old_name}\" updated to \"#{new_name}\" successfully")
|
45
|
+
rescue StandardError => e
|
46
|
+
ExceptionHandler.new(e).process
|
35
47
|
end
|
36
48
|
end
|
37
49
|
end
|
@@ -9,24 +9,33 @@ module Neetob
|
|
9
9
|
module Github
|
10
10
|
module Labels
|
11
11
|
class Upsert < Base
|
12
|
-
|
12
|
+
WHITE_COLOR_HEX_CODE = "ffffff"
|
13
13
|
|
14
|
-
|
14
|
+
attr_accessor :apps, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description
|
15
|
+
|
16
|
+
def initialize(apps, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false,
|
17
|
+
name = "", color = "", description = "")
|
15
18
|
super()
|
16
19
|
@apps = apps
|
17
20
|
@required_labels_json_file_path = required_labels_json_file_path
|
18
21
|
@sandbox = sandbox
|
22
|
+
@all_neeto_repos = all_neeto_repos
|
23
|
+
@name = name
|
24
|
+
@color = color
|
25
|
+
@description = description
|
19
26
|
end
|
20
27
|
|
21
28
|
def run
|
22
|
-
|
29
|
+
check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
|
30
|
+
matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
|
23
31
|
inform_about_default_labels_file
|
24
32
|
matching_apps.each do |app|
|
25
|
-
ui.info("\
|
33
|
+
ui.info("\nWorking on #{app} repo\n")
|
26
34
|
begin
|
27
|
-
required_labels =
|
35
|
+
required_labels = get_required_labels
|
28
36
|
required_labels.each do |label|
|
29
37
|
create_or_update_label(app, label)
|
38
|
+
sleep(1)
|
30
39
|
end
|
31
40
|
rescue StandardError => e
|
32
41
|
ExceptionHandler.new(e).process
|
@@ -36,13 +45,40 @@ module Neetob
|
|
36
45
|
|
37
46
|
private
|
38
47
|
|
48
|
+
def get_required_labels
|
49
|
+
if name.blank? && (!color.blank? || !description.blank?)
|
50
|
+
ui.error("Please provide \"name\" for the label you want to upsert.")
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
|
54
|
+
if !name.blank?
|
55
|
+
return create_label_payload
|
56
|
+
end
|
57
|
+
|
58
|
+
read_json_file(required_labels_json_file_path || default_labels_file_path)
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_label_payload
|
62
|
+
[
|
63
|
+
{
|
64
|
+
"name" => name,
|
65
|
+
"color" => color,
|
66
|
+
"description" => description
|
67
|
+
}.compact
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
39
71
|
def create_or_update_label(app, label_details)
|
40
72
|
begin
|
41
73
|
client.update_label(app, label_details["name"], label_details)
|
42
74
|
ui.success("Label \"#{label_details["name"]}\" updated successfully")
|
43
75
|
rescue Octokit::NotFound
|
44
|
-
client.add_label(
|
76
|
+
client.add_label(
|
77
|
+
app, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE,
|
78
|
+
label_details)
|
45
79
|
ui.success("Label \"#{label_details["name"]}\" created successfully")
|
80
|
+
rescue StandardError => e
|
81
|
+
ExceptionHandler.new(e).process
|
46
82
|
end
|
47
83
|
end
|
48
84
|
|
@@ -51,7 +87,7 @@ module Neetob
|
|
51
87
|
end
|
52
88
|
|
53
89
|
def inform_about_default_labels_file
|
54
|
-
if required_labels_json_file_path.nil?
|
90
|
+
if required_labels_json_file_path.nil? && name.nil?
|
55
91
|
ui.info("Upserting labels from the \"neetob/data/github-labels.json\" file")
|
56
92
|
end
|
57
93
|
end
|
@@ -33,7 +33,8 @@ module Neetob
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def add_commmit_and_push_changes(app)
|
36
|
-
`#{cd_to_app_in_tmp_dir(app)} && git add . &&
|
36
|
+
`#{cd_to_app_in_tmp_dir(app)} && git add . && \\
|
37
|
+
git commit -m "#{pr_title}" && git push -u origin #{branch_name} --force`
|
37
38
|
end
|
38
39
|
|
39
40
|
def delete_local_feature_branch(app)
|
@@ -27,8 +27,11 @@ module Neetob
|
|
27
27
|
desc: "Path to UNIX executable script which will be run for each product", required: true
|
28
28
|
option :title, type: :string, aliases: "-t", desc: "Title for the PR"
|
29
29
|
option :branch, type: :string, aliases: "-b", desc: "Feature branch name for the PR"
|
30
|
+
option :description, type: :string, aliases: "-d", desc: "Description of the PR"
|
30
31
|
def script
|
31
|
-
Script.new(
|
32
|
+
Script.new(
|
33
|
+
options[:apps], options[:path], options[:title], options[:branch], options[:description],
|
34
|
+
options[:sandbox]).run
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|