cinatra 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/cinatra.rb +9 -14
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -13,6 +13,8 @@ class Cinatra
13
13
  puts "Warning: The command '#{name}' will be overridden."
14
14
  end
15
15
  commands[name] = Command.new(name, desc, &block)
16
+ rescue Exception => e
17
+ handle_error(e)
16
18
  end
17
19
 
18
20
  def delete_command(name)
@@ -38,12 +40,10 @@ class Cinatra
38
40
  unless command_name
39
41
  puts "Error: Command not found: #{line}"
40
42
  else
41
- begin
42
- get_command(command_name).call(command_arg)
43
- rescue Exception => e
44
- puts "Error: #{e.message}\n #{e.backtrace.join("\n ")}"
45
- end
43
+ get_command(command_name).call(command_arg)
46
44
  end
45
+ rescue Exception => e
46
+ handle_error(e)
47
47
  end
48
48
 
49
49
  def completion(text)
@@ -51,15 +51,6 @@ class Cinatra
51
51
  end
52
52
 
53
53
  def start
54
- stty_save = `stty -g`.chomp
55
- trap("INT") do
56
- begin
57
- system "stty", stty_save
58
- ensure
59
- exit
60
- end
61
- end
62
-
63
54
  Readline.basic_word_break_characters= "\t\n\"\\'`><=;|&{("
64
55
  Readline.completion_proc = lambda {|text| completion(text) }
65
56
 
@@ -72,6 +63,10 @@ class Cinatra
72
63
  self.exiting = true
73
64
  end
74
65
 
66
+ def handle_error(e)
67
+ puts "Error: #{e.message}\n #{e.backtrace.join("\n ")}"
68
+ end
69
+
75
70
  def resolve_command_name_and_arg(line)
76
71
  command_names.map {|i| i.split(' ')}.sort_by{|i| i.size}.reverse_each do |command|
77
72
  if is_command_match_to_line?(command, line)
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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo