rails-sh 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  The Rails Shell to execute sub commands of rails quickly.
4
4
 
5
+ == Install
6
+
7
+ $ gem install rails-sh
8
+
5
9
  == Usage
6
10
 
7
11
  $ cd your-rails3-app
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/lib/rails/sh.rb CHANGED
@@ -11,7 +11,9 @@ module Rails
11
11
  def start
12
12
  setup_readline
13
13
  while buf = Readline.readline("\e[42mrails>\e[0m ", true)
14
- execute(buf)
14
+ line = buf.strip
15
+ next if line.empty?
16
+ execute(line)
15
17
  setup_readline
16
18
  end
17
19
  end
@@ -24,7 +26,6 @@ module Rails
24
26
  end
25
27
 
26
28
  def execute(line)
27
- line = line.strip
28
29
  if command = Command.find(line)
29
30
  arg = line[/\s+\w+/].strip rescue nil
30
31
  command.call(arg)
@@ -11,7 +11,11 @@ module Rails
11
11
  end
12
12
 
13
13
  def find(line)
14
- commands[line[/\w+/].to_sym]
14
+ if name = line[/\w+/]
15
+ commands[name.to_sym]
16
+ else
17
+ nil
18
+ end
15
19
  end
16
20
 
17
21
  def command_names
@@ -11,6 +11,10 @@ describe Rails::Sh::Command do
11
11
  Rails::Sh::Command.find('foo').should eq(@block)
12
12
  end
13
13
 
14
+ it 'We can find nil with wrong name' do
15
+ Rails::Sh::Command.find('bar').should eq(nil)
16
+ end
17
+
14
18
  it 'We can get command names' do
15
19
  Rails::Sh::Command.command_names.should =~ [:exit, :foo, :routes]
16
20
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.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: -4152638312712520890
116
+ hash: -1888015006894182058
117
117
  segments:
118
118
  - 0
119
119
  version: "0"