theine 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/theine/worker.rb +25 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a725ca8fb94098b7c8a22c3a20060423f460ea2c
|
4
|
+
data.tar.gz: ad60b0331d09109a055bbed9b24a88a452d8cd30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fbd349c19047ab9b8eb27cd0f72d8d8d8092e3235d62e65f63930e2d24a77bb4b6aa15aca7d907a251d8d9ddc2e259a833faadd7af56d11d7df270d5b773568
|
7
|
+
data.tar.gz: 2c3931769b602b0e0882dcca9875d12deee91127a57659bb89fdca70d8dc4285ddc212d5a8b747a4b574081857bf7132a7e61b603053edcb31a68ca5901a8e80
|
data/lib/theine/worker.rb
CHANGED
@@ -11,12 +11,23 @@ module Theine
|
|
11
11
|
require 'rails/commands'
|
12
12
|
},
|
13
13
|
rake: proc {
|
14
|
-
::Rails.application.load_tasks
|
14
|
+
::Rails.application.load_tasks if defined? ::Rails
|
15
|
+
|
15
16
|
ARGV.each do |task|
|
17
|
+
is_test_task = task =~ /^(spec|test)$/
|
18
|
+
if is_test_task
|
19
|
+
previous_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
20
|
+
change_rails_env_to("test")
|
21
|
+
end
|
22
|
+
|
16
23
|
::Rake::Task[task].invoke
|
24
|
+
|
25
|
+
change_rails_env_to(previous_env) if is_test_task
|
17
26
|
end
|
18
27
|
},
|
19
28
|
rspec: proc {
|
29
|
+
change_rails_env_to("test")
|
30
|
+
|
20
31
|
require 'rspec/core'
|
21
32
|
RSpec::Core::Runner.autorun
|
22
33
|
}
|
@@ -36,7 +47,7 @@ module Theine
|
|
36
47
|
sleep 0.1 while !screen_attached?
|
37
48
|
|
38
49
|
puts "command: #{@command_name} #{argv_to_s}"
|
39
|
-
|
50
|
+
instance_exec(&@command_proc)
|
40
51
|
ensure
|
41
52
|
balancer.worker_done(port)
|
42
53
|
end
|
@@ -73,6 +84,18 @@ module Theine
|
|
73
84
|
DRb.stop_service
|
74
85
|
end
|
75
86
|
|
87
|
+
def change_rails_env_to(env)
|
88
|
+
ENV['RAILS_ENV'] = env
|
89
|
+
ENV['RACK_ENV'] = env
|
90
|
+
if defined? ::Rails
|
91
|
+
::Rails.env = env
|
92
|
+
|
93
|
+
# load config/environments/test.rb
|
94
|
+
test_env_rb = ::Rails.root.join("config/environments/#{env}.rb")
|
95
|
+
load(test_env_rb) if File.exist?(test_env_rb)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
76
99
|
def argv_to_s
|
77
100
|
ARGV.map { |arg|
|
78
101
|
if arg.include?(" ")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Berdajs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|