neetob 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +3 -4
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +15 -2
  6. data/README.md +64 -36
  7. data/bookmarks.md +5 -0
  8. data/data/branch-protection-rules.json +1 -1
  9. data/data/github-labels.json +7 -2
  10. data/lib/neetob/cli/base.rb +22 -10
  11. data/lib/neetob/cli/fetchorupdate_repos/execute.rb +5 -3
  12. data/lib/neetob/cli/github/base.rb +7 -0
  13. data/lib/neetob/cli/github/commands.rb +6 -2
  14. data/lib/neetob/cli/github/labels/commands.rb +18 -10
  15. data/lib/neetob/cli/github/labels/delete.rb +5 -3
  16. data/lib/neetob/cli/github/labels/delete_all.rb +5 -3
  17. data/lib/neetob/cli/github/labels/list.rb +5 -3
  18. data/lib/neetob/cli/github/labels/show.rb +5 -3
  19. data/lib/neetob/cli/github/labels/update.rb +5 -3
  20. data/lib/neetob/cli/github/labels/upsert.rb +41 -7
  21. data/lib/neetob/cli/github/make_pr/base.rb +2 -1
  22. data/lib/neetob/cli/github/make_pr/commands.rb +4 -1
  23. data/lib/neetob/cli/github/make_pr/compliance_fix.rb +6 -1
  24. data/lib/neetob/cli/github/make_pr/script.rb +4 -3
  25. data/lib/neetob/cli/github/protect_branch.rb +5 -3
  26. data/lib/neetob/cli/heroku/config_vars/upsert.rb +6 -2
  27. data/lib/neetob/cli/heroku/execute.rb +2 -2
  28. data/lib/neetob/cli/users/commands.rb +3 -1
  29. data/lib/neetob/cli/users/commits.rb +71 -22
  30. data/lib/neetob/cli.rb +3 -1
  31. data/lib/neetob/version.rb +1 -1
  32. data/neetob.gemspec +1 -1
  33. metadata +7 -57
  34. data/LICENSE.txt +0 -21
  35. data/env.sample +0 -1
  36. data/neeto_compliance/lib/neeto_compliance/github_access.rb +0 -29
  37. data/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +0 -35
  38. data/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +0 -16
  39. data/neeto_compliance/lib/neeto_compliance/runner.rb +0 -35
  40. data/neeto_compliance/lib/neeto_compliance/skippable.rb +0 -19
  41. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +0 -32
  42. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +0 -35
  43. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +0 -33
  44. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +0 -36
  45. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +0 -38
  46. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +0 -36
  47. data/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +0 -25
  48. data/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +0 -72
  49. data/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +0 -53
  50. data/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +0 -25
  51. data/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +0 -25
  52. data/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +0 -25
  53. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +0 -46
  54. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +0 -25
  55. data/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +0 -25
  56. data/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +0 -38
  57. data/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +0 -38
  58. data/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +0 -34
  59. data/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +0 -39
  60. data/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +0 -100
  61. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +0 -20
  62. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +0 -42
  63. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +0 -24
  64. data/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +0 -25
  65. data/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +0 -63
  66. data/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +0 -62
  67. data/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +0 -39
  68. data/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +0 -22
  69. data/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +0 -25
  70. data/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +0 -162
  71. data/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +0 -34
  72. data/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +0 -28
  73. data/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +0 -29
  74. data/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +0 -25
  75. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +0 -29
  76. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +0 -29
  77. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +0 -29
  78. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +0 -29
  79. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +0 -28
  80. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +0 -31
  81. data/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +0 -44
  82. data/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +0 -29
  83. data/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +0 -61
  84. data/neeto_compliance/lib/neeto_compliance/version.rb +0 -5
@@ -9,18 +9,20 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class Update < Base
12
- attr_accessor :apps, :sandbox, :old_name, :new_name
12
+ attr_accessor :apps, :sandbox, :old_name, :new_name, :all_neeto_repos
13
13
 
