technomancy-conspire 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -28,17 +28,28 @@ conspire from there on the files with which you wish to collaborate.
28
28
 
29
29
  See lib/conspire/support to see which editors are supported. In Emacs,
30
30
  install conspire.el and then visit the file you want to edit and
31
- pressing M-x conspire-mode, though this is still very rough and should
32
- be done in its own Emacs instance.
31
+ pressing M-x conspire-mode.
33
32
 
34
33
  Repository history is cleared in between conspiracy sessions.
35
34
 
36
- == Troubleshooting
35
+ For testing purposes, you can run two or more conspiracies on the same
36
+ machine; you just have to specify an alternate port and name for the
37
+ others. Names should always include the string "conspiracy" to
38
+ distinguish them from other gitjour repositories.
37
39
 
38
- When using Avahi for your ZeroConf implementation, you will not be
39
- able to do anything unless you have an active network connection. So
40
- disconnected conspirancy sessions are not possible without bringing up
41
- an ad-hoc network to trick Avahi into activating.
40
+ $ conspire repo -p 7457 -n conspiracy2
41
+
42
+ Set the DEBUG environment variable to get more information on the console.
43
+
44
+ == Bugs
45
+
46
+ * Conflict resolution remains entirely unhandled.
47
+
48
+ * When using Avahi for your ZeroConf implementation, you will not be
49
+ able to do anything unless you have an active network connection. So
50
+ disconnected conspirancy sessions are not possible without bringing
51
+ up an ad-hoc network to trick Avahi into activating. You'll also see
52
+ a big fat warning, which should be ignored.
42
53
 
43
54
  == Editor Support
44
55
 
@@ -46,11 +57,12 @@ Editors must support:
46
57
 
47
58
  * Saving on an interval
48
59
  * Committing files to the repo
49
- * Refreshing internal copies
60
+ * Refreshing internal buffers
50
61
 
51
62
  Edits should not be allowed in between these steps.
52
63
 
53
- Editors may be able to support launching the +conspire+ executable.
64
+ Editors may be able to support launching the +conspire+ executable for
65
+ added convenience.
54
66
 
55
67
  That's about all there is to it. If your favourite editor is not
56
68
  supported, please fork and add support for it; it's really not a
@@ -7,22 +7,21 @@ module Conspire
7
7
  end
8
8
 
9
9
  def sync(path)
10
- if ENV['DEBUG']
11
- puts "cd #{path} && git pull --rebase #{url}"
12
- system "cd #{path} && git pull --rebase #{url}" or
13
- raise "Could not rebase from #{url}"
14
- else
15
- system "cd #{path} && git pull --rebase #{url} > /dev/null" or
16
- raise "Could not rebase from #{url}"
17
- end
10
+ # TODO: figure out conflictless rebasing... evan?
11
+ success = if ENV['DEBUG']
12
+ puts "cd #{path} && git pull --rebase #{url}"
13
+ system "cd #{path} && git pull --rebase #{url}"
14
+ else
15
+ system "cd #{path} && git pull --rebase #{url} &> /dev/null"
16
+ end
18
17
 
19
- @last_synced = Time.now
18
+ raise "could not rebase from #{url}" if ! success
19
+ # @last_synced = Time.now # is this useful?
20
20
  end
21
21
 
22
22
  def url; "git://#{@host}:#{@port}/" end
23
23
 
24
24
  alias_method :to_s, :url
25
- alias_method :inspect, :url
26
25
 
27
26
  # For set equality
28
27
  def eql?(other); self.url == other.url end
@@ -5,7 +5,7 @@ module Gitjour
5
5
 
6
6
  def init(path)
7
7
  abort "Repository already exists: #{path}" if File.exist? path + '/.git'
8
- at_exit { FileUtils.rm_rf path + '/.git' }
8
+ at_exit { FileUtils.rm_rf path + '/.git' } unless ENV['KEEP']
9
9
  `mkdir -p #{path} && cd #{path} && git init`
10
10
  `touch #{path}/.git/git-daemon-export-ok`
11
11
  end
@@ -3,8 +3,8 @@
3
3
  ;; Copyright (C) 2008 Phil Hagelberg
4
4
 
5
5
  ;; Author: Phil Hagelberg <technomancy@gmail.com>
6
- ;; URL: http://www.emacswiki.org/cgi-bin/wiki/Conspire
7
- ;; Version: 0.1
6
+ ;; URL: http://conspire.rubyforge.org
7
+ ;; Version: 0.2
8
8
  ;; Created: 2008-07-22
9
9
  ;; Keywords: collaboration
10
10
 
@@ -39,11 +39,8 @@
39
39
 
40
40
  ;;; TODO:
41
41
 
42
- ;; In its current state, it's very dangerous to start a conspire
43
- ;; session and then switch buffers, since the timer is not yet buffer
44
- ;; local. Watch out!
45
-
46
42
  ;; Automatically launch conspire executable.
43
+ ;; Color lines based on which conspirator wrote them?
47
44
 
48
45
  ;;; Code:
49
46
 
@@ -53,20 +50,26 @@
53
50
  (defvar conspire-timer nil
54
51
  "A timer to activate conspire synchronizing.")
55
52
 
