theine 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/theine/client.rb +10 -1
- data/lib/theine/worker.rb +20 -3
- metadata +1 -1
data/lib/theine/client.rb
CHANGED
@@ -97,7 +97,16 @@ module Theine
|
|
97
97
|
|
98
98
|
private
|
99
99
|
def run_command
|
100
|
-
@
|
100
|
+
case @argv[0]
|
101
|
+
when "rake"
|
102
|
+
@argv.shift
|
103
|
+
@worker.command_rake(@argv)
|
104
|
+
when "rspec"
|
105
|
+
@argv.shift
|
106
|
+
@worker.command_rspec(@argv)
|
107
|
+
else
|
108
|
+
@worker.command_rails(@argv)
|
109
|
+
end
|
101
110
|
rescue DRb::DRbConnError
|
102
111
|
$stderr.puts "\nTheine closed the connection."
|
103
112
|
end
|
data/lib/theine/worker.rb
CHANGED
@@ -46,15 +46,32 @@ module Theine
|
|
46
46
|
|
47
47
|
require 'pry'
|
48
48
|
::Rails.application.config.console = Pry
|
49
|
-
|
50
|
-
Pry.config.input = stdin
|
51
|
-
Pry.config.output = stdout
|
49
|
+
pry_setup
|
52
50
|
|
53
51
|
require 'rails/commands'
|
54
52
|
sleep 0.1 # allow Pumps to finish
|
55
53
|
DRb.stop_service
|
56
54
|
end
|
57
55
|
|
56
|
+
def command_rake(argv)
|
57
|
+
pry_setup
|
58
|
+
::Rails.application.load_tasks
|
59
|
+
argv.each do |task|
|
60
|
+
::Rake::Task[task].invoke
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def command_rspec(argv)
|
65
|
+
pry_setup
|
66
|
+
require 'rspec/core'
|
67
|
+
::RSpec::Core::Runner.run(argv, $stderr, $stdout)
|
68
|
+
end
|
69
|
+
|
70
|
+
def pry_setup
|
71
|
+
::Pry.config.input = stdin
|
72
|
+
::Pry.config.output = stdout
|
73
|
+
end
|
74
|
+
|
58
75
|
def stdin=(value)
|
59
76
|
@stdin = InputProxy.new(value)
|
60
77
|
$stdin = @stdin
|