neetob 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 341391d50e6f4be4c69fe7608c6cdcdad8ffecb7fbf55aac1bdcf0fa307a51dd
4
- data.tar.gz: 2984a090795cf1f51a05e8dfd18957ba74172469f432cef6f8f217f2739dbbf2
3
+ metadata.gz: db01d1b2016e6c59d67ae056f53722b919ff42d02a90cad6870c2899dff4936f
4
+ data.tar.gz: e7f7f4d09faa15c778012285c6db15cc257b588951b8b2fdd1946b305131dd75
5
5
  SHA512:
6
- metadata.gz: e2f7b80a100686409a27f851aa9abc9f74bcbe101ebe6a635619bd9c6a5db9e8ed39804444207f63703db4e207a7f886272117a6287c8cfc3421ac3ba81dde3a
7
- data.tar.gz: 19ca0f250839ef5c0c47ec51520fbdfd7af5ae344e9efedbefb6f8a9579c4675307f0a11a50a029de83709f2ba02ce8f0017e3814289719c09289f5a6b8676fd
6
+ metadata.gz: e004714a7fc30663a27cdd3c1a0268a6b33ad54476724897a40b10425fa36cedcafb62435a4a97bd8701ec594701b159e60717839b6a20126105777375c1cc55
7
+ data.tar.gz: 373e1262f481fa4a0a5126c15c75ff188830723def4273713710e122df18ecf3df8487075733db6af94ab30b62959dcc3e50b43c4694a5199807d13817f124ea
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # cspell:Disable
2
2
  AllCops:
3
- TargetRubyVersion: 3.0.4
3
+ TargetRubyVersion: 3.1.3
4
4
  # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
5
5
  # to ignore them, so only the ones explicitly set in this file are enabled.
6
6
  DisabledByDefault: true
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.4
1
+ 3.1.3
@@ -9,7 +9,7 @@ global_job_config:
9
9
  prologue:
10
10
  commands:
11
11
  - checkout
12
- - sem-version ruby 3.0.4
12
+ - sem-version ruby 3.1.3
13
13
  - bundle config path 'vendor/bundle'
14
14
  - bundle install
15
15
  env_vars:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0](https://www.github.com/bigbinary/neetob/compare/v0.1.5...v0.2.0) (2023-03-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * Added release gems command ([#188](https://www.github.com/bigbinary/neetob/issues/188)) ([0485cb1](https://www.github.com/bigbinary/neetob/commit/0485cb11e4f13d5eb4f6b7439d34725f509c482d))
9
+
10
+ ### [0.1.5](https://www.github.com/bigbinary/neetob/compare/v0.1.4...v0.1.5) (2023-03-01)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * handled some edge cases in the update and upsert labels cmd ([#192](https://www.github.com/bigbinary/neetob/issues/192)) ([dc87d19](https://www.github.com/bigbinary/neetob/commit/dc87d198a6a22850f3e04659413bed41d9db454f))
16
+
3
17
  ### [0.1.4](https://www.github.com/bigbinary/neetob/compare/v0.1.3...v0.1.4) (2023-02-23)
4
18
 
5
19
 
data/Gemfile CHANGED
@@ -28,6 +28,7 @@ end
28
28
 
29
29
  gem "byebug"
30
30
  gem "chronic"
31
+ gem "fury"
31
32
 
32
33
  source "https://O6Ts9-SVDaUZpHMRs2CpJp22RwbETDE@gems.neeto.com" do
33
34
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.1.4)
4
+ neetob (0.2.0)
5
5
  dotenv (~> 2.8.1)
6
6
  launchy (~> 2.5.0)
7
7
  octokit (~> 4.0)
@@ -107,6 +107,7 @@ GEM
107
107
  faraday-net_http (3.0.2)
108
108
  faraday-retry (2.0.0)
109
109
  faraday (~> 2.0)
110
+ fury (0.0.1)
110
111
  globalid (1.0.1)
111
112
  activesupport (>= 5.0)
112
113
  hashdiff (1.0.1)
@@ -237,6 +238,7 @@ GEM
237
238
 
238
239
  PLATFORMS
239
240
  x86_64-darwin-21
241
+ x86_64-darwin-22
240
242
  x86_64-linux
241
243
 
242
244
  DEPENDENCIES
@@ -244,6 +246,7 @@ DEPENDENCIES
244
246
  chronic
245
247
  dotenv (~> 2.8.1)
246
248
  faraday-retry
249
+ fury
247
250
  minitest (~> 5.0)
248
251
  minitest-reporters
249
252
  mocha
@@ -259,4 +262,4 @@ DEPENDENCIES
259
262
  webmock
260
263
 
261
264
  BUNDLED WITH
262
- 2.2.33
265
+ 2.4.7
data/README.md CHANGED
@@ -1,56 +1,44 @@
1
1
  # neetob
2
2
 
