neetob 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +11 -10
  5. data/lib/neetob/cli/base.rb +1 -1
  6. data/lib/neetob/cli/fetchorupdate_repos/execute.rb +1 -1
  7. data/lib/neetob/cli/github/base.rb +3 -3
  8. data/lib/neetob/cli/github/commands.rb +5 -5
  9. data/lib/neetob/cli/github/gems/release.rb +3 -3
  10. data/lib/neetob/cli/github/issues/commands.rb +5 -5
  11. data/lib/neetob/cli/github/issues/create.rb +7 -7
  12. data/lib/neetob/cli/github/issues/list.rb +15 -15
  13. data/lib/neetob/cli/github/labels/commands.rb +9 -9
  14. data/lib/neetob/cli/github/labels/delete.rb +10 -10
  15. data/lib/neetob/cli/github/labels/delete_all.rb +11 -11
  16. data/lib/neetob/cli/github/labels/list.rb +8 -8
  17. data/lib/neetob/cli/github/labels/show.rb +8 -8
  18. data/lib/neetob/cli/github/labels/update.rb +12 -12
  19. data/lib/neetob/cli/github/labels/upsert.rb +11 -11
  20. data/lib/neetob/cli/github/make_pr/base.rb +23 -23
  21. data/lib/neetob/cli/github/make_pr/commands.rb +5 -5
  22. data/lib/neetob/cli/github/make_pr/compliance_fix.rb +19 -19
  23. data/lib/neetob/cli/github/make_pr/script.rb +16 -16
  24. data/lib/neetob/cli/github/protect_branch.rb +8 -8
  25. data/lib/neetob/cli/github/search.rb +7 -7
  26. data/lib/neetob/cli/heroku/access/add.rb +1 -1
  27. data/lib/neetob/cli/heroku/access/list.rb +1 -1
  28. data/lib/neetob/cli/heroku/access/remove.rb +1 -1
  29. data/lib/neetob/cli/heroku/config_vars/audit.rb +1 -1
  30. data/lib/neetob/cli/heroku/config_vars/list.rb +1 -1
  31. data/lib/neetob/cli/heroku/config_vars/remove.rb +1 -1
  32. data/lib/neetob/cli/heroku/config_vars/upsert.rb +1 -1
  33. data/lib/neetob/cli/heroku/execute.rb +1 -1
  34. data/lib/neetob/cli/local/ls.rb +1 -1
  35. data/lib/neetob/cli/users/audit.rb +1 -1
  36. data/lib/neetob/cli/users/commits.rb +1 -1
  37. data/lib/neetob/version.rb +1 -1
  38. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f81625c823e05e9fcddcb86381a5730e3cc2c03acf3f137803a0cbb74d1ee220
4
- data.tar.gz: 9a127257a9793d42dc5aa8e3bc7d59356236152f606e262d12ed87a2a937b7ed
3
+ metadata.gz: ab7271fb7040070268b0c67e53a7dfabae013e6294265f19fc5f38de85952075
4
+ data.tar.gz: cee7a555e9d0a17f7006aefb26932cbd70d44297f2f0c13b59dde2a787f9f4f4
5
5
  SHA512:
6
- metadata.gz: fab4a057fc1341c2bd0827396e224b632dd7aea72c6627a0b06679efb8e4e2bac704d6f22542ea1afc1eb2bfdb678efc4749a135e77f9df0f36b7cfa25feabe8
7
- data.tar.gz: 1cc41989ec73d0cd004b953dc21598e66ec01ae3e39c18a9ed501b172b174d317bc51492a507b0f11e294b68ae86867cb60244cf1d3fd76511af0c794cb8797b
6
+ metadata.gz: 07b0a97173101a0f6a67f632641c7e67f2b42155177704fa3efeefa015ca9f269b372308cc0b1503e37931158ae178625e5e3c6f2361da5f234aa9f0c90bbd25
7
+ data.tar.gz: 3cdae7098530aeaf351b82e7b31944e606bf086235fd9964842f1ad19cc59276ed10fb1130c4647a86770c326b670121e37574e25397aecba8ec4345eb290bb8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### [0.2.3](https://www.github.com/bigbinary/neetob/compare/v0.2.2...v0.2.3) (2023-03-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Fixed github commands to accept "--repos" arguement instead of "--apps" ([#208](https://www.github.com/bigbinary/neetob/issues/208)) ([a1b419e](https://www.github.com/bigbinary/neetob/commit/a1b419ed4e7cb902962dacfbdd7a7112f84ade4e))
9
+
3
10
  ### [0.2.2](https://www.github.com/bigbinary/neetob/compare/v0.2.1...v0.2.2) (2023-03-06)
4
11
 
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.2.2)
4
+ neetob (0.2.3)
5
5
  dotenv (~> 2.8.1)
6
6
  launchy (~> 2.5.0)
7
7
  octokit (~> 4.0)
data/README.md CHANGED
@@ -59,6 +59,7 @@ Options:
59
59
 
60
60
  | Option | Meaning |
61
61
  | ------------ | --------------------------------- |
62
+ | --repos | Target repo names |
62
63
  | --apps | Target app names |
63
64
  | --sandbox | Sandbox mode |
64
65
  | --no-sandbox | Non-Sandbox mode |
@@ -157,11 +158,11 @@ neetob github help
157
158
 
158
159
  ```sh
159
160
  # Lists and counts all the open issues that are currently unassigned
160
- neetob github issues list --count --state open --assignee none --apps "neeto-*-staging"
161
+ neetob github issues list --count --state open --assignee none --repos "neeto-*-staging"
161
162
 
162
163
  # Lists, counts and filters all unassigned open issues that are labeled as "bug"
163
164
  neetob github issues list --count --label bug --state open --assignee none \
164
- --apps "neeto-*-staging"
165
+ --repos "neeto-*-staging"
165
166
  ```
166
167
 
167
168
  ### Labels
@@ -170,10 +171,10 @@ The `labels` command provides an interface for interacting with Github labels.
170
171
 
