lib/neetob/cli/github/labels/upsert.rb in neetob-0.2.2 vs lib/neetob/cli/github/labels/upsert.rb in neetob-0.2.3

- old
+ new

@@ -9,34 +9,34 @@ module Github module Labels class Upsert < Base WHITE_COLOR_HEX_CODE = "ffffff" - attr_accessor :apps, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description + attr_accessor :repos, :required_labels_json_file_path, :sandbox, :all_neeto_repos, :name, :color, :description - def initialize(apps, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false, + def initialize(repos, required_labels_json_file_path = "", sandbox = false, all_neeto_repos = false, name = "", color = "", description = "") super() - @apps = apps + @repos = repos @required_labels_json_file_path = required_labels_json_file_path @sandbox = sandbox @all_neeto_repos = all_neeto_repos @name = name @color = color @description = description 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) + 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) inform_about_default_labels_file - matching_apps.each do |app| - ui.info("\nWorking on #{app} repo\n") + matching_repos.each do |repo| + ui.info("\nWorking on #{repo} repo\n") begin required_labels = get_required_labels required_labels.each do |label| - create_or_update_label(app, label) + create_or_update_label(repo, label) sleep(1) end rescue StandardError => e ExceptionHandler.new(e).process end @@ -66,16 +66,16 @@ "description" => description }.compact ] end - def create_or_update_label(app, label_details) + def create_or_update_label(repo, label_details) begin - client.update_label(app, label_details["name"], label_details) + client.update_label(repo, label_details["name"], label_details) ui.success("Label \"#{label_details["name"]}\" updated successfully") rescue Octokit::NotFound client.add_label( - app, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE, + repo, label_details["name"], label_details["color"] || WHITE_COLOR_HEX_CODE, label_details) ui.success("Label \"#{label_details["name"]}\" created successfully") rescue StandardError => e ExceptionHandler.new(e).process end