neetob 0.3.0 → 0.3.1

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: 129689cbd6ed773bb8b33aced3e726123662c5cc772c52287a3464bf63fe324b
4
- data.tar.gz: ea5801918efe691ab99c985315fded011149eab7dc0082481d4c6ce6f41c2594
3
+ metadata.gz: c24a5c688914c96c2ab4652e673124a9f794e1cdb57ca86e606e61134717b015
4
+ data.tar.gz: b66c79be8be99068e154fdd811556fa3a6dc947f9f8ac232fdc82654241236b5
5
5
  SHA512:
6
- metadata.gz: 6e933f42dc569195d856c707ac01911e71538057afcd4d447ab50242330a498d2fb31f769f1375a03bd3fbbad0e105dd24094ad642e74ed2cea0fdf751b5c5e4
7
- data.tar.gz: 8a543540b8974374280c0b2781b99c7819918d34c0248b53dd85d0792d05004b4de407717d5bbd3a87881604672d1c714b11986f6642efb1af360a0952bb34e6
6
+ metadata.gz: d07b6d3b394a6ce90d6feaa8031c506bb49be5bdcf076761cdc1c55b9e555400cc9fafdb766816de82d4bfbc438e8e8a3784c9c2c94d4ab49a3c66795f5f4da0
7
+ data.tar.gz: 8fbfe0585f64116cd3404873d19a7518e034ffe250d789c5775bc6186c808bcf88c1407e10cbca5c73fe1333ef069642095577c3142054ef2fc6260cd90ee33b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### [0.3.1](https://www.github.com/bigbinary/neetob/compare/v0.3.0...v0.3.1) (2023-03-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Cleanup documentation ([#226](https://www.github.com/bigbinary/neetob/issues/226)) ([c20203b](https://www.github.com/bigbinary/neetob/commit/c20203bf31b0a08e9d22d8cb32295e840c3a1afe))
9
+
3
10
  ## [0.3.0](https://www.github.com/bigbinary/neetob/compare/v0.2.7...v0.3.0) (2023-03-23)
4
11
 
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.3.0)
4
+ neetob (0.3.1)
5
5
  dotenv (~> 2.8.1)
6
6
  launchy (~> 2.5.0)
7
7
  octokit (~> 4.0)
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. [For development](#for-development)
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
- 5. [Working with Heroku](#working-with-heroku)
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](#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-neeto-repos
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-neeto-repos
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-neeto-repos
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 use the `--all-neeto-repos` option with the above mentioned command so that the
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-neeto-repos
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 using the `--all-neeto-repos` option
436
- neetob users commits --author udai1931 --duration 6.months --all-neeto-repos
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 with `--all-neeto-repos`
447
- neetob make_repos_uptodate --all-neeto-repos
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.
@@ -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, :apps
9
+ attr_accessor :sandbox, :repos
10
10
 
11
- def initialize(sandbox = false, apps = ["*"])
11
+ def initialize(sandbox = false, repos = ["*"])
12
12
  super()
13
13
  @sandbox = sandbox
14
- @apps = apps
14
+ @repos = repos
15
15
  end
16
16
 
17
17
  def run
18
- neeto_apps = find_all_matching_apps_or_repos(apps, :github, sandbox)
19
- neeto_apps.each do |app|
20
- app_name = app.split("/").last
21
- ui.info("\nWorking on #{app_name}\n")
22
- if directory_exists(app_name)
23
- checkout_to_main_and_fetch_commits(app_name)
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(app_name)
25
+ clone_repo(repo_name)
26
26
  end
27
27
  end
28
28
  end
29
29
 
30
- def directory_exists(app_name)
31
- File.directory?(app_name)
30
+ def directory_exists(repo_name)
31
+ File.directory?(repo_name)
32
32
  end
33
33
 
34
- def checkout_to_main_and_fetch_commits(app_name)
35
- %x[ cd #{app_name} && git checkout main && git pull origin main ]
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 #{app_name}------"
37
+ puts "------Successfully pulled main branch of #{repo_name}------"
38
38
  else
39
- puts "------Unable to pull the main branch of #{app_name} due to conflicts------"
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(app_name)
44
- `git clone git@github.com:bigbinary/#{app_name}.git`
43
+ def clone_repo(repo_name)
44
+ `git clone git@github.com:bigbinary/#{repo_name}.git`
45
45
  if $?.success?
46
- puts "------Done cloning #{app_name}------"
46
+ puts "------Done cloning #{repo_name}------"
47
47
  else
48
- puts "------Failed cloning #{app_name}------"
48
+ puts "------Failed cloning #{repo_name}------"
49
49
  end
50
50
  end
51
51
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
@@ -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