rails-sh 1.2.7 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.7
1
+ 1.3.0
data/lib/rails/sh.rb CHANGED
@@ -55,21 +55,21 @@ module Rails
55
55
  Readline.completion_proc = lambda do |word|
56
56
  (
57
57
  Command.command_names.map { |name| name.to_s } +
58
- RAILS_SUB_COMMANDS +
58
+ RAILS_SUB_COMMANDS.map { |name| "rails #{name}" } +
59
59
  Rails::Sh::Rake.task_names.map { |name| "rake #{name}" }
60
60
  ).grep(/#{Regexp.quote(word)}/)
61
61
  end
62
62
  end
63
63
 
64
64
  def execute(line)
65
- start = Time.now
66
65
  if command = Command.find(line)
66
+ start = Time.now
67
67
  arg = line.split(/\s+/, 2)[1] rescue nil
68
68
  command.call(arg)
69
+ puts "\e[34m#{Time.now - start}sec\e[0m"
69
70
  else
70
- execute_rails_command(line)
71
+ puts "\e[41mCommand not found\e[0m"
71
72
  end
72
- puts "\e[34m#{Time.now - start}sec\e[0m"
73
73
  end
74
74
 
75
75
  def execute_rails_command(line)
@@ -1,21 +1,23 @@
1
1
  include Rails::Sh
2
2
 
3
3
  Command.define 'help' do
4
- Rails::Sh.execute_rails_command('--help')
5
4
  puts <<HELP
6
-
7
- \e[36mThe rails-sh commands are:
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
- reload reload the environment
14
- !, system execute a system command
15
- eval eval as ruby script\e[0m
5
+ \e[36mhelp print help
6
+ rails ARG execute rails command
7
+ rake TASK execute rake task
8
+ t, tasks PATTERN print rake tasks
9
+ exit exit from rails-sh
10
+ restart restart rails-sh
11
+ reload reload the environment
12
+ !, system execute a system command
13
+ eval eval as ruby script\e[0m
16
14
  HELP
17
15
  end
18
16
 
17
+ Command.define 'rails' do |arg|
18
+ Rails::Sh.execute_rails_command(arg)
19
+ end
20
+
19
21
  Command.define 'rake' do |arg|
20
22
  Rails::Sh::Rake.invoke(arg || :default)
21
23
  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.7"
8
+ s.version = "1.3.0"
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.7
5
+ version: 1.3.0
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: -4208403511275198265
102
+ hash: -3249246770813538482
103
103
  segments:
104
104
  - 0
105
105
  version: "0"