171
172
  ```sh
172
173
  # Lists the details of all the labels in the Github repo
173
- neetob github labels list --apps "neeto-*-staging"
174
+ neetob github labels list --repos "neeto-*-staging"
174
175
 
175
176
  # Provides the details for a specific label in the Github repo
176
- neetob github labels show --name priority --apps "neeto-*-staging"
177
+ neetob github labels show --name priority --repos "neeto-*-staging"
177
178
 
178
179
  # Changes the name of the label
179
180
  neetob github labels update --old-name "High Priority" --new-name \
@@ -183,7 +184,7 @@ neetob github labels update --old-name "High Priority" --new-name \
183
184
  neetob github labels upsert --all-neeto-repos
184
185
 
185
186
  # Accepts a different JSON file using `path` option
186
- neetob github labels upsert --path ~/Desktop/labels.json --apps "neeto-*-staging"
187
+ neetob github labels upsert --path ~/Desktop/labels.json --repos "neeto-*-staging"
187
188
 
188
189
  # Upsert a single label using `name`, `color`, and `description` options
189
190
  # No `#` is required while adding `color`
@@ -192,10 +193,10 @@ neetob github labels upsert --name UI --color 8250df --description \
192
193
 
193
194
  # Deletes the given labels from the Github repos
194
195
  neetob github labels delete --labels "High Priority" "Priority 1" "bug" \
195
- --apps "neeto-*-staging"
196
+ --repos "neeto-*-staging"
196
197
 
197
198
  # Deletes all the labels from the Github repos
198
- neetob github labels delete_all --apps "neeto-*-staging"
199
+ neetob github labels delete_all --repos "neeto-*-staging"
199
200
  ```
200
201
 
201
202
  Check out the default labels [file](data/github-labels.json) for the required JSON file structure.
@@ -216,7 +217,7 @@ Don't use `#` before the color code.
216
217
  Searches for keywords across multiple neeto projects within specified files by utilizing the `search` command.
217
218
 
218
219
  ```sh
219
- neetob github search --keyword neeto --path README.md --apps "neeto-*-staging"
220
+ neetob github search --keyword neeto --path README.md --repos "neeto-*-staging"
220
221
  ```
221
222
 
222
223
  ### Protect branch
@@ -224,7 +225,7 @@ neetob github search --keyword neeto --path README.md --apps "neeto-*-staging"
224
225
  Updates branch protection rules in neeto repos by using the `protect_branch` command.
225
226
 
226
227
  ```sh
227
- neetob github protect_branch --branch main --apps "neeto-*-staging"
228
+ neetob github protect_branch --branch main --repos "neeto-*-staging"
228
229
  ```
229
230
 
230
231
  By default, file "data/branch-protection-rules.json" will be used for updating the branch protection rules.
@@ -244,7 +245,7 @@ To update the above-mentioned branch protection rules for the `main` branch of a
244
245
 
245
246
  ```sh
246
247
  neetob github protect_branch --branch main --path ~/Desktop/branch-protection-rules.json \
247
- --apps "neeto-*-staging"
248
+ --repos "neeto-*-staging"
248
249
  ```
249
250
 
250
251
  We can also use the `--all-neeto-repos` option with the above mentioned command so that the
@@ -19,7 +19,7 @@ module Neetob
19
19
 
20
20
  private
21
21
 
22
- def find_all_matching_apps(apps, platform_name, sandbox_mode, quiet = false, all_neeto_repos = false)
22
+ def find_all_matching_apps_or_repos(apps, platform_name, sandbox_mode, quiet = false, all_neeto_repos = false)
23
23
  inform_about_current_working_mode(sandbox_mode, quiet)
24
24
  all_available_apps = sandbox_mode ?
25
25
  testing_apps(platform_name) :
@@ -16,7 +16,7 @@ module Neetob
16
16
  end
17
17
 
18
18
  def run
19
- neeto_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
19
+ neeto_apps = find_all_matching_apps_or_repos(apps, :github, sandbox, false, all_neeto_repos)
20
20
  neeto_apps.each do |app|
21
21
  app_name = app.split("/").last
22
22
  ui.info("\nWorking on #{app_name}\n")
@@ -23,9 +23,9 @@ 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.")
26
+ def check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
27
+ if (repos.nil? && !all_neeto_repos) || (!repos.nil? && all_neeto_repos)
28
+ ui.error("Please provide either \"repos\" or \"all-neeto-repos\" option.")
29
29
  exit
30
30
  end
31
31
  end
@@ -25,13 +25,13 @@ module Neetob
25
25
  desc "gems", "Interact with the neeto gems"
26
26
  subcommand "gems", Gems::Commands
27
27
 
28
- desc "search", "Find the lines matching the given keyword in the specified file across all the neeto apps"
29
- option :apps, type: :array, aliases: "-a", required: true, desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
28
+ desc "search", "Find the lines matching the given keyword in the specified file across all the neeto repos"
29
+ option :repos, type: :array, aliases: "-r", required: true, desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
30
30
  option :keyword, type: :string, aliases: "-k", desc: "Keyword which needs to be searched", required: true
31
31
  option :path, type: :string, aliases: "-p",
32
32
  desc: "Path of the file in which you want to search the given keyword.", required: true
33
33
  def search
34
- Search.new(options[:apps], options[:keyword], options[:path], options[:sandbox]).run
34
+ Search.new(options[:repos], options[:keyword], options[:path], options[:sandbox]).run
35
35
  end
36
36
 
37
37
  desc "login", "Update the Github access token by authenticating via browser"
@@ -44,12 +44,12 @@ module Neetob
44
44
  desc: "Name of the branch whose protections rules needs to be updated", required: true
45
45
  option :path, type: :string, aliases: "-p",
46
46
  desc: "The JSON file path which specify all the required rules for branch protection"
47
- option :apps, type: :array, aliases: "-a", desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
47
+ option :repos, type: :array, aliases: "-r", desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
48
48
  option :all_neeto_repos, type: :boolean, aliases: "--all",
49
49
  desc: "Use this flag for working with all neeto repos", default: false
50
50
  def protect_branch
51
51
  ProtectBranch.new(
52
- options[:branch], options[:apps], options[:path], options[:sandbox],
52
+ options[:branch], options[:repos], options[:path], options[:sandbox],
53
53
  options[:all_neeto_repos]).run
54
54
  end
55
55
  end
@@ -23,7 +23,7 @@ module Neetob
23
23
  matching_gems.each do |gem|
