muby 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/muby/configuration.rb +12 -5
- data/lib/muby/connection.rb +20 -1
- data/lib/muby/help.rb +1 -0
- data/lib/muby/inputwindow.rb +1 -1
- data/lib/muby/user_methods.rb +16 -1
- metadata +10 -10
data/lib/muby/configuration.rb
CHANGED
@@ -4,7 +4,7 @@ require 'ncurses'
|
|
4
4
|
module Muby
|
5
5
|
|
6
6
|
|
7
|
-
VERSION = "0.7.
|
7
|
+
VERSION = "0.7.4" unless defined?(Muby::VERSION)
|
8
8
|
|
9
9
|
#
|
10
10
|
# The class that encapsulates all configuration.
|
@@ -127,7 +127,7 @@ module Muby
|
|
127
127
|
}
|
128
128
|
|
129
129
|
@key_commands = {
|
130
|
-
|
130
|
+
12 => :resize_application!, # ctrl-l
|
131
131
|
Ncurses.const_get("KEY_PPAGE") => :scroll_up!,
|
132
132
|
Ncurses.const_get("KEY_NPAGE") => :scroll_down!,
|
133
133
|
Ncurses.const_get("KEY_ENTER") => :process_buffer!,
|
@@ -138,10 +138,15 @@ module Muby
|
|
138
138
|
127 => :backspace_buffer!, # backspace
|
139
139
|
Ncurses.const_get("KEY_BACKSPACE") => :backspace_buffer!,
|
140
140
|
27 => {
|
141
|
+
263 => :word_backspace_buffer!, # alt-backspace
|
141
142
|
91 => {
|
142
|
-
|
143
|
-
|
144
|
-
|
143
|
+
49 => {
|
144
|
+
59 => {
|
145
|
+
53 => {
|
146
|
+
68 => :previous_word_buffer!, # ctrl-key_left
|
147
|
+
67 => :next_word_buffer!, # ctrl-key_right
|
148
|
+
}
|
149
|
+
}
|
145
150
|
}
|
146
151
|
}
|
147
152
|
},
|
@@ -160,6 +165,8 @@ module Muby
|
|
160
165
|
# miscellaneous options #
|
161
166
|
#
|
162
167
|
|
168
|
+
@connect_timeout = 10
|
169
|
+
|
163
170
|
@feed_completer_with_history = true
|
164
171
|
|
165
172
|
@feed_completer_with_input = true
|
data/lib/muby/connection.rb
CHANGED
@@ -19,7 +19,7 @@ class Muby::Connection
|
|
19
19
|
status("Connecting to " + host.inspect + ":" + port.inspect)
|
20
20
|
@host = host
|
21
21
|
@port = port
|
22
|
-
|
22
|
+
connect!
|
23
23
|
conf.connect_triggers.each do |command|
|
24
24
|
@inputWindow.execute(command, @inputWindow, @outputWindow)
|
25
25
|
end
|
@@ -40,6 +40,25 @@ class Muby::Connection
|
|
40
40
|
end if @socket
|
41
41
|
end
|
42
42
|
|
43
|
+
#
|
44
|
+
# Almost ripped from the documentation: http://www.ruby-doc.org/core/classes/Socket.src/M002114.html
|
45
|
+
#
|
46
|
+
def connect!
|
47
|
+
@socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
|
48
|
+
addr = Socket.sockaddr_in(@port, @host)
|
49
|
+
begin
|
50
|
+
@socket.connect_nonblock(addr)
|
51
|
+
rescue Errno::EINPROGRESS
|
52
|
+
IO.select(nil, [@socket], nil, conf.connect_timeout)
|
53
|
+
begin
|
54
|
+
@socket.connect_nonblock(addr)
|
55
|
+
rescue Errno::EISCONN
|
56
|
+
rescue Errno::EALREADY
|
57
|
+
raise "Connection timed out"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
43
62
|
#
|
44
63
|
# Display a status message in the outputwindow if wanted (conf.connection_status)
|
45
64
|
#
|
data/lib/muby/help.rb
CHANGED
@@ -3,6 +3,7 @@ module Muby
|
|
3
3
|
module Help
|
4
4
|
def self.configuration
|
5
5
|
{
|
6
|
+
:connect_timeout => "The number of seconds we will try to connect before giving up.",
|
6
7
|
:feed_completer_with_history => "If true, the completion command will use history to calculate possible completions.",
|
7
8
|
:feed_completer_with_input => "If true, the completion command will use everything seen from the remote end to calculate possible completions.",
|
8
9
|
:extra_completions => "Fill this array with words that you allways want to be able to complete to.",
|
data/lib/muby/inputwindow.rb
CHANGED
@@ -134,7 +134,7 @@ class Muby::InputWindow
|
|
134
134
|
def loadHistory
|
135
135
|
begin
|
136
136
|
if FileTest.readable?(conf.history_file)
|
137
|
-
info("Reading
|
137
|
+
info("Reading #{conf.history_file}")
|
138
138
|
Kernel::open(conf.history_file) do |input|
|
139
139
|
@history = Marshal.load(input.read)
|
140
140
|
end
|
data/lib/muby/user_methods.rb
CHANGED
@@ -105,10 +105,25 @@ ENDTEXT
|
|
105
105
|
disconnect
|
106
106
|
@last_host = host
|
107
107
|
@last_port = port
|
108
|
-
|
108
|
+
rescue_thread do
|
109
|
+
@connection = Muby::Connection.new(self, Muby::OutputWindow.get_instance, host, port)
|
110
|
+
end
|
109
111
|
"Connecting"
|
110
112
|
end
|
111
113
|
|
114
|
+
#
|
115
|
+
# Do block in a thread that displays errors that happen.
|
116
|
+
#
|
117
|
+
def rescue_thread(&block)
|
118
|
+
Thread.new do
|
119
|
+
begin
|
120
|
+
yield
|
121
|
+
rescue Exception => e
|
122
|
+
exception(e)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
112
127
|
#
|
113
128
|
# Make a fake connection for debug purposes
|
114
129
|
#
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: muby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.7.4
|
7
|
+
date: 2007-11-15 00:00:00 +01:00
|
8
8
|
summary: A simple but powerful mud client.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,21 +29,20 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Martin Kihlgren, Sy Ali
|
31
31
|
files:
|
32
|
-
- lib/muby/completer.rb
|
33
|
-
- lib/muby/configuration.rb
|
34
32
|
- lib/muby/connection.rb
|
35
|
-
- lib/muby/displayer.rb
|
36
|
-
- lib/muby/help.rb
|
37
|
-
- lib/muby/inputwindow.rb
|
38
33
|
- lib/muby/logger.rb
|
39
|
-
- lib/muby/outputwindow.rb
|
40
34
|
- lib/muby/style.rb
|
41
35
|
- lib/muby/user_methods.rb
|
42
36
|
- lib/muby/application.rb
|
37
|
+
- lib/muby/configuration.rb
|
38
|
+
- lib/muby/inputwindow.rb
|
39
|
+
- lib/muby/help.rb
|
40
|
+
- lib/muby/outputwindow.rb
|
41
|
+
- lib/muby/completer.rb
|
42
|
+
- lib/muby/displayer.rb
|
43
43
|
- lib/muby/helper_methods.rb
|
44
44
|
- lib/muby/user_window.rb
|
45
45
|
- lib/muby.rb
|
46
|
-
- contrib/sy/cce.rb
|
47
46
|
- contrib/aardmud.org_4000/aliases/aard-aliases.rb
|
48
47
|
- contrib/aardmud.org_4000/gags/aard-gags.rb
|
49
48
|
- contrib/aardmud.org_4000/speedwalks/aard-sw-areas-vidblain.rb
|
@@ -64,6 +63,7 @@ files:
|
|
64
63
|
- contrib/aardmud.org_4000/misc/aard_consider_substitutions.rb
|
65
64
|
- contrib/aardmud.org_4000/aard-helpers.rb
|
66
65
|
- contrib/aardmud.org_4000/aard-config.rb
|
66
|
+
- contrib/sy/cce.rb
|
67
67
|
- contrib/aardmud.org_4000/README.txt
|
68
68
|
- LICENSE
|
69
69
|
test_files: []
|