Sha256: 386c3282ddfe609702a7bf7681858daa2e2b905faa0aaf56a161b48da9ed2631

Contents?: true

Size: 1.19 KB

Versions: 18

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "thor"

require_relative "../base"

module Neetob
  class CLI
    module Github
      module Labels
        class Update < Base
          attr_accessor :apps, :sandbox, :old_name, :new_name, :all_neeto_repos

          def initialize(apps, old_name, new_name, sandbox = false, all_neeto_repos = false)
            super()
            @apps = apps
            @sandbox = sandbox
            @old_name = old_name
            @new_name = new_name
            @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 Updating label for #{app} repo \n")
              update_label!(app, old_name, new_name)
            end
          end

          private

            def update_label!(app, old_name, new_name)
              client.update_label(app, old_name, { name: new_name })
              ui.success("Label \"#{old_name}\" updated to \"#{new_name}\" successfully")
            end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
neetob-ud-1.0.59 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.8 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.6 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.4 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.3 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.2 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.1 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.0 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.1.3 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.1.2 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.1.1 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.1.0 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.14 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.13 lib/neetob/cli/github/labels/update.rb
neetob-0.1.4 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.11 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.9 lib/neetob/cli/github/labels/update.rb
neetob-ud-0.2.5 lib/neetob/cli/github/labels/update.rb