torquebox-configure 2.0.3-java → 2.1.0-java
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.
@@ -139,12 +139,17 @@ module TorqueBox
|
|
139
139
|
job.merge!( data )
|
140
140
|
end
|
141
141
|
|
142
|
-
when 'options_for' # => tasks:, messaging:\n
|
142
|
+
when 'options_for' # => tasks:, messaging:\n default_message_encoding:, jobs:\n concurrency:
|
143
143
|
if (messaging_opts = entry_data.delete( 'messaging' )) &&
|
144
144
|
(default_encoding = messaging_opts.delete( :default_message_encoding ))
|
145
145
|
metadata['messaging']['default_message_encoding'] = default_encoding.to_s
|
146
146
|
end
|
147
147
|
|
148
|
+
if (job_opts = entry_data.delete( 'jobs' )) &&
|
149
|
+
(concurrency = job_opts.delete( :concurrency ))
|
150
|
+
metadata['jobs']['concurrency'] = concurrency.to_java(java.lang.Integer)
|
151
|
+
end
|
152
|
+
|
148
153
|
entry_data.each do |name, data|
|
149
154
|
data[:concurrency] = 0 if data.delete( :disabled )
|
150
155
|
data[:concurrency] &&= data[:concurrency].to_java(java.lang.Integer)
|
@@ -24,7 +24,9 @@ module TorqueBox
|
|
24
24
|
def self.load_configuration(file, config, entry_map)
|
25
25
|
Thread.current[:torquebox_config] = config
|
26
26
|
Thread.current[:torquebox_config_entry_map] = entry_map
|
27
|
-
|
27
|
+
Dir.chdir( File.dirname( file ) ) do
|
28
|
+
eval( File.read( file ) )
|
29
|
+
end
|
28
30
|
config
|
29
31
|
end
|
30
32
|
|
@@ -79,7 +81,6 @@ module TorqueBox
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def self.const_missing(name)
|
82
|
-
puts "CONST_MISSING #{name}"
|
83
84
|
FakeConstant.new( name ).to_const
|
84
85
|
end
|
85
86
|
|
@@ -172,16 +173,14 @@ module TorqueBox
|
|
172
173
|
class FakeConstant
|
173
174
|
def initialize(name)
|
174
175
|
@name = name.to_s
|
175
|
-
puts "MODULE #{name}"
|
176
176
|
s = <<-END
|
177
177
|
module ::#{name}
|
178
178
|
def self.const_missing(k)
|
179
|
-
FakeConstant.new( "#{name}::" + k.to_s )
|
179
|
+
FakeConstant.new( "#{name}::" + k.to_s ).to_const
|
180
180
|
end
|
181
181
|
end
|
182
182
|
END
|
183
183
|
|
184
|
-
puts "eval #{s}"
|
185
184
|
eval s
|
186
185
|
|
187
186
|
end
|
data/lib/torquebox-configure.jar
CHANGED
Binary file
|
data/lib/torquebox-configure.rb
CHANGED
data/spec/global_spec.rb
CHANGED
@@ -350,8 +350,21 @@ describe "TorqueBox.configure using the GlobalConfiguration" do
|
|
350
350
|
job 'One::AJob', :cron => '1234'
|
351
351
|
job 'Two::AJob', :cron => '1234'
|
352
352
|
end
|
353
|
+
|
354
|
+
config['<root>']['job'].should == [['One::AJob', { :cron => '1234' }],
|
355
|
+
['Two::AJob', { :cron => '1234' }]]
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should allow jobs as constants" do
|
359
|
+
config = TorqueBox.configure do |cfg|
|
360
|
+
cfg.instance_eval("job JobX, :cron => '1234'")
|
361
|
+
cfg.instance_eval("job Mod1::JobY, :cron => '1234'")
|
362
|
+
cfg.instance_eval("job Mod2::Mod3::JobZ, :cron => '1234'")
|
363
|
+
end
|
353
364
|
|
354
|
-
config['<root>']['job'].should == [['
|
365
|
+
config['<root>']['job'].should == [['JobX', { :cron => '1234' }],
|
366
|
+
['Mod1::JobY', { :cron => '1234' }],
|
367
|
+
['Mod2::Mod3::JobZ', { :cron => '1234' }]]
|
355
368
|
end
|
356
369
|
|
357
370
|
it "should allow cron to be set in a block" do
|
@@ -414,7 +427,9 @@ describe "TorqueBox.configure using the GlobalConfiguration" do
|
|
414
427
|
} ] ],
|
415
428
|
'options_for' => {
|
416
429
|
FakeConstant.new( 'Backgroundable' ) => { :concurrency => 42 },
|
417
|
-
'messaging' => { :default_message_encoding => :biscuit }
|
430
|
+
'messaging' => { :default_message_encoding => :biscuit },
|
431
|
+
'jobs' => { :concurrency => 55 }
|
432
|
+
|
418
433
|
},
|
419
434
|
'pool' => {
|
420
435
|
'web' => { :type => :shared },
|
@@ -477,7 +492,11 @@ describe "TorqueBox.configure using the GlobalConfiguration" do
|
|
477
492
|
it "should properly set messaging options from options_for" do
|
478
493
|
@metadata['messaging']['default_message_encoding'].should == 'biscuit'
|
479
494
|
end
|
480
|
-
|
495
|
+
|
496
|
+
it "should properly set jobs options from options_for" do
|
497
|
+
@metadata['jobs']['concurrency'].should == 55
|
498
|
+
end
|
499
|
+
|
481
500
|
it "should properly set task options from options_for" do
|
482
501
|
@metadata['tasks']['Backgroundable']['concurrency'].should == 42
|
483
502
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: torquebox-configure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0
|
5
|
+
version: 2.1.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- The TorqueBox Team
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-07-26 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: blankslate
|
@@ -50,11 +50,11 @@ files:
|
|
50
50
|
- lib/gem_hook.rb
|
51
51
|
- lib/torquebox/configuration.rb
|
52
52
|
- lib/torquebox/configure.rb
|
53
|
-
- lib/torquebox/configuration/global.rb
|
54
53
|
- lib/torquebox/configuration/validator.rb
|
54
|
+
- lib/torquebox/configuration/global.rb
|
55
55
|
- spec/options_macros.rb
|
56
|
-
- spec/validator_spec.rb
|
57
56
|
- spec/global_spec.rb
|
57
|
+
- spec/validator_spec.rb
|
58
58
|
homepage: http://torquebox.org/
|
59
59
|
licenses:
|
60
60
|
- lgpl
|
@@ -83,5 +83,5 @@ signing_key:
|
|
83
83
|
specification_version: 3
|
84
84
|
summary: TorqueBox Configure Gem
|
85
85
|
test_files:
|
86
|
-
- spec/validator_spec.rb
|
87
86
|
- spec/global_spec.rb
|
87
|
+
- spec/validator_spec.rb
|