Class: Neetob::CLI::Github::Labels::Upsert

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/github/labels/upsert.rb

Constant Summary collapse

WHITE_COLOR_HEX_CODE =
"ffffff"

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(repos, required_labels_json_file_path = "", sandbox = false, name = "", color = "", description = "") ⇒ Upsert

Returns a new instance of Upsert.



16
17
18
19
20
21
22
23
24
25
# File 'lib/neetob/cli/github/labels/upsert.rb', line 16

def initialize(repos, required_labels_json_file_path = "", sandbox = false,
  name = "", color = "", description = "")
  super()
  @repos = repos
  @required_labels_json_file_path = required_labels_json_file_path
  @sandbox = sandbox
  @name = name
  @color = color
  @description = description
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def color
  @color
end

#descriptionObject

Returns the value of attribute description.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def description
  @description
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def name
  @name
end

#reposObject

Returns the value of attribute repos.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def repos
  @repos
end

#required_labels_json_file_pathObject

Returns the value of attribute required_labels_json_file_path.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def required_labels_json_file_path
  @required_labels_json_file_path
end

#sandboxObject

Returns the value of attribute sandbox.



14
15
16
# File 'lib/neetob/cli/github/labels/upsert.rb', line 14

def sandbox
  @sandbox
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/neetob/cli/github/labels/upsert.rb', line 27

def run
  matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
  inform_about_default_labels_file
  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(repo, label)
        sleep(1)
      end
    rescue StandardError => e
      ExceptionHandler.new(e).process
    end
  end
end