Browse files

Cleanup in preparation for a new release.

  • Loading branch information...
1 parent 4e50177 commit 29895d27f38022a3b0c9cb82d5cc445832c865b6 tailor committed Oct 15, 2008
Showing with 19 additions and 31 deletions.
  1. +7 −19 bin/{lc-unix-socket → udscat}
  2. +1 −1 doc/lc_example.rb
  3. +9 −10 doc/lc_unix_example.rb
  4. +2 −1 gemspec
View
26 bin/lc-unix-socket → bin/udscat
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
-# This is the client for the unix-socket version of LiveConsole. It just talks
-# to the Unix socket, and there may already be a tool for this. I don't know,
-# I just work here.
+# This is a client for the unix domain socket version of LiveConsole. It just
+# talks to the socket. It has been included so that you don't have to track
+# down a version of netcat that does this.
require 'socket'
@@ -25,24 +25,11 @@ read_thread =
rescue Errno::EAGAIN, Errno::EINTR => e
IO.select [client], [], [], 1
rescue Errno::EOFError, Errno::EPIPE => e
- $stderr.puts e.inspect
- rescue Exception => e
- $stderr.puts e.inspect
+ # nothing
end
}
}
-<<-EOSHIT
-while(l = $stdin.gets)
- begin
- client.print l if IO.select [], [client], [], 1
- rescue Errno::EPIPE => e
- puts "Other end closed."
- break
- end
-end
-EOSHIT
-
Thread.new {
loop {
begin
@@ -54,10 +41,11 @@ Thread.new {
begin
client.print l if IO.select [], [client], [], 1
rescue Errno::EPIPE => e
- puts "Other end closed."
- break
+ $stderr.puts "Other end closed."
+ exit 0
end
}
}
+trap('INT') { exit 0 }
loop { sleep 1 }
View
2 doc/lc_example.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-#require 'rubygems'
+require 'rubygems'
require 'live_console'
print <<-EOF
View
19 doc/lc_unix_example.rb
@@ -1,24 +1,23 @@
#!/usr/bin/env ruby
-#require 'rubygems'
+require 'rubygems'
require 'live_console'
+default_path = "/tmp/lc_example_#{Process.uid}.sock"
+
print <<-EOF
-This is a demo program for LiveConsole. It starts a LiveConsole on the
-specified port, and you can connect to it by using netcat or telnet to connect
+This is a demo program for LiveConsole. It starts a LiveConsole at the
+specified path, and you can connect to it by using netcat or telnet to connect
to the specified port.
Usage:
#{$0} [path_to_socket [value_for_$x]]
-The default port is 3333, and $x is set by default to nil. Run this program,
-and then in a different terminal, connect to it via netcat or telnet. You can
-check that the value of $x is exactly what you set it to, and that you're
-working inside this process, but there's not much to do inside the example
-script. :)
-
+The default path is #{default_path}, and $x is set by default to nil.
+Run this program, and then in a different terminal, connect to it via
+the supplied udscat program or the BSD version of netcat.
EOF
path = ARGV.first
-path = path.nil? ? "/tmp/lc_example_#{Process.uid}" : path
+path = path.nil? ? default_path : path
$x = ARGV[1]
lc = LiveConsole.new :unix_socket, :path => path
View
3 gemspec
@@ -17,7 +17,8 @@ SPEC = Gem::Specification.new { |s|
s.require_path 'lib'
s.autorequire = 'live_console'
s.has_rdoc = true
- s.extra_rdoc_files = %w(doc/README doc/LICENSE doc/lc_example.rb)
+ s.extra_rdoc_files = Dir['doc/*'].select(&File.method(:file?))
+ Dir['bin/*'].map(&File.method(:basename)).map(&s.executables.method(:<<))
}
if __FILE__ == $0

0 comments on commit 29895d2

Please sign in to comment.