Class: Labelito::Tool
- Inherits:
-
Object
- Object
- Labelito::Tool
- Defined in:
- lib/Labelito/tool.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clone(from_repo, to_repo) ⇒ Object
- #create(template_path, repo) ⇒ Object
-
#initialize(client, template_reader) ⇒ Tool
constructor
A new instance of Tool.
Constructor Details
#initialize(client, template_reader) ⇒ Tool
Returns a new instance of Tool.
8 9 10 11 |
# File 'lib/Labelito/tool.rb', line 8 def initialize(client, template_reader) @client = client @template_reader = template_reader end |
Class Method Details
.with_token(token) ⇒ Object
13 14 15 |
# File 'lib/Labelito/tool.rb', line 13 def self.with_token(token) Tool.new GithubClient.with_token(token), TemplateReader.new end |
Instance Method Details
#clone(from_repo, to_repo) ⇒ Object
17 18 19 20 |
# File 'lib/Labelito/tool.rb', line 17 def clone(from_repo, to_repo) labels = @client.labels(from_repo) @client.update(labels, to_repo) end |
#create(template_path, repo) ⇒ Object
22 23 24 25 |
# File 'lib/Labelito/tool.rb', line 22 def create(template_path, repo) labels = @template_reader.read(template_path) @client.update(labels, repo) end |