24
24
  ui.info("\nWorking on #{gem}\n")
25
25
  begin
26
- clone_app_in_tmp_dir("bigbinary/#{gem}")
26
+ clone_repo_in_tmp_dir("bigbinary/#{gem}")
27
27
  build_gem(gem)
28
28
  release_gem(gem)
29
29
  if $?.success?
@@ -39,11 +39,11 @@ module Neetob
39
39
  private
40
40
 
41
41
  def build_gem(gem)
42
- ui.info(`#{cd_to_app_in_tmp_dir(gem)} && gem build`)
42
+ ui.info(`#{cd_to_repo_in_tmp_dir(gem)} && gem build`)
43
43
  end
44
44
 
45
45
  def release_gem(gem)
46
- ui.info(`#{cd_to_app_in_tmp_dir(gem)} && fury push #{gem}-*.gem --as unnitallman`)
46
+ ui.info(`#{cd_to_repo_in_tmp_dir(gem)} && fury push #{gem}-*.gem --as unnitallman`)
47
47
  end
48
48
  end
49
49
  end
@@ -11,10 +11,10 @@ module Neetob
11
11
  module Github
12
12
  module Issues
13
13
  class Commands < SubCommandBase
14
- class_option :apps,
14
+ class_option :repos,
15
15
  {
16
- type: :array, aliases: "-a", required: true,
17
- desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
16
+ type: :array, aliases: "-r", required: true,
17
+ desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
18
18
  }
19
19
 
20
20
  desc "list", "List the issues in the Github repos"
@@ -25,7 +25,7 @@ module Neetob
25
25
  option :search, type: :string, desc: "Can provide custom query to filter or sort issues. Example: \"created:2022-11-07..2022-11-08 sort:comments-asc\""
26
26
  def list
27
27
  List.new(
28
- options[:apps], options[:assignee], options[:state], options[:search], options[:count],
28
+ options[:repos], options[:assignee], options[:state], options[:search], options[:count],
29
29
  options[:label], options[:sandbox]).run
30
30
  end
31
31
 
@@ -36,7 +36,7 @@ module Neetob
36
36
  option :labels, type: :string, desc: "List of comma separated labels you want to add in this issue. Example: \"--labels bug,ui\""
37
37
  def create
