Class: GithubTV::Sync

Inherits:
Object
  • Object
show all
Defined in:
lib/github-tv.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, target, source_repo) ⇒ Sync

Returns a new instance of Sync.



31
32
33
34
35
# File 'lib/github-tv.rb', line 31

def initialize(client, target, source_repo)
  @client = client
  @target = target
  @source, @project = source_repo.split('/')
end

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
45
# File 'lib/github-tv.rb', line 37

def run
  if @client.repository? target_repo
    fast_forward
    puts "#@project fast-forwarded"
  else
    @client.fork source_repo, organization: @target
    puts "#@project forked"
  end
end