14
- def initialize(apps, old_name, new_name, sandbox = false)
14
+ def initialize(apps, old_name, new_name, sandbox = false, all_neeto_repos = false)
15
15
  super()
16
16
  @apps = apps
17
17
  @sandbox = sandbox
18
18
  @old_name = old_name
19
19
  @new_name = new_name
20
+ @all_neeto_repos = all_neeto_repos
20
21
  end
21
22
 
22
23
  def run
23
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
24
+ check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
25
+ matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
24
26
  matching_apps.each do |app|
25
27
  ui.info("\n Updating label for #{app} repo \n")
26
28
  update_label!(app, old_name, new_name)
@@ -9,24 +9,33 @@ module Neetob
9
9
  module Github
10
10
  module Labels
11
11
  class Upsert < Base
12
- attr_accessor :apps, :required_labels_json_file_path, :sandbox
12
+ WHITE_COLOR_HEX_CODE = "ffffff"
13
13
 
14
- def initialize(apps, required_labels_json_file_path = "", sandbox = false)
14
+ attr_accessor :apps, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description
15
+
16
+ def initialize(apps, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false,
17
+ name = "", color = "", description = "")
15
18
  super()
16
19
  @apps = apps
17
20
  @required_labels_json_file_path = required_labels_json_file_path
18
21
  @sandbox = sandbox
22
+ @all_neeto_repos = all_neeto_repos
23
+ @name = name
24
+ @color = color
25
+ @description = description
19
26
  end
20
27
 
21
28
  def run
22
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
29
+ check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
30
+ matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
23
31
  inform_about_default_labels_file
24
32
  matching_apps.each do |app|
25
- ui.info("\n Working on #{app} repo \n")
33
+ ui.info("\nWorking on #{app} repo\n")
26
34
  begin
27
- required_labels = read_json_file(required_labels_json_file_path || default_labels_file_path)
35
+ required_labels = get_required_labels
28
36
  required_labels.each do |label|
29
37
  create_or_update_label(app, label)
38
+ sleep(1)
30
39
  end
31
40
  rescue StandardError => e
32
41
  ExceptionHandler.new(e).process
@@ -36,12 +45,37 @@ module Neetob
36
45
 
37
46
  private
38
47
 
48
+ def get_required_labels
49
+ if name.blank? && (!color.blank? || !description.blank?)
50
+ ui.error("Please provide \"name\" for the label you want to upsert.")
51
+ exit
52
+ end
53
+
54
+ if !name.blank?
55
+ return create_label_payload
56
+ end
57
+
58
+ read_json_file(required_labels_json_file_path || default_labels_file_path)
59
+ end
60
+
61
+ def create_label_payload
62
+ [
63
+ {
64
+ "name" => name,
65
+ "color" => color,
66
+ "description" => description
67
+ }.compact
68
+ ]
69
+ end
70
+
39
71
  def create_or_update_label(app, label_details)
40
72
  begin
41
73
  client.update_label(app, label_details["name"], label_details)
42
74
  ui.success("Label \"#{label_details["name"]}\" updated successfully")
43
75
  rescue Octokit::NotFound
44
- client.add_label(app, label_details["name"], label_details["color"], label_details)
76
+ client.add_label(
77
+ app, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE,
78
+ label_details)
45
79
  ui.success("Label \"#{label_details["name"]}\" created successfully")
46
80
  end
47
81
  end
@@ -51,7 +85,7 @@ module Neetob
51
85
  end
52
86
 
53
87
  def inform_about_default_labels_file
54
- if required_labels_json_file_path.nil?
88
+ if required_labels_json_file_path.nil? && name.nil?
55
89
  ui.info("Upserting labels from the \"neetob/data/github-labels.json\" file")
56
90
  end
57
91
  end
@@ -33,7 +33,8 @@ module Neetob
33
33
  end
34
34
 
35
35
  def add_commmit_and_push_changes(app)
