Class: PortVCS::CVSDumb
- Inherits:
-
Object
- Object
- PortVCS::CVSDumb
- Defined in:
- lib/portvcs/portvcs.rb
Overview
VCS
Constant Summary collapse
- CLIENT =
debug print prefixes
'C: '
- SERVER =
'S: '
- PASSPAIR =
{ ?! => 120, ?" => 53, ?% => 109, ?& => 72, ?' => 108, ?( => 70, ?) => 64, ?* => 76, ?+ => 67, ?, => 116, ?- => 74, ?. => 68, ?/ => 87, ?0 => 111, ?1 => 52, ?2 => 75, ?3 => 119, ?4 => 49, ?5 => 34, ?6 => 82, ?7 => 81, ?8 => 95, ?9 => 65, ?: => 112, ?; => 86, ?< => 118, ?= => 110, ?> => 122, ?? => 105, ?A => 57, ?B => 83, ?C => 43, ?D => 46, ?E => 102, ?F => 40, ?G => 89, ?H => 38, ?I => 103, ?J => 45, ?K => 50, ?L => 42, ?M => 123, ?N => 91, ?O => 35, ?P => 125, ?Q => 55, ?R => 54, ?S => 66, ?T => 124, ?U => 126, ?V => 59, ?W => 47, ?X => 92, ?Y => 71, ?Z => 115, ?_ => 56, ?a => 121, ?b => 117, ?c => 104, ?d => 101, ?e => 100, ?f => 69, ?g => 73, ?f => 69, ?h => 99, ?i => 63, ?j => 94, ?k => 93, ?l => 39, ?m => 37, ?n => 61, ?o => 48, ?p => 58, ?q => 113, ?r => 32, ?s => 90, ?t => 44, ?u => 98, ?v => 60, ?w => 51, ?x => 33, ?y => 97, ?z => 62 }
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Class Method Summary collapse
-
.pass_descramble(t) ⇒ Object
the algorithm is symmetric.
- .pass_scramble(t) ⇒ Object
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(p) ⇒ CVSDumb
constructor
p is a hash.
- #log(dir, file = nil, date_cond = nil) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(p) ⇒ CVSDumb
p is a hash
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/portvcs/portvcs.rb', line 77 def initialize(p) @host = p[:host] @port = p[:port] @user = p[:user] @pass = p[:pass] @cvsroot = p[:cvsroot].strip @debug = p[:debug] @ports_tree = p[:ports_tree].strip @client = TCPSocket.open(@host, @port) request("BEGIN AUTH REQUEST") request(@cvsroot) request(@user) request(CVSDumb.pass_scramble(@pass)) request("END AUTH REQUEST") fail "cannot auth to #{@user}@#{@host}" if getline != 'I LOVE YOU' end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
95 96 97 |
# File 'lib/portvcs/portvcs.rb', line 95 def debug @debug end |
Class Method Details
.pass_descramble(t) ⇒ Object
the algorithm is symmetric
72 73 74 |
# File 'lib/portvcs/portvcs.rb', line 72 def self.pass_descramble(t) pass_scramble(t)[2..-1] end |
Instance Method Details
#close ⇒ Object
120 121 122 |
# File 'lib/portvcs/portvcs.rb', line 120 def close @client.close end |
#log(dir, file = nil, date_cond = nil) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/portvcs/portvcs.rb', line 105 def log(dir, file = nil, date_cond = nil) request("Root #{@cvsroot}") request("Directory .") request("#{@cvsroot}/#{@ports_tree.to_s == '' ? '' : @ports_tree + '/'}#{dir}") request("Argument -N") if date_cond request("Argument -d") request("Argument #{date_cond}") end request("Argument #{file}") if file != nil request('log') getmultilines_text {|i| yield i } end |
#version ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/portvcs/portvcs.rb', line 97 def version request('version') request('noop') r = getline_text getline # for 'noop' return r end |