Class: SyncIssues::Synchronizer

Inherits:
Object
  • Object
show all
Defined in:
lib/sync_issues/synchronizer.rb

Overview

Synchronizer is responsible for the actual synchronization.

Instance Method Summary collapse

Constructor Details

#initialize(directory, repository_names, label_yaml: nil, reset_labels: false, sync_assignees: true, sync_labels: true, update_only: false) ⇒ Synchronizer

Returns a new instance of Synchronizer.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sync_issues/synchronizer.rb', line 10

def initialize(directory, repository_names, label_yaml: nil,
               reset_labels: false, sync_assignees: true,
               sync_labels: true, update_only: false)
  @github = SyncIssues.github
  @issues = issues(directory)
  @label_sync = LabelSync.new(@github, label_yaml)
  @repositories = repositories(repository_names)
  @reset_labels = reset_labels
  @sync_assignees = sync_assignees
  @sync_labels = sync_labels
  @update_only = update_only
end

Instance Method Details

#runObject



23
24
25
26
# File 'lib/sync_issues/synchronizer.rb', line 23

def run
  puts "Synchronize #{@issues.count} issue#{@issues.count == 1 ? '' : 's'}"
  @repositories.each { |repository| synchronize(repository) }
end