53
+ (make-variable-buffer-local 'conspire-mode)
54
+
56
55
  ;;;###autoload
57
56
  (defun conspire-mode ()
58
57
  "Activate conspire-mode for real-time collaborative editing."
59
58
  (interactive)
60
- (set (make-local-variable 'conspire-timer)
61
- (run-with-idle-timer conspire-interval
62
- :repeat 'conspire-sync-buffer)))
59
+ (setq conspire-mode t)
60
+ (setq conspire-timer
61
+ (run-with-idle-timer conspire-interval :repeat 'conspire-sync-buffer)))
62
+
63
63
 
64
64
  (defun conspire-sync-buffer ()
65
65
  "Synchronize buffer with Conspire repository."
66
- (when (buffer-modified-p)
67
- (save-buffer)
68
- (shell-command (format "git add %s && git commit -m \"conspire\""
69
- buffer-file-name)))
70
- (revert-buffer nil t))
66
+ (when conspire-mode
67
+ (when (buffer-modified-p)
68
+ (save-buffer)
69
+ (shell-command (format "git add %s && git commit -m \"conspire\""
70
+ buffer-file-name)))
71
+ (revert-buffer nil t)
72
+ ;; revert resets local variables; heh
73
+ (setq conspire-mode t)))
71
74
 
72
75
  ;;; conspire.el ends here
data/lib/conspire.rb CHANGED
@@ -9,7 +9,7 @@ require 'conspire/gitjour_exts'
9
9
  require 'conspire/conspirator'
10
10
 
11
11
  module Conspire
12
- VERSION = '0.0.1'
12
+ VERSION = '0.1.0'
13
13
  DEFAULTS = { :port => 7456, :name => 'conspiracy', :sync_interval => 0.5 }
14
14
  HOSTNAME = `hostname`.chomp
15
15
 
@@ -21,7 +21,6 @@ module Conspire
21
21
  def start(path, options)
22
22
  @options = options
23
23
  @path = path
24
- puts "Starting with #{@options.inspect}" if ENV['DEBUG']
25
24
  Gitjour::Application.init @path
26
25
  @thread = Thread.new do
27
26
  Gitjour::Application.serve(@path, @options.name, @options.port)
@@ -58,9 +57,7 @@ module Conspire
58
57
  def discover_loop
59
58
  loop do
60
59
  Conspire.discover
61
- p Conspire.conspirators if ENV['DEBUG']
60
+ puts Conspire.conspirators.map{ |c| c.to_s } if ENV['DEBUG']
62
61
  end
63
62
  end
64
-
65
- def conspirators; @conspirators end
66
63
  end
@@ -9,12 +9,16 @@ require File.dirname(__FILE__) + '/../lib/conspire'
9
9
 
10
10
  REMOTE_SPACE = File.dirname(__FILE__) + '/remote-space'
11
11
  LOCAL_SPACE = File.dirname(__FILE__) + '/local-space'
12
+ FileUtils.rm_rf(REMOTE_SPACE)
13
+ FileUtils.rm_rf(LOCAL_SPACE)
12
14
 
13
15
  module Conspire
14
16
  def self.reset!
15
17
  @conspirators = []
16
18
  @thread && @thread.kill
17
19
  end
20
+
21
+ def self.conspirators; @conspirators end
18
22
  end
19
23
 
20
24
  class TestConspire < Test::Unit::TestCase
@@ -27,15 +31,21 @@ class TestConspire < Test::Unit::TestCase
27
31
  Gitjour::Application.serve(REMOTE_SPACE, 'conspiracy-remote-test', 7458)
28
32
  end
29
33
 
30
- Conspire.start(LOCAL_SPACE, OpenStruct.new(:port => 7457))
34
+ Conspire.start(LOCAL_SPACE, OpenStruct.new(:port => 7457,
35
+ :name => 'conspiracy',
36
+ :sync_interval => 0.5))
31
37
  end
32
38
 
33
39
  def teardown
34
40
  @remote_thread.kill
35
41
  `killall git-daemon` # workaround until gitjour handles this correctly
36
42
  Conspire.reset!
37
- FileUtils.rm_rf(REMOTE_SPACE)
38
- FileUtils.rm_rf(LOCAL_SPACE)
43
+ FileUtils.rm_rf(REMOTE_SPACE) unless ENV['KEEP']
44
+ FileUtils.rm_rf(LOCAL_SPACE) unless ENV['KEEP']
45
+ end
46
+
47
+ def test_start
48
+ assert File.exist?(LOCAL_SPACE + '/.git')
39
49
  end
40
50
 
41
51
  def test_discover
@@ -44,14 +54,13 @@ class TestConspire < Test::Unit::TestCase
44
54
  end
45
55
 
46
56
  def test_sync
57
+ # getting random unreproducible failings here
47
58
  Conspire.conspirators << Conspire::Conspirator.new('localhost.', '7458')
48
59
  Conspire.sync_all
49
60
  assert_equal ["#{LOCAL_SPACE}/file"], Dir.glob("#{LOCAL_SPACE}/*")
50
61
  end
51
62
 
52
63
  def test_conspirator_set
53
- Conspire.conspirators << Conspire::Conspirator.new('dynabook.', '7458')
54
- Conspire.conspirators << Conspire::Conspirator.new('dynabook.', '7458')
55
64
  Conspire.conspirators << Conspire::Conspirator.new('dynabook.', '7458')
56
65
  Conspire.conspirators << Conspire::Conspirator.new('dynabook.', '7458')
57
66
  assert_equal 1, Conspire.conspirators.size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technomancy-conspire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Hagelberg