neetob 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +13 -76
- data/docs/development.md +53 -0
- data/docs/testing.md +7 -0
- data/lib/neetob/cli/fetchorupdate_repos/execute.rb +20 -20
- data/lib/neetob/cli/github/issues/commands.rb +1 -1
- data/lib/neetob/cli/github/issues/create.rb +24 -1
- data/lib/neetob/cli.rb +3 -1
- data/lib/neetob/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a5009ec9b17cb67db7709598632c5001f487460c4a393ff4415c657f8f2a26
|
4
|
+
data.tar.gz: 7ef5bae6ffe881a4b3507865b35c56a68beb35cc0af5114cd348c163678fcc1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89aec8ad58378aef387e4bf6a2ac5b8bbc40cb15432a4c884b1ba05e752f660c0a8785b3021bdc98e85c193bfa8b505f36b5ba68ae428af08a36a2634e2112fb
|
7
|
+
data.tar.gz: e4831981bfc7e6136489583f91f592aa2ff1931b9d248cfd3d2683a3128931fe9b1e5b58a6f94906d3d2a7c6e60923f125534b89cf0f17b00ceb3dd6e3a54e10
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
### [0.3.2](https://www.github.com/bigbinary/neetob/compare/v0.3.1...v0.3.2) (2023-03-29)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* Added multiline input format logic for issue create command ([#236](https://www.github.com/bigbinary/neetob/issues/236)) ([71f1442](https://www.github.com/bigbinary/neetob/commit/71f1442ff92938bb84661c42853fb6f72bbc8fba))
|
9
|
+
|
10
|
+
### [0.3.1](https://www.github.com/bigbinary/neetob/compare/v0.3.0...v0.3.1) (2023-03-23)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* Cleanup documentation ([#226](https://www.github.com/bigbinary/neetob/issues/226)) ([c20203b](https://www.github.com/bigbinary/neetob/commit/c20203bf31b0a08e9d22d8cb32295e840c3a1afe))
|
16
|
+
|
3
17
|
## [0.3.0](https://www.github.com/bigbinary/neetob/compare/v0.2.7...v0.3.0) (2023-03-23)
|
4
18
|
|
5
19
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,7 @@ The `neetob` gem gives a different set of commands for interacting with Github r
|
|
6
6
|
|
7
7
|
1. [Usage](#usage)
|
8
8
|
1. [Installing neetob for use](#installing-neetob-for-use)
|
9
|
-
2. [
|
10
|
-
3. [Gem release](#gem-release)
|
9
|
+
2. [Installing neetob for development](docs/development.md)
|
11
10
|
2. [Source of truth](#source-of-truth)
|
12
11
|
3. [Working with GitHub](#working-with-github)
|
13
12
|
1. [Issues](#issues)
|
@@ -17,7 +16,7 @@ The `neetob` gem gives a different set of commands for interacting with Github r
|
|
17
16
|
5. [Make PR](#make-pr)
|
18
17
|
6. [Gems](#gems)
|
19
18
|
7. [Login](#login)
|
20
|
-
|
19
|
+
4. [Working with Heroku](#working-with-heroku)
|
21
20
|
1. [Config Vars](#config-vars)
|
22
21
|
2. [Access](#access)
|
23
22
|
3. [Execute](#execute)
|
@@ -27,7 +26,7 @@ The `neetob` gem gives a different set of commands for interacting with Github r
|
|
27
26
|
6. [Make Repos Uptodate](#make-repos-uptodate)
|
28
27
|
7. [Working with local Repos](#working-with-local-repos)
|
29
28
|
1. [ls](#ls)
|
30
|
-
8. [Testing](
|
29
|
+
8. [Testing](docs/testing.md)
|
31
30
|
|
32
31
|
## Usage
|
33
32
|
|
@@ -67,61 +66,6 @@ Options:
|
|
67
66
|
|
68
67
|
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.
|
69
68
|
|
70
|
-
### For development
|
71
|
-
|
72
|
-
Clone the repository onto your system using the following command:
|
73
|
-
|
74
|
-
```sh
|
75
|
-
git clone https://github.com/bigbinary/neetob.git
|
76
|
-
```
|
77
|
-
|
78
|
-
Navigate to the root of the application directory.
|
79
|
-
|
80
|
-
```sh
|
81
|
-
cd neetob
|
82
|
-
```
|
83
|
-
|
84
|
-
To check and use the latest changes in the local repository install `neetob` like so:
|
85
|
-
|
86
|
-
```sh
|
87
|
-
bin/setup
|
88
|
-
```
|
89
|
-
|
90
|
-
We can use, check or debug the `neetob` locally by directly invoking the `neetob` class like so:
|
91
|
-
|
92
|
-
```sh
|
93
|
-
ruby exe/neeetob
|
94
|
-
```
|
95
|
-
|
96
|
-
#### Conventional commit messages
|
97
|
-
|
98
|
-
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.
|
99
|
-
|
100
|
-
In order to make this action work we have to use the [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
|
101
|
-
|
102
|
-
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.
|
103
|
-
|
104
|
-
Generally, we use three types of suffix in the commit messages that are as follows:
|
105
|
-
|
106
|
-
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`.
|
107
|
-
|
108
|
-
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`.
|
109
|
-
|
110
|
-
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`.
|
111
|
-
|
112
|
-
For more details please refer [official docs](https://www.conventionalcommits.org/en/v1.0.0/) from Conventional commits.
|
113
|
-
|
114
|
-
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.
|
115
|
-
|
116
|
-
For example:
|
117
|
-
|
118
|
-
![Commit message update](images/commit-message-update.png)
|
119
|
-
|
120
|
-
|
121
|
-
### Gem release
|
122
|
-
|
123
|
-
When a commit is added to the `main` branch [release](.github/workflows/release.yml) Github action checks that commit for the [conventional commit message](#conventional-commit-messages). If a proper suffix like `fix:`, `feat:`, etc is used in that commit message then the Github action will create a new PR with the updated version and changelog. The version and changelog for the `neetob` gem are updated automatically by the Github action using the commit message. When we merge this newly created PR by the Github action into the main branch, an updated Gem is released to the [rubygems](https://rubygems.org).
|
124
|
-
|
125
69
|
## Source of truth
|
126
70
|
|
127
71
|
This [list of repos](https://github.com/bigbinary/neeto-compliance/blob/main/data/neeto_repos.json) is used as the "source of truth".
|
@@ -178,10 +122,10 @@ neetob github labels show --name priority --repos "neeto-*-staging"
|
|
178
122
|
|
179
123
|
# Changes the name of the label
|
180
124
|
neetob github labels update --old-name "High Priority" --new-name \
|
181
|
-
"high-priority" --all
|
125
|
+
"high-priority" --repos "all"
|
182
126
|
|
183
127
|
# Updates and inserts all the labels mentioned in the file "data/github-labels.json"
|
184
|
-
neetob github labels upsert --all
|
128
|
+
neetob github labels upsert --repos "all"
|
185
129
|
|
186
130
|
# Accepts a different JSON file using `path` option
|
187
131
|
neetob github labels upsert --path ~/Desktop/labels.json --repos "neeto-*-staging"
|
@@ -189,7 +133,7 @@ neetob github labels upsert --path ~/Desktop/labels.json --repos "neeto-*-stagin
|
|
189
133
|
# Upsert a single label using `name`, `color`, and `description` options
|
190
134
|
# No `#` is required while adding `color`
|
191
135
|
neetob github labels upsert --name UI --color 8250df --description \
|
192
|
-
"UI work needed" --all
|
136
|
+
"UI work needed" --repos "all"
|
193
137
|
|
194
138
|
# Deletes the given labels from the Github repos
|
195
139
|
neetob github labels delete --labels "High Priority" "Priority 1" "bug" \
|
@@ -248,13 +192,13 @@ neetob github protect_branch --branch main --path ~/Desktop/branch-protection-ru
|
|
248
192
|
--repos "neeto-*-staging"
|
249
193
|
```
|
250
194
|
|
251
|
-
We can also
|
195
|
+
We can also pass the value `all` to the option `--repos` with the above mentioned command so that the
|
252
196
|
branch protection rules can be updated for
|
253
197
|
all [neeto repos](https://github.com/bigbinary/neeto-compliance/blob/main/data/neeto_repos.json).
|
254
198
|
|
255
199
|
```sh
|
256
200
|
neetob github protect_branch --branch main --path ~/Desktop/branch-protection-rules.json \
|
257
|
-
--all
|
201
|
+
--repos "all"
|
258
202
|
```
|
259
203
|
|
260
204
|
**Note:** Unfortunately, utilizing the Github API, we are unable to update the `Require deployments to succeed before merging` rule, as it is currently not defined as a parameter within the API. For further information on available options to update different branch protection rules, kindly refer to the official Github [documentation](https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection).
|
@@ -432,8 +376,8 @@ neetob users commits --author udai1931 --duration 6.months
|
|
432
376
|
# List commits for a specific product using `--apps` option
|
433
377
|
neetob users commits --author udai1931 --duration 6.months --apps neeto-kb-web
|
434
378
|
|
435
|
-
# List commits for all neeto repos
|
436
|
-
neetob users commits --author udai1931 --duration 6.months --all
|
379
|
+
# List commits for all neeto repos by passing the value `all` to`--apps` option
|
380
|
+
neetob users commits --author udai1931 --duration 6.months --apps "all"
|
437
381
|
```
|
438
382
|
|
439
383
|
## Make Repos Uptodate
|
@@ -443,8 +387,9 @@ The `make_repos_uptodate` command updates all neeto repos.
|
|
443
387
|
```sh
|
444
388
|
neetob make_repos_uptodate
|
445
389
|
|
446
|
-
# Update all neeto repos
|
447
|
-
neetob make_repos_uptodate --all
|
390
|
+
# Update all neeto repos by passing the value `all` to`--repos` option
|
391
|
+
neetob make_repos_uptodate --repos "all"
|
392
|
+
|
448
393
|
```
|
449
394
|
|
450
395
|
Executing the above mentioned command will check and clone all the missing neeto repos in the current working directory and will update all of them to the latest version. After the execution of command the directories will look something like this:
|
@@ -473,11 +418,3 @@ neetob local ls --dir public --apps "neeto-*-web"
|
|
473
418
|
# List files in a nested directory
|
474
419
|
neetob local ls --dir app/controllers --apps "neeto-*-web"
|
475
420
|
```
|
476
|
-
|
477
|
-
## Testing
|
478
|
-
|
479
|
-
For testing `github` commands use - [neeto-dummy](https://github.com/bigbinary/neeto-dummy) repo.
|
480
|
-
|
481
|
-
For testing `heroku` commands use - [neeto-dummy](https://dashboard.heroku.com/apps/neeto-dummy) app.
|
482
|
-
|
483
|
-
**Note:** Contact your respective Team Lead if you don't have access.
|
data/docs/development.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
### Installing neetob for development
|
2
|
+
|
3
|
+
Clone the repository onto your system using the following command:
|
4
|
+
|
5
|
+
```sh
|
6
|
+
git clone https://github.com/bigbinary/neetob.git
|
7
|
+
```
|
8
|
+
|
9
|
+
Navigate to the root of the application directory.
|
10
|
+
|
11
|
+
```sh
|
12
|
+
cd neetob
|
13
|
+
```
|
14
|
+
|
15
|
+
To check and use the latest changes in the local repository install `neetob` like so:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
bin/setup
|
19
|
+
```
|
20
|
+
|
21
|
+
We can use, check or debug the `neetob` locally by directly invoking the `neetob` class like so:
|
22
|
+
|
23
|
+
```sh
|
24
|
+
ruby exe/neeetob
|
25
|
+
```
|
26
|
+
|
27
|
+
### Conventional commit messages
|
28
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
In order to make this action work we have to use the [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
|
32
|
+
|
33
|
+
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.
|
34
|
+
|
35
|
+
Generally, we use three types of suffix in the commit messages that are as follows:
|
36
|
+
|
37
|
+
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`.
|
38
|
+
|
39
|
+
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`.
|
40
|
+
|
41
|
+
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`.
|
42
|
+
|
43
|
+
For more details please refer [official docs](https://www.conventionalcommits.org/en/v1.0.0/) from Conventional commits.
|
44
|
+
|
45
|
+
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.
|
46
|
+
|
47
|
+
For example:
|
48
|
+
|
49
|
+
![Commit message update](../images/commit-message-update.png)
|
50
|
+
|
51
|
+
### Gem release
|
52
|
+
|
53
|
+
When a commit is added to the `main` branch [release](.github/workflows/release.yml) Github action checks that commit for the [conventional commit message](#conventional-commit-messages). If a proper suffix like `fix:`, `feat:`, etc is used in that commit message then the Github action will create a new PR with the updated version and changelog. The version and changelog for the `neetob` gem are updated automatically by the Github action using the commit message. When we merge this newly created PR by the Github action into the main branch, an updated Gem is released to the [rubygems](https://rubygems.org).
|
data/docs/testing.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Testing instructions
|
2
|
+
|
3
|
+
For testing `github` commands use - [neeto-dummy](https://github.com/bigbinary/neeto-dummy) repo.
|
4
|
+
|
5
|
+
For testing `heroku` commands use - [neeto-dummy](https://dashboard.heroku.com/apps/neeto-dummy) app.
|
6
|
+
|
7
|
+
**Note:** Contact your respective Team Lead if you don't have access.
|
@@ -6,46 +6,46 @@ module Neetob
|
|
6
6
|
class CLI
|
7
7
|
module FetchorupdateRepos
|
8
8
|
class Execute < Base
|
9
|
-
attr_accessor :sandbox, :
|
9
|
+
attr_accessor :sandbox, :repos
|
10
10
|
|
11
|
-
def initialize(sandbox = false,
|
11
|
+
def initialize(sandbox = false, repos = ["*"])
|
12
12
|
super()
|
13
13
|
@sandbox = sandbox
|
14
|
-
@
|
14
|
+
@repos = repos
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
ui.info("\nWorking on #{
|
22
|
-
if directory_exists(
|
23
|
-
checkout_to_main_and_fetch_commits(
|
18
|
+
neeto_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
|
19
|
+
neeto_repos.each do |repo|
|
20
|
+
repo_name = repo.split("/").last
|
21
|
+
ui.info("\nWorking on #{repo_name}\n")
|
22
|
+
if directory_exists(repo_name)
|
23
|
+
checkout_to_main_and_fetch_commits(repo_name)
|
24
24
|
else
|
25
|
-
clone_repo(
|
25
|
+
clone_repo(repo_name)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def directory_exists(
|
31
|
-
File.directory?(
|
30
|
+
def directory_exists(repo_name)
|
31
|
+
File.directory?(repo_name)
|
32
32
|
end
|
33
33
|
|
34
|
-
def checkout_to_main_and_fetch_commits(
|
35
|
-
%x[ cd #{
|
34
|
+
def checkout_to_main_and_fetch_commits(repo_name)
|
35
|
+
%x[ cd #{repo_name} && git checkout main && git pull origin main ]
|
36
36
|
if $?.success?
|
37
|
-
puts "------Successfully pulled main branch of #{
|
37
|
+
puts "------Successfully pulled main branch of #{repo_name}------"
|
38
38
|
else
|
39
|
-
puts "------Unable to pull the main branch of #{
|
39
|
+
puts "------Unable to pull the main branch of #{repo_name} due to conflicts------"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def clone_repo(
|
44
|
-
`git clone git@github.com:bigbinary/#{
|
43
|
+
def clone_repo(repo_name)
|
44
|
+
`git clone git@github.com:bigbinary/#{repo_name}.git`
|
45
45
|
if $?.success?
|
46
|
-
puts "------Done cloning #{
|
46
|
+
puts "------Done cloning #{repo_name}------"
|
47
47
|
else
|
48
|
-
puts "------Failed cloning #{
|
48
|
+
puts "------Failed cloning #{repo_name}------"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -30,7 +30,7 @@ module Neetob
|
|
30
30
|
end
|
31
31
|
|
32
32
|
desc "create", "Create a issue in the Github repos"
|
33
|
-
option :title, type: :string,
|
33
|
+
option :title, type: :string, aliases: "-t", desc: "Title of the issue"
|
34
34
|
option :description, type: :string, aliases: "-d", desc: "Description of the issue"
|
35
35
|
option :assignee, type: :string, desc: "Username of the user you want to assign this issue."
|
36
36
|
option :labels, type: :string, desc: "List of comma separated labels you want to add in this issue. Example: \"--labels bug,ui\""
|
@@ -20,12 +20,13 @@ sandbox = false)
|
|
20
20
|
@issue_assignee = issue_assignee
|
21
21
|
@issue_labels = issue_labels
|
22
22
|
@sandbox = sandbox
|
23
|
+
get_issue_title_or_description_and_confirm_data
|
23
24
|
end
|
24
25
|
|
25
26
|
def run
|
26
27
|
matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
|
27
28
|
matching_repos.each do |repo|
|
28
|
-
ui.info("\
|
29
|
+
ui.info("\nCreating issue in \"#{repo}\" \n")
|
29
30
|
begin
|
30
31
|
issue_options = { assignee: issue_assignee, labels: issue_labels }
|
31
32
|
issue = client.create_issue(repo, issue_title, issue_description, issue_options)
|
@@ -35,6 +36,28 @@ sandbox = false)
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def get_issue_title_or_description_and_confirm_data
|
43
|
+
until issue_title.present?
|
44
|
+
ui.info("Enter the issue title below. Once you are done then just press enter:\n~ ")
|
45
|
+
@issue_title = STDIN.gets.chomp
|
46
|
+
ui.say("Title can't be blank.") if issue_title.blank?
|
47
|
+
end
|
48
|
+
if issue_description.blank?
|
49
|
+
ui.info(
|
50
|
+
"Enter the issue body below. Once you are done then press Ctrl-D: " +
|
51
|
+
"(While creating the issue body you can use the enter key to type multiline message)\n")
|
52
|
+
@issue_description = STDIN.read.chomp
|
53
|
+
end
|
54
|
+
ui.info(
|
55
|
+
"Please review the issue title & the issue body that you have typed and also check the repos " +
|
56
|
+
"for which issues will be created. If everything looks good then type " +
|
57
|
+
"\"proceed\" below. Type anything else to cancel the operation.\n~ ")
|
58
|
+
proceed = STDIN.gets.chomp
|
59
|
+
ui.error("Cancelled creating issue(s)") and exit(true) if proceed.casecmp?("proceed") == false
|
60
|
+
end
|
38
61
|
end
|
39
62
|
end
|
40
63
|
end
|
data/lib/neetob/cli.rb
CHANGED
@@ -37,8 +37,10 @@ module Neetob
|
|
37
37
|
subcommand "code", Code::Commands
|
38
38
|
|
39
39
|
desc "make_repos_uptodate", "Uptodate all neeto repos"
|
40
|
+
option :repos, type: :array, aliases: "-r", default: ["*"],
|
41
|
+
desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\", also providing \"all\" as value matches all neeto repos. Note: The default value is \"*\", hence all neeto repos would be affected."
|
40
42
|
def make_repos_uptodate
|
41
|
-
FetchorupdateRepos::Execute.new(options[:sandbox]).run
|
43
|
+
FetchorupdateRepos::Execute.new(options[:sandbox], options[:repos]).run
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
data/lib/neetob/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.2
|
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-03-
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- data/config-vars-list.json
|
107
107
|
- data/config-vars-upsert.json
|
108
108
|
- data/github-labels.json
|
109
|
+
- docs/development.md
|
110
|
+
- docs/testing.md
|
109
111
|
- exe/neetob
|
110
112
|
- images/commit-message-update.png
|
111
113
|
- install.sh
|