rails-sh 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rails/sh.rb +2 -0
- data/lib/rails/sh/command.rb +4 -2
- data/lib/rails/sh/commands.rb +9 -13
- data/rails-sh.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
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)
|
data/lib/rails/sh/command.rb
CHANGED
data/lib/rails/sh/commands.rb
CHANGED
@@ -5,13 +5,13 @@ Command.define 'help' do
|
|
5
5
|
puts <<HELP
|
6
6
|
|
7
7
|
\e[36mThe rails-sh commands are:
|
8
|
-
help
|
9
|
-
rake TASK
|
10
|
-
tasks PATTERN
|
11
|
-
exit
|
12
|
-
restart
|
13
|
-
system
|
14
|
-
eval
|
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
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.
|
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:
|
102
|
+
hash: -4433203662375037067
|
103
103
|
segments:
|
104
104
|
- 0
|
105
105
|
version: "0"
|