36
- `#{cd_to_app_in_tmp_dir(app)} && git add . && git commit -m "#{pr_title}" && git push -u origin #{branch_name} --force`
36
+ `#{cd_to_app_in_tmp_dir(app)} && git add . && \\
37
+ git commit -m "#{pr_title}" && git push -u origin #{branch_name} --force`
37
38
  end
38
39
 
39
40
  def delete_local_feature_branch(app)
@@ -27,8 +27,11 @@ module Neetob
27
27
  desc: "Path to UNIX executable script which will be run for each product", required: true
28
28
  option :title, type: :string, aliases: "-t", desc: "Title for the PR"
29
29
  option :branch, type: :string, aliases: "-b", desc: "Feature branch name for the PR"
30
+ option :description, type: :string, aliases: "-d", desc: "Description of the PR"
30
31
  def script
31
- Script.new(options[:apps], options[:path], options[:title], options[:branch], options[:sandbox]).run
32
+ Script.new(
33
+ options[:apps], options[:path], options[:title], options[:branch], options[:description],
34
+ options[:sandbox]).run
32
35
  end
33
36
  end
34
37
  end
@@ -26,6 +26,7 @@ module Neetob
26
26
  clone_app_in_tmp_dir(app)
27
27
  check_and_delete_remote_branch(app)
28
28
  bundle_install(app)
29
+ fix_neeto_audit(app)
29
30
  ui.info(add_commmit_and_push_changes(app))
30
31
  delete_local_feature_branch(app)
31
32
  res = client.create_pull_request(app, "main", BRANCH_NAME, PR_TITLE)
@@ -40,7 +41,11 @@ module Neetob
40
41
  private
41
42
 
42
43
  def bundle_install(app)
43
- `#{cd_to_app_in_tmp_dir(app)} && bundle`
44
+ `#{cd_to_app_in_tmp_dir(app)} && bundle install`
45
+ end
46
+
47
+ def fix_neeto_audit(app)
48
+ `#{cd_to_app_in_tmp_dir(app)} && bundle exec neeto-audit -a`
44
49
  end
45
50
  end
46
51
  end
@@ -9,13 +9,14 @@ 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
12
+ attr_accessor :apps, :sandbox, :path_to_the_script_file, :pr_description
13
13
 
14
- def initialize(apps, path_to_the_script_file, pr_title, branch_name, sandbox = false)
14
+ def initialize(apps, path_to_the_script_file, pr_title, branch_name, pr_description, sandbox = false)
15
15
  super(pr_title, branch_name)
16
16
  @apps = apps
17
17
  @sandbox = sandbox
18
18
  @path_to_the_script_file = path_to_the_script_file
19
+ @pr_description = pr_description
19
20
  end
20
21
 
21
22
  def run
@@ -30,7 +31,7 @@ module Neetob
30
31
  execute_script(app)
31
32
  ui.info(add_commmit_and_push_changes(app))
32
33
  delete_local_feature_branch(app)
33
- res = client.create_pull_request(app, "main", branch_name, pr_title)
34
+ res = client.create_pull_request(app, "main", branch_name, pr_title, pr_description)
34
35
  ui.success("PR created in \"#{app}\" project successfully.")
35
36
  rescue StandardError => e
36
37
  ExceptionHandler.new(e).process
@@ -6,18 +6,20 @@ 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
9
+ attr_accessor :branch_name, :required_rules_json_file_path, :apps, :sandbox, :all_neeto_repos
10
10
 
11
- def initialize(branch_name, apps, required_rules_json_file_path = "", sandbox = false)
11
+ def initialize(branch_name, apps, 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
15
  @apps = apps
16
16
  @sandbox = sandbox
17
+ @all_neeto_repos = all_neeto_repos
17
18
  end
18
19
 
19
20
  def run
20
- matching_apps = find_all_matching_apps(apps, :github, sandbox)
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
23
  inform_about_default_rules_file
22
24
  matching_apps.each do |app|
23
25
  ui.info("\n Working on \"#{app}\" repo")
@@ -29,7 +29,9 @@ required_config_vars_with_project_keys_json_file_path, sandbox = false)
29
29
  inform_about_default_config_vars_file
