rstyx 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +4 -1
- data/{README → README.txt} +1 -1
- data/Rakefile +9 -1
- data/examples/fileondisk.rb +22 -0
- data/examples/readstyxfile.rb +1 -1
- data/examples/testserver.rb +23 -0
- data/examples/writestyxfile.rb +49 -0
- data/lib/rstyx/messages.rb +259 -22
- data/lib/rstyx/server.rb +588 -56
- data/lib/rstyx/version.rb +2 -2
- data/tests/tc_styxservproto.rb +68 -44
- metadata +7 -3
data/Manifest.txt
CHANGED
data/{README → README.txt}
RENAMED
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
|
18
18
|
# 02110-1301 USA.
|
19
19
|
#
|
20
|
-
# $Id: Rakefile
|
20
|
+
# $Id: Rakefile 237 2007-08-14 11:35:47Z dido $
|
21
21
|
#
|
22
22
|
require 'rubygems'
|
23
23
|
require 'hoe'
|
@@ -51,5 +51,13 @@ Rcov::RcovTask.new(:coverage) do |t|
|
|
51
51
|
t.verbose = true
|
52
52
|
end
|
53
53
|
|
54
|
+
desc "Tag the current trunk with the current release version"
|
55
|
+
task :tag do
|
56
|
+
warn "WARNING: this will tag svn+ssh://rubyforge.org/var/svn/rstyx/trunk using the tag v#{RStyx::Version::MAJOR}.#{RStyx::Version::MINOR}.#{RStyx::Version::TINY}"
|
57
|
+
warn "If you do not wish to continue, you have 5 seconds to cancel by pressing CTRL-C..."
|
58
|
+
5.times { |i| print "#{5-i} "; $stdout.flush; sleep 1 }
|
59
|
+
system "svn copy svn+ssh://rubyforge.org/var/svn/rstyx/trunk svn+ssh://rubyforge.org/var/svn/rstyx/tags/v#{RStyx::Version::MAJOR}.#{RStyx::Version::MINOR}.#{RStyx::Version::TINY} -m \"Tagging the #{RStyx::Version::STRING} release\""
|
60
|
+
end
|
61
|
+
|
54
62
|
# vim: syntax=Ruby
|
55
63
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# $Id: fileondisk.rb 243 2007-09-13 08:21:09Z dido $
|
4
|
+
#
|
5
|
+
require 'rstyx/server'
|
6
|
+
require 'logger'
|
7
|
+
|
8
|
+
log = Logger.new(STDOUT)
|
9
|
+
sd = RStyx::Server::SDirectory.new("/")
|
10
|
+
sf = RStyx::Server::FileOnDisk.new(ARGV[0])
|
11
|
+
sf.add_changelistener do |f|
|
12
|
+
puts "File contents changed"
|
13
|
+
end
|
14
|
+
sd << sf
|
15
|
+
serv = RStyx::Server::TCPServer.new(:bindaddr => "0.0.0.0",
|
16
|
+
:port => 9876,
|
17
|
+
:root => sd,
|
18
|
+
:log => log,
|
19
|
+
:debug => Logger::DEBUG)
|
20
|
+
Thread.abort_on_exception = true
|
21
|
+
serv.run.join
|
22
|
+
|
data/examples/readstyxfile.rb
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
# Copyright:: Copyright (c) 2005,2006 Rafael R. Sevilla
|
25
25
|
# License:: GNU Lesser General Public License
|
26
26
|
#
|
27
|
-
# $Id: readstyxfile.rb
|
27
|
+
# $Id: readstyxfile.rb 237 2007-08-14 11:35:47Z dido $
|
28
28
|
#
|
29
29
|
require 'rstyx'
|
30
30
|
require 'digest/sha1'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# $Id: testserver.rb 237 2007-08-14 11:35:47Z dido $
|
4
|
+
#
|
5
|
+
require 'rstyx/server'
|
6
|
+
require 'logger'
|
7
|
+
|
8
|
+
log = Logger.new(STDOUT)
|
9
|
+
sd = RStyx::Server::SDirectory.new("/")
|
10
|
+
sf = RStyx::Server::InMemoryFile.new("test.file")
|
11
|
+
sf.contents = "hello"
|
12
|
+
sf.add_changelistener do |f|
|
13
|
+
puts "File contents changed to #{f.contents}"
|
14
|
+
end
|
15
|
+
sd << sf
|
16
|
+
serv = RStyx::Server::TCPServer.new(:bindaddr => "0.0.0.0",
|
17
|
+
:port => 9876,
|
18
|
+
:root => sd,
|
19
|
+
:log => log,
|
20
|
+
:debug => Logger::DEBUG)
|
21
|
+
Thread.abort_on_exception = true
|
22
|
+
serv.run.join
|
23
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2005,2006 Rafael Sevilla
|
4
|
+
# This file is part of RStyx
|
5
|
+
#
|
6
|
+
# RStyx is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Lesser General Public License as
|
8
|
+
# published by the Free Software Foundation; either version 2.1
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# RStyx is distributed in the hope that it will be useful, but
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with RStyx; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
|
19
|
+
# 02110-1301 USA.
|
20
|
+
#
|
21
|
+
# Styx file reader
|
22
|
+
#
|
23
|
+
# Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
|
24
|
+
# Copyright:: Copyright (c) 2005,2006 Rafael R. Sevilla
|
25
|
+
# License:: GNU Lesser General Public License
|
26
|
+
#
|
27
|
+
# $Id: readstyxfile.rb 190 2007-06-04 06:53:54Z dido $
|
28
|
+
#
|
29
|
+
require 'rstyx'
|
30
|
+
require 'digest/sha1'
|
31
|
+
|
32
|
+
RSTYX_HOST = "localhost"
|
33
|
+
RSTYX_PORT = 9876
|
34
|
+
|
35
|
+
file = ARGV[0]
|
36
|
+
|
37
|
+
module RStyx
|
38
|
+
DEBUG = 1
|
39
|
+
end
|
40
|
+
|
41
|
+
Thread.abort_on_exception = true
|
42
|
+
|
43
|
+
RStyx::Client::TCPConnection.new(RSTYX_HOST, RSTYX_PORT).connect do |conn|
|
44
|
+
conn.open(file, "w") do |fp|
|
45
|
+
1.upto(10000) do |i|
|
46
|
+
fp.write((i % 10).to_s)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|