muby 0.7.1 → 0.7.2
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 +1 -1
- data/lib/muby/helper_methods.rb +21 -16
- data/lib/muby/inputwindow.rb +30 -13
- data/lib/muby/outputwindow.rb +17 -9
- data/lib/muby/user_methods.rb +7 -2
- metadata +2 -2
data/lib/muby/configuration.rb
CHANGED
data/lib/muby/helper_methods.rb
CHANGED
@@ -7,24 +7,29 @@ module Muby
|
|
7
7
|
execute_with_verbosity(:debug, command, *args)
|
8
8
|
end
|
9
9
|
|
10
|
+
def do_execute(command, *args)
|
11
|
+
result = nil
|
12
|
+
if Proc === command
|
13
|
+
result = command.call(*args[0...(command.arity)])
|
14
|
+
elsif String === command
|
15
|
+
result = eval(command)
|
16
|
+
elsif Symbol === command
|
17
|
+
method = self.method(command)
|
18
|
+
args = args[0...(method.arity)]
|
19
|
+
result = method.call(*args)
|
20
|
+
elsif Array === command
|
21
|
+
method = self.method(command.first)
|
22
|
+
args = (command[1..-1] + args)[0...(method.arity)]
|
23
|
+
result = method.call(*args)
|
24
|
+
else
|
25
|
+
result = command
|
26
|
+
end
|
27
|
+
result
|
28
|
+
end
|
29
|
+
|
10
30
|
def execute_with_verbosity(verbosity, command, *args)
|
11
31
|
begin
|
12
|
-
result =
|
13
|
-
if Proc === command
|
14
|
-
result = command.call(*args[0...(command.arity)])
|
15
|
-
elsif String === command
|
16
|
-
result = eval(command)
|
17
|
-
elsif Symbol === command
|
18
|
-
method = self.method(command)
|
19
|
-
args = args[0...(method.arity)]
|
20
|
-
result = method.call(*args)
|
21
|
-
elsif Array === command
|
22
|
-
method = self.method(command.first)
|
23
|
-
args = (command[1..-1] + args)[0...(method.arity)]
|
24
|
-
result = method.call(*args)
|
25
|
-
else
|
26
|
-
result = command
|
27
|
-
end
|
32
|
+
result = do_execute(command, *args)
|
28
33
|
unless result.nil?
|
29
34
|
case result
|
30
35
|
when String
|
data/lib/muby/inputwindow.rb
CHANGED
@@ -32,6 +32,17 @@ class Muby::InputWindow
|
|
32
32
|
# Start working!
|
33
33
|
#
|
34
34
|
def go
|
35
|
+
# Ensure our size is calculable
|
36
|
+
begin
|
37
|
+
height
|
38
|
+
width
|
39
|
+
top
|
40
|
+
left
|
41
|
+
rescue Exception => e
|
42
|
+
Ncurses.endwin
|
43
|
+
raise "Unable to calculate input window geometry: #{e}\n\nCheck your config file (#{conf.loaded_rc_file}) for errors in 'conf.input_window_geometry!\n\n"
|
44
|
+
end
|
45
|
+
|
35
46
|
# Init all the default values
|
36
47
|
@buffer = ""
|
37
48
|
@cursorPosition = 0
|
@@ -43,6 +54,12 @@ class Muby::InputWindow
|
|
43
54
|
@recent_escape = []
|
44
55
|
@handle_mode = :append_buffer!
|
45
56
|
|
57
|
+
resize!
|
58
|
+
|
59
|
+
help unless conf.user_edited_config_file
|
60
|
+
end
|
61
|
+
|
62
|
+
def resize!
|
46
63
|
# Init the input box
|
47
64
|
@inputBorder = Ncurses.newwin(height, width, top, left)
|
48
65
|
@inputBorder.box(0,0)
|
@@ -55,31 +72,26 @@ class Muby::InputWindow
|
|
55
72
|
@inputWindow.scrollok(true)
|
56
73
|
@inputWindow.nodelay(true)
|
57
74
|
@inputWindow.refresh
|
58
|
-
|
59
|
-
help unless conf.user_edited_config_file
|
60
75
|
end
|
61
76
|
|
62
77
|
def reload!
|
63
|
-
|
64
|
-
@top = nil
|
65
|
-
@width = nil
|
66
|
-
@height = nil
|
78
|
+
do_startup_triggers
|
67
79
|
end
|
68
80
|
|
69
81
|
def left
|
70
|
-
|
82
|
+
do_execute(conf.input_window_geometry[:left])
|
71
83
|
end
|
72
84
|
|
73
85
|
def top
|
74
|
-
|
86
|
+
do_execute(conf.input_window_geometry[:top])
|
75
87
|
end
|
76
88
|
|
77
89
|
def width
|
78
|
-
|
90
|
+
do_execute(conf.input_window_geometry[:width])
|
79
91
|
end
|
80
92
|
|
81
93
|
def height
|
82
|
-
|
94
|
+
do_execute(conf.input_window_geometry[:height])
|
83
95
|
end
|
84
96
|
|
85
97
|
#
|
@@ -159,20 +171,25 @@ class Muby::InputWindow
|
|
159
171
|
end
|
160
172
|
end
|
161
173
|
|
174
|
+
def do_startup_triggers
|
175
|
+
conf.startup_triggers.each do |trigger|
|
176
|
+
execute(trigger, self, Muby::OutputWindow.get_instance)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
162
180
|
#
|
163
181
|
# Just keep listening to the keyboard input.
|
164
182
|
#
|
165
183
|
def process
|
166
184
|
loadHistory
|
167
|
-
|
168
|
-
execute(trigger, self, Muby::OutputWindow.get_instance)
|
169
|
-
end
|
185
|
+
do_startup_triggers
|
170
186
|
# We need to check one key at a time due to triggers and conf.key_commands
|
171
187
|
while c = @inputWindow.wgetch
|
172
188
|
if c == Ncurses.const_get("ERR")
|
173
189
|
sleep(0.01)
|
174
190
|
else
|
175
191
|
handle(c, conf.key_commands)
|
192
|
+
update
|
176
193
|
end
|
177
194
|
end # while c = @inputWindow.wgetch
|
178
195
|
end # def process
|
data/lib/muby/outputwindow.rb
CHANGED
@@ -28,6 +28,17 @@ class Muby::OutputWindow
|
|
28
28
|
# Start working!
|
29
29
|
#
|
30
30
|
def go
|
31
|
+
# Ensure our size is calculable
|
32
|
+
begin
|
33
|
+
height
|
34
|
+
width
|
35
|
+
top
|
36
|
+
left
|
37
|
+
rescue Exception => e
|
38
|
+
Ncurses.endwin
|
39
|
+
raise "Unable to calculate output window geometry: #{e}\n\nCheck your config file (#{conf.loaded_rc_file}) for errors in 'conf.output_window_geometry!\n\n"
|
40
|
+
end
|
41
|
+
|
31
42
|
@scrollback = 0
|
32
43
|
@waitBuffer = []
|
33
44
|
@lines = 0
|
@@ -47,27 +58,24 @@ class Muby::OutputWindow
|
|
47
58
|
@ready = true
|
48
59
|
end
|
49
60
|
|
50
|
-
def
|
51
|
-
|
52
|
-
@top = nil
|
53
|
-
@width = nil
|
54
|
-
@height = nil
|
61
|
+
def resize!
|
62
|
+
refresh
|
55
63
|
end
|
56
64
|
|
57
65
|
def left
|
58
|
-
|
66
|
+
do_execute(conf.output_window_geometry[:left])
|
59
67
|
end
|
60
68
|
|
61
69
|
def top
|
62
|
-
|
70
|
+
do_execute(conf.output_window_geometry[:top])
|
63
71
|
end
|
64
72
|
|
65
73
|
def width
|
66
|
-
|
74
|
+
do_execute(conf.output_window_geometry[:width])
|
67
75
|
end
|
68
76
|
|
69
77
|
def height
|
70
|
-
|
78
|
+
do_execute(conf.output_window_geometry[:height])
|
71
79
|
end
|
72
80
|
|
73
81
|
def show_version
|
data/lib/muby/user_methods.rb
CHANGED
@@ -41,7 +41,7 @@ configuration file.
|
|
41
41
|
(Then, you could type /help or press F1 to get the help text again)
|
42
42
|
|
43
43
|
The configuration file the system has tried to create for you
|
44
|
-
is at #{conf.loaded_rc_file}.
|
44
|
+
is at #{File.expand_path(conf.loaded_rc_file)}.
|
45
45
|
ENDTEXT
|
46
46
|
info help
|
47
47
|
end
|
@@ -229,10 +229,15 @@ ENDTEXT
|
|
229
229
|
end
|
230
230
|
nil
|
231
231
|
end
|
232
|
+
|
233
|
+
def resize_application!
|
234
|
+
Muby::OutputWindow.get_instance.resize!
|
235
|
+
Muby::InputWindow.get_instance.resize!
|
236
|
+
end
|
232
237
|
|
233
238
|
def reload_application!
|
239
|
+
resize_application!
|
234
240
|
conf.reload_application!
|
235
|
-
Muby::OutputWindow.get_instance.reload!
|
236
241
|
Muby::InputWindow.get_instance.reload!
|
237
242
|
end
|
238
243
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: muby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.7.2
|
7
|
+
date: 2007-10-20 00:00:00 +02:00
|
8
8
|
summary: A simple but powerful mud client.
|
9
9
|
require_paths:
|
10
10
|
- lib
|