lib/neetob/cli/github/labels/delete_all.rb in neetob-0.2.2 vs lib/neetob/cli/github/labels/delete_all.rb in neetob-0.2.3
- old
+ new
@@ -7,38 +7,38 @@
module Neetob
class CLI
module Github
module Labels
class DeleteAll < Base
- attr_accessor :apps, :sandbox, :all_neeto_repos
+ attr_accessor :repos, :sandbox, :all_neeto_repos
- def initialize(apps, sandbox = false, all_neeto_repos = false)
+ def initialize(repos, sandbox = false, all_neeto_repos = false)
super()
- @apps = apps
+ @repos = repos
@sandbox = sandbox
@all_neeto_repos = all_neeto_repos
end
def run
- check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
- matching_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos)
- matching_apps.each do |app|
- ui.info("\n Working on #{app} repo \n")
+ check_for_apps_and_all_neeto_repos_option(repos, all_neeto_repos)
+ matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox, false, all_neeto_repos)
+ matching_repos.each do |repo|
+ ui.info("\n Working on #{repo} repo \n")
begin
- labels = client.labels(app)
+ labels = client.labels(repo)
labels.each do |label|
- delete_label(app, label)
+ delete_label(repo, label)
end
rescue StandardError => e
ExceptionHandler.new(e).process
end
end
end
private
- def delete_label(app, label_details)
- if client.delete_label!(app, label_details[:name])
+ def delete_label(repo, label_details)
+ if client.delete_label!(repo, label_details[:name])
ui.success("The \"#{label_details[:name]}\" label deleted successfully")
else
ui.error("The \"#{label_details[:name]}\" label can't be deleted. Please try again")
end
end