cinatra 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/examples/sub_command.rb +0 -4
- data/lib/cinatra.rb +9 -2
- metadata +1 -1
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/examples/sub_command.rb
CHANGED
data/lib/cinatra.rb
CHANGED
@@ -8,7 +8,10 @@ class Cinatra
|
|
8
8
|
|
9
9
|
def add_command(name, &block)
|
10
10
|
name = self.class.normalize_as_command_name(name.to_s).to_sym
|
11
|
-
|
11
|
+
if commands.key?(name)
|
12
|
+
puts "Warning: command '#{name}' is already exists."
|
13
|
+
return
|
14
|
+
end
|
12
15
|
commands[name] = block
|
13
16
|
end
|
14
17
|
|
@@ -33,7 +36,7 @@ class Cinatra
|
|
33
36
|
return if line.empty?
|
34
37
|
command_name, command_arg = resolve_command_name_and_arg(line)
|
35
38
|
unless command_name
|
36
|
-
puts "Command not found!"
|
39
|
+
puts "Error: Command not found!"
|
37
40
|
else
|
38
41
|
begin
|
39
42
|
get_command(command_name).call(command_arg)
|
@@ -107,6 +110,10 @@ module Kernel
|
|
107
110
|
end
|
108
111
|
end
|
109
112
|
|
113
|
+
command 'exit' do
|
114
|
+
Cinatra.exit
|
115
|
+
end
|
116
|
+
|
110
117
|
at_exit do
|
111
118
|
Cinatra.start
|
112
119
|
end
|