30
30
 
31
31
  apps_to_be_updated.each do |app|
32
- required_config = apps.nil? ? app[1] : read_json_file(required_config_vars_json_file_path || default_config_vars_upsert_file_path)
32
+ required_config = apps.nil? ?
33
+ app[1]
34
+ : read_json_file(required_config_vars_json_file_path || default_config_vars_upsert_file_path)
33
35
  app = app[0] if apps.nil?
34
36
 
35
37
  if apps.nil? && sandbox && app != "neeto-dummy"
@@ -69,7 +71,9 @@ required_config_vars_with_project_keys_json_file_path, sandbox = false)
69
71
  end
70
72
 
71
73
  def inform_about_default_config_vars_file
72
- if !apps.nil? && required_config_vars_with_project_keys_json_file_path.nil? && required_config_vars_json_file_path.nil?
74
+ if !apps.nil? &&
75
+ required_config_vars_with_project_keys_json_file_path.nil? && required_config_vars_json_file_path.nil?
76
+
73
77
  ui.info("Upserting config vars from the \"neetob/data/config-vars-upsert.json\" file")
74
78
  end
75
79
  end
@@ -18,11 +18,11 @@ module Neetob
18
18
 
19
19
  def run
20
20
  matching_apps = find_all_matching_apps(apps, :heroku, sandbox)
21
- rails_runner_command = "heroku run rails runner '#{command_to_execute}'"
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|
24
24
  ui.info("\n Working on #{app}\n")
25
- output = `#{heroku_command} -a #{app}`
25
+ output = `heroku run "#{heroku_command}" -a #{app}`
26
26
  unless $?.success?
27
27
  ui.error("There is a problem in accessing the app with name \"#{app}\" in your account.")
28
28
  ui.error("Please check the specified app name and ensure you're authorized to view that app.")
@@ -17,10 +17,12 @@ module Neetob
17
17
  option :apps, type: :array, aliases: "-a", default: ["*"], desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\""
18
18
  option :author, type: :string, required: true, desc: "Github username of the person whose commits you want to list"
19
19
  option :duration, type: :string, required: true, desc: "Duration for which you want to list the commits. Example: \"6.months\" \"10.days\""
20
+ option :all_neeto_repos, type: :boolean, aliases: "--all",
21
+ desc: "Use this flag for working with all neeto repos", default: false
20
22
  def commits
21
23
  Commits.new(
22
24
  options[:author], options[:duration], options[:apps],
23
- options[:sandbox]).run
25
+ options[:sandbox], options[:all_neeto_repos]).run
24
26
  end
25
27
  end
26
28
  end
@@ -1,19 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../base"
3
+ require "chronic"
4
+ require "active_support/core_ext/numeric/time"
5
+
6
+ require_relative "../github/base"
4
7
 
5
8
  module Neetob
6
9
  class CLI
7
10
  module Users
8
- class Commits < Base
9
- attr_accessor :sandbox, :apps, :author, :duration
11
+ class Commits < Github::Base
12
+ include ActionView::Helpers::DateHelper
13
+
14
+ attr_accessor :sandbox, :apps, :author, :duration, :all_neeto_repos
10
15
 
11
- def initialize(author, duration, apps = ["*"], sandbox = false)
16
+ def initialize(author, duration, apps = ["*"], sandbox = false, all_neeto_repos = false)
12
17
  super()
13
18
  @sandbox = sandbox
14
19
  @apps = apps
15
20
  @author = author
16
21
  @duration = duration
22
+ @all_neeto_repos = all_neeto_repos
17
23
  end
18
24
 
19
25
  def run
@@ -26,38 +32,49 @@ module Neetob
26
32
  private
27
33
 
28
34
  def build_commit_rows
