Class: Neetob::CLI::Github::MakePr::ComplianceFix
- Defined in:
- lib/neetob/cli/github/make_pr/compliance_fix.rb
Constant Summary
Constants inherited from Base
Base::BRANCH_NAME, Base::PR_TITLE
Constants inherited from Base
Instance Attribute Summary collapse
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#local ⇒ Object
Returns the value of attribute local.
-
#repos ⇒ Object
Returns the value of attribute repos.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#should_fix_nanos ⇒ Object
Returns the value of attribute should_fix_nanos.
Attributes inherited from Base
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(repos, should_fix_nanos = false, sandbox = false, labels = "", local = false) ⇒ ComplianceFix
constructor
A new instance of ComplianceFix.
- #run ⇒ Object
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize(repos, should_fix_nanos = false, sandbox = false, labels = "", local = false) ⇒ ComplianceFix
Returns a new instance of ComplianceFix.
14 15 16 17 18 19 20 21 22 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 14 def initialize(repos, should_fix_nanos = false, sandbox = false, labels = "", local = false) super() @repos = repos @sandbox = sandbox @should_fix_nanos = should_fix_nanos @failed_repos = [] @labels = labels @local = local end |
Instance Attribute Details
#labels ⇒ Object
Returns the value of attribute labels.
12 13 14 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 12 def labels @labels end |
#local ⇒ Object
Returns the value of attribute local.
12 13 14 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 12 def local @local end |
#repos ⇒ Object
Returns the value of attribute repos.
12 13 14 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 12 def repos @repos end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
12 13 14 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 12 def sandbox @sandbox end |
#should_fix_nanos ⇒ Object
Returns the value of attribute should_fix_nanos.
12 13 14 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 12 def should_fix_nanos @should_fix_nanos end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/neetob/cli/github/make_pr/compliance_fix.rb', line 24 def run matching_repos = build_matching_repos_list(should_fix_nanos) @failed_repos = matching_repos.clone local ? warn_about_local_repos : delete_and_create_temp_neetob_dir matching_repos.each do |repo| ui.info("\nWorking on #{repo}\n") begin if local unless Dir.exist?("./#{repo_name_without_org_suffix(repo)}") ui.error("#{repo_name_without_org_suffix(repo)} don't exist in current dir") next end stash_local_changes(repo, local) end shallow_clone_repo_in_tmp_dir!(repo) if !local check_and_delete_remote_branch(repo, local) bundle_install!(repo, local) fix_neeto_audit(repo, local) ui.info(add_commmit_and_push_changes!(repo, local)) delete_local_feature_branch(repo, local) pull_request = client.create_pull_request(repo, "main", BRANCH_NAME, PR_TITLE) ui.success("PR created in \"#{repo}\" project successfully.") client.add_labels_to_an_issue(repo, pull_request[:number], labels.split(",")) @failed_repos.delete(repo) rescue StandardError => e ExceptionHandler.new(e).process end end print_failed_repos if @failed_repos.length > 0 `rm -rf /tmp/neetob` if !local end |