Class: CopyGithubLabels::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/copy_github_labels/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
# File 'lib/copy_github_labels/client.rb', line 8

def initialize(opts = {})
  @client = Octokit::Client.new(opts)
  @client.auto_paginate = true
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/copy_github_labels/client.rb', line 6

def client
  @client
end

Instance Method Details

#copy_labels(source, target, opts = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/copy_github_labels/client.rb', line 17

def copy_labels(source, target, opts = {})
  labels(source).map do |label|
    Thread.new do
    msg = copy_label(label, target, opts)
    puts msg.join(" ")
    end
  end.each(&:join)
  puts "DONE".green
end

#labels(repo) ⇒ Object



13
14
15
# File 'lib/copy_github_labels/client.rb', line 13

def labels(repo)
  client.labels(repo)
end