Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bin launcher works

  • Loading branch information...
commit 07ce131ecee2dd8c512696f458520166351513ca 1 parent 424d6bc
@technomancy authored
View
17 bin/conspire
@@ -2,5 +2,18 @@
require File.dirname(__FILE__) + '/../lib/conspire'
-# For now...
-Conspire.send *ARGV
+# TODO: real option parsing
+Conspire.start :port => ARGV.first || Conspire::DEFAULT_OPTIONS[:port]
+
+Thread.new do
+ loop do
+ Conspire.discover
+ p Conspire.conspirators if ENV['DEBUG']
+ sleep 10
+ end
+end
+
+loop do
+ Conspire.sync_all
+ sleep 1
+end
View
1  lib/conspire.rb
@@ -44,6 +44,7 @@ def discover(wait = DISCOVER_TIME)
end
def sync_all
+ # TODO: drop conspirators if they shut down their repo
@conspirators.map{ |s| s.sync(File.dirname(@repo.path)) }
end
View
7 lib/conspire/conspirator.rb
@@ -6,10 +6,6 @@ def initialize(host, port, name = SERVICE_NAME)
@host, @port, @name = host, port || DEFAULT_OPTIONS[:port], name
end
- def to_s
- "#{@host}:#{@port}"
- end
-
def sync(path)
# TODO: suppress output
`cd #{path} && git pull --rebase #{url}`
@@ -18,6 +14,9 @@ def sync(path)
def url; "git://#{@host}.local:#{@port}/" end
+ alias_method :to_s, :url
+ alias_method :inspect, :url
+
def eql?(other)
self.to_s == other.to_s
end
View
6 test/test_conspire.rb
@@ -47,10 +47,4 @@ def test_sync
Conspire.sync_all
assert_equal ["#{LOCAL_SPACE}/file"], Dir.glob("#{LOCAL_SPACE}/*")
end
-
-# def test_commit
-# end
-
-# def test_rebase
-# end
end
Please sign in to comment.
Something went wrong with that request. Please try again.