summaryrefslogtreecommitdiff
path: root/backends/gitmirrorbackend.rb
diff options
context:
space:
mode:
Diffstat (limited to 'backends/gitmirrorbackend.rb')
-rw-r--r--backends/gitmirrorbackend.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/backends/gitmirrorbackend.rb b/backends/gitmirrorbackend.rb
new file mode 100644
index 0000000..25f7c3e
--- /dev/null
+++ b/backends/gitmirrorbackend.rb
@@ -0,0 +1,30 @@
+# coding: utf-8
+
+require 'shellwords'
+
+class GitMirrorBackend
+ def repl(accountName)
+ @accountName = account_name
+ $stdin.each do |line|
+ args = line.shellsplit
+ out = self.send('cmd_'+args[0].gsub('-', '_'), *args[1..0])
+ if out.is_a? String
+ puts out
+ elsif out.is_a? Array
+ out.each do |outline|
+ puts outline
+ end
+ elsif out.is_a? Hash
+ out.each do |k,v|
+ puts "#{k}=#{v}"
+ end
+ else
+ raise "I don't know what to do with output value: #{out}"
+ end
+ end
+ self.finish
+ end
+ def finish
+ # noop
+ end
+end