This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

a couple bug fixes

  • Loading branch information...
technomancy committed Jul 24, 2008
1 parent 8ce2c59 commit 0242e8f4972c4eb1407ca81c0d340c0b2a31175d
Showing with 9 additions and 10 deletions.
  1. +6 −2 lib/conspire.rb
  2. +2 −2 lib/conspire/conspirator.rb
  3. +1 −6 lib/conspire/gitjour_exts.rb
View
@@ -21,7 +21,11 @@ module Conspire
def start(options = {})
@options = DEFAULT_OPTIONS.merge options
puts "Starting with #{@options.inspect}" if ENV['DEBUG']
Gitjour::Application.start @options[:path], @options[:name], @options[:port]
Gitjour::Application.init @options[:path]
@thread = Thread.new do
Gitjour::Application.serve(@options[:path], @options[:name],
@options[:port])
end
end
# This should be called periodically
@@ -38,7 +42,7 @@ def discover(wait = @options[:discover_interval])
def sync_all
@conspirators.map do |c|
begin
c.sync(File.dirname(@options[:path]))
c.sync(@options[:path])
rescue => e
puts "Dropping #{c} because #{e.message}"
@conspirators.delete c
@@ -3,12 +3,12 @@ class Conspirator
attr_accessor :last_synced, :host, :port, :name
def initialize(host, port, name = SERVICE_NAME)
@host, @port, @name = host, port || DEFAULT_OPTIONS[:port], name
@host, @port, @name = host[0 .. -2], port || DEFAULT_OPTIONS[:port], name
end
def sync(path)
# TODO: suppress output
puts "Rebasing from #{url}" if ENV['DEBUG']
puts "cd #{path} && git pull --rebase #{url}" if ENV['DEBUG']
system "cd #{path} && git pull --rebase #{url}" or
raise "Could not rebase from #{url}"
@@ -1,18 +1,13 @@
module Gitjour
class Application
class << self
def start(path, name, port)
init path
@thread = Thread.new { Gitjour::Application.start(path, name, port) }
end
def init(path)
FileUtils.mkdir_p(path) unless File.exist? path
`cd #{path}; git init` if ! File.exist? path + '/.git'
`touch #{path}/.git/git-daemon-export-ok`
end
public :discover
public :discover, :serve
def puts(*args); end unless ENV['DEBUG']
end
end

0 comments on commit 0242e8f

Please sign in to comment.