29
- find_all_matching_apps(apps, :github, sandbox, true).map do |app|
35
+ commits = find_all_matching_apps(apps, :github, sandbox, true, all_neeto_repos).map do |app|
30
36
  commits = commits_within_range(app)
31
- if commits.empty?
32
- ui.error("No commits found in \"#{app}\" for the given author and duration.")
37
+ if commits&.empty?
38
+ ui.info("No commits found in \"#{app}\" for the given author and duration.")
33
39
  next
34
40
  end
35
-
36
- build_table_rows(app, commits)
41
+ ui.success("Commits found in \"#{app}\".\n")
42
+ commits
37
43
  end
44
+ sorted_commits = commits.compact.flatten.sort_by { |obj| obj.dig(:commit, :author, :date) }.reverse
45
+ build_table_rows(sorted_commits)
38
46
  end
39
47
 
40
48
  def commits_within_range(app)
41
- `git -C ./#{app_name_without_org_suffix(app)} log --pretty=format:"%H:::%ae:::%ar:::%s" --author=#{author} --since=#{duration} --no-merges`
49
+ fetch_commits(app, 1)
42
50
  end
43
51
 
44
- def build_table_rows(app, commits)
45
- commits.split("\n").map { |commit| html_table_row(app, *commit.split(":::")) }
52
+ def build_table_rows(commits)
53
+ commits.map do |commit|
54
+ app = commit[:html_url].split("/")[4]
55
+ commit_id = commit[:sha]
56
+ email = commit.dig(:commit, :author, :email)
57
+ time = distance_of_time_in_words(commit.dig(:commit, :author, :date), Time.current) + " ago"
58
+ date = commit.dig(:commit, :author, :date).strftime("%B %d, %Y")
59
+ title = commit.dig(:commit, :message).split("\n")[0]
60
+ html_table_row(app, commit_id, email, time, date, title)
61
+ end
46
62
  end
47
63
 
48
64
  def app_name_without_org_suffix(app)
49
65
  app.split("/")[1]
50
66
  end
51
67
 
52
- def html_table_row(app, commit, email, time, title)
53
- starting_7_characters_of_commit = commit[0..6]
68
+ def html_table_row(app, commit_id, email, time, date, title)
69
+ starting_7_characters_of_commit = commit_id[0..6]
54
70
  "<tr>
55
- <td class='commit'><a href='https://github.com/#{app}/commit/#{commit}'
56
- target='_blank'>#{starting_7_characters_of_commit}</a></td>
57
- <td class='project'>#{app_name_without_org_suffix(app)}</td>
58
- <td class='email'>#{email}</td>
71
+ <td class='commit'><a href='https://github.com/bigbinary/#{app}/commit/#{commit_id}'
72
+ target='_blank'>#{starting_7_characters_of_commit}</a></td>
73
+ <td class='project'>#{app}</td>
59
74
  <td class='time'>#{time}</td>
60
75
  <td class='title'>#{title}</td>
76
+ <td class='time'>#{date}</td>
77
+ <td class='email'>#{email}</td>
61
78
  </tr>"
62
79
  end
63
80
 
@@ -66,8 +83,10 @@ module Neetob
66
83
  <html>
67
84
  <body>
68
85
  <style>
