Class: Hubeye::Server::Strategies::SaveRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/hubeye/server/strategies/save_repo.rb

Instance Method Summary collapse

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hubeye/server/strategies/save_repo.rb', line 8

def call
  if !tracker.empty?
    file = "#{ENV['HOME']}/.hubeye/repos/#{@matches[2]}.yml"
    if File.exists? file
      override?
    end
    # dump only the repository names, not the shas
    File.open(file, "w") do |f_out|
      YAML.dump(tracker.repo_names, f_out)
    end
    socket.deliver "Saved repo#{@matches[1]} as #{@matches[2]}"
  else
    socket.deliver "No remote repos are being tracked"
  end
end