merb-core 0.9.13 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -3
- data/lib/merb-core.rb +84 -41
- data/lib/merb-core/bootloader.rb +71 -60
- data/lib/merb-core/config.rb +31 -17
- data/lib/merb-core/controller/abstract_controller.rb +35 -35
- data/lib/merb-core/controller/exceptions.rb +14 -9
- data/lib/merb-core/controller/merb_controller.rb +22 -20
- data/lib/merb-core/controller/mime.rb +5 -5
- data/lib/merb-core/controller/mixins/authentication.rb +11 -8
- data/lib/merb-core/controller/mixins/conditional_get.rb +7 -7
- data/lib/merb-core/controller/mixins/controller.rb +15 -15
- data/lib/merb-core/controller/mixins/render.rb +16 -16
- data/lib/merb-core/controller/mixins/responder.rb +23 -23
- data/lib/merb-core/controller/template.rb +17 -17
- data/lib/merb-core/core_ext/hash.rb +2 -2
- data/lib/merb-core/core_ext/kernel.rb +19 -18
- data/lib/merb-core/dispatch/cookies.rb +13 -0
- data/lib/merb-core/dispatch/default_exception/default_exception.rb +12 -1
- data/lib/merb-core/dispatch/dispatcher.rb +6 -5
- data/lib/merb-core/dispatch/request.rb +56 -52
- data/lib/merb-core/dispatch/request_parsers.rb +7 -7
- data/lib/merb-core/dispatch/router.rb +14 -14
- data/lib/merb-core/dispatch/router/behavior.rb +31 -31
- data/lib/merb-core/dispatch/router/cached_proc.rb +13 -1
- data/lib/merb-core/dispatch/router/resources.rb +9 -9
- data/lib/merb-core/dispatch/router/route.rb +60 -7
- data/lib/merb-core/dispatch/session.rb +21 -15
- data/lib/merb-core/dispatch/session/container.rb +10 -8
- data/lib/merb-core/dispatch/session/cookie.rb +12 -11
- data/lib/merb-core/dispatch/session/memcached.rb +4 -2
- data/lib/merb-core/dispatch/session/memory.rb +8 -6
- data/lib/merb-core/dispatch/session/store_container.rb +6 -5
- data/lib/merb-core/dispatch/worker.rb +28 -10
- data/lib/merb-core/gem_ext/erubis.rb +4 -2
- data/lib/merb-core/logger.rb +3 -22
- data/lib/merb-core/plugins.rb +5 -5
- data/lib/merb-core/rack.rb +1 -1
- data/lib/merb-core/rack/adapter.rb +5 -1
- data/lib/merb-core/rack/adapter/abstract.rb +15 -10
- data/lib/merb-core/rack/adapter/ebb.rb +4 -2
- data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -1
- data/lib/merb-core/rack/adapter/fcgi.rb +3 -1
- data/lib/merb-core/rack/adapter/irb.rb +10 -1
- data/lib/merb-core/rack/adapter/mongrel.rb +5 -2
- data/lib/merb-core/rack/adapter/runner.rb +3 -1
- data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +2 -1
- data/lib/merb-core/rack/adapter/thin.rb +4 -1
- data/lib/merb-core/rack/adapter/thin_turbo.rb +1 -0
- data/lib/merb-core/rack/adapter/webrick.rb +8 -34
- data/lib/merb-core/rack/application.rb +2 -2
- data/lib/merb-core/rack/handler/mongrel.rb +7 -0
- data/lib/merb-core/rack/helpers.rb +1 -1
- data/lib/merb-core/rack/middleware.rb +7 -1
- data/lib/merb-core/rack/middleware/conditional_get.rb +3 -0
- data/lib/merb-core/rack/middleware/content_length.rb +2 -0
- data/lib/merb-core/rack/middleware/path_prefix.rb +4 -0
- data/lib/merb-core/rack/middleware/profiler.rb +3 -1
- data/lib/merb-core/rack/middleware/static.rb +7 -1
- data/lib/merb-core/rack/middleware/tracer.rb +1 -0
- data/lib/merb-core/rack/stream_wrapper.rb +35 -30
- data/lib/merb-core/server.rb +17 -16
- data/lib/merb-core/tasks/gem_management.rb +1 -1
- data/lib/merb-core/tasks/merb.rb +3 -1
- data/lib/merb-core/tasks/merb_rake_helper.rb +1 -1
- data/lib/merb-core/test.rb +8 -8
- data/lib/merb-core/test/helpers.rb +1 -1
- data/lib/merb-core/test/helpers/cookie_jar.rb +16 -2
- data/lib/merb-core/test/helpers/mock_request_helper.rb +13 -13
- data/lib/merb-core/test/helpers/request_helper.rb +1 -1
- data/lib/merb-core/test/helpers/route_helper.rb +2 -2
- data/lib/merb-core/test/matchers.rb +3 -3
- data/lib/merb-core/test/matchers/request_matchers.rb +1 -1
- data/lib/merb-core/test/run_spec.rb +1 -1
- data/lib/merb-core/test/tasks/spectasks.rb +1 -1
- data/lib/merb-core/test/test_ext/hpricot.rb +1 -1
- data/lib/merb-core/test/test_ext/rspec.rb +2 -2
- data/lib/merb-core/test/test_ext/string.rb +1 -1
- data/lib/merb-core/version.rb +1 -1
- metadata +8 -22
- data/lib/merb-core/test/matchers/view_matchers.rb +0 -231
- data/lib/merb-core/test/webrat.rb +0 -37
- data/lib/merb-core/vendor/nokogiri/css.rb +0 -6
- data/lib/merb-core/vendor/nokogiri/css/generated_parser.rb +0 -653
- data/lib/merb-core/vendor/nokogiri/css/generated_tokenizer.rb +0 -159
- data/lib/merb-core/vendor/nokogiri/css/node.rb +0 -95
- data/lib/merb-core/vendor/nokogiri/css/parser.rb +0 -24
- data/lib/merb-core/vendor/nokogiri/css/parser.y +0 -198
- data/lib/merb-core/vendor/nokogiri/css/tokenizer.rb +0 -9
- data/lib/merb-core/vendor/nokogiri/css/tokenizer.rex +0 -63
- data/lib/merb-core/vendor/nokogiri/css/xpath_visitor.rb +0 -159
data/Rakefile
CHANGED
@@ -56,6 +56,8 @@ spec = Gem::Specification.new do |s|
|
|
56
56
|
s.has_rdoc = true
|
57
57
|
s.extra_rdoc_files = %w( README LICENSE TODO )
|
58
58
|
|
59
|
+
s.required_rubygems_version = ">= 1.3.0"
|
60
|
+
|
59
61
|
# Dependencies
|
60
62
|
s.add_dependency "extlib", ">= 0.9.8"
|
61
63
|
s.add_dependency "erubis", ">= 2.6.2"
|
@@ -64,12 +66,12 @@ spec = Gem::Specification.new do |s|
|
|
64
66
|
s.add_dependency "rspec"
|
65
67
|
s.add_dependency "rack"
|
66
68
|
s.add_dependency "mime-types"
|
67
|
-
s.add_dependency "hpricot"
|
68
69
|
s.add_dependency "thor", ">= 0.9.7"
|
69
70
|
# this escalates to "regular" dependencies, comment it out
|
70
71
|
# for now. RubyGems need some love.
|
71
72
|
#s.add_development_dependency "libxml-ruby"
|
72
73
|
#s.add_development_dependency "memcache-client"
|
74
|
+
s.add_development_dependency "webrat", ">= 0.3.1"
|
73
75
|
# Requirements
|
74
76
|
s.requirements << "install the json gem to get faster json parsing"
|
75
77
|
s.required_ruby_version = ">= 1.8.6"
|
@@ -101,7 +103,7 @@ task :gemspec do
|
|
101
103
|
end
|
102
104
|
end
|
103
105
|
|
104
|
-
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "lib/*.so", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "spec/**/*.log"]
|
106
|
+
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "lib/*.so", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "spec/**/*.log", "**/gems/*"]
|
105
107
|
|
106
108
|
desc "Run the specs."
|
107
109
|
task :default => :specs
|
@@ -184,7 +186,7 @@ def setup_specs(name, spec_cmd='spec', run_opts = "-c")
|
|
184
186
|
except = []
|
185
187
|
except += Dir["spec/**/memcache*_spec.rb"] if ENV['MEMCACHED'] == 'no'
|
186
188
|
|
187
|
-
public_globs = Dir["#{Dir.pwd}/spec/public/**/*_spec.rb"]
|
189
|
+
public_globs = Dir["#{Dir.pwd}/spec/public/**/*_spec.rb"].reject{|file| file.include?('/gems/')}
|
188
190
|
|
189
191
|
private_globs = Dir["#{Dir.pwd}/spec/private/**/*_spec.rb"]
|
190
192
|
|
data/lib/merb-core.rb
CHANGED
@@ -42,12 +42,47 @@ module Merb
|
|
42
42
|
class << self
|
43
43
|
attr_reader :exiting
|
44
44
|
|
45
|
+
# The list of procs that have been registered with Merb to run when
|
46
|
+
# Merb exits gracefully.
|
47
|
+
#
|
48
|
+
# ==== Returns
|
49
|
+
# Array:: The current list of procs
|
50
|
+
#
|
51
|
+
# :api: private
|
52
|
+
def at_exit_procs
|
53
|
+
@at_exit_procs ||= []
|
54
|
+
end
|
55
|
+
|
56
|
+
# Set the current exiting state of Merb. Setting this state to true
|
57
|
+
# also alerts Extlib to exit and clean up its state.
|
58
|
+
#
|
59
|
+
# ==== Returns
|
60
|
+
# Boolean:: The current exiting state of Merb
|
61
|
+
#
|
62
|
+
# :api: private
|
45
63
|
def exiting=(bool)
|
46
64
|
Extlib.exiting = bool
|
47
|
-
if bool && Extlib.const_defined?("Pooling") && Extlib::Pooling.scavenger
|
48
|
-
Extlib::Pooling.scavenger.wakeup
|
49
|
-
end
|
50
65
|
@exiting = bool
|
66
|
+
if bool
|
67
|
+
if Extlib.const_defined?("Pooling") && Extlib::Pooling.scavenger
|
68
|
+
Extlib::Pooling.scavenger.wakeup
|
69
|
+
end
|
70
|
+
while prc = self.at_exit_procs.pop
|
71
|
+
prc.call
|
72
|
+
end unless Merb::Config[:reap_workers_quickly]
|
73
|
+
end
|
74
|
+
@exiting
|
75
|
+
end
|
76
|
+
|
77
|
+
# Register a proc to run when Merb is exiting gracefully. It will *not*
|
78
|
+
# be run when Merb exits quickly.
|
79
|
+
#
|
80
|
+
# ==== Returns
|
81
|
+
# Array:: The current list of procs to run when Merb exits gracefully
|
82
|
+
#
|
83
|
+
# :api: plugin
|
84
|
+
def at_exit(&blk)
|
85
|
+
self.at_exit_procs << blk
|
51
86
|
end
|
52
87
|
|
53
88
|
# Merge environment settings
|
@@ -71,7 +106,7 @@ module Merb
|
|
71
106
|
# use_db<~Boolean>:: Should Merb use the merged environments DB connection
|
72
107
|
# Defaults to +false+
|
73
108
|
#
|
74
|
-
#
|
109
|
+
# :api: public
|
75
110
|
def merge_env(env,use_db=false)
|
76
111
|
if Merb.environment_info.nil?
|
77
112
|
Merb.environment_info = {
|
@@ -108,7 +143,7 @@ module Merb
|
|
108
143
|
# argv<String, Hash>::
|
109
144
|
# The config arguments to start Merb with. Defaults to +ARGV+.
|
110
145
|
#
|
111
|
-
#
|
146
|
+
# :api: public
|
112
147
|
def start(argv = ARGV)
|
113
148
|
Merb::Config[:original_log_stream] = Merb::Config[:log_stream]
|
114
149
|
Merb::Config[:log_stream] ||= STDOUT
|
@@ -142,7 +177,7 @@ module Merb
|
|
142
177
|
# argv<String, Hash>::
|
143
178
|
# The config arguments to start Merb with. Defaults to +ARGV+.
|
144
179
|
#
|
145
|
-
#
|
180
|
+
# :api: public
|
146
181
|
def start_environment(argv=ARGV)
|
147
182
|
start(argv) unless (@started ||= false)
|
148
183
|
end
|
@@ -153,15 +188,20 @@ module Merb
|
|
153
188
|
# argv<String, Hash>::
|
154
189
|
# The config arguments to restart Merb with. Defaults to +Merb::Config+.
|
155
190
|
#
|
156
|
-
#
|
191
|
+
# :api: public
|
157
192
|
def restart_environment(argv={})
|
158
193
|
@started = false
|
159
194
|
start_environment(Merb::Config.to_hash.merge(argv))
|
160
195
|
end
|
161
196
|
|
162
|
-
|
197
|
+
# :api: public
|
198
|
+
attr_accessor :environment, :adapter
|
199
|
+
# :api: private
|
200
|
+
attr_accessor :load_paths, :environment_info, :started
|
163
201
|
|
202
|
+
# :api: public
|
164
203
|
alias :env :environment
|
204
|
+
# :api: public
|
165
205
|
alias :started? :started
|
166
206
|
|
167
207
|
Merb.load_paths = Dictionary.new { [Merb.root] } unless Merb.load_paths.is_a?(Dictionary)
|
@@ -216,7 +256,7 @@ module Merb
|
|
216
256
|
# A glob that will be used to autoload files under the path. Defaults to
|
217
257
|
# "**/*.rb".
|
218
258
|
#
|
219
|
-
#
|
259
|
+
# :api: public
|
220
260
|
def push_path(type, path, file_glob = "**/*.rb")
|
221
261
|
enforce!(type => Symbol)
|
222
262
|
load_paths[type] = [path, file_glob]
|
@@ -239,7 +279,7 @@ module Merb
|
|
239
279
|
#
|
240
280
|
# Will make Merb use app/models for mailers just like Ruby on Rails does.
|
241
281
|
#
|
242
|
-
#
|
282
|
+
# :api: public
|
243
283
|
def remove_paths(*args)
|
244
284
|
args.each {|arg| load_paths.delete(arg)}
|
245
285
|
end
|
@@ -250,7 +290,7 @@ module Merb
|
|
250
290
|
# ==== Returns
|
251
291
|
# String:: The directory for the requested type.
|
252
292
|
#
|
253
|
-
#
|
293
|
+
# :api: public
|
254
294
|
def dir_for(type)
|
255
295
|
Merb.load_paths[type].first
|
256
296
|
end
|
@@ -261,7 +301,7 @@ module Merb
|
|
261
301
|
# ===== Returns
|
262
302
|
# String:: The pattern with which to match files within the type directory.
|
263
303
|
#
|
264
|
-
#
|
304
|
+
# :api: public
|
265
305
|
def glob_for(type)
|
266
306
|
Merb.load_paths[type][1]
|
267
307
|
end
|
@@ -269,7 +309,7 @@ module Merb
|
|
269
309
|
# ==== Returns
|
270
310
|
# String:: The Merb root path.
|
271
311
|
#
|
272
|
-
#
|
312
|
+
# :api: public
|
273
313
|
def root
|
274
314
|
@root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)
|
275
315
|
end
|
@@ -277,7 +317,7 @@ module Merb
|
|
277
317
|
# ==== Parameters
|
278
318
|
# value<String>:: Path to the root directory.
|
279
319
|
#
|
280
|
-
#
|
320
|
+
# :api: public
|
281
321
|
def root=(value)
|
282
322
|
@root = value
|
283
323
|
end
|
@@ -303,14 +343,14 @@ module Merb
|
|
303
343
|
# Return the Merb Logger object for the current thread.
|
304
344
|
# Set it up if it does not exist.
|
305
345
|
#
|
306
|
-
#
|
346
|
+
# :api: public
|
307
347
|
def logger
|
308
348
|
Thread.current[:merb_logger] ||= Merb::Logger.new
|
309
349
|
end
|
310
350
|
|
311
351
|
# Removes the logger for the current thread (nil).
|
312
352
|
#
|
313
|
-
#
|
353
|
+
# :api: public
|
314
354
|
def reset_logger!
|
315
355
|
Thread.current[:merb_logger] = nil
|
316
356
|
end
|
@@ -326,7 +366,7 @@ module Merb
|
|
326
366
|
# just once, thereby never taking changes into account again. Now, it will
|
327
367
|
# be memoized as :test - and just logging to merb_test.log.
|
328
368
|
#
|
329
|
-
#
|
369
|
+
# :api: public
|
330
370
|
def log_stream(port = "main")
|
331
371
|
port = :test if Merb.testing?
|
332
372
|
@streams ||= {}
|
@@ -357,7 +397,7 @@ module Merb
|
|
357
397
|
# ==== Returns
|
358
398
|
# String:: Path to the log directory which contains the log file.
|
359
399
|
#
|
360
|
-
#
|
400
|
+
# :api: public
|
361
401
|
def log_path
|
362
402
|
case Merb::Config[:log_file]
|
363
403
|
when String then File.dirname(Merb::Config[:log_file])
|
@@ -368,7 +408,7 @@ module Merb
|
|
368
408
|
# ==== Returns
|
369
409
|
# String:: The path of root directory of the Merb framework.
|
370
410
|
#
|
371
|
-
#
|
411
|
+
# :api: public
|
372
412
|
def framework_root
|
373
413
|
@framework_root ||= File.dirname(__FILE__)
|
374
414
|
end
|
@@ -381,7 +421,7 @@ module Merb
|
|
381
421
|
# ==== Notes
|
382
422
|
# Concatenates :deferred_actions configuration option values.
|
383
423
|
#
|
384
|
-
#
|
424
|
+
# :api: public
|
385
425
|
def deferred_actions
|
386
426
|
@deferred ||= begin
|
387
427
|
if Merb::Config[:deferred_actions].empty?
|
@@ -395,7 +435,7 @@ module Merb
|
|
395
435
|
# Perform a hard Exit.
|
396
436
|
# Print a backtrace to the merb logger before exiting if verbose is enabled.
|
397
437
|
#
|
398
|
-
#
|
438
|
+
# :api: private
|
399
439
|
def fatal!(str, e = nil)
|
400
440
|
Merb.logger.fatal!
|
401
441
|
Merb.logger.fatal!("\e[1;31;47mFATAL: #{str}\e[0m")
|
@@ -412,7 +452,7 @@ module Merb
|
|
412
452
|
|
413
453
|
# Print a colorized backtrace to the merb logger.
|
414
454
|
#
|
415
|
-
#
|
455
|
+
# :api: private
|
416
456
|
def print_colorized_backtrace(e)
|
417
457
|
e.backtrace.map! do |line|
|
418
458
|
line.gsub!(/^#{Merb.framework_root}/, "\e[34mFRAMEWORK_ROOT\e[31m")
|
@@ -434,7 +474,7 @@ module Merb
|
|
434
474
|
# ==== Returns
|
435
475
|
# <Symbol>:: default ORM.
|
436
476
|
#
|
437
|
-
#
|
477
|
+
# :api: public
|
438
478
|
def orm
|
439
479
|
@orm ||= :none
|
440
480
|
end
|
@@ -451,7 +491,7 @@ module Merb
|
|
451
491
|
# ==== Returns
|
452
492
|
# <Symbol>:: default test framework.
|
453
493
|
#
|
454
|
-
#
|
494
|
+
# :api: public
|
455
495
|
def test_framework
|
456
496
|
@test_framework ||= :rspec
|
457
497
|
end
|
@@ -467,7 +507,7 @@ module Merb
|
|
467
507
|
# ==== Returns
|
468
508
|
# <Symbol>:: default template engine.
|
469
509
|
#
|
470
|
-
#
|
510
|
+
# :api: public
|
471
511
|
def template_engine
|
472
512
|
@template_engine ||= :erb
|
473
513
|
end
|
@@ -483,7 +523,7 @@ module Merb
|
|
483
523
|
# framework and gems and is very useful when application is run in
|
484
524
|
# some sort of sandbox, for instance, shared hosting with preconfigured gems.
|
485
525
|
#
|
486
|
-
#
|
526
|
+
# :api: public
|
487
527
|
def bundled?
|
488
528
|
$BUNDLE || ENV.key?("BUNDLE")
|
489
529
|
end
|
@@ -546,7 +586,7 @@ module Merb
|
|
546
586
|
# application start, some of them are set in Merb init file
|
547
587
|
# or environment-specific.
|
548
588
|
#
|
549
|
-
#
|
589
|
+
# :api: public
|
550
590
|
def load_config(options = {})
|
551
591
|
Merb::Config.setup(Merb::Config.defaults.merge(options))
|
552
592
|
Merb::BootLoader::Logger.run
|
@@ -561,7 +601,7 @@ module Merb
|
|
561
601
|
# ==== Parameters
|
562
602
|
# options<Hash>:: Options to pass on to the Merb config.
|
563
603
|
#
|
564
|
-
#
|
604
|
+
# :api: public
|
565
605
|
def load_dependencies(options = {})
|
566
606
|
load_config(options)
|
567
607
|
Merb::BootLoader::BuildFramework.run
|
@@ -572,7 +612,7 @@ module Merb
|
|
572
612
|
# Reload application and framework classes.
|
573
613
|
# See Merb::BootLoader::ReloadClasses for details.
|
574
614
|
#
|
575
|
-
#
|
615
|
+
# :api: public
|
576
616
|
def reload
|
577
617
|
Merb::BootLoader::ReloadClasses.reload
|
578
618
|
end
|
@@ -581,7 +621,7 @@ module Merb
|
|
581
621
|
# Boolean:: True if Merb environment is testing for instance,
|
582
622
|
# Merb is running with RSpec, Test::Unit of other testing facility.
|
583
623
|
#
|
584
|
-
#
|
624
|
+
# :api: public
|
585
625
|
def testing?
|
586
626
|
$TESTING ||= env?(:test) || Merb::Config[:testing]
|
587
627
|
end
|
@@ -595,7 +635,7 @@ module Merb
|
|
595
635
|
# Merb.env?(:production) #=> true
|
596
636
|
# Merb.env?(:development) #=> false
|
597
637
|
#
|
598
|
-
#
|
638
|
+
# :api: public
|
599
639
|
def env?(env)
|
600
640
|
Merb.env == env.to_s
|
601
641
|
end
|
@@ -624,7 +664,7 @@ module Merb
|
|
624
664
|
# reload_time 0.5
|
625
665
|
# end
|
626
666
|
#
|
627
|
-
#
|
667
|
+
# :api: public
|
628
668
|
def config(&block)
|
629
669
|
Merb::Config.configure(&block) if block_given?
|
630
670
|
Config
|
@@ -635,7 +675,7 @@ module Merb
|
|
635
675
|
# ==== Parameters
|
636
676
|
# *args:: One or more symbols of Merb internal components.
|
637
677
|
#
|
638
|
-
#
|
678
|
+
# :api: public
|
639
679
|
def disable(*components)
|
640
680
|
disabled_components.push(*components)
|
641
681
|
end
|
@@ -643,7 +683,7 @@ module Merb
|
|
643
683
|
# ==== Parameters
|
644
684
|
# Array:: All components that should be disabled.
|
645
685
|
#
|
646
|
-
#
|
686
|
+
# :api: public
|
647
687
|
def disabled_components=(components)
|
648
688
|
disabled_components.replace components
|
649
689
|
end
|
@@ -651,7 +691,7 @@ module Merb
|
|
651
691
|
# ==== Returns
|
652
692
|
# Array:: All components that have been disabled.
|
653
693
|
#
|
654
|
-
#
|
694
|
+
# :api: public
|
655
695
|
def disabled_components
|
656
696
|
Merb::Config[:disabled_components] ||= []
|
657
697
|
end
|
@@ -659,7 +699,7 @@ module Merb
|
|
659
699
|
# ==== Returns
|
660
700
|
# Boolean:: True if all components (or just one) are disabled.
|
661
701
|
#
|
662
|
-
#
|
702
|
+
# :api: public
|
663
703
|
def disabled?(*components)
|
664
704
|
components.all? { |c| disabled_components.include?(c) }
|
665
705
|
end
|
@@ -671,7 +711,7 @@ module Merb
|
|
671
711
|
# Recommended way to find out what paths Rakefiles
|
672
712
|
# are loaded from.
|
673
713
|
#
|
674
|
-
#
|
714
|
+
# :api: public
|
675
715
|
def rakefiles
|
676
716
|
@rakefiles ||= []
|
677
717
|
end
|
@@ -682,7 +722,7 @@ module Merb
|
|
682
722
|
# === Notes
|
683
723
|
# Recommended way to find out what paths generators are loaded from.
|
684
724
|
#
|
685
|
-
#
|
725
|
+
# :api: public
|
686
726
|
def generators
|
687
727
|
@generators ||= []
|
688
728
|
end
|
@@ -693,7 +733,7 @@ module Merb
|
|
693
733
|
# ==== Notes
|
694
734
|
# Recommended way to add Rakefiles load path for plugins authors.
|
695
735
|
#
|
696
|
-
#
|
736
|
+
# :api: public
|
697
737
|
def add_rakefiles(*rakefiles)
|
698
738
|
@rakefiles ||= []
|
699
739
|
@rakefiles += rakefiles
|
@@ -705,7 +745,7 @@ module Merb
|
|
705
745
|
# ==== Notes
|
706
746
|
# Recommended way to add Generator load paths for plugin authors.
|
707
747
|
#
|
708
|
-
#
|
748
|
+
# :api: public
|
709
749
|
def add_generators(*generators)
|
710
750
|
@generators ||= []
|
711
751
|
@generators += generators
|
@@ -717,21 +757,24 @@ module Merb
|
|
717
757
|
# signal:: The name of the signal to install a handler for.
|
718
758
|
# &block:: The block to be run when the given signal is received.
|
719
759
|
#
|
720
|
-
#
|
760
|
+
# :api: public
|
721
761
|
def trap(signal, &block)
|
722
762
|
if Signal.list.include?(signal)
|
723
763
|
Kernel.trap(signal, &block) unless Merb.disabled?(:signals)
|
724
764
|
end
|
725
765
|
end
|
726
766
|
|
767
|
+
# :api: plugin
|
727
768
|
def forking_environment?
|
728
769
|
!on_windows? && !on_jruby?
|
729
770
|
end
|
730
771
|
|
772
|
+
# :api: plugin
|
731
773
|
def on_jruby?
|
732
774
|
RUBY_PLATFORM =~ Merb::Const::JAVA_PLATFORM_REGEXP
|
733
775
|
end
|
734
776
|
|
777
|
+
# :api: plugin
|
735
778
|
def on_windows?
|
736
779
|
RUBY_PLATFORM =~ Merb::Const::WIN_PLATFORM_REGEXP
|
737
780
|
end
|
data/lib/merb-core/bootloader.rb
CHANGED
@@ -4,7 +4,7 @@ module Merb
|
|
4
4
|
|
5
5
|
# def self.subclasses
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# :api: plugin
|
8
8
|
cattr_accessor :subclasses, :after_load_callbacks, :before_load_callbacks,
|
9
9
|
:finished, :before_worker_shutdown_callbacks, :before_master_shutdown_callbacks
|
10
10
|
|
@@ -23,7 +23,7 @@ module Merb
|
|
23
23
|
# ==== Returns
|
24
24
|
# nil
|
25
25
|
#
|
26
|
-
#
|
26
|
+
# :api: plugin
|
27
27
|
def inherited(klass)
|
28
28
|
subclasses << klass.to_s
|
29
29
|
super
|
@@ -38,7 +38,7 @@ module Merb
|
|
38
38
|
# ==== Returns
|
39
39
|
# nil
|
40
40
|
#
|
41
|
-
#
|
41
|
+
# :api: plugin
|
42
42
|
def after(klass)
|
43
43
|
move_klass(klass, 1)
|
44
44
|
nil
|
@@ -53,7 +53,7 @@ module Merb
|
|
53
53
|
# ==== Returns
|
54
54
|
# nil
|
55
55
|
#
|
56
|
-
#
|
56
|
+
# :api: plugin
|
57
57
|
def before(klass)
|
58
58
|
move_klass(klass, 0)
|
59
59
|
nil
|
@@ -71,7 +71,7 @@ module Merb
|
|
71
71
|
# ==== Returns
|
72
72
|
# nil
|
73
73
|
#
|
74
|
-
#
|
74
|
+
# :api: private
|
75
75
|
def move_klass(klass, where)
|
76
76
|
index = Merb::BootLoader.subclasses.index(klass.to_s)
|
77
77
|
if index
|
@@ -86,7 +86,7 @@ module Merb
|
|
86
86
|
# ==== Returns
|
87
87
|
# nil
|
88
88
|
#
|
89
|
-
#
|
89
|
+
# :api: plugin
|
90
90
|
def run
|
91
91
|
Merb.started = true
|
92
92
|
subklasses = subclasses.dup
|
@@ -114,7 +114,7 @@ module Merb
|
|
114
114
|
# ==== Returns
|
115
115
|
# Boolean:: Whether or not the bootloader has finished.
|
116
116
|
#
|
117
|
-
#
|
117
|
+
# :api: private
|
118
118
|
def finished?(bootloader)
|
119
119
|
self.finished.include?(bootloader.to_s)
|
120
120
|
end
|
@@ -124,7 +124,7 @@ module Merb
|
|
124
124
|
# ==== Returns
|
125
125
|
# nil
|
126
126
|
#
|
127
|
-
#
|
127
|
+
# :api: plugin
|
128
128
|
# @overridable
|
129
129
|
def default_framework
|
130
130
|
%w[view model helper controller mailer part].each do |component|
|
@@ -150,7 +150,7 @@ module Merb
|
|
150
150
|
# A block to be added to the callbacks that will be executed after the
|
151
151
|
# app loads.
|
152
152
|
#
|
153
|
-
#
|
153
|
+
# :api: public
|
154
154
|
def after_app_loads(&block)
|
155
155
|
after_load_callbacks << block
|
156
156
|
end
|
@@ -162,7 +162,7 @@ module Merb
|
|
162
162
|
# A block to be added to the callbacks that will be executed before the
|
163
163
|
# app loads.
|
164
164
|
#
|
165
|
-
#
|
165
|
+
# :api: public
|
166
166
|
def before_app_loads(&block)
|
167
167
|
before_load_callbacks << block
|
168
168
|
end
|
@@ -175,7 +175,7 @@ module Merb
|
|
175
175
|
# A block to be added to the callbacks that will be executed
|
176
176
|
# before master process is shut down.
|
177
177
|
#
|
178
|
-
#
|
178
|
+
# :api: public
|
179
179
|
def before_master_shutdown(&block)
|
180
180
|
before_master_shutdown_callbacks << block
|
181
181
|
end
|
@@ -188,7 +188,7 @@ module Merb
|
|
188
188
|
# A block to be added to the callbacks that will be executed
|
189
189
|
# before worker process is shut down.
|
190
190
|
#
|
191
|
-
#
|
191
|
+
# :api: public
|
192
192
|
def before_worker_shutdown(&block)
|
193
193
|
before_worker_shutdown_callbacks << block
|
194
194
|
end
|
@@ -209,7 +209,7 @@ class Merb::BootLoader::Logger < Merb::BootLoader
|
|
209
209
|
# ==== Returns
|
210
210
|
# nil
|
211
211
|
#
|
212
|
-
#
|
212
|
+
# :api: plugin
|
213
213
|
def self.run
|
214
214
|
Merb::Config[:log_level] ||= begin
|
215
215
|
if Merb.environment == "production"
|
@@ -232,7 +232,7 @@ class Merb::BootLoader::Logger < Merb::BootLoader
|
|
232
232
|
# ==== Returns
|
233
233
|
# nil
|
234
234
|
#
|
235
|
-
#
|
235
|
+
# :api: private
|
236
236
|
def self.print_warnings
|
237
237
|
if Gem::Version.new(Gem::RubyGemsVersion) < Gem::Version.new("1.1")
|
238
238
|
Merb.fatal! "Merb requires Rubygems 1.1 and later. " \
|
@@ -253,7 +253,7 @@ class Merb::BootLoader::DropPidFile < Merb::BootLoader
|
|
253
253
|
# ==== Returns
|
254
254
|
# nil
|
255
255
|
#
|
256
|
-
#
|
256
|
+
# :api: plugin
|
257
257
|
def run
|
258
258
|
Merb::Server.store_pid("main") #if Merb::Config[:daemonize] || Merb::Config[:cluster]
|
259
259
|
nil
|
@@ -268,7 +268,7 @@ class Merb::BootLoader::Defaults < Merb::BootLoader
|
|
268
268
|
# ==== Returns
|
269
269
|
# nil
|
270
270
|
#
|
271
|
-
#
|
271
|
+
# :api: plugin
|
272
272
|
def self.run
|
273
273
|
Merb::Request.http_method_overrides.concat([
|
274
274
|
proc { |c| c.params[:_method] },
|
@@ -321,6 +321,8 @@ class Merb::BootLoader::BuildFramework < Merb::BootLoader
|
|
321
321
|
#
|
322
322
|
# ==== Returns
|
323
323
|
# nil
|
324
|
+
#
|
325
|
+
# :api: plugin
|
324
326
|
def run
|
325
327
|
$:.push Merb.root unless Merb.root == File.expand_path(Dir.pwd)
|
326
328
|
build_framework
|
@@ -335,7 +337,7 @@ class Merb::BootLoader::BuildFramework < Merb::BootLoader
|
|
335
337
|
# ==== Returns
|
336
338
|
# nil
|
337
339
|
#
|
338
|
-
#
|
340
|
+
# :api: plugin
|
339
341
|
# @overridable
|
340
342
|
def build_framework
|
341
343
|
if File.exists?(Merb.root / "config" / "framework.rb")
|
@@ -359,7 +361,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
359
361
|
# ==== Returns
|
360
362
|
# Array[Gem::Dependency]:: The dependencies regiestered in init.rb.
|
361
363
|
#
|
362
|
-
#
|
364
|
+
# :api: plugin
|
363
365
|
cattr_accessor :dependencies
|
364
366
|
self.dependencies = []
|
365
367
|
|
@@ -376,7 +378,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
376
378
|
# ==== Returns
|
377
379
|
# nil
|
378
380
|
#
|
379
|
-
#
|
381
|
+
# :api: plugin
|
380
382
|
def self.run
|
381
383
|
set_encoding
|
382
384
|
# this is crucial: load init file with all the preferences
|
@@ -398,7 +400,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
398
400
|
# ==== Returns
|
399
401
|
# nil
|
400
402
|
#
|
401
|
-
#
|
403
|
+
# :api: private
|
402
404
|
def self.load_dependencies
|
403
405
|
dependencies.each { |dependency| Kernel.load_dependency(dependency) }
|
404
406
|
nil
|
@@ -408,6 +410,8 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
408
410
|
#
|
409
411
|
# ==== Returns
|
410
412
|
# nil
|
413
|
+
#
|
414
|
+
# :api: private
|
411
415
|
def self.enable_json_gem
|
412
416
|
gem "json"
|
413
417
|
require "json/ext"
|
@@ -422,7 +426,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
422
426
|
# ==== Returns
|
423
427
|
# nil
|
424
428
|
#
|
425
|
-
#
|
429
|
+
# :api: private
|
426
430
|
def self.update_logger
|
427
431
|
Merb.reset_logger!
|
428
432
|
|
@@ -444,7 +448,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
444
448
|
# ==== Returns
|
445
449
|
# nil
|
446
450
|
#
|
447
|
-
#
|
451
|
+
# :api: private
|
448
452
|
def self.set_encoding
|
449
453
|
$KCODE = 'UTF8' if $KCODE == 'NONE' || $KCODE.blank?
|
450
454
|
nil
|
@@ -457,7 +461,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
457
461
|
# ==== Returns
|
458
462
|
# String:: The path to the config file for the environment
|
459
463
|
#
|
460
|
-
#
|
464
|
+
# :api: private
|
461
465
|
def self.env_config
|
462
466
|
Merb.dir_for(:config) / "environments" / (Merb.environment + ".rb")
|
463
467
|
end
|
@@ -467,7 +471,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
467
471
|
# ==== Returns
|
468
472
|
# Boolean:: Whether or not the environment configuration file exists.
|
469
473
|
#
|
470
|
-
#
|
474
|
+
# :api: private
|
471
475
|
def self.env_config?
|
472
476
|
Merb.environment && File.exist?(env_config)
|
473
477
|
end
|
@@ -477,7 +481,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
477
481
|
# ==== Returns
|
478
482
|
# nil
|
479
483
|
#
|
480
|
-
#
|
484
|
+
# :api: private
|
481
485
|
def self.load_env_config
|
482
486
|
if env_config?
|
483
487
|
STDOUT.puts "Loading #{env_config}" unless Merb.testing?
|
@@ -492,7 +496,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
492
496
|
# ==== Returns
|
493
497
|
# nil
|
494
498
|
#
|
495
|
-
#
|
499
|
+
# :api: private
|
496
500
|
def self.initfile
|
497
501
|
if Merb::Config[:init_file]
|
498
502
|
Merb::Config[:init_file].chomp(".rb") + ".rb"
|
@@ -506,7 +510,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
506
510
|
# ==== Returns
|
507
511
|
# nil
|
508
512
|
#
|
509
|
-
#
|
513
|
+
# :api: private
|
510
514
|
def self.load_initfile
|
511
515
|
if File.exists?(initfile)
|
512
516
|
STDOUT.puts "Loading init file from #{initfile}" unless Merb.testing?
|
@@ -524,7 +528,7 @@ class Merb::BootLoader::Dependencies < Merb::BootLoader
|
|
524
528
|
# ==== Returns
|
525
529
|
# nil
|
526
530
|
#
|
527
|
-
#
|
531
|
+
# :api: private
|
528
532
|
def self.expand_ruby_path
|
529
533
|
# Add models, controllers, helpers and lib to the load path
|
530
534
|
unless @ran
|
@@ -554,7 +558,7 @@ class Merb::BootLoader::MixinSession < Merb::BootLoader
|
|
554
558
|
# ==== Returns
|
555
559
|
# nil
|
556
560
|
#
|
557
|
-
#
|
561
|
+
# :api: plugin
|
558
562
|
def self.run
|
559
563
|
require 'merb-core/dispatch/session'
|
560
564
|
Merb::Controller.send(:include, ::Merb::SessionMixin)
|
@@ -571,7 +575,7 @@ class Merb::BootLoader::BeforeAppLoads < Merb::BootLoader
|
|
571
575
|
# ==== Returns
|
572
576
|
# nil
|
573
577
|
#
|
574
|
-
#
|
578
|
+
# :api: plugin
|
575
579
|
def self.run
|
576
580
|
Merb::BootLoader.before_load_callbacks.each { |x| x.call }
|
577
581
|
nil
|
@@ -604,7 +608,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
604
608
|
# Returns at least once:
|
605
609
|
# nil
|
606
610
|
#
|
607
|
-
#
|
611
|
+
# :api: plugin
|
608
612
|
def run
|
609
613
|
# process name you see in ps output
|
610
614
|
$0 = "merb#{" : " + Merb::Config[:name] if Merb::Config[:name]} : master"
|
@@ -644,7 +648,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
644
648
|
# ==== Returns
|
645
649
|
# (Does not return.)
|
646
650
|
#
|
647
|
-
#
|
651
|
+
# :api: private
|
648
652
|
def exit_gracefully
|
649
653
|
# wait all workers to exit
|
650
654
|
Process.waitall
|
@@ -675,8 +679,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
675
679
|
# Child Process returns at least once:
|
676
680
|
# nil
|
677
681
|
#
|
678
|
-
#
|
679
|
-
|
682
|
+
# :api: private
|
680
683
|
def start_transaction
|
681
684
|
Merb.logger.warn! "Parent pid: #{Process.pid}"
|
682
685
|
reader, writer = nil, nil
|
@@ -706,7 +709,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
706
709
|
Merb.trap("INT") do
|
707
710
|
Merb.logger.warn! "Reaping Workers"
|
708
711
|
begin
|
709
|
-
Process.kill(
|
712
|
+
Process.kill(reap_workers_signal, pid)
|
710
713
|
rescue SystemCallError
|
711
714
|
end
|
712
715
|
exit_gracefully
|
@@ -758,12 +761,18 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
758
761
|
Merb::Server.add_irb_trap
|
759
762
|
at_exit { reap_workers }
|
760
763
|
else
|
761
|
-
Merb.trap('INT')
|
764
|
+
Merb.trap('INT') do
|
765
|
+
Merb::BootLoader.before_worker_shutdown_callbacks.each { |cb| cb.call }
|
766
|
+
end
|
762
767
|
Merb.trap('ABRT') { reap_workers }
|
763
|
-
Merb.trap('HUP') { reap_workers(128) }
|
768
|
+
Merb.trap('HUP') { reap_workers(128, "ABRT") }
|
764
769
|
end
|
765
770
|
end
|
766
771
|
|
772
|
+
def reap_workers_signal
|
773
|
+
Merb::Config[:reap_workers_quickly] ? "KILL" : "ABRT"
|
774
|
+
end
|
775
|
+
|
767
776
|
# Reap any workers of the spawner process and
|
768
777
|
# exit with an appropriate status code.
|
769
778
|
#
|
@@ -773,14 +782,14 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
773
782
|
#
|
774
783
|
# ==== Parameters
|
775
784
|
# status<Integer>:: The status code to exit with. Defaults to 0.
|
785
|
+
# sig<String>:: The signal to send to workers
|
776
786
|
#
|
777
787
|
# ==== Returns
|
778
788
|
# (Does not return.)
|
779
789
|
#
|
780
|
-
#
|
781
|
-
|
782
|
-
|
783
|
-
def reap_workers(status = 0, sig = "ABRT")
|
790
|
+
# :api: private
|
791
|
+
def reap_workers(status = 0, sig = reap_workers_signal)
|
792
|
+
|
784
793
|
Merb.logger.info "Executed all before worker shutdown callbacks..."
|
785
794
|
Merb::BootLoader.before_worker_shutdown_callbacks.each do |cb|
|
786
795
|
begin
|
@@ -821,7 +830,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
821
830
|
# ==== Returns
|
822
831
|
# nil
|
823
832
|
#
|
824
|
-
#
|
833
|
+
# :api: private
|
825
834
|
def load_file(file)
|
826
835
|
# Don't do this expensive operation unless we need to
|
827
836
|
unless Merb::Config[:fork_for_class_load]
|
@@ -857,7 +866,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
857
866
|
# ==== Returns
|
858
867
|
# nil
|
859
868
|
#
|
860
|
-
#
|
869
|
+
# :api: private
|
861
870
|
def load_classes(*paths)
|
862
871
|
orphaned_classes = []
|
863
872
|
paths.flatten.each do |path|
|
@@ -886,7 +895,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
886
895
|
# When fork-based loading is not in use:
|
887
896
|
# nil
|
888
897
|
#
|
889
|
-
#
|
898
|
+
# :api: private
|
890
899
|
def reload(file)
|
891
900
|
if Merb::Config[:fork_for_class_load]
|
892
901
|
reap_workers(128)
|
@@ -908,7 +917,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
908
917
|
# ==== Returns
|
909
918
|
# nil
|
910
919
|
#
|
911
|
-
#
|
920
|
+
# :api: private
|
912
921
|
def remove_classes_in_file(file, &block)
|
913
922
|
Merb.klass_hashes.each { |x| x.protect_keys! }
|
914
923
|
if klasses = LOADED_CLASSES.delete(file)
|
@@ -932,7 +941,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
932
941
|
# ==== Returns
|
933
942
|
# nil
|
934
943
|
#
|
935
|
-
#
|
944
|
+
# :api: private
|
936
945
|
def remove_constant(const)
|
937
946
|
# This is to support superclasses (like AbstractController) that track
|
938
947
|
# their subclasses in a class variable.
|
@@ -968,7 +977,7 @@ class Merb::BootLoader::LoadClasses < Merb::BootLoader
|
|
968
977
|
# ==== Returns
|
969
978
|
# nil
|
970
979
|
#
|
971
|
-
#
|
980
|
+
# :api: private
|
972
981
|
def load_classes_with_requirements(klasses)
|
973
982
|
klasses.uniq!
|
974
983
|
|
@@ -1024,7 +1033,7 @@ class Merb::BootLoader::Router < Merb::BootLoader
|
|
1024
1033
|
# ==== Returns
|
1025
1034
|
# nil
|
1026
1035
|
#
|
1027
|
-
#
|
1036
|
+
# :api: plugin
|
1028
1037
|
def run
|
1029
1038
|
Merb::BootLoader::LoadClasses.load_file(router_file) if router_file
|
1030
1039
|
|
@@ -1035,6 +1044,8 @@ class Merb::BootLoader::Router < Merb::BootLoader
|
|
1035
1044
|
#
|
1036
1045
|
# ==== Returns
|
1037
1046
|
# String:: The path to the router file if it exists, nil otherwise.
|
1047
|
+
#
|
1048
|
+
# :api: private
|
1038
1049
|
def router_file
|
1039
1050
|
@router_file ||= begin
|
1040
1051
|
if File.file?(router = Merb.dir_for(:router) / Merb.glob_for(:router))
|
@@ -1055,7 +1066,7 @@ class Merb::BootLoader::Templates < Merb::BootLoader
|
|
1055
1066
|
# ==== Returns
|
1056
1067
|
# Array[String]:: The list of template files which were loaded.
|
1057
1068
|
#
|
1058
|
-
#
|
1069
|
+
# :api: plugin
|
1059
1070
|
def run
|
1060
1071
|
template_paths.each do |path|
|
1061
1072
|
Merb::Template.inline_template(File.open(path))
|
@@ -1067,7 +1078,7 @@ class Merb::BootLoader::Templates < Merb::BootLoader
|
|
1067
1078
|
# ==== Returns
|
1068
1079
|
# Array[String]:: All found template files whose basename does not begin with "_".
|
1069
1080
|
#
|
1070
|
-
#
|
1081
|
+
# :api: private
|
1071
1082
|
def template_paths
|
1072
1083
|
extension_glob = "{#{Merb::Template.template_extensions.join(',')}}"
|
1073
1084
|
|
@@ -1110,7 +1121,7 @@ class Merb::BootLoader::MimeTypes < Merb::BootLoader
|
|
1110
1121
|
# ==== Returns
|
1111
1122
|
# nil
|
1112
1123
|
#
|
1113
|
-
#
|
1124
|
+
# :api: plugin
|
1114
1125
|
def self.run
|
1115
1126
|
Merb.add_mime_type(:all, nil, %w[*/*])
|
1116
1127
|
Merb.add_mime_type(:yaml, :to_yaml, %w[application/x-yaml text/yaml], :charset => "utf-8")
|
@@ -1131,7 +1142,7 @@ class Merb::BootLoader::Cookies < Merb::BootLoader
|
|
1131
1142
|
# ==== Returns
|
1132
1143
|
# nil
|
1133
1144
|
#
|
1134
|
-
#
|
1145
|
+
# :api: plugin
|
1135
1146
|
def self.run
|
1136
1147
|
require 'merb-core/dispatch/cookies'
|
1137
1148
|
Merb::Controller.send(:include, Merb::CookiesMixin)
|
@@ -1149,7 +1160,7 @@ class Merb::BootLoader::SetupSession < Merb::BootLoader
|
|
1149
1160
|
# ==== Returns
|
1150
1161
|
# nil
|
1151
1162
|
#
|
1152
|
-
#
|
1163
|
+
# :api: plugin
|
1153
1164
|
def self.run
|
1154
1165
|
# Require all standard session containers.
|
1155
1166
|
Dir[Merb.framework_root / "merb-core" / "dispatch" / "session" / "*.rb"].each do |file|
|
@@ -1193,7 +1204,7 @@ class Merb::BootLoader::SetupStubClasses < Merb::BootLoader
|
|
1193
1204
|
# ==== Returns
|
1194
1205
|
# nil
|
1195
1206
|
#
|
1196
|
-
#
|
1207
|
+
# :api: plugin
|
1197
1208
|
def self.run
|
1198
1209
|
unless defined?(Exceptions)
|
1199
1210
|
Object.class_eval <<-RUBY
|
@@ -1217,7 +1228,7 @@ class Merb::BootLoader::AfterAppLoads < Merb::BootLoader
|
|
1217
1228
|
# ==== Returns
|
1218
1229
|
# nil
|
1219
1230
|
#
|
1220
|
-
#
|
1231
|
+
# :api: plugin
|
1221
1232
|
def self.run
|
1222
1233
|
Merb::BootLoader.after_load_callbacks.each {|x| x.call }
|
1223
1234
|
nil
|
@@ -1231,7 +1242,7 @@ class Merb::BootLoader::ChooseAdapter < Merb::BootLoader
|
|
1231
1242
|
# ==== Returns
|
1232
1243
|
# nil
|
1233
1244
|
#
|
1234
|
-
#
|
1245
|
+
# :api: plugin
|
1235
1246
|
def self.run
|
1236
1247
|
Merb.adapter = Merb::Rack::Adapter.get(Merb::Config[:adapter])
|
1237
1248
|
end
|
@@ -1247,7 +1258,7 @@ class Merb::BootLoader::RackUpApplication < Merb::BootLoader
|
|
1247
1258
|
# ==== Returns
|
1248
1259
|
# nil
|
1249
1260
|
#
|
1250
|
-
#
|
1261
|
+
# :api: plugin
|
1251
1262
|
def self.run
|
1252
1263
|
require 'rack'
|
1253
1264
|
if File.exists?(Merb.dir_for(:config) / "rack.rb")
|
@@ -1283,7 +1294,7 @@ class Merb::BootLoader::ReloadClasses < Merb::BootLoader
|
|
1283
1294
|
# ==== Returns
|
1284
1295
|
# Thread:: The thread executing the block periodically.
|
1285
1296
|
#
|
1286
|
-
#
|
1297
|
+
# :api: private
|
1287
1298
|
def self.every(seconds, &block)
|
1288
1299
|
Thread.new do
|
1289
1300
|
loop do
|
@@ -1302,7 +1313,7 @@ class Merb::BootLoader::ReloadClasses < Merb::BootLoader
|
|
1302
1313
|
# ==== Returns
|
1303
1314
|
# nil
|
1304
1315
|
#
|
1305
|
-
#
|
1316
|
+
# :api: plugin
|
1306
1317
|
def self.run
|
1307
1318
|
return unless Merb::Config[:reload_classes]
|
1308
1319
|
|
@@ -1332,7 +1343,7 @@ class Merb::BootLoader::ReloadClasses < Merb::BootLoader
|
|
1332
1343
|
# ==== Returns
|
1333
1344
|
# nil
|
1334
1345
|
#
|
1335
|
-
#
|
1346
|
+
# :api: private
|
1336
1347
|
def self.reload(paths)
|
1337
1348
|
paths.each do |file|
|
1338
1349
|
next if LoadClasses::MTIMES[file] &&
|