69
- table {
86
+ body{
70
87
  font-family: arial, sans-serif;
88
+ }
89
+ table {
71
90
  border-collapse: collapse;
72
91
  width: 100%;
73
92
  }
@@ -95,16 +114,25 @@ module Neetob
95
114
  .title {
96
115
  color: lightcoral
97
116
  }
117
+ .info{
118
+ font-size: larger;
119
+ margin-bottom: 10px;
120
+ }
98
121
  </style>
122
+ <div class='info'>
123
+ Github user id: <strong>#{author}</strong> <br/>
124
+ Duration: <strong>#{duration}</strong>
125
+ </div>
99
126
  <table>
100
127
  <tr>
101
128
  <th>Commit</th>
102
- <th>Product</th>
103
- <th>Email</th>
129
+ <th>Repo</th>
104
130
  <th>Created at</th>
105
131
  <th>Title</th>
132
+ <th>Commited on</th>
133
+ <th>Email</th>
106
134
  </tr>
107
- #{table_rows.empty? ? "<tr><td>No commits found in the given duration</td></tr>" : table_rows.join}
135
+ #{table_rows&.compact&.empty? ? "<tr><td>No commits found in the given duration</td></tr>" : table_rows.join}
108
136
  </table>
109
137
  </body>
110
138
  </html>"
@@ -119,6 +147,27 @@ module Neetob
119
147
  def open_html_file_in_default_system_application
120
148
  `open ./commits.html`
121
149
  end
150
+
151
+ def since_duration(duration)
152
+ Chronic.parse(duration.split(".").join(" ") + " ago")&.iso8601
153
+ end
154
+
155
+ def fetch_commits(app, page = 1)
156
+ begin
157
+ commits = client.commits(
158
+ app, "main",
159
+ { author: author, since: since_duration(duration), per_page: 100, page: page })
160
+ rescue => exception
161
+ ui.error(exception.message)
162
+ commits = []
163
+ end
164
+
165
+ if commits.length == 100
166
+ commits + fetch_commits(app, page + 1)
167
+ else
168
+ commits
169
+ end
170
+ end
122
171
  end
123
172
  end
124
173
  end
data/lib/neetob/cli.rb CHANGED
@@ -33,8 +33,10 @@ module Neetob
33
33
  subcommand "local", Local::Commands
34
34
 
35
35
  desc "make_repos_uptodate", "Uptodate all neeto repos"
36
+ option :all_neeto_repos, type: :boolean, aliases: "--all", desc: "Use this flag for working with all neeto repos",
37
+ default: false
36
38
  def make_repos_uptodate
37
- FetchorupdateRepos::Execute.new(options[:sandbox]).run
39
+ FetchorupdateRepos::Execute.new(options[:sandbox], options[:all_neeto_repos]).run
38
40
  end
39
41
  end
40
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/neetob.gemspec CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  Dir.chdir(submodule_path) do
42
42
  required_submodule_files = `git ls-files -z`
43
43
  .split("\x0")
44
- .select { |file| file.match("lib/neeto_compliance*") }
44
+ .select { |file| file.match("lib/neeto_compliance*|data/*") }
45
45
  .map { |file| "#{submodule_path}/#{file}" }
46
46
  .map { |file| file.gsub "#{File.dirname(__FILE__)}/", "" }
47
47
  spec.files += required_submodule_files
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.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -98,15 +98,14 @@ files:
98
98
  - CODE_OF_CONDUCT.md
99
99
  - Gemfile
100
100
  - Gemfile.lock
101
- - LICENSE.txt
102
101
  - README.md
103
102
  - Rakefile
103
+ - bookmarks.md
104
104
  - data/branch-protection-rules.json
105
105
  - data/config-vars-audit.json
106
106
  - data/config-vars-list.json
107
107
  - data/config-vars-upsert.json
108
108
  - data/github-labels.json
109
- - env.sample
110
109
  - exe/neetob
111
110
  - install.sh
112
111
  - lib/neetob.rb
@@ -155,55 +154,6 @@ files:
155
154
  - lib/neetob/exception_handler.rb
156
155
  - lib/neetob/utils.rb
157
156
  - lib/neetob/version.rb
158
- - neeto_compliance/lib/neeto_compliance/github_access.rb
159
- - neeto_compliance/lib/neeto_compliance/neeto_apps.rb
160
- - neeto_compliance/lib/neeto_compliance/neeto_commons.rb
161
- - neeto_compliance/lib/neeto_compliance/runner.rb
162
- - neeto_compliance/lib/neeto_compliance/skippable.rb
163
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb
164
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb
165
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb
166
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb
167
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb
168
- - neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb
169
- - neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb
170
- - neeto_compliance/lib/neeto_compliance/verifiers/base.rb
171
- - neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb
172
- - neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb
173
- - neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb
174
- - neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb
175
- - neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb
176
- - neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb
177
- - neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb
178
- - neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb
179
- - neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb
180
- - neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb
181
- - neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb
182
- - neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb
183
- - neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb
184
- - neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb
185
- - neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb
186
- - neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb
187
- - neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb
188
- - neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb
189
- - neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb
190
- - neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb
191
- - neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb
192
- - neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb
193
- - neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb
194
- - neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb
195
- - neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb
196
- - neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb
197
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb
198
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb
199
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb
200
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb
201
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb
202
- - neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb
203
- - neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb
204
- - neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb
205
- - neeto_compliance/lib/neeto_compliance/verifiers_list.rb
206
- - neeto_compliance/lib/neeto_compliance/version.rb
207
157
  - neetob.gemspec
208
158
  - overcommit.yml
209
159
  - scripts/delete_unused_assets.rb
@@ -214,7 +164,7 @@ metadata:
214
164
  homepage_uri: https://github.com/bigbinary/neetob
215
165
  source_code_uri: https://github.com/bigbinary/neetob
216
166
  changelog_uri: https://github.com/bigbinary/neetob/blob/main/CHANGELOG.md
217
- post_install_message:
167
+ post_install_message:
218
168
  rdoc_options: []
219
169
  require_paths:
220
170
  - lib
@@ -229,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
179
  - !ruby/object:Gem::Version
230
180
  version: '0'
231
181
  requirements: []
232
- rubygems_version: 3.4.6
233
- signing_key:
182
+ rubygems_version: 3.2.33
183
+ signing_key:
234
184
  specification_version: 4
235
185
  summary: Provides a set of helper scripts for Github and Heroku.
236
186
  test_files: []
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Udai Gupta
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/env.sample DELETED
@@ -1 +0,0 @@
1
- AUTH_PARAMS='{"provider": "github","client_id": "9aefff37f98713262fd0","grant_type": "urn:ietf:params:oauth:grant-type:device_code","auth_uris": {"auth_req": "https://github.com/login/device/code","token_req": "https://github.com/login/oauth/access_token"},"scope": "repo,user"}'
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "base64"
4
-
5
- module NeetoCompliance
6
- class GithubAccess
7
- def self.token
8
- Base64.decode64(
9
- File.read("Gemfile.common.rb")
10
- .split("encoded_github_auth_string =")[1]
11
- .split("%{")[1]
12
- .split("}")[0]
13
- .gsub("\\r", "\r")
14
- .gsub("\\n", "\n")
15
- ).split(":")[1]
16
- end
17
-
18
- def self.latest_commit_sha(uri)
19
- JSON.parse(get(uri))["sha"]
20
- end
21
-
22
- def self.get(uri)
23
- response = Net::HTTP.get_response(
24
- URI(uri), {
25
- "Authorization" => "Bearer #{token}"
26
- }).body
27
- end
28
- end
29
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class NeetoApps
5
- def self.list
6
- [ "neetoWheel",
7
- "neetoChat",
8
- "neetoDesk",
9
- "neetoKB",
10
- "neetoForm",
11
- "neetoInvoice",
12
- "neetoChangelog",
13
- "neetoInvisible",
14
- "neetoSocial",
15
- "neetoWireframe",
16
- "neetoRunner",
17
- "neetoPlanner",
18
- "neetoCourse",
19
- "neetoCrm",
20
- "neetoCal",
21
- "neetoAuth",
22
- "neetoReplay",
23
- "neetoQuiz",
24
- "neetoTestify",
25
- "neetoSite",
26
- "neetoDeploy",
27
- "neetoMonitor",
28
- "neetoCI",
29
- "neetoSign",
30
- "neetoBugtrap",
31
- "neetoGit"
32
- ]
33
- end
34
- end
35
- end