Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

a couple bug fixes

  • Loading branch information...
commit 0242e8f4972c4eb1407ca81c0d340c0b2a31175d 1 parent 8ce2c59
@technomancy authored
View
8 lib/conspire.rb
@@ -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
View
4 lib/conspire/conspirator.rb
@@ -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}"
View
7 lib/conspire/gitjour_exts.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.