rails-sh 1.1.0 → 1.1.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -31,19 +31,15 @@ module Kernel
31
31
  def exit(*args); end
32
32
  end
33
33
 
34
- Rails::Sh::Command.define 'exit' do
35
- _exit
36
- end
37
-
38
34
  Rails::Sh::Command.define 'help' do
39
35
  Rails::Sh.execute_rails_command('--help')
40
- puts <<-HELP
36
+ puts <<HELP
41
37
 
42
38
  The rails-sh commands are:
43
- help print help
44
- routes print routes
45
- exit exit from rails-sh
46
- HELP
39
+ help print help
40
+ routes CONTROLLER print routes
41
+ exit exit from rails-sh
42
+ HELP
47
43
  end
48
44
 
49
45
  Rails::Sh::Command.define 'routes' do |controller|
@@ -73,3 +69,7 @@ Rails::Sh::Command.define 'routes' do |controller|
73
69
  puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
74
70
  end
75
71
  end
72
+
73
+ Rails::Sh::Command.define 'exit' do
74
+ _exit
75
+ end
data/lib/rails/sh.rb CHANGED
@@ -15,7 +15,11 @@ module Rails
15
15
  while buf = Readline.readline("\e[42mrails>\e[0m ", true)
16
16
  line = buf.strip
17
17
  next if line.empty?
18
- execute(line)
18
+ begin
19
+ execute(line)
20
+ rescue => e
21
+ puts "\e[41m#{e.message}\e[0m"
22
+ end
19
23
  setup_readline
20
24
  end
21
25
  end
@@ -29,7 +33,7 @@ module Rails
29
33
 
30
34
  def execute(line)
31
35
  if command = Command.find(line)
32
- arg = line[/\s+\w+/].strip rescue nil
36
+ arg = line[/\s+[^\s]+/].strip rescue nil
33
37
  command.call(arg)
34
38
  else
35
39
  execute_rails_command(line)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 0
9
- version: 1.1.0
8
+ - 1
9
+ version: 1.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - jugyo
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- hash: -794054863153019561
116
+ hash: 2128425194900972469
117
117
  segments:
118
118
  - 0
119
119
  version: "0"