class TransparentGit::RemoteTrackers
Public Class Methods
create_from_yaml(f)
click to toggle source
# File lib/transparent_git/remote_trackers.rb, line 25 def create_from_yaml(f) str = File.read(f) puts str raise "file is empty" if str.blank? h = YAML::load(str) puts h.inspect res = new if h.kind_of?(Hash) repos = h.delete('repos') raise "no repos given" unless repos res.from_hash(h) repos.each do |repo| res.add(repo) end else repos = str.split("\n").map { |x| x.strip }.select { |x| x.present? } repos.each do |r| res.add :working_dir => r end end res end
Public Instance Methods
add(ops)
click to toggle source
# File lib/transparent_git/remote_trackers.rb, line 7 def add(ops) ops = {:repo_holding_dir => repo_holding_dir}.merge(ops) res = RemoteTracker.new(ops) list << res end
run_loop!()
click to toggle source
# File lib/transparent_git/remote_trackers.rb, line 17 def run_loop! loop do run_once! sleep(interval.to_i) end end
run_once!()
click to toggle source
# File lib/transparent_git/remote_trackers.rb, line 12 def run_once! list.each do |t| t.commit_current_state! end end