38
38
  Create.new(
39
- options[:apps],
39
+ options[:repos],
40
40
  options[:title],
41
41
  options[:description],
42
42
  options[:assignee],
@@ -9,12 +9,12 @@ module Neetob
9
9
  module Github
10
10
  module Issues
11
11
  class Create < Base
12
- attr_accessor :apps, :issue_title, :issue_description, :issue_assignee, :issue_labels, :sandbox
12
+ attr_accessor :repos, :issue_title, :issue_description, :issue_assignee, :issue_labels, :sandbox
13
13
 
14
- def initialize(apps, issue_title, issue_description = "", issue_assignee = "", issue_labels = "",
14
+ def initialize(repos, issue_title, issue_description = "", issue_assignee = "", issue_labels = "",
15
15
  sandbox = false)
16
16
  super()
17
- @apps = apps
17
+ @repos = repos
18
18
  @issue_title = issue_title
19
19
  @issue_description = issue_description
20
20
  @issue_assignee = issue_assignee
@@ -23,12 +23,12 @@ sandbox = false)
23
23
  end
24
24
 
25
25
  def run
26
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
27
- matching_apps.each do |app|
28
- ui.info("\n Creating issue in \"#{app}\" \n")
26
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
27
+ matching_repos.each do |repo|
28
+ ui.info("\n Creating issue in \"#{repo}\" \n")
29
29
  begin
30
30
  issue_options = { assignee: issue_assignee, labels: issue_labels }
31
- issue = client.create_issue(app, issue_title, issue_description, issue_options)
31
+ issue = client.create_issue(repo, issue_title, issue_description, issue_options)
32
32
  ui.success("Created the issue successfully \nLink: #{issue[:html_url]}")
33
33
  rescue StandardError => e
34
34
  ExceptionHandler.new(e).process
@@ -12,14 +12,14 @@ module Neetob
12
12
  class List < Base
13
13
  include ActionView::Helpers::DateHelper
14
14
 
15
- attr_accessor :apps, :issue_state, :issue_assignee, :issue_search_query, :show_issues_count, :issue_label,
15
+ attr_accessor :repos, :issue_state, :issue_assignee, :issue_search_query, :show_issues_count, :issue_label,
16
16
  :sandbox
17
17
 
18
- def initialize(apps, issue_assignee = "", issue_state = "open",
18
+ def initialize(repos, issue_assignee = "", issue_state = "open",
19
19
  issue_search_query = "", show_issues_count = false, issue_label = "",
20
20
  sandbox = false)
21
21
  super()
22
- @apps = apps
22
+ @repos = repos
23
23
  @issue_state = issue_state
24
24
  @issue_assignee = issue_assignee
25
25
  @show_issues_count = show_issues_count
@@ -29,11 +29,11 @@ module Neetob
29
29
  end
30
30
 
31
31
  def run
32
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
33
- matching_apps.each do |app|
34
- ui.info("\n Issues of #{app} \n")
32
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
33
+ matching_repos.each do |repo|
34
+ ui.info("\n Issues of #{repo} \n")
35
35
  begin
36
- issues = client.search_issues(uri_with_query_options(app))
36
+ issues = client.search_issues(uri_with_query_options(repo))
37
37
  ui.info("There are #{issues[:total_count]} issues with matching query") if show_issues_count
38
38
  table_rows = create_table(issues[:items])
39
39
  table = Terminal::Table.new headings: table_columns, rows: table_rows
@@ -64,10 +64,10 @@ module Neetob
64
64
  end
65
65
  end
66
66
 
67
- def uri_with_query_options(app)
68
- uri = "repo:#{app} is:issue state:#{issue_state}"
67
+ def uri_with_query_options(repo)
68
+ uri = "repo:#{repo} is:issue state:#{issue_state}"
69
69
  unless issue_label.nil?
70
- check_valid_labels(app)
70
+ check_valid_labels(repo)
71
71
  uri.concat(" label:#{issue_label}")
72
72
  end
73
73
  uri.concat(issue_assignee == "none" ? " no:assignee" : " assignee:#{issue_assignee}") if issue_assignee
@@ -78,14 +78,14 @@ module Neetob
78
78
  labels.map { |label| label[:name] }.join(", ")
79
79
  end
80
80
 
81
- def check_valid_labels(app)
82
- issue_label.split(",").each { |label| valid_label?(app, label) }
81
+ def check_valid_labels(repo)
82
+ issue_label.split(",").each { |label| valid_label?(repo, label) }
83
83
  end
84
84
 
85
- def valid_label?(app, label)
86
- client.label(app, label)
85
+ def valid_label?(repo, label)
86
+ client.label(repo, label)
87
87
  rescue Octokit::NotFound => e
88
- ui.error("There is no \"#{label}\" label in the \"#{app}\" repo.")
88
+ ui.error("There is no \"#{label}\" label in the \"#{repo}\" repo.")
89
89
  end
90
90
  end
91
91
  end
@@ -15,22 +15,22 @@ module Neetob
15
15
  module Github
16
16
  module Labels
17
17
  class Commands < SubCommandBase
18
- class_option :apps,
19
- type: :array, aliases: "-a",
20
- desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
18
+ class_option :repos,
19
+ type: :array, aliases: "-r",
20
+ desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
21
21
  class_option :all_neeto_repos,
22
22
  type: :boolean, aliases: "--all", default: false,
23
23
  desc: "Use this flag for working with all neeto repos"
24
24
 
25
25
  desc "list", "List all the labels in the Github repos"
26
26
  def list
27
- List.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run
27
+ List.new(options[:repos], options[:sandbox], options[:all_neeto_repos]).run
28
28
  end
29
29
 
30
30
  desc "show", "Show details about the given label in the Github repos"
31
31
  option :name, type: :string, aliases: "-n", required: true, desc: "Name of the label"
32
32
  def show
33
- Show.new(options[:apps], options[:name], options[:sandbox], options[:all_neeto_repos]).run
33
+ Show.new(options[:repos], options[:name], options[:sandbox], options[:all_neeto_repos]).run
34
34
  end
35
35
 
36
36
  desc "upsert", "Create and update labels in the Github repos"
@@ -40,19 +40,19 @@ module Neetob
40
40
  option :description, type: :string, desc: "Description of the label you want to upsert"
41
41
  def upsert
42
42
  Upsert.new(
43
- options[:apps], options[:path], options[:sandbox], options[:all_neeto_repos], options[:name],
43
+ options[:repos], options[:path], options[:sandbox], options[:all_neeto_repos], options[:name],
44
44
  options[:color], options[:description]).run
45
45
  end
46
46
 
47
47
  desc "delete_all", "Delete all the labels from the Github repos"
48
48
  def delete_all
49
- DeleteAll.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run
49
+ DeleteAll.new(options[:repos], options[:sandbox], options[:all_neeto_repos]).run
50
50
  end
51
51
 
52
52
  desc "delete", "Delete some labels from the Github repos"
53
53
  option :labels, type: :array, required: true, desc: "Labels you want to delete from the repos."
54
54
  def delete
55
- Delete.new(options[:apps], options[:labels], options[:sandbox], options[:all_neeto_repos]).run
55
+ Delete.new(options[:repos], options[:labels], options[:sandbox], options[:all_neeto_repos]).run
56
56
  end
57
57
 
58
58
  desc "update", "Update a label name in Github repos"
@@ -60,7 +60,7 @@ module Neetob
60
60
  option :new_name, type: :string, required: true, desc: "New name for the updated label"
61
61
  def update
62
62
  Update.new(
63
- options[:apps], options[:old_name], options[:new_name], options[:sandbox],
63
+ options[:repos], options[:old_name], options[:new_name], options[:sandbox],
64
64
  options[:all_neeto_repos]).run
65
65
  end
66
66
  end
@@ -9,31 +9,31 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class Delete < Base
12
- attr_accessor :apps, :sandbox, :labels, :all_neeto_repos
12
+ attr_accessor :repos, :sandbox, :labels, :all_neeto_repos
13
13
 
14
- def initialize(apps, labels, sandbox = false, all_neeto_repos = false)
14
+ def initialize(repos, labels, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
16
  @labels = labels
17
- @apps = apps
17
+ @repos = repos
18
18
  @sandbox = sandbox
19
19
  @all_neeto_repos = all_neeto_repos
20
20
  end
21
21
 
22
22
  def run
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)
25
- matching_apps.each do |app|
26
- ui.info("\n Deleting labels from #{app} repo \n")
23
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
24
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
25
+ matching_repos.each do |repo|
26
+ ui.info("\n Deleting labels from #{repo} repo \n")
27
27
  labels.each do |label|
28
- delete_label(app, label)
28
+ delete_label(repo, label)
29
29
  end
30
30
  end
31
31
  end
32
32
 
33
33
  private
34
34
 
35
- def delete_label(app, label)
36
- if client.delete_label!(app, label)
35
+ def delete_label(repo, label)
36
+ if client.delete_label!(repo, label)
37
37
  ui.success("The \"#{label}\" label deleted successfully")
38
38
  else
39
39
  ui.error("The \"#{label}\" label can't be deleted. Please check and try again")
@@ -9,24 +9,24 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class DeleteAll < Base
12
- attr_accessor :apps, :sandbox, :all_neeto_repos
12
+ attr_accessor :repos, :sandbox, :all_neeto_repos
13
13
 
14
- def initialize(apps, sandbox = false, all_neeto_repos = false)
14
+ def initialize(repos, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
- @apps = apps
16
+ @repos = repos
17
17
  @sandbox = sandbox
18
18
  @all_neeto_repos = all_neeto_repos
19
19
  end
20
20
 
21
21
  def run
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)
24
- matching_apps.each do |app|
25
- ui.info("\n Working on #{app} repo \n")
22
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
23
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
24
+ matching_repos.each do |repo|
25
+ ui.info("\n Working on #{repo} repo \n")
26
26
  begin
27
- labels = client.labels(app)
27
+ labels = client.labels(repo)
28
28
  labels.each do |label|
29
- delete_label(app, label)
29
+ delete_label(repo, label)
30
30
  end
31
31
  rescue StandardError => e
32
32
  ExceptionHandler.new(e).process
@@ -36,8 +36,8 @@ module Neetob
36
36
 
37
37
  private
38
38
 
39
- def delete_label(app, label_details)
40
- if client.delete_label!(app, label_details[:name])
39
+ def delete_label(repo, label_details)
40
+ if client.delete_label!(repo, label_details[:name])
41
41
  ui.success("The \"#{label_details[:name]}\" label deleted successfully")
42
42
  else
43
43
  ui.error("The \"#{label_details[:name]}\" label can't be deleted. Please try again")
@@ -9,22 +9,22 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class List < Base
12
- attr_accessor :apps, :sandbox, :all_neeto_repos
12
+ attr_accessor :repos, :sandbox, :all_neeto_repos
13
13
 
14
- def initialize(apps, sandbox = false, all_neeto_repos = false)
14
+ def initialize(repos, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
- @apps = apps
16
+ @repos = repos
17
17
  @sandbox = sandbox
18
18
  @all_neeto_repos = all_neeto_repos
19
19
  end
20
20
 
21
21
  def run
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)
24
- matching_apps.each do |app|
25
- ui.info("\n Labels of #{app} \n")
22
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
23
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
24
+ matching_repos.each do |repo|
25
+ ui.info("\n Labels of #{repo} \n")
26
26
  begin
27
- labels = client.labels(app)
27
+ labels = client.labels(repo)
28
28
  ui.success(labels)
29
29
  rescue StandardError => e
30
30
  ExceptionHandler.new(e).process
@@ -9,23 +9,23 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class Show < Base
12
- attr_accessor :apps, :label_name, :sandbox, :all_neeto_repos
12
+ attr_accessor :repos, :label_name, :sandbox, :all_neeto_repos
13
13
 
14
- def initialize(apps, label_name, sandbox = false, all_neeto_repos = false)
14
+ def initialize(repos, label_name, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
- @apps = apps
16
+ @repos = repos
17
17
  @label_name = label_name
18
18
  @sandbox = sandbox
19
19
  @all_neeto_repos = all_neeto_repos
20
20
  end
21
21
 
22
22
  def run
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)
25
- matching_apps.each do |app|
26
- ui.info("\n \"#{label_name}\" label details from #{app} \n")
23
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
24
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
25
+ matching_repos.each do |repo|
26
+ ui.info("\n \"#{label_name}\" label details from #{repo} \n")
27
27
  begin
28
- label_details = client.label(app, label_name)
28
+ label_details = client.label(repo, label_name)
29
29
  ui.success(label_details.inspect)
30
30
  rescue StandardError => e
31
31
  ExceptionHandler.new(e).process
@@ -9,11 +9,11 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class Update < Base
12
- attr_accessor :apps, :sandbox, :old_name, :new_name, :all_neeto_repos
12
+ attr_accessor :repos, :sandbox, :old_name, :new_name, :all_neeto_repos
13
13
 
14
- def initialize(apps, old_name, new_name, sandbox = false, all_neeto_repos = false)
14
+ def initialize(repos, old_name, new_name, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
- @apps = apps
16
+ @repos = repos
17
17
  @sandbox = sandbox
18
18
  @old_name = old_name
19
19
  @new_name = new_name
@@ -21,14 +21,14 @@ module Neetob
21
21
  end
22
22
 
23
23
  def run
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)
26
- matching_apps.each do |app|
27
- ui.info("\nUpdating label for #{app} repo \n")
24
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
25
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
26
+ matching_repos.each do |repo|
27
+ ui.info("\nUpdating label for #{repo} repo \n")
28
28
  begin
29
- update_label!(app, old_name, new_name)
29
+ update_label!(repo, old_name, new_name)
30
30
  rescue Octokit::NotFound
31
- ui.say("Ignoring update for #{app} repo as it doesn't have the \"#{old_name}\" label.")
31
+ ui.say("Ignoring update for #{repo} repo as it doesn't have the \"#{old_name}\" label.")
32
32
  rescue StandardError => e
33
33
  ExceptionHandler.new(e).process
34
34
  end
@@ -37,12 +37,12 @@ module Neetob
37
37
 
38
38
  private
39
39
 
40
- def update_label!(app, old_name, new_name)
41
- client.label(app, new_name)
40
+ def update_label!(repo, old_name, new_name)
41
+ client.label(repo, new_name)
42
42
  ui.error("Label with name \"#{new_name}\" already exists.")
43
43
  nil
44
44
  rescue Octokit::NotFound
45
- client.update_label(app, old_name, { name: new_name })
45
+ client.update_label(repo, old_name, { name: new_name })
46
46
  ui.success("Label \"#{old_name}\" updated to \"#{new_name}\" successfully")
47
47
  rescue StandardError => e
48
48
  ExceptionHandler.new(e).process
@@ -11,12 +11,12 @@ module Neetob
11
11
  class Upsert < Base
12
12
  WHITE_COLOR_HEX_CODE = "ffffff"
13
13
 
14
- attr_accessor :apps, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description
14
+ attr_accessor :repos, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description
15
15
 
16
- def initialize(apps, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false,
16
+ def initialize(repos, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false,
17
17
  name = "", color = "", description = "")
18
18
  super()
19
- @apps = apps
19
+ @repos = repos
20
20
  @required_labels_json_file_path = required_labels_json_file_path
21
21
  @sandbox = sandbox
22
22
  @all_neeto_repos = all_neeto_repos
@@ -26,15 +26,15 @@ module Neetob
26
26
  end
27
27
 
28
28
  def run
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)
29
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
30
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
31
31
  inform_about_default_labels_file
32
- matching_apps.each do |app|
33
- ui.info("\nWorking on #{app} repo\n")
32
+ matching_repos.each do |repo|
33
+ ui.info("\nWorking on #{repo} repo\n")
34
34
  begin
35
35
  required_labels = get_required_labels
36
36
  required_labels.each do |label|
37
- create_or_update_label(app, label)
37
+ create_or_update_label(repo, label)
38
38
  sleep(1)
39
39
  end
40
40
  rescue StandardError => e
@@ -68,13 +68,13 @@ module Neetob
68
68
  ]
69
69
  end
70
70
 
71
- def create_or_update_label(app, label_details)
71
+ def create_or_update_label(repo, label_details)
72
72
  begin
73
- client.update_label(app, label_details["name"], label_details)
73
+ client.update_label(repo, label_details["name"], label_details)
74
74
  ui.success("Label \"#{label_details["name"]}\" updated successfully")
75
75
  rescue Octokit::NotFound
76
76
  client.add_label(
77
- app, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE,
77
+ repo, 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
80
  rescue StandardError => e
@@ -24,51 +24,51 @@ module Neetob
24
24
  `mkdir /tmp/neetob`
25
25
  end
26
26
 
27
- def app_name_without_org_suffix(app)
28
- app.split("/").last
27
+ def repo_name_without_org_suffix(repo)
28
+ repo.split("/").last
29
29
  end
30
30
 
31
- def clone_app_in_tmp_dir(app)
32
- `git clone --quiet git@github.com:#{app}.git /tmp/neetob/#{app_name_without_org_suffix(app)}`
31
+ def clone_repo_in_tmp_dir(repo)
32
+ `git clone --quiet git@github.com:#{repo}.git /tmp/neetob/#{repo_name_without_org_suffix(repo)}`
33
33
  end
34
34
 
35
- def add_commmit_and_push_changes(app)
36
- `#{cd_to_app_in_tmp_dir(app)} && git add . && \\
35
+ def add_commmit_and_push_changes(repo)
36
+ `#{cd_to_repo_in_tmp_dir(repo)} && git add . && \\
37
37
  git commit -m "#{pr_title}" && git push -u origin #{branch_name} --force`
38
38
  end
39
39
 
40
- def delete_local_feature_branch(app)
41
- `#{cd_to_app_in_tmp_dir(app)} && git checkout main && git branch -D #{branch_name}`
40
+ def delete_local_feature_branch(repo)
41
+ `#{cd_to_repo_in_tmp_dir(repo)} && git checkout main && git branch -D #{branch_name}`
42
42
  end
43
43
 
44
- def checkout_to_new_branch(app)
45
- `#{cd_to_app_in_tmp_dir(app)} && git checkout -b #{branch_name}`
44
+ def checkout_to_new_branch(repo)
45
+ `#{cd_to_repo_in_tmp_dir(repo)} && git checkout -b #{branch_name}`
46
46
  end
47
47
 
48
- def checkout_to_feature_branch(app)
49
- `#{cd_to_app_in_tmp_dir(app)} && git checkout #{branch_name}`
48
+ def checkout_to_feature_branch(repo)
49
+ `#{cd_to_repo_in_tmp_dir(repo)} && git checkout #{branch_name}`
50
50
  end
51
51
 
52
- def delete_remote_feature_branch(app)
53
- `#{cd_to_app_in_tmp_dir(app)} && git push origin --delete #{branch_name}`
52
+ def delete_remote_feature_branch(repo)
53
+ `#{cd_to_repo_in_tmp_dir(repo)} && git push origin --delete #{branch_name}`
54
54
  end
55
55
 
56
- def check_and_delete_remote_branch(app)
57
- checkout_to_feature_branch(app)
56
+ def check_and_delete_remote_branch(repo)
57
+ checkout_to_feature_branch(repo)
58
58
  if $?.success?
59
59
  ui.info("Remote branch found with the name \"#{branch_name}\"")
60
- delete_remote_feature_branch(app)
61
- delete_local_feature_branch(app)
60
+ delete_remote_feature_branch(repo)
61
+ delete_local_feature_branch(repo)
62
62
  end
63
- checkout_to_new_branch(app)
63
+ checkout_to_new_branch(repo)
64
64
  end
65
65
 
66
- def cd_to_app_in_tmp_dir(app)
67
- "cd /tmp/neetob/#{app_name_without_org_suffix(app)}"
66
+ def cd_to_repo_in_tmp_dir(repo)
67
+ "cd /tmp/neetob/#{repo_name_without_org_suffix(repo)}"
68
68
  end
69
69
 
70
- def add_org_suffix(apps)
71
- apps.map { |app| "bigbinary/#{app}" }
70
+ def add_org_suffix(repos)
71
+ repos.map { |repo| "bigbinary/#{repo}" }
72
72
  end
73
73
  end
74
74
  end
@@ -11,14 +11,14 @@ module Neetob
11
11
  module Github
12
12
  module MakePr
13
13
  class Commands < SubCommandBase
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\""
14
+ class_option :repos, type: :array, aliases: "-r", default: ["*"],
15
+ desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
16
16
  class_option :nanos, type: :boolean, aliases: "-n", default: false,
17
17
  desc: "Use this flag to make PRs for the neeto gems"
18
18
 
19
19
  desc "compliance-fix", "Create PRs for fixing neeto compliance in all products"
20
20
  def compliance_fix
21
- ComplianceFix.new(options[:apps], options[:nanos], options[:sandbox]).run
21
+ ComplianceFix.new(options[:repos], options[:nanos], options[:sandbox]).run
22
22
  end
23
23
 
24
24
  desc "script", "Create PRs after running the given script for each product."
@@ -29,8 +29,8 @@ module Neetob
29
29
  option :description, type: :string, aliases: "-d", desc: "Description of the PR"
30
30
  def script
31
31
  Script.new(
32
- options[:apps], options[:path], options[:title], options[:branch], options[:description], options[:nanos],
33
- options[:sandbox]).run
32
+ options[:repos], options[:path], options[:title], options[:branch], options[:description],
33
+ options[:nanos], options[:sandbox]).run
34
34
  end
35
35
  end
36
36
  end
@@ -9,31 +9,31 @@ module Neetob
9
9
  module Github
10
10
  module MakePr
11
11
  class ComplianceFix < Base
12
- attr_accessor :apps, :sandbox, :should_fix_nanos
12
+ attr_accessor :repos, :sandbox, :should_fix_nanos
13
13
 
14
- def initialize(apps, should_fix_nanos = false, sandbox = false)
14
+ def initialize(repos, should_fix_nanos = false, sandbox = false)
15
15
  super()
16
- @apps = apps
16
+ @repos = repos
17
17
  @sandbox = sandbox
18
18
  @should_fix_nanos = should_fix_nanos
19
19
  end
20
20
 
21
21
  def run
22
- matching_apps = should_fix_nanos ?
22
+ matching_repos = should_fix_nanos ?
23
23
  add_org_suffix(find_all_matching_gems) :
24
- find_all_matching_apps(apps, :github, sandbox)
24
+ find_all_matching_apps_or_repos(repos, :github, sandbox)
25
25
  delete_and_create_temp_neetob_dir
26
- matching_apps.each do |app|
27
- ui.info("\nWorking on #{app}\n")
26
+ matching_repos.each do |repo|
27
+ ui.info("\nWorking on #{repo}\n")
28
28
  begin
29
- clone_app_in_tmp_dir(app)
30
- check_and_delete_remote_branch(app)
31
- bundle_install(app)
32
- fix_neeto_audit(app)
33
- ui.info(add_commmit_and_push_changes(app))
34
- delete_local_feature_branch(app)
35
- res = client.create_pull_request(app, "main", BRANCH_NAME, PR_TITLE)
36
- ui.success("PR created in \"#{app}\" project successfully.")
29
+ clone_repo_in_tmp_dir(repo)
30
+ check_and_delete_remote_branch(repo)
31
+ bundle_install(repo)
32
+ fix_neeto_audit(repo)
33
+ ui.info(add_commmit_and_push_changes(repo))
34
+ delete_local_feature_branch(repo)
35
+ res = client.create_pull_request(repo, "main", BRANCH_NAME, PR_TITLE)
36
+ ui.success("PR created in \"#{repo}\" project successfully.")
37
37
  rescue StandardError => e
38
38
  ExceptionHandler.new(e).process
39
39
  end
@@ -43,12 +43,12 @@ module Neetob
43
43
 
44
44
  private
45
45
 
46
- def bundle_install(app)
47
- `#{cd_to_app_in_tmp_dir(app)} && bundle install`
46
+ def bundle_install(repo)
47
+ `#{cd_to_repo_in_tmp_dir(repo)} && bundle install`
48
48
  end
49
49
 
50
- def fix_neeto_audit(app)
51
- `#{cd_to_app_in_tmp_dir(app)} && bundle exec neeto-audit -a`
50
+ def fix_neeto_audit(repo)
51
+ `#{cd_to_repo_in_tmp_dir(repo)} && bundle exec neeto-audit -a`
52
52
  end
53
53
  end
54
54
  end
@@ -9,12 +9,12 @@ 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, :should_fix_nanos
12
+ attr_accessor :repos, :sandbox, :path_to_the_script_file, :pr_description, :should_fix_nanos
13
13
 
14
- def initialize(apps, path_to_the_script_file, pr_title,
14
+ def initialize(repos, path_to_the_script_file, pr_title,
15
15
  branch_name, pr_description, should_fix_nanos, sandbox = false)
16
16
  super(pr_title, branch_name)
17
- @apps = apps
17
+ @repos = repos
18
18
  @sandbox = sandbox
19
19
  @path_to_the_script_file = path_to_the_script_file
20
20
  @pr_description = pr_description
@@ -22,21 +22,21 @@ module Neetob
22
22
  end
23
23
 
24
24
  def run
25
- matching_apps = should_fix_nanos ?
25
+ matching_repos = should_fix_nanos ?
26
26
  add_org_suffix(find_all_matching_gems) :
27
- find_all_matching_apps(apps, :github, sandbox)
27
+ find_all_matching_apps_or_repos(repos, :github, sandbox)
28
28
  delete_and_create_temp_neetob_dir
29
- matching_apps.each do |app|
30
- ui.info("\n Working on #{app} \n")
29
+ matching_repos.each do |repo|
30
+ ui.info("\n Working on #{repo} \n")
31
31
  begin
32
- clone_app_in_tmp_dir(app)
33
- check_and_delete_remote_branch(app)
32
+ clone_repo_in_tmp_dir(repo)
33
+ check_and_delete_remote_branch(repo)
34
34
  update_script_file_permissions
35
- execute_script(app)
36
- ui.info(add_commmit_and_push_changes(app))
37
- delete_local_feature_branch(app)
38
- res = client.create_pull_request(app, "main", branch_name, pr_title, pr_description)
39
- ui.success("PR created in \"#{app}\" project successfully.")
35
+ execute_script(repo)
36
+ ui.info(add_commmit_and_push_changes(repo))
37
+ delete_local_feature_branch(repo)
38
+ res = client.create_pull_request(repo, "main", branch_name, pr_title, pr_description)
39
+ ui.success("PR created in \"#{repo}\" project successfully.")
40
40
  rescue StandardError => e
41
41
  ExceptionHandler.new(e).process
42
42
  end
@@ -50,8 +50,8 @@ module Neetob
50
50
  `chmod +x #{path_to_the_script_file}`
51
51
  end
52
52
 
53
- def execute_script(app)
54
- `#{cd_to_app_in_tmp_dir(app)} && #{path_to_the_script_file}`
53
+ def execute_script(repo)
54
+ `#{cd_to_repo_in_tmp_dir(repo)} && #{path_to_the_script_file}`
55
55
  end
56
56
  end
57
57
  end
@@ -6,27 +6,27 @@ module Neetob
6
6
  class CLI
7
7
  module Github
8
8
  class ProtectBranch < Base
9
- attr_accessor :branch_name, :required_rules_json_file_path, :apps, :sandbox, :all_neeto_repos
9
+ attr_accessor :branch_name, :required_rules_json_file_path, :repos, :sandbox, :all_neeto_repos
10
10
 
11
- def initialize(branch_name, apps, required_rules_json_file_path = "", sandbox = false, all_neeto_repos = false)
11
+ def initialize(branch_name, repos, required_rules_json_file_path = "", sandbox = false, all_neeto_repos = false)
12
12
  super()
13
13
  @branch_name = branch_name
14
14
  @required_rules_json_file_path = required_rules_json_file_path
15
- @apps = apps
15
+ @repos = repos
16
16
  @sandbox = sandbox
17
17
  @all_neeto_repos = all_neeto_repos
18
18
  end
19
19
 
20
20
  def run
21
- check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
22
- matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
21
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
22
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
23
23
  inform_about_default_rules_file
24
- matching_apps.each do |app|
25
- ui.info("\n Working on \"#{app}\" repo")
24
+ matching_repos.each do |repo|
25
+ ui.info("\n Working on \"#{repo}\" repo")
26
26
  ui.info(" Updating \"#{branch_name}\" branch protection rules")
27
27
  rules = read_json_file(required_rules_json_file_path || default_rules_file_path)
28
28
  rules_with_symbol_keys = rules.transform_keys(&:to_sym)
29
- client.protect_branch(app, branch_name, rules_with_symbol_keys)
29
+ client.protect_branch(repo, branch_name, rules_with_symbol_keys)
30
30
  ui.success("Branch protection rules updated successfully")
31
31
  end
32
32
  end
@@ -6,22 +6,22 @@ module Neetob
6
6
  class CLI
7
7
  module Github
8
8
  class Search < Base
9
- attr_accessor :apps, :key_to_search, :search_file_path, :sandbox
9
+ attr_accessor :repos, :key_to_search, :search_file_path, :sandbox
10
10
 
11
- def initialize(apps, key_to_search, search_file_path, sandbox = false)
11
+ def initialize(repos, key_to_search, search_file_path, sandbox = false)
12
12
  super()
13
- @apps = apps
13
+ @repos = repos
14
14
  @key_to_search = key_to_search
15
15
  @search_file_path = search_file_path
16
16
  @sandbox = sandbox
17
17
  end
18
18
 
19
19
  def run
20
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
21
- matching_apps.each do |app|
20
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
21
+ matching_repos.each do |repo|
22
22
  begin
23
- ui.info("\n Searching in \"#{app}/#{search_file_path}\" for \"#{key_to_search}\"\n")
24
- content = Base64.decode64(client.contents(app, path: search_file_path).content)
23
+ ui.info("\n Searching in \"#{repo}/#{search_file_path}\" for \"#{key_to_search}\"\n")
24
+ content = Base64.decode64(client.contents(repo, path: search_file_path).content)
25
25
  ui.error("Keyword not found") and next unless content.include? key_to_search
26
26
 
27
27
  content.each_line do |line|
@@ -17,7 +17,7 @@ module Neetob
17
17
  end
18
18
 
19
19
  def run
20
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
20
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
21
21
  matching_apps.each do |app|
22
22
  `heroku access -a #{app}`
23
23
  unless $?.success?
@@ -16,7 +16,7 @@ module Neetob
16
16
  end
17
17
 
18
18
  def run
19
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
19
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
20
20
  matching_apps.each do |app|
21
21
  ui.info("\n Users for \"#{app}\" app\n")
22
22
  users = `heroku access -a #{app}`
@@ -17,7 +17,7 @@ module Neetob
17
17
  end
18
18
 
19
19
  def run
20
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
20
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
21
21
  matching_apps.each do |app|
22
22
  `heroku access -a #{app}`
23
23
  unless $?.success?
@@ -20,7 +20,7 @@ module Neetob
20
20
  end
21
21
 
22
22
  def run
23
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
23
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
24
24
  table_rows = []
25
25
  expected_config = read_json_file(expected_config_vars_json_file_path || default_config_vars_json_file_path)
26
26
  return unless expected_config
@@ -18,7 +18,7 @@ module Neetob
18
18
  end
19
19
 
20
20
  def run
21
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
21
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
22
22
  matching_apps.each do |app|
23
23
  ui.info("\n Config of #{app}\n")
24
24
  config = `heroku config -a #{app} --json`
@@ -17,7 +17,7 @@ module Neetob
17
17
  end
18
18
 
19
19
  def run
20
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
20
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
21
21
  matching_apps.each do |app|
22
22
  `heroku access -a #{app}`
23
23
 
@@ -25,7 +25,7 @@ required_config_vars_with_project_keys_json_file_path, sandbox = false)
25
25
  inform_about_current_working_mode(sandbox) if apps.nil?
26
26
  apps_to_be_updated = apps.nil? ?
27
27
  read_json_file(required_config_vars_with_project_keys_json_file_path) :
28
- find_all_matching_apps(apps, :heroku, sandbox)
28
+ find_all_matching_apps_or_repos(apps, :heroku, sandbox)
29
29
  inform_about_default_config_vars_file
30
30
 
31
31
  apps_to_be_updated.each do |app|
@@ -17,7 +17,7 @@ module Neetob
17
17
  end
18
18
 
19
19
  def run
20
- matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
20
+ matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
21
21
  rails_runner_command = "rails runner '#{command_to_execute}'"
22
22
  heroku_command = should_run_in_rails_console ? rails_runner_command : command_to_execute
23
23
  matching_apps.each do |app|
@@ -16,7 +16,7 @@ module Neetob
16
16
  end
17
17
 
18
18
  def run
19
- matching_apps = find_all_matching_apps(apps, :github, sandbox, true)
19
+ matching_apps = find_all_matching_apps_or_repos(apps, :github, sandbox, true)
20
20
  matching_apps.each do |app|
21
21
  app_name = app.split("/")[1]
22
22
  ui.info("\nListing files from #{app_name}/#{dir}\n")
@@ -27,7 +27,7 @@ module Neetob
27
27
  private
28
28
 
29
29
  def users_for_all_available_apps
30
- find_all_matching_apps(["*"], :github, sandbox, true).map do |app|
30
+ find_all_matching_apps_or_repos(["*"], :github, sandbox, true).map do |app|
31
31
  clone_repo_and_get_users(app).split("\n").map { |user| "#{user} #{app}" }
32
32
  end
33
33
  end
@@ -32,7 +32,7 @@ module Neetob
32
32
  private
33
33
 
34
34
  def build_commit_rows
35
- commits = find_all_matching_apps(apps, :github, sandbox, true, all_neeto_repos).map do |app|
35
+ commits = find_all_matching_apps_or_repos(apps, :github, sandbox, true, all_neeto_repos).map do |app|
36
36
  commits = commits_within_range(app)
37
37
  if commits&.empty?
38
38
  ui.info("No commits found in \"#{app}\" for the given author and duration.")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
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.2.2
4
+ version: 0.2.3
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-06 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor