cinatra 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,10 @@ Cinatra is a Sinatra like command base app library.
10
10
  sleep arg.to_f
11
11
  end
12
12
 
13
+ command 'exit' do
14
+ Cinatra.exit
15
+ end
16
+
13
17
  == Run
14
18
 
15
19
  ruby app.rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -25,7 +25,3 @@ end
25
25
  command 'todo clear' do |arg|
26
26
  TODOS.clear
27
27
  end
28
-
29
- command 'exit' do
30
- Cinatra.exit
31
- end
@@ -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
- raise "command '#{name}' is already exists." if commands.key?(name)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo