Sha256: 82aad0c69b14f88f191d7a288f744c1857472f039bc032be33c38e25855a2894

Contents?: true

Size: 1023 Bytes

Versions: 3

Compression:

Stored size: 1023 Bytes

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

          def initialize(apps, old_name, new_name, sandbox = false)
            super()
            @apps = apps
            @sandbox = sandbox
            @old_name = old_name
            @new_name = new_name
          end

          def run
            matching_apps = find_all_matching_apps(apps, :github, sandbox)
            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

3 entries across 3 versions & 1 rubygems

Version Path
neetob-0.1.2 lib/neetob/cli/github/labels/update.rb
neetob-0.1.1 lib/neetob/cli/github/labels/update.rb
neetob-0.1.0 lib/neetob/cli/github/labels/update.rb