3
- The `neetob` gem gives different commands for interacting with Github repos and Heroku instances of existing neeto products, nanos and [repos](https://github.com/bigbinary/neeto-compliance/blob/main/data/neeto_repos.json).
3
+ The `neetob` gem gives different commands for interacting with Github repos, Heroku instances and other tools to manage the workflow of neeto products.
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- 1. [Getting Started](#getting-started)
8
- 1. [Installation](#installation)
9
- 2. [Usage](#usage)
7
+ 1. [Usage](#usage)
8
+ 1. [Installing neetob for use](#installing-neetob-for-use)
9
+ 2. [For development](#for-development)
10
+ 2. [Source of truth](#source-of-truth)
10
11
  3. [Working with GitHub](#working-with-github)
11
12
  1. [Issues](#issues)
12
13
  2. [Labels](#labels)
13
14
  3. [Search](#search)
14
15
  4. [Protect Branch](#protect-branch)
15
16
  5. [Make PR](#make-pr)
16
- 6. [Login](#login)
17
- 4. [Working with Heroku](#working-with-heroku)
17
+ 6. [Gems](#gems)
18
+ 7. [Login](#login)
19
+ 5. [Working with Heroku](#working-with-heroku)
18
20
  1. [Config Vars](#config-vars)
19
21
  2. [Access](#access)
20
22
  3. [Execute](#execute)
21
23
  5. [Working with Users](#working-with-users)
22
24
  1. [Audit](#audit)
23
25
  2. [Commits](#commits)
24
- 6. [Working with Make Repos Uptodate](#working-with-make-repos-uptodate)
26
+ 6. [Make Repos Uptodate](#make-repos-uptodate)
25
27
  7. [Working with local Repos](#working-with-local-repos)
26
28
  1. [ls](#ls)
27
29
  8. [Testing](#testing)
28
30
 
29
- ## Getting started
31
+ ## Usage
30
32
 
31
- ### Installation
33
+ ### Installing neetob for use
32
34
 
33
- Clone the repository onto your system using the following command:
35
+ Install and update the gem using the following command:
34
36
 
35
37
  ```sh
36
- git clone https://github.com/bigbinary/neetob.git
38
+ gem install neetob && gem update neetob
37
39
  ```
38
40
 
39
- Navigate to the root of the application directory.
40
-
41
- ```sh
42
- cd neetob
43
- ```
44
-
45
- To set up `neetob`, execute the below command from the root of the application directory.
46
-
47
- ```sh
48
- bin/setup
49
- ```
50
-
51
- ## Usage
52
-
53
- Utilize the `help` keyword to access a comprehensive list of all the available commands and options.
41
+ Use the `help` keyword to access a list of all the available commands and options.
54
42
 
55
43
  ```
56
44
  neetob help
@@ -66,9 +54,7 @@ Options:
66
54
  [--sandbox] # All the commands in sandbox mode will run only on the "neeto-dummy" app.
67
55
  ```
68
56
 
69
- **By default, all commands will be executed in non-sandbox mode.**
70
-
71
- ### Useful command-line options
57
+ #### Useful command-line options
72
58
 
73
59
  | Option | Meaning |
74
60
  | ------------ | --------------------------------- |
@@ -77,11 +63,85 @@ Options:
77
63
  | --no-sandbox | Non-Sandbox mode |
78
64
  | --help | Provides information on a command |
79
65
 
80
- **Note:** The commands within `neetob` should be used with caution, as improper usage may result in unintended consequences, and some actions may not be reversible.
66
+ The commands within `neetob` should be used with caution, as improper usage may result in unintended consequences, and some actions may not be reversible. By default, all commands will be executed in non-sandbox mode.
67
+
68
+ ### For development
69
+
70
+ Clone the repository onto your system using the following command:
71
+
72
+ ```sh
73
+ git clone https://github.com/bigbinary/neetob.git
74
+ ```
75
+
76
+ Navigate to the root of the application directory.
77
+
78
+ ```sh
79
+ cd neetob
80
+ ```
81
+
82
+ To check and use the latest changes in the local repository install `neetob` like so:
83
+
84
+ ```sh
85
+ bin/setup
86
+ ```
87
+
88
+ We can use, check or debug the `neetob` locally by directly invoking the `neetob` class like so:
89
+
90
+ ```sh
91
+ ruby exe/neeetob
92
+ ```
93
+
94
+ #### Conventional commit messages
95
+
96
+ In `neetob` we are using the Google's [release please](https://github.com/googleapis/release-please) Github action to auto update the version and release the latest gem.
97
+
98
+ In order to make this action work we have to use the [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
99
+
100
+ The Conventional commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history.
101
+
102
+ Generally, we use three types of suffix in the commit messages that are as follows:
103
+
104
+ 1. `fix:` for the commit that fixes a bug in the codebase. This updates the third digit in the version. For example, `0.1.0` version will be updated to `0.1.1`.
105
+
106
+ 2. `feat:` for the commit that introduces a new feature to the codebase. This updates the second digit in the version. For example, `0.1.0` version will be updated to `0.2.0`.
107
+
108
+ 3. `BREAKING CHANGE:` for the commit that introduces a breaking API change. This updates the first digit in the version. For example, `0.1.0` version will be updated to `1.0.0`.
109
+
110
+ For more details please refer [official docs](https://www.conventionalcommits.org/en/v1.0.0/) from Conventional commits.
111
+
112
+ In `neetob` we use "squash and merge" option while merging the PR. So we have to update the commit message while squash and merge so that Github action can track that merge commit.
113
+
114
+ For example:
115
+
116
+ ![Commit message update](images/commit-message-update.png)
117
+
118
+ ## Source of truth
119
+
120
+ This [list of repos](https://github.com/bigbinary/neeto-compliance/blob/main/data/neeto_repos.json) is used as the "source of truth".
121
+
122
+ ## Passing list of heroku apps as option
123
+
124
+ `neetob` allows you to pass list of apps in the following three formats.
125
+
126
+ ```
127
+ // all staging heroku instances
128
+ --apps "neeto-*-staging"
129
+
130
+ // all production heroku instances
131
+ --apps "neeto-*-production"
132
+
133
+ // all staging and production instances
134
+ --apps "neeto-*-web"
135
+
136
+ // for local testing
137
+ --apps neeto-dummy
138
+ ```
139
+
140
+ For safety reasons all the examples given below would be using `--apps neeto-*-staging`.
81
141
 
82
142
  ## Working with GitHub
83
143
 
84
- Efficiently gain access to a comprehensive list of all the available subcommands for the `github` command by utilizing the `help` keyword.
144
+ Check the list of all the available subcommands for the `github` command by utilizing the `help` keyword.
85
145
 
86
146
  ```sh
87
147
  neetob github help
@@ -91,10 +151,11 @@ neetob github help
91
151
 
92
152
  ```sh
93
153
  # Lists and counts all the open issues that are currently unassigned
94
- neetob github issues list --count --state open --assignee none --apps "neeto-*-web"
154
+ neetob github issues list --count --state open --assignee none --apps "neeto-*-staging"
95
155
 
96
156
  # Lists, counts and filters all unassigned open issues that are labeled as "bug"
97
- neetob github issues list --count --label bug --state open --assignee none --apps "neeto-*-web"
157
+ neetob github issues list --count --label bug --state open --assignee none \
158
+ --apps "neeto-*-staging"
98
159
  ```
99
160
 
100
161
  ### Labels
@@ -103,10 +164,10 @@ The `labels` command provides an interface for interacting with Github labels.
103
164
 
104
165
  ```sh
105
166
  # Lists the details of all the labels in the Github repo
106
- neetob github labels list --apps "neeto-*-web"
167
+ neetob github labels list --apps "neeto-*-staging"
107
168
 
108
169
  # Provides the details for a specific label in the Github repo
109
- neetob github labels show --name priority --apps "neeto-*-web"
170
+ neetob github labels show --name priority --apps "neeto-*-staging"
110
171
 
111
172
  # Changes the name of the label
112
173
  neetob github labels update --old-name "High Priority" --new-name \
@@ -116,20 +177,19 @@ neetob github labels update --old-name "High Priority" --new-name \
116
177
  neetob github labels upsert --all-neeto-repos
117
178
 
118
179
  # Accepts a different JSON file using `path` option
119
- neetob github labels upsert --path ~/Desktop/labels.json --apps "neeto-*-web"
180
+ neetob github labels upsert --path ~/Desktop/labels.json --apps "neeto-*-staging"
120
181
 
121
- # The `upsert` command can also upsert a single label using `name`, `color`
122
- # and `description` options
182
+ # Upsert a single label using `name`, `color`, and `description` options
123
183
  # No `#` is required while adding `color`
124
184
  neetob github labels upsert --name UI --color 8250df --description \
125
185
  "UI work needed" --all-neeto-repos
126
186
 
127
187
  # Deletes the given labels from the Github repos
128
188
  neetob github labels delete --labels "High Priority" "Priority 1" "bug" \
129
- --apps "neeto-*-web"
189
+ --apps "neeto-*-staging"
130
190
 
131
191
  # Deletes all the labels from the Github repos
132
- neetob github labels delete_all --apps "neeto-*-web"
192
+ neetob github labels delete_all --apps "neeto-*-staging"
133
193
  ```
134
194
 
135
195
  Check out the default labels [file](data/github-labels.json) for the required JSON file structure.
@@ -150,7 +210,7 @@ Don't use `#` before the color code.
150
210
  Searches for keywords across multiple neeto projects within specified files by utilizing the `search` command.
151
211
 
152
212
  ```sh
153
- neetob github search --keyword neeto --path README.md --apps "neeto-*-web"
213
+ neetob github search --keyword neeto --path README.md --apps "neeto-*-staging"
154
214
  ```
155
215
 
156
216
  ### Protect branch
@@ -158,7 +218,7 @@ neetob github search --keyword neeto --path README.md --apps "neeto-*-web"
158
218
  Updates branch protection rules in neeto repos by using the `protect_branch` command.
159
219
 
160
220
  ```sh
161
- neetob github protect_branch --branch main --apps neeto-dummy
221
+ neetob github protect_branch --branch main --apps "neeto-*-staging"
162
222
  ```
163
223
 
164
224
  By default, file "data/branch-protection-rules.json" will be used for updating the branch protection rules.
@@ -201,11 +261,26 @@ The `make-pr` command creates pull requests across Github repos.
201
261
  # `bundle exec neeto-audit -a` inside all repos and create a PR.
202
262
  neetob github make-pr compliance-fix
203
263
 
264
+ # Fix compliance for nanos
265
+ neetob github make-pr compliance-fix --nanos
266
+
204
267
  # The `script` command runs the given script for each product and create a PR
205
268
  neetob github make-pr script --path ~/Desktop/fix-folders.sh --branch "neetob-test" \
206
269
  --title "PR title" --description "PR description"
207
270
  ```
208
271
 
272
+ ### Gems
273
+
274
+ The `gems release` command releases the lastest gem for all neeto nanos.
275
+
276
+ ```sh
277
+ # Releases the latest gem for all nanos
278
+ neetob github gems release
279
+
280
+ # Releases the latest gem for given nanos
281
+ neetob github gems release --nanos neeto-monitor-ruby neeto-bugtrap-ruby
282
+ ```
283
+
209
284
  ### Login
210
285
 
211
286
  Authenticate through your browser and update your Github access token by utilizing the `login` command.
@@ -224,37 +299,37 @@ neetob heroku help
224
299
 
225
300
  ### Config vars
226
301
 
227
- The `config_vars` command is useful to interact with Heroku config variables.
302
+ The `config_vars` command interacts with Heroku config variables.
228
303
 
229
304
  ```sh
230
305
  # The `list` command lists all the Heroku config variables
231
- neetob heroku config_vars list --apps "neeto-*-production"
306
+ neetob heroku config_vars list --apps "neeto-*-staging"
232
307
 
233
- # We can list specific Heroku config variables using `keys` option
234
- neetob heroku config_vars list --apps "neeto-*-production" --keys key1 key2 key3
308
+ # List specific Heroku config variables using `keys` option
309
+ neetob heroku config_vars list --apps "neeto-*-staging" --keys key1 key2 key3
235
310
 
236
- # We can also use a file to specify required config vars for `list` command
237
- # Checkout the `data/config-vars-list.json` file for the required structure.
238
- neetob heroku config_vars list --apps "neeto-*-production" --path \
311
+ # List specific Heroku config variables using a file
312
+ # Checkout the `data/config-vars-list.json` file for the required structure
313
+ neetob heroku config_vars list --apps "neeto-*-staging" --path \
239
314
  neetob/data/config-vars-list.json
240
315
 
241
- # The `audit` command will check the config variables against the JSON file named as
316
+ # The `audit` command checks the config variables against the JSON file named as
242
317
  # `required-config-vars.json` that is present inside the `data` directory at the root of
243
- # installed `neetob` gem.
244
- neetob heroku config_vars audit --apps "neeto-*-production"
318
+ # installed `neetob` gem
319
+ neetob heroku config_vars audit --apps "neeto-*-staging"
245
320
 
246
- # The `audit` command can also be used with a different JSON file using `--path` option.
247
- neetob heroku config_vars audit --path ~/Desktop/config.json --apps "neeto-*-production"
321
+ # The `audit` command also works with a different JSON file using `--path` option
322
+ neetob heroku config_vars audit --path ~/Desktop/config.json --apps "neeto-*-staging"
248
323
 
249
- # The `upsert` command adds or updates the config variables from the
250
- # `data/config-vars-upsert.json` file present at the root of installed `neetob` gem.
324
+ # The `upsert` command adds or updates config variables from the
325
+ # `data/config-vars-upsert.json` file present at the root of installed `neetob` gem
251
326
  neetob heroku config_vars upsert --apps "neeto-*-staging"
252
327
 
253
- # The `remove` command is used to delete `config_vars`.
328
+ # The `remove` command deletes config variables
254
329
  neetob heroku config_vars remove --keys=TEST_KEY_1 TEST_KEY_2 --apps "neeto-*-staging"
255
330
  ```
256
331
 
257
- We can use a custom JSON file with `upsert` command using the `path` option.
332
+ We can use a custom JSON file with `upsert` command using the `--path` option.
258
333
 
259
334
  For example, assume we have a file named `config.json` on the Desktop, like so:
260
335
 
@@ -266,13 +341,13 @@ For example, assume we have a file named `config.json` on the Desktop, like so:
266
341
  }
267
342
  ```
268
343
 
269
- To update the above-mentioned config variables to all staging apps, we can use the upsert command like so:
344
+ To update the above-mentioned config variables to all staging apps, we can use the `upsert` command like so:
270
345
 
271
346
  ```sh
272
347
  neetob heroku config_vars upsert --path ~/Desktop/config.json --apps "neeto-*-staging"
273
348
  ```
274
349
 
275
- The `upsert` command can also be used to update and insert project-specific config variables.
350
+ The `upsert` command can also update or insert project-specific config variables.
276
351
 
277
352
  For example, assume we have a file named `config.json` on the `Desktop` with the following properties:
278
353
 
@@ -293,79 +368,75 @@ For example, assume we have a file named `config.json` on the `Desktop` with the
293
368
  To update the above-mentioned config variables under the defined project, we can use the upsert command like so:
294
369
 
295
370
  ```sh
296
- neetob heroku config_vars upsert --path_with_project_keys ~/Desktop/config.json
371
+ neetob heroku config_vars upsert --path_with_project_keys ~/Desktop/config.json --apps "neeto-*-staging"
297
372
  ```
298
373
 
299
374
  ### Access
300
375
 
301
- We can list, add, and remove users from multiple Heroku apps using the `access` command.
376
+ The `access` command list, add and remove users from multiple Heroku apps.
302
377
 
303
378
  ```sh
304
- # The `list` command retrieves a list of all the users from Heroku apps.
305
- neetob heroku access list --apps "neeto-*-production"
379
+ # List all the users from Heroku apps
380
+ neetob heroku access list --apps "neeto-*-staging"
306
381
 
307
- # Add new users to the Heroku apps.
382
+ # Add new users to the Heroku apps
308
383
  neetob heroku access add --users oliver@bigbinary.com eve@bigbinary.com --apps "neeto-*-staging"
309
384
 
310
- # Remove the users from the Heroku apps.
385
+ # Remove the users from the Heroku apps
311
386
  neetob heroku access remove --users oliver@bigbinary.com eve@bigbinary.com --apps \
312
387
  "neeto-*-staging"
313
388
  ```
314
389
 
315
390
  ### Execute
316
391
 
317
- Utilize the `execute` command to run a Heroku CLI command or a Rails console command for multiple neeto apps in one go.
392
+ The `execute` command executes a Heroku CLI command or a Rails console command for multiple neeto apps in one go.
318
393
 
319
394
  ```sh
320
- # We can check who has access to the neeto Heroku apps like so:
321
- neetob heroku execute -c "heroku access" --apps "neeto-*-production"
395
+ # Execute Heroku CLI command
396
+ neetob heroku execute -c "heroku access" --apps "neeto-*-staging"
322
397
 
323
- # We can run a command in the Rails console for different neeto Heroku apps like so:
398
+ # Execute Rails console command
324
399
  neetob heroku execute -c "Sidekiq::Cron::Job.destroy \"server_side_worker\"" --apps \
325
400
  "neeto-*-staging" --rails
326
401
  ```
327
402
 
328
403
  ## Working with users
329
404
 
330
- Using the `users` command, we can interact with the contributors of neeto applications.
405
+ The `users` command interacts with the contributors of neeto applications.
331
406
 
332
407
  ### Audit
333
408
 
334
- The `audit` command enables the ability to comprehensively audit contributors across all neeto applications by providing functionality to check for contributors with multiple emails and users with third-party domain emails.
335
-
336
- This command will search and use the neeto repos in the current working directory.
337
- To fetch and update all neeto repos execute [make_repos_uptodate](#working-with-make-repos-uptodate) command before the `audit` command.
409
+ The `audit` command checks the contributors across all neeto applications for multiple emails and third-party domain emails.
338
410
 
339
411
  ```sh
412
+ # Audit all the contributors
340
413
  neetob users audit
341
414
  ```
342
415
 
343
416
  ### Commits
344
417
 
345
- Using `commits` command we can list the commits for a user in a defined duration.
418
+ The `commits` command lists the commits for a user in a defined duration.
346
419
 
347
420
  ```sh
348
421
  # The below mentioned command will open a list of all the commits across neeto
349
- # product repos made by "udai1931" in the duration of last 6 months.
422
+ # product repos made by "udai1931" in the duration of last 6 months
350
423
  neetob users commits --author udai1931 --duration 6.months
351
424
 
352
- # We can list commits for a specific product using `--apps` option.
425
+ # List commits for a specific product using `--apps` option
353
426
  neetob users commits --author udai1931 --duration 6.months --apps neeto-kb-web
354
427
 
355
- # We can list commits for all neeto repos using the `--all-neeto-repos` option.
428
+ # List commits for all neeto repos using the `--all-neeto-repos` option
356
429
  neetob users commits --author udai1931 --duration 6.months --all-neeto-repos
357
430
  ```
358
431
 
359
- ## Working with Make Repos Uptodate
432
+ ## Make Repos Uptodate
360
433
 
361
- Using the `make_repos_uptodate` command, we can uptodate all neeto repos.
362
- The list of neeto repos is picked up from [neeto_compliance](https://github.com/bigbinary/neeto-compliance/blob/main/lib/neeto_compliance/neeto_repos.rb).
434
+ The `make_repos_uptodate` command updates all neeto repos.
363
435
 
364
436
  ```sh
365
437
  neetob make_repos_uptodate
366
438
 
367
- # We have a `--all-neeto-repos` option for this command too so that we can
368
- # fetch and update all the neeto repos in the current working directory.
439
+ # Update all neeto repos with `--all-neeto-repos`
369
440
  neetob make_repos_uptodate --all-neeto-repos
370
441
  ```
371
442
 
@@ -379,25 +450,21 @@ neeto-kb-web
379
450
 
380
451
  ## Working with local Repos
381
452
 
382
- Using the `local` command, we can interact with the local neeto repos.
453
+ The `local` command interacts with the local neeto repos.
383
454
 
384
455
  ### ls
385
456
 
386
- The `ls` command can list the files from all the local neeto repos.
387
-
388
- This command will search and use the neeto repos in the current working directory.
389
- To fetch and update all neeto repos execute [make_repos_uptodate](#working-with-make-repos-uptodate) command before the `ls` command.
457
+ The `ls` command lists the files from all the local neeto repos.
390
458
 
391
459
  ```sh
392
- # The `ls` command will list all the files in the root directory of neeto repos.
393
- neetob local ls --apps "*"
460
+ # List all the files in the root directory of neeto repos
461
+ neetob local ls --apps "neeto-*-web"
394
462
 
395
- # The `ls` command can also list files in a specific directory using the
396
- # `--dir` option.
397
- neetob local ls --dir public --apps "*"
463
+ # List files in a specific directory with `--dir` option
464
+ neetob local ls --dir public --apps "neeto-*-web"
398
465
 
399
- # We can also list files in a nested directory.
400
- neetob local ls --dir app/controllers --apps "*"
466
+ # List files in a nested directory
467
+ neetob local ls --dir app/controllers --apps "neeto-*-web"
401
468
  ```
402
469
 
403
470
  ## Testing
data/bookmarks.md CHANGED
@@ -3,3 +3,28 @@
3
3
  [All UX issues](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Abigbinary+label%3Aux)
4
4
 
5
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
@@ -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.",
104
+ "description": "Will get closed when sub-issues are fixed and this issue is tracked in a monthly milestone.",
110
105
  "color": "6A5ACD"
111
106
  },
107
+ {
108
+ "name": "backend",
109
+ "description": "Deals with Ruby & Rails code majorly.",
110
+ "color": "C2E0C6"
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": "honeybadger",
124
- "description": "Issue created by honeybadger.",
125
- "color": "D3D3D3"
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 neeto engines/frontend packages.",
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": "Reason should be specified as a comment before putting issue/PR on-hold.",
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
  {
@@ -154,11 +174,6 @@
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,21 +184,11 @@
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
- {
183
- "name": "UX-design-needed",
184
- "description": "This issue is part of the UI weekly milestone.",
185
- "color": "366FB9"
186
- },
187
192
  {
188
193
  "name": "engineer-needed",
189
194
  "description": "Engineer is needed to work on the issue",
@@ -191,7 +196,22 @@
191
196
  },
192
197
  {
193
198
  "name": "working",
194
- "description": "This issue is part of the UI weekly milestone.",
199
+ "description": "A branch associated with this issue is created.",
195
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"
196
216
  }
197
217
  ]
Binary file
@@ -93,5 +93,10 @@ module Neetob
93
93
  NeetoCompliance::NeetoRepos::mobile_apps +
94
94
  NeetoCompliance::NeetoRepos::other_repos
95
95
  end
96
+
97
+ def find_all_matching_gems(gems = ["*"])
98
+ all_available_gems = NeetoCompliance::NeetoRepos.nanos_backend
99
+ match_apps(gems || ["*"], all_available_gems)
100
+ end
96
101
  end
97
102
  end
@@ -41,7 +41,7 @@ module Neetob
41
41
  end
42
42
 
43
43
  def request_authorization
44
- post(uris["auth_req"], params: { client_id: client_id, scope: scope })
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: client_id,
90
+ client_id:,
91
91
  device_code: auth_data[:device_code],
92
- grant_type: grant_type
92
+ grant_type:
93
93
  }
94
94
  )
95
95
 
@@ -7,6 +7,7 @@ require_relative "search"
7
7
  require_relative "protect_branch"
8
8
  require_relative "login"
9
9
  require_relative "make_pr/commands"
10
+ require_relative "gems/commands"
10
11
 
11
12
  module Neetob
12
13
  class CLI
@@ -21,6 +22,9 @@ module Neetob
21
22
  desc "make-pr", "Create PRs across multiple Github repos"
22
23
  subcommand "make_pr", MakePr::Commands
23
24
 
25
+ desc "gems", "Interact with the neeto gems"
26
+ subcommand "gems", Gems::Commands
27
+
24
28
  desc "search", "Find the lines matching the given keyword in the specified file across all the neeto apps"
25
29
  option :apps, type: :array, aliases: "-a", required: true, desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
26
30
  option :keyword, type: :string, aliases: "-k", desc: "Keyword which needs to be searched", required: true
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+
5
+ require_relative "release"
6
+ require_relative "../../sub_command_base"
7
+
8
+ module Neetob
9
+ class CLI
10
+ module Github
11
+ module Gems
12
+ class Commands < SubCommandBase
13
+ desc "release", "Release all the neeto nanos"
14
+ option :nanos, type: :array, aliases: "-n", desc: "List of nanos you want to release"
15
+ def release
16
+ Release.new(options[:nanos], options[:sandbox]).run
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+
5
+ require_relative "../make_pr/base"
6
+
7
+ module Neetob
8
+ class CLI
9
+ module Github
10
+ module Gems
11
+ class Release < MakePr::Base
12
+ attr_accessor :gems, :sandbox
13
+
14
+ def initialize(gems, sandbox = false)
15
+ super()
16
+ @gems = gems
17
+ @sandbox = sandbox
18
+ end
19
+
20
+ def run
21
+ matching_gems = find_all_matching_gems(gems)
22
+ delete_and_create_temp_neetob_dir
23
+ matching_gems.each do |gem|
24
+ ui.info("\nWorking on #{gem}\n")
25
+ begin
26
+ clone_app_in_tmp_dir("bigbinary/#{gem}")
27
+ build_gem(gem)
28
+ release_gem(gem)
29
+ if $?.success?
30
+ ui.success("Gem \"#{gem}\" released successfully")
31
+ end
32
+ rescue StandardError => e
33
+ ExceptionHandler.new(e).process
34
+ end
35
+ end
36
+ `rm -rf /tmp/neetob`
37
+ end
38
+
39
+ private
40
+
41
+ def build_gem(gem)
42
+ ui.info(`#{cd_to_app_in_tmp_dir(gem)} && gem build`)
43
+ end
44
+
45
+ def release_gem(gem)
46
+ ui.info(`#{cd_to_app_in_tmp_dir(gem)} && fury push #{gem}-*.gem --as unnitallman`)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -25,15 +25,25 @@ module Neetob
25
25
  matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
26
26
  matching_apps.each do |app|
27
27
  ui.info("\n Updating label for #{app} repo \n")
28
- update_label!(app, old_name, new_name)
28
+ begin
29
+ update_label!(app, old_name, new_name)
30
+ rescue StandardError => e
31
+ ExceptionHandler.new(e).process
32
+ end
29
33
  end
30
34
  end
31
35
 
32
36
  private
33
37
 
34
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
35
43
  client.update_label(app, old_name, { name: new_name })
36
44
  ui.success("Label \"#{old_name}\" updated to \"#{new_name}\" successfully")
45
+ rescue StandardError => e
46
+ ExceptionHandler.new(e).process
37
47
  end
38
48
  end
39
49
  end
@@ -77,6 +77,8 @@ module Neetob
77
77
  app, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE,
78
78
  label_details)
79
79
  ui.success("Label \"#{label_details["name"]}\" created successfully")
80
+ rescue StandardError => e
81
+ ExceptionHandler.new(e).process
80
82
  end
81
83
  end
82
84
 
@@ -66,6 +66,10 @@ module Neetob
66
66
  def cd_to_app_in_tmp_dir(app)
67
67
  "cd /tmp/neetob/#{app_name_without_org_suffix(app)}"
68
68
  end
69
+
70
+ def add_org_suffix(apps)
71
+ apps.map { |app| "bigbinary/#{app}" }
72
+ end
69
73
  end
70
74
  end
71
75
  end
@@ -11,15 +11,14 @@ module Neetob
11
11
  module Github
12
12
  module MakePr
13
13
  class Commands < SubCommandBase
14
- class_option :apps,
15
- {
16
- type: :array, aliases: "-a", default: ["*"],
17
- desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
18
- }
14
+ class_option :apps, type: :array, aliases: "-a", default: ["*"],
15
+ desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
16
+ class_option :nanos, type: :boolean, aliases: "-n", default: false,
17
+ desc: "Use this flag to make PRs for the neeto gems"
19
18
 
20
19
  desc "compliance-fix", "Create PRs for fixing neeto compliance in all products"
21
20
  def compliance_fix
22
- ComplianceFix.new(options[:apps], options[:sandbox]).run
21
+ ComplianceFix.new(options[:apps], options[:nanos], options[:sandbox]).run
23
22
  end
24
23
 
25
24
  desc "script", "Create PRs after running the given script for each product."
@@ -30,7 +29,7 @@ module Neetob
30
29
  option :description, type: :string, aliases: "-d", desc: "Description of the PR"
31
30
  def script
32
31
  Script.new(
33
- options[:apps], options[:path], options[:title], options[:branch], options[:description],
32
+ options[:apps], options[:path], options[:title], options[:branch], options[:description], options[:nanos],
34
33
  options[:sandbox]).run
35
34
  end
36
35
  end
@@ -9,19 +9,22 @@ module Neetob
9
9
  module Github
10
10
  module MakePr
11
11
  class ComplianceFix < Base
12
- attr_accessor :apps, :sandbox
12
+ attr_accessor :apps, :sandbox, :should_fix_nanos
13
13
 
14
- def initialize(apps, sandbox = false)
14
+ def initialize(apps, should_fix_nanos = false, sandbox = false)
15
15
  super()
16
16
  @apps = apps
17
17
  @sandbox = sandbox
18
+ @should_fix_nanos = should_fix_nanos
18
19
  end
19
20
 
20
21
  def run
21
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
22
+ matching_apps = should_fix_nanos ?
23
+ add_org_suffix(find_all_matching_gems) :
24
+ find_all_matching_apps(apps, :github, sandbox)
22
25
  delete_and_create_temp_neetob_dir
23
26
  matching_apps.each do |app|
24
- ui.info("\n Working on #{app} \n")
27
+ ui.info("\nWorking on #{app}\n")
25
28
  begin
26
29
  clone_app_in_tmp_dir(app)
27
30
  check_and_delete_remote_branch(app)
@@ -9,18 +9,22 @@ module Neetob
9
9
  module Github
10
10
  module MakePr
11
11
  class Script < Base
12
- attr_accessor :apps, :sandbox, :path_to_the_script_file, :pr_description
12
+ attr_accessor :apps, :sandbox, :path_to_the_script_file, :pr_description, :should_fix_nanos
13
13
 
14
- def initialize(apps, path_to_the_script_file, pr_title, branch_name, pr_description, sandbox = false)
14
+ def initialize(apps, path_to_the_script_file, pr_title,
15
+ branch_name, pr_description, should_fix_nanos, sandbox = false)
15
16
  super(pr_title, branch_name)
16
17
  @apps = apps
17
18
  @sandbox = sandbox
18
19
  @path_to_the_script_file = path_to_the_script_file
19
20
  @pr_description = pr_description
21
+ @should_fix_nanos = should_fix_nanos
20
22
  end
21
23
 
22
24
  def run
23
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
25
+ matching_apps = should_fix_nanos ?
26
+ add_org_suffix(find_all_matching_gems) :
27
+ find_all_matching_apps(apps, :github, sandbox)
24
28
  delete_and_create_temp_neetob_dir
25
29
  matching_apps.each do |app|
26
30
  ui.info("\n Working on #{app} \n")
data/lib/neetob/cli/ui.rb CHANGED
@@ -18,7 +18,7 @@ module Neetob
18
18
  end
19
19
 
20
20
  def ask(question, echo = true)
21
- shell.ask(question, echo: echo)
21
+ shell.ask(question, echo:)
22
22
  end
23
23
 
24
24
  def yes?(question)
@@ -156,7 +156,7 @@ module Neetob
156
156
  begin
157
157
  commits = client.commits(
158
158
  app, "main",
159
- { author: author, since: since_duration(duration), per_page: 100, page: page })
159
+ { author:, since: since_duration(duration), per_page: 100, page: })
160
160
  rescue => exception
161
161
  ui.error(exception.message)
162
162
  commits = []
@@ -26,7 +26,9 @@ module Neetob
26
26
  when Octokit::UnprocessableEntity
27
27
  ui.error(
28
28
  "Failed to complete the given request."\
29
- " Make sure that the given entity is correct and processable")
29
+ " Make sure that the given entity is correct and processable"\
30
+ "#{exception.message}."
31
+ )
30
32
  when Octokit::Unauthorized
31
33
  ui.error(
32
34
  "You are unauthorized to make API calls,"\
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.1.4"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-23 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -107,6 +107,7 @@ files:
107
107
  - data/config-vars-upsert.json
108
108
  - data/github-labels.json
109
109
  - exe/neetob
110
+ - images/commit-message-update.png
110
111
  - install.sh
111
112
  - lib/neetob.rb
112
113
  - lib/neetob/cli.rb
@@ -115,6 +116,8 @@ files:
115
116
  - lib/neetob/cli/github/auth.rb
116
117
  - lib/neetob/cli/github/base.rb
117
118
  - lib/neetob/cli/github/commands.rb
119
+ - lib/neetob/cli/github/gems/commands.rb
120
+ - lib/neetob/cli/github/gems/release.rb
118
121
  - lib/neetob/cli/github/issues/commands.rb
119
122
  - lib/neetob/cli/github/issues/create.rb
120
123
  - lib/neetob/cli/github/issues/list.rb
@@ -179,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
182
  - !ruby/object:Gem::Version
180
183
  version: '0'
181
184
  requirements: []
182
- rubygems_version: 3.2.33
185
+ rubygems_version: 3.3.26
183
186
  signing_key:
184
187
  specification_version: 4
185
188
  summary: Provides a set of helper scripts for Github and Heroku.