Class: Conspire::Conspirator
- Inherits:
-
Object
- Object
- Conspire::Conspirator
- Defined in:
- lib/conspire/conspirator.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
For set equality.
- #hash ⇒ Object
-
#initialize(host, port, name) ⇒ Conspirator
constructor
A new instance of Conspirator.
- #sync(path) ⇒ Object
- #url ⇒ Object (also: #to_s, #inspect)
Constructor Details
#initialize(host, port, name) ⇒ Conspirator
Returns a new instance of Conspirator.
5 6 7 8 |
# File 'lib/conspire/conspirator.rb', line 5 def initialize(host, port, name) # host has a trailing dot; remove it @host, @port, @name = host[0 .. -2], port, name end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/conspire/conspirator.rb', line 3 def host @host end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/conspire/conspirator.rb', line 3 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
3 4 5 |
# File 'lib/conspire/conspirator.rb', line 3 def port @port end |
Instance Method Details
#eql?(other) ⇒ Boolean
For set equality
25 |
# File 'lib/conspire/conspirator.rb', line 25 def eql?(other); self.url == other.url end |
#hash ⇒ Object
26 |
# File 'lib/conspire/conspirator.rb', line 26 def hash; url.hash end |
#sync(path) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/conspire/conspirator.rb', line 10 def sync(path) # TODO: figure out conflictless rebasing; new content always wins. evan? if ENV['DEBUG'] puts "cd #{path} && git pull --rebase #{url}" system "cd #{path} && git pull --rebase #{url}" else system "cd #{path} && git pull --rebase #{url} &> /dev/null" end or raise "could not rebase from #{url}" if ! success end |
#url ⇒ Object Also known as: to_s, inspect
20 |
# File 'lib/conspire/conspirator.rb', line 20 def url; "git://#{@host}:#{@port}/" end |