rails-sh 1.2.3 → 1.2.4

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.2.3
1
+ 1.2.4
data/lib/rails/sh.rb CHANGED
@@ -41,12 +41,14 @@ module Rails
41
41
  end
42
42
 
43
43
  def execute(line)
44
+ start = Time.now
44
45
  if command = Command.find(line)
45
46
  arg = line.split(/\s+/, 2)[1] rescue nil
46
47
  command.call(arg)
47
48
  else
48
49
  execute_rails_command(line)
49
50
  end
51
+ puts "\e[34m#{Time.now - start}sec\e[0m"
50
52
  end
51
53
 
52
54
  def execute_rails_command(line)
@@ -6,8 +6,10 @@ module Rails
6
6
  @commands ||= {}
7
7
  end
8
8
 
9
- def define(name, &block)
10
- commands[name.to_sym] = block
9
+ def define(*names, &block)
10
+ names.each do |name|
11
+ commands[name.to_sym] = block
12
+ end
11
13
  end
12
14
 
13
15
  def find(line)
@@ -5,13 +5,13 @@ Command.define 'help' do
5
5
  puts <<HELP
6
6
 
7
7
  \e[36mThe rails-sh commands are:
8
- help print help
9
- rake TASK execute rake task
10
- tasks PATTERN print rake tasks
11
- exit exit from rails-sh
12
- restart restart rails-sh
13
- system execute a system command
14
- eval eval as ruby script\e[0m
8
+ help print help
9
+ rake TASK execute rake task
10
+ t, tasks PATTERN print rake tasks
11
+ exit exit from rails-sh
12
+ restart restart rails-sh
13
+ !, system execute a system command
14
+ eval eval as ruby script\e[0m
15
15
  HELP
16
16
  end
17
17
 
@@ -19,19 +19,15 @@ Command.define 'rake' do |arg|
19
19
  Rails::Sh::Rake.invoke(arg || :default)
20
20
  end
21
21
 
22
- Command.define 'tasks' do |arg|
22
+ Command.define 'tasks', 't' do |arg|
23
23
  Rake.application.options.show_task_pattern = arg ? Regexp.new(arg) : //
24
24
  Rake.application.display_tasks_and_comments
25
25
  end
26
26
 
27
- Command.define 'system' do |arg|
27
+ Command.define 'system', '!' do |arg|
28
28
  system arg
29
29
  end
30
30
 
31
- Command.define '!' do |arg|
32
- Command[:system].call(arg)
33
- end
34
-
35
31
  Command.define 'eval' do |arg|
36
32
  puts "\e[34m=> #{eval(arg, binding, __FILE__, __LINE__).inspect}\e[0m"
37
33
  end
data/rails-sh.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails-sh}
8
- s.version = "1.2.3"
8
+ s.version = "1.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails-sh
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.3
5
+ version: 1.2.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- hash: 2133100381079114914
102
+ hash: -4433203662375037067
103
103
  segments:
104
104
  - 0
105
105
  version: "0"