merb-core 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +136 -2
- data/CONTRIBUTORS +6 -0
- data/PUBLIC_CHANGELOG +38 -0
- data/Rakefile +38 -30
- data/lib/merb-core.rb +88 -23
- data/lib/merb-core/bootloader.rb +235 -51
- data/lib/merb-core/config.rb +121 -36
- data/lib/merb-core/controller/abstract_controller.rb +59 -36
- data/lib/merb-core/controller/exceptions.rb +2 -15
- data/lib/merb-core/controller/merb_controller.rb +44 -1
- data/lib/merb-core/controller/mime.rb +4 -0
- data/lib/merb-core/controller/mixins/controller.rb +38 -21
- data/lib/merb-core/controller/mixins/render.rb +44 -29
- data/lib/merb-core/controller/mixins/responder.rb +3 -31
- data/lib/merb-core/controller/template.rb +45 -21
- data/lib/merb-core/core_ext/kernel.rb +60 -32
- data/lib/merb-core/dispatch/default_exception/default_exception.rb +2 -2
- data/lib/merb-core/dispatch/default_exception/views/_css.html.erb +3 -1
- data/lib/merb-core/dispatch/default_exception/views/_javascript.html.erb +71 -67
- data/lib/merb-core/dispatch/default_exception/views/index.html.erb +7 -3
- data/lib/merb-core/dispatch/dispatcher.rb +3 -3
- data/lib/merb-core/dispatch/request.rb +56 -9
- data/lib/merb-core/dispatch/router.rb +159 -133
- data/lib/merb-core/dispatch/router/behavior.rb +462 -703
- data/lib/merb-core/dispatch/router/cached_proc.rb +3 -3
- data/lib/merb-core/dispatch/router/resources.rb +289 -0
- data/lib/merb-core/dispatch/router/route.rb +514 -294
- data/lib/merb-core/dispatch/session.rb +4 -2
- data/lib/merb-core/logger.rb +213 -202
- data/lib/merb-core/plugins.rb +9 -1
- data/lib/merb-core/rack.rb +3 -1
- data/lib/merb-core/rack/adapter.rb +7 -4
- data/lib/merb-core/rack/adapter/abstract.rb +188 -0
- data/lib/merb-core/rack/adapter/ebb.rb +12 -13
- data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -15
- data/lib/merb-core/rack/adapter/irb.rb +3 -2
- data/lib/merb-core/rack/adapter/mongrel.rb +22 -15
- data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +4 -16
- data/lib/merb-core/rack/adapter/thin.rb +21 -22
- data/lib/merb-core/rack/adapter/thin_turbo.rb +4 -11
- data/lib/merb-core/rack/adapter/webrick.rb +54 -18
- data/lib/merb-core/rack/application.rb +4 -4
- data/lib/merb-core/rack/handler/mongrel.rb +12 -13
- data/lib/merb-core/rack/middleware/csrf.rb +1 -1
- data/lib/merb-core/rack/stream_wrapper.rb +41 -0
- data/lib/merb-core/server.rb +157 -90
- data/lib/merb-core/tasks/gem_management.rb +267 -0
- data/lib/merb-core/tasks/merb.rb +1 -0
- data/lib/merb-core/tasks/merb_rake_helper.rb +48 -34
- data/lib/merb-core/tasks/stats.rake +1 -1
- data/lib/merb-core/test.rb +9 -3
- data/lib/merb-core/test/helpers.rb +1 -0
- data/lib/merb-core/test/helpers/mock_request_helper.rb +393 -0
- data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -2
- data/lib/merb-core/test/helpers/request_helper.rb +40 -372
- data/lib/merb-core/test/helpers/route_helper.rb +16 -2
- data/lib/merb-core/test/matchers.rb +1 -0
- data/lib/merb-core/test/matchers/controller_matchers.rb +4 -247
- data/lib/merb-core/test/matchers/request_matchers.rb +140 -0
- data/lib/merb-core/test/matchers/view_matchers.rb +22 -4
- data/lib/merb-core/test/run_specs.rb +118 -26
- data/lib/merb-core/test/test_ext/rspec.rb +181 -0
- data/lib/merb-core/version.rb +1 -9
- metadata +10 -342
- data/docs/bootloading.dox +0 -58
- data/docs/documentation_standards +0 -40
- data/docs/merb-core-call-stack-diagram.mmap +0 -0
- data/docs/merb-core-call-stack-diagram.pdf +0 -0
- data/docs/merb-core-call-stack-diagram.png +0 -0
- data/docs/new_render_api +0 -51
- data/lib/merb-core/vendor/facets.rb +0 -2
- data/lib/merb-core/vendor/facets/dictionary.rb +0 -433
- data/lib/merb-core/vendor/facets/inflect.rb +0 -342
- data/spec/private/config/adapter_spec.rb +0 -32
- data/spec/private/config/config_spec.rb +0 -202
- data/spec/private/config/environment_spec.rb +0 -13
- data/spec/private/config/merb_spec.rb +0 -34
- data/spec/private/config/spec_helper.rb +0 -1
- data/spec/private/core_ext/kernel_spec.rb +0 -159
- data/spec/private/dispatch/bootloader_spec.rb +0 -24
- data/spec/private/dispatch/fixture/app/controllers/application.rb +0 -4
- data/spec/private/dispatch/fixture/app/controllers/exceptions.rb +0 -25
- data/spec/private/dispatch/fixture/app/controllers/foo.rb +0 -19
- data/spec/private/dispatch/fixture/app/helpers/global_helpers.rb +0 -8
- data/spec/private/dispatch/fixture/app/views/exeptions/client_error.html.erb +0 -37
- data/spec/private/dispatch/fixture/app/views/exeptions/internal_server_error.html.erb +0 -216
- data/spec/private/dispatch/fixture/app/views/exeptions/not_acceptable.html.erb +0 -38
- data/spec/private/dispatch/fixture/app/views/exeptions/not_found.html.erb +0 -40
- data/spec/private/dispatch/fixture/app/views/foo/bar.html.erb +0 -0
- data/spec/private/dispatch/fixture/app/views/layout/application.html.erb +0 -11
- data/spec/private/dispatch/fixture/config/black_hole.rb +0 -12
- data/spec/private/dispatch/fixture/config/environments/development.rb +0 -6
- data/spec/private/dispatch/fixture/config/environments/production.rb +0 -5
- data/spec/private/dispatch/fixture/config/environments/test.rb +0 -6
- data/spec/private/dispatch/fixture/config/init.rb +0 -45
- data/spec/private/dispatch/fixture/config/rack.rb +0 -11
- data/spec/private/dispatch/fixture/config/router.rb +0 -35
- data/spec/private/dispatch/fixture/log/merb_test.log +0 -8839
- data/spec/private/dispatch/fixture/public/images/merb.jpg +0 -0
- data/spec/private/dispatch/fixture/public/merb.fcgi +0 -4
- data/spec/private/dispatch/fixture/public/stylesheets/master.css +0 -119
- data/spec/private/dispatch/route_params_spec.rb +0 -23
- data/spec/private/dispatch/spec_helper.rb +0 -1
- data/spec/private/router/behavior_spec.rb +0 -60
- data/spec/private/router/fixture/log/merb_test.log +0 -35
- data/spec/private/router/route_spec.rb +0 -418
- data/spec/private/router/router_spec.rb +0 -183
- data/spec/private/vendor/facets/plural_spec.rb +0 -564
- data/spec/private/vendor/facets/singular_spec.rb +0 -489
- data/spec/public/DEFINITIONS +0 -11
- data/spec/public/abstract_controller/controllers/alt_views/layout/application.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_string_controller_layout.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_template_controller_layout.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/show.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/partial/basic_partial_with_multiple_roots/_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_and_custom_location/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_inherited/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/cousins.rb +0 -41
- data/spec/public/abstract_controller/controllers/display.rb +0 -60
- data/spec/public/abstract_controller/controllers/filters.rb +0 -260
- data/spec/public/abstract_controller/controllers/helpers.rb +0 -41
- data/spec/public/abstract_controller/controllers/partial.rb +0 -121
- data/spec/public/abstract_controller/controllers/render.rb +0 -113
- data/spec/public/abstract_controller/controllers/views/helpers/capture/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/helpers/capture_eq/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/helpers/capture_with_args/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/helpers/concat/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/layout/alt.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/layout/custom.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object_with_action/new.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_app_layout/index.erb +0 -0
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_custom_layout/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/show.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_two_throw_contents/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/another_directory/_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial/_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/basic_partial_with_multiple_roots/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_first.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_second.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/nested_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_in_another_directory/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/_collection.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/_collection.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/_collection.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/_collection.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/_variables.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/_both.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/_with_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/_with_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_partial/_with_partial.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/partial/with_partial/index.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/test_display/foo.html.erb +0 -1
- data/spec/public/abstract_controller/controllers/views/test_render/foo.html.erb +0 -0
- data/spec/public/abstract_controller/controllers/views/wonderful/index.erb +0 -1
- data/spec/public/abstract_controller/display_spec.rb +0 -37
- data/spec/public/abstract_controller/filter_spec.rb +0 -136
- data/spec/public/abstract_controller/helper_spec.rb +0 -21
- data/spec/public/abstract_controller/partial_spec.rb +0 -61
- data/spec/public/abstract_controller/render_spec.rb +0 -90
- data/spec/public/abstract_controller/spec_helper.rb +0 -31
- data/spec/public/boot_loader/boot_loader_spec.rb +0 -33
- data/spec/public/boot_loader/spec_helper.rb +0 -1
- data/spec/public/controller/authentication_spec.rb +0 -174
- data/spec/public/controller/base_spec.rb +0 -88
- data/spec/public/controller/conditional_get_spec.rb +0 -100
- data/spec/public/controller/config/init.rb +0 -6
- data/spec/public/controller/controllers/authentication.rb +0 -74
- data/spec/public/controller/controllers/base.rb +0 -65
- data/spec/public/controller/controllers/conditional_get.rb +0 -35
- data/spec/public/controller/controllers/cookies.rb +0 -36
- data/spec/public/controller/controllers/dispatcher.rb +0 -35
- data/spec/public/controller/controllers/display.rb +0 -118
- data/spec/public/controller/controllers/redirect.rb +0 -36
- data/spec/public/controller/controllers/responder.rb +0 -93
- data/spec/public/controller/controllers/url.rb +0 -7
- data/spec/public/controller/controllers/views/layout/custom.html.erb +0 -1
- data/spec/public/controller/controllers/views/layout/custom_arg.html.erb +0 -1
- data/spec/public/controller/controllers/views/layout/custom_arg.json.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.xml.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.xml.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/no_layout.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template_argument/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/html_default/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/layout/custom.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.xml.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.html.erb +0 -1
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.js.erb +0 -1
- data/spec/public/controller/cookies_spec.rb +0 -95
- data/spec/public/controller/dispatcher_spec.rb +0 -410
- data/spec/public/controller/display_spec.rb +0 -84
- data/spec/public/controller/redirect_spec.rb +0 -33
- data/spec/public/controller/responder_spec.rb +0 -169
- data/spec/public/controller/spec_helper.rb +0 -13
- data/spec/public/controller/url_spec.rb +0 -255
- data/spec/public/core/merb_core_spec.rb +0 -45
- data/spec/public/core_ext/fixtures/core_ext_dependency.rb +0 -2
- data/spec/public/core_ext/kernel_spec.rb +0 -88
- data/spec/public/core_ext/spec_helper.rb +0 -1
- data/spec/public/directory_structure/directory/app/controllers/application.rb +0 -3
- data/spec/public/directory_structure/directory/app/controllers/base.rb +0 -13
- data/spec/public/directory_structure/directory/app/controllers/custom.rb +0 -19
- data/spec/public/directory_structure/directory/app/views/base/template.html.erb +0 -1
- data/spec/public/directory_structure/directory/app/views/wonderful/template.erb +0 -1
- data/spec/public/directory_structure/directory/config/router.rb +0 -3
- data/spec/public/directory_structure/directory/log/merb_test.log +0 -4588
- data/spec/public/directory_structure/directory_spec.rb +0 -43
- data/spec/public/logger/logger_spec.rb +0 -181
- data/spec/public/logger/spec_helper.rb +0 -1
- data/spec/public/rack/conditinal_get_middleware_spec.rb +0 -127
- data/spec/public/rack/csrf_middleware_spec.rb +0 -70
- data/spec/public/rack/rack_middleware_spec.rb +0 -99
- data/spec/public/rack/shared_example_groups.rb +0 -35
- data/spec/public/reloading/directory/app/controllers/application.rb +0 -3
- data/spec/public/reloading/directory/app/controllers/reload.rb +0 -6
- data/spec/public/reloading/directory/config/init.rb +0 -2
- data/spec/public/reloading/directory/log/merb_test.log +0 -288231
- data/spec/public/reloading/reload_spec.rb +0 -103
- data/spec/public/request/multipart_spec.rb +0 -41
- data/spec/public/request/request_spec.rb +0 -250
- data/spec/public/router/default_spec.rb +0 -21
- data/spec/public/router/deferred_spec.rb +0 -22
- data/spec/public/router/fixation_spec.rb +0 -49
- data/spec/public/router/fixture/log/merb_test.log +0 -524
- data/spec/public/router/namespace_spec.rb +0 -113
- data/spec/public/router/nested_matches_spec.rb +0 -97
- data/spec/public/router/nested_resources_spec.rb +0 -41
- data/spec/public/router/resource_spec.rb +0 -37
- data/spec/public/router/resources_spec.rb +0 -82
- data/spec/public/router/spec_helper.rb +0 -90
- data/spec/public/router/special_spec.rb +0 -61
- data/spec/public/router/string_spec.rb +0 -61
- data/spec/public/session/controllers/sessions.rb +0 -56
- data/spec/public/session/cookie_session_spec.rb +0 -73
- data/spec/public/session/memcached_session_spec.rb +0 -31
- data/spec/public/session/memory_session_spec.rb +0 -28
- data/spec/public/session/multiple_sessions_spec.rb +0 -74
- data/spec/public/session/no_session_spec.rb +0 -12
- data/spec/public/session/session_spec.rb +0 -106
- data/spec/public/template/template_spec.rb +0 -104
- data/spec/public/template/templates/error.html.erb +0 -2
- data/spec/public/template/templates/template.html.erb +0 -1
- data/spec/public/template/templates/template.html.myt +0 -1
- data/spec/public/test/controller_matchers_spec.rb +0 -412
- data/spec/public/test/controllers/controller_assertion_mock.rb +0 -7
- data/spec/public/test/controllers/dispatch_controller.rb +0 -11
- data/spec/public/test/controllers/spec_helper_controller.rb +0 -39
- data/spec/public/test/multipart_request_helper_spec.rb +0 -159
- data/spec/public/test/multipart_upload_text_file.txt +0 -1
- data/spec/public/test/request_helper_spec.rb +0 -269
- data/spec/public/test/route_helper_spec.rb +0 -78
- data/spec/public/test/route_matchers_spec.rb +0 -166
- data/spec/public/test/view_helper_spec.rb +0 -96
- data/spec/public/test/view_matchers_spec.rb +0 -183
- data/spec/spec_helper.rb +0 -121
data/CHANGELOG
CHANGED
@@ -1,4 +1,138 @@
|
|
1
|
-
== 0.9.
|
1
|
+
== 0.9.8 "Time Machine" 2008-06-10
|
2
|
+
|
3
|
+
* Pre-release contributors file update.
|
4
|
+
* Nillify Merb.logger first.
|
5
|
+
* Legacy Merb apps log again. And Merb tells you where it logs on boot unless you are testing.
|
6
|
+
* Fixes up RSpec matcher for request helper
|
7
|
+
* remove vestigal @_template_stack variable.
|
8
|
+
* remove rogure require no longer needed
|
9
|
+
* compile templates with preambles to assign locals, support recompiling partial templates if previously unseen locals are provided
|
10
|
+
* Add a note on Dictionary and inflection code to public changelog.
|
11
|
+
* Nuke files that are already part of Extlib.
|
12
|
+
* Update public changelog.
|
13
|
+
* Fixed Merb::BootLoader::Router issue
|
14
|
+
* -core now depends on most recent Extlib
|
15
|
+
* Revert "Added MinimalPrivilege to merb.thor. Thanks namelessjon."
|
16
|
+
* Fixed stats.rake to check if directory exists
|
17
|
+
* Move inflection code and Dictionary to extlib.
|
18
|
+
* Rakefiles should be empty by default (so RSpec is not pushed down test unit users' throat).
|
19
|
+
* Added MinimalPrivilege to merb.thor. Thanks namelessjon.
|
20
|
+
* Added Merb::BootLoader::Router
|
21
|
+
* Improve public specs for logger. Use Mash for log levels.
|
22
|
+
* Untabify logger.rb.
|
23
|
+
* Allow Merb.disable(:signals) to keep Merb from installing any signal handlers.
|
24
|
+
* Added the ability to specify resource actions in the block
|
25
|
+
* Fixed bug where subgems (of meta-gems) weren't reinstalled each time
|
26
|
+
* Added process title reporting as per: LH #517
|
27
|
+
* Making the :key a synonym to :keys for Behavior#resource
|
28
|
+
* Fixing the rspec error when running rake tasks
|
29
|
+
* Cleaned up the specs. Removed any stray pending specs.
|
30
|
+
* Added stacking and redirecting deferred routing blocks.
|
31
|
+
* Removed private/dispatch/route_params_spec.rb
|
32
|
+
* New spec helpers ported over. Old #request helper becomes #mock_request, which uses some mocking and stubbing to set up the request. The new #request API uses no mocking, and has the following API changes:
|
33
|
+
* Removed spec/private/config
|
34
|
+
* Added dependency 'foo', :immediate => true for loading dependencies immediately
|
35
|
+
* call to_s in the csrf middlewre
|
36
|
+
* make StreamWrapper more duck typed to the old body string.
|
37
|
+
* If --log-level or --log is explicitly given, never log to STDOUT, alsways to file
|
38
|
+
* If Merb.env?(:test) we don't need ugly = true spread all over the place
|
39
|
+
* use Proc === @body instead
|
40
|
+
* Bring the console adapter's #url back into action
|
41
|
+
* update specs for new rack stream_wrapper
|
42
|
+
* Updating streaming methods to work on *all* rack adapters.
|
43
|
+
* Make Merb::Config[]= work without calling setup 1st
|
44
|
+
* Default to = 'UTF8' - you can just set this in init.rb if needed
|
45
|
+
* Colorful GemManagement
|
46
|
+
* Removed unused directory under spec.
|
47
|
+
* Reorganized URL generation methods across Controller classes
|
48
|
+
* Added a :singular option to resource route building
|
49
|
+
* merb -k works right
|
50
|
+
* Fixes stupid issue in spec loader
|
51
|
+
* Route matching handles slashes according to the RFC
|
52
|
+
* Added the #resource controller helper for URL generation.
|
53
|
+
* Fixes #503; raise InternalServerError works now.
|
54
|
+
* We shouldn't use minigems explicitly in our code (yet)
|
55
|
+
* Add missing pieces of forking awesomeness.
|
56
|
+
* Executable wrappers use /usr/bin/env again - run them with /path/to/ruby -S if you need a specific Ruby version
|
57
|
+
* Merge in forking branch.
|
58
|
+
* Use trenary operator here.
|
59
|
+
* capture returns return value of passed in block if it is not a template block
|
60
|
+
* Updated PUBLIC_CHANGELOG regarding Merb::RakeHelper
|
61
|
+
* reverts URI generation on requests
|
62
|
+
* Updates full_uri for the changes to the Request#protocol
|
63
|
+
* Reorganized merb-core/tasks/merb to require merb-core/tasks/merb_rake_helper (see merb-gen too)
|
64
|
+
* Cleanup of tasks/merb_rake_helper.rb
|
65
|
+
* Added :gemspec task to Rakefile
|
66
|
+
* Fixed executable wrapper code (for loading local gems)
|
67
|
+
* Added Merb::RakeHelper.install_package method to install packages directly
|
68
|
+
* Merb::RakeHelper now handles local ./bin and GEM_DIR installs correctly
|
69
|
+
* Rakefile now uses Merb::RakeHelper.install
|
70
|
+
* Added GemManagement module - working towards new install/uninstall rake tasks
|
71
|
+
* Removed Merb::BootLoader::ReloadTemplates; Merb::Config[:reload_templates] needs to be set explicitly
|
72
|
+
* Marked Kernel#track_dependency as @api private - updated specs to reflect this
|
73
|
+
* Added warning when specs are run without memcached being available
|
74
|
+
* Refactored Kernel#dependency and #load_dependency to work with Gem::Dependency
|
75
|
+
* Include request uri in routing exception raised by request helpers.
|
76
|
+
* Added require 'thread' explicitly for Mutex to be available
|
77
|
+
* Revert "Initial support for fast redeploys and code reloading via forks."
|
78
|
+
* Revert "Split out the code transaction into a method and do some experimentation with cluster forking."
|
79
|
+
* Revert "Better exit message"
|
80
|
+
* Revert "Initial experiments are a success. TODO: Move the logic out of mongrel and make a proper clustering instead of hardcoding to 4"
|
81
|
+
* Fixes issue people were having
|
82
|
+
* Initial experiments are a success. TODO: Move the logic out of mongrel and make a proper clustering instead of hardcoding to 4
|
83
|
+
* Split out the code transaction into a method and do some experimentation with cluster forking.
|
84
|
+
* Better exit message
|
85
|
+
* Initial support for fast redeploys and code reloading via forks.
|
86
|
+
* Fixed that YAML plugin configuratator wasn't requiring YAML.
|
87
|
+
* Reindent core_ext/kernel.rb.
|
88
|
+
* Register dependencies even after the BootLoader has finished
|
89
|
+
* Fixes Merb::Request#protocol to remove the ://. May Break things in apps if you're checking protocol directly.
|
90
|
+
* Moves actual url generation methods onto the request object from the controller.
|
91
|
+
Also updates the Merb::Request#redirect method to be usable just like the controller version.
|
92
|
+
* Throw the correct error when generating a non existent route.
|
93
|
+
* Modify throw_content to not append. Add append_content for that purpose.
|
94
|
+
* Significant router refactoring and feature development
|
95
|
+
* Run specs in groups
|
96
|
+
* Added more discriptive message when a class fails to load
|
97
|
+
* Optimized Merb::Request.query_parse - fixed silly spec
|
98
|
+
* Update Rack application spec to reflect current affairs.
|
99
|
+
* Document template_for.
|
100
|
+
* Make merb fast again. Also make rake install work from any Ruby via -S
|
101
|
+
* ControllerMixin#html_escape => #escape_html (bring it in line with #escape_xml).
|
102
|
+
* Protected makes no sense for class methods.
|
103
|
+
* Remove dead code from responder.
|
104
|
+
* Adds abstract! and abstract? for controller classes for your inheritance pleasure
|
105
|
+
* Server#add_irb_trap should play nice with ruby-debugger.
|
106
|
+
* Reworked the Server#add_irb_trap to suppress the warnings.
|
107
|
+
* added flag for an IRB trap
|
108
|
+
* Add links to nginx_send_file examples: gist and app at GitHub.
|
109
|
+
* Untabify fixture controller for streaming.
|
110
|
+
* Make Merb::Controller#nginx_send_file more user friendly.
|
111
|
+
* More fine-grained check to see if a local ./bin executable should have been used
|
112
|
+
* Ignore products RDoc generates.
|
113
|
+
* Include RDoc in the gem.
|
114
|
+
* Ignore RDoc template cache.
|
115
|
+
* Remove RDoc template cache from version control.
|
116
|
+
* Session cookies now expire at the end of a browser session again (instead of 2 weeks)
|
117
|
+
* Second attempt: fixed load_dependency (hopefully)
|
118
|
+
* Fixed failing spec regarding 'dependency' change
|
119
|
+
* Make flat! more useful
|
120
|
+
* This rescue is obsolete and is obscuring useful failing information, as well as loading
|
121
|
+
from the system even when you require a specific version that isn't available in the bundled gems.
|
122
|
+
* Clean before installation. Remove *.so and *.log under spec.
|
123
|
+
* Make gem 3 times lighter.
|
124
|
+
* Merb::Release is gone.
|
125
|
+
* Bump up version
|
126
|
+
* Set @_content_type before running transform blocks
|
127
|
+
* sneaky merge failure piece that shouldn't be here
|
128
|
+
* Revert "Add specs for action-level only_provides"
|
129
|
+
* Revert "add specs for does_not_provide"
|
130
|
+
* add specs for does_not_provide
|
131
|
+
* Add specs for action-level only_provides
|
132
|
+
* Make controller.route work
|
133
|
+
|
134
|
+
|
135
|
+
== 0.9.7 "Universe In A Bundle" 2008-13-09
|
2
136
|
|
3
137
|
* Made the post body available to the routing when testing a request.
|
4
138
|
* Better local gems dir detection and end-user feedback
|
@@ -30,7 +164,7 @@
|
|
30
164
|
* Meaninful message when have_xpath matcher is used but libxml-ruby fails to load.
|
31
165
|
* Don't blow up when there are no system paths.
|
32
166
|
|
33
|
-
== 0.9.6 "Therapy session" 2008-09
|
167
|
+
== 0.9.6 "Therapy session" 2008-08-09
|
34
168
|
|
35
169
|
* Merge in simple conditional get support at controller level.
|
36
170
|
* Merged in new bundling (aka freezer) branch
|
data/CONTRIBUTORS
CHANGED
@@ -22,10 +22,12 @@ Daniel Siemssen
|
|
22
22
|
David James
|
23
23
|
Diego Scataglini
|
24
24
|
Dirkjan Bussink
|
25
|
+
Drew Colthorp
|
25
26
|
Dudley Flanders
|
26
27
|
Ezra Zygmuntowicz
|
27
28
|
Fabien Franzen
|
28
29
|
Flea
|
30
|
+
Foy Savas
|
29
31
|
Gabe
|
30
32
|
Geoffrey Grosenbach
|
31
33
|
Goh Toh Chye
|
@@ -57,6 +59,7 @@ Max Lapshin
|
|
57
59
|
Michael D'Auria
|
58
60
|
Michael D. Ivey
|
59
61
|
Michael Holub
|
62
|
+
Michael Klishin
|
60
63
|
Michael Latta
|
61
64
|
Michael S. Klishin
|
62
65
|
Michael Sheakoski
|
@@ -77,6 +80,8 @@ StarTrader
|
|
77
80
|
Steve Tooke
|
78
81
|
Thomas Reynolds
|
79
82
|
Tim Kofol
|
83
|
+
Tyler Hunt
|
84
|
+
Tymon (teamon) Tobolski
|
80
85
|
Wayne E. Seguin
|
81
86
|
Wayne Larsen
|
82
87
|
Wesley Beary
|
@@ -90,5 +95,6 @@ jonas
|
|
90
95
|
jonuts
|
91
96
|
macournoyer
|
92
97
|
mde
|
98
|
+
michael.s.klishin@gmail.com
|
93
99
|
rick
|
94
100
|
wvl
|
data/PUBLIC_CHANGELOG
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
10/06/2008:
|
2
|
+
|
3
|
+
* Use -L option or :log_file or :log_stream in init.rb or env init file
|
4
|
+
to point logger where you want.
|
5
|
+
|
6
|
+
10/05/2008:
|
7
|
+
* Merb does not add spec tasks to Rakefiles list by default. Add
|
8
|
+
require "merb-core/test/tasks/spectasks" in your existing Rakefiles
|
9
|
+
explicitly. This is done so that test unit users do not get spec
|
10
|
+
tasks they do not need down their throat in any merb application,
|
11
|
+
even running on just -core.
|
12
|
+
|
13
|
+
* Dictionary and inflection code are now parts of Extlib library and shared
|
14
|
+
with other frameworks that use it (DataMapper, Halcyon, Mack, etc).
|
15
|
+
|
16
|
+
9/26/2008:
|
17
|
+
* For Merb developers, Rakefile features a new implementation of the :install
|
18
|
+
and :uninstall tasks. These will work with Gems directly, without running
|
19
|
+
the intermediate commands on the shell. This means 'sudo' is now explicitly
|
20
|
+
needed when installing gems system-wide; implicit sudo (prompt) is considered
|
21
|
+
harmful. The new code will write appropriate executable wrappers that feature
|
22
|
+
local gem loading and minigems usage. All gems in -more and -core now use this
|
23
|
+
new (un)install procedure.
|
24
|
+
|
25
|
+
9/25/2008:
|
26
|
+
* Merb::Config[:reload_templates] needs to be set explicitly in
|
27
|
+
config/environments/development.rb - which is true for newly generated apps.
|
28
|
+
Previously Merb.env?(:development) meant that reload_templates was enabled.
|
29
|
+
Since we don't want to depend on Merb.env like that, we're using Merb::Config.
|
30
|
+
|
31
|
+
9/24/2008:
|
32
|
+
* Kernel#dependency and Kernel#load_dependency will now register the requested
|
33
|
+
dependency on Merb::BootLoader::Dependencies.dependencies. Doing so creates a
|
34
|
+
Gem::Dependency instance, which will be returned from these methods.
|
35
|
+
Before, an Array of [name, ver] was returned. Working with Gem::Dependency
|
36
|
+
makes the dependency information more uniform, regardless of the original
|
37
|
+
version requirements.
|
38
|
+
|
1
39
|
9/13/2008:
|
2
40
|
* Merb apps will always give priority to gems that are available locally in
|
3
41
|
Merb.root / gems. Because of the specific load order, you will need to use
|
data/Rakefile
CHANGED
@@ -17,7 +17,6 @@ require __DIR__ + "/tools/annotation_extract"
|
|
17
17
|
include FileUtils
|
18
18
|
|
19
19
|
require "lib/merb-core/version"
|
20
|
-
require "lib/merb-core/test/run_specs"
|
21
20
|
require 'lib/merb-core/tasks/merb_rake_helper'
|
22
21
|
|
23
22
|
##############################################################################
|
@@ -51,14 +50,14 @@ spec = Gem::Specification.new do |s|
|
|
51
50
|
s.description = PROJECT_DESCRIPTION
|
52
51
|
s.executables = %w( merb )
|
53
52
|
s.require_path = "lib"
|
54
|
-
s.files = %w( LICENSE README Rakefile TODO CHANGELOG PUBLIC_CHANGELOG CONTRIBUTORS ) + Dir["{
|
53
|
+
s.files = %w( LICENSE README Rakefile TODO CHANGELOG PUBLIC_CHANGELOG CONTRIBUTORS ) + Dir["{doc/rdoc,bin,lib}/**/*"]
|
55
54
|
|
56
55
|
# rdoc
|
57
56
|
s.has_rdoc = true
|
58
57
|
s.extra_rdoc_files = %w( README LICENSE TODO )
|
59
58
|
|
60
59
|
# Dependencies
|
61
|
-
s.add_dependency "extlib", ">= 0.9.
|
60
|
+
s.add_dependency "extlib", ">= 0.9.7"
|
62
61
|
s.add_dependency "erubis"
|
63
62
|
s.add_dependency "rake"
|
64
63
|
s.add_dependency "json_pure"
|
@@ -81,31 +80,28 @@ Rake::GemPackageTask.new(spec) do |package|
|
|
81
80
|
end
|
82
81
|
|
83
82
|
desc "Run :package and install the resulting .gem"
|
84
|
-
task :install => :
|
85
|
-
|
83
|
+
task :install => :clean do
|
84
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
|
86
85
|
end
|
87
86
|
|
88
87
|
desc "Install Merb with development dependencies"
|
89
|
-
task :dev_install => :
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
desc "Run :package and install the resulting .gem with jruby"
|
94
|
-
task :jinstall => :package do
|
95
|
-
sh jinstall_command(GEM_NAME, GEM_VERSION)
|
96
|
-
end
|
97
|
-
|
98
|
-
desc "Run :package and install the resulting .gem with jruby (development dependencies)"
|
99
|
-
task :jinstall => :package do
|
100
|
-
sh dev_jinstall_command(GEM_NAME, GEM_VERSION)
|
88
|
+
task :dev_install => :clean do
|
89
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION, :development => true)
|
101
90
|
end
|
102
91
|
|
103
92
|
desc "Run :clean and uninstall the .gem"
|
104
93
|
task :uninstall => :clean do
|
105
|
-
|
94
|
+
Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "Create a gemspec file"
|
98
|
+
task :gemspec do
|
99
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
100
|
+
file.puts spec.to_ruby
|
101
|
+
end
|
106
102
|
end
|
107
103
|
|
108
|
-
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache"]
|
104
|
+
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "lib/*.so", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "spec/**/*.log"]
|
109
105
|
|
110
106
|
desc "Run the specs."
|
111
107
|
task :default => :specs
|
@@ -172,7 +168,7 @@ namespace :doc do
|
|
172
168
|
|
173
169
|
desc "rdoc to rubyforge"
|
174
170
|
task :rubyforge do
|
175
|
-
sh %{#{sudo} chmod -R 755 doc} unless windows?
|
171
|
+
sh %{#{Merb::RakeHelper.sudo} chmod -R 755 doc} unless Merb::RakeHelper.windows?
|
176
172
|
sh %{/usr/bin/scp -r -p doc/rdoc/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb}
|
177
173
|
end
|
178
174
|
|
@@ -185,36 +181,48 @@ desc "Run :specs, :rcov"
|
|
185
181
|
task :aok => [:specs, :rcov]
|
186
182
|
|
187
183
|
def setup_specs(name, spec_cmd='spec', run_opts = "-c")
|
184
|
+
except = []
|
185
|
+
except += Dir["spec/**/memcache*_spec.rb"] if ENV['MEMCACHED'] == 'no'
|
186
|
+
|
187
|
+
public_globs = Dir["#{Dir.pwd}/spec/public/**/*_spec.rb"]
|
188
|
+
|
189
|
+
private_globs = Dir["#{Dir.pwd}/spec/private/**/*_spec.rb"]
|
190
|
+
|
188
191
|
desc "Run all specs (#{name})"
|
189
192
|
task "specs:#{name}" do
|
190
|
-
|
191
|
-
|
192
|
-
run_specs(
|
193
|
+
require "lib/merb-core/test/run_specs"
|
194
|
+
globs = public_globs + private_globs
|
195
|
+
run_specs(globs, spec_cmd, ENV['RSPEC_OPTS'] || run_opts, except)
|
193
196
|
end
|
194
197
|
|
195
198
|
desc "Run private specs (#{name})"
|
196
199
|
task "specs:#{name}:private" do
|
197
|
-
|
200
|
+
require "lib/merb-core/test/run_specs"
|
201
|
+
run_specs(private_globs, spec_cmd, ENV['RSPEC_OPTS'] || run_opts)
|
198
202
|
end
|
199
203
|
|
200
204
|
desc "Run public specs (#{name})"
|
201
205
|
task "specs:#{name}:public" do
|
202
|
-
|
206
|
+
require "lib/merb-core/test/run_specs"
|
207
|
+
run_specs(public_globs, spec_cmd, ENV['RSPEC_OPTS'] || run_opts)
|
203
208
|
end
|
204
209
|
|
205
210
|
# With profiling formatter
|
206
211
|
desc "Run all specs (#{name}) with profiling formatter"
|
207
212
|
task "specs:#{name}_profiled" do
|
213
|
+
require "lib/merb-core/test/run_specs"
|
208
214
|
run_specs("spec/**/*_spec.rb", spec_cmd, "-c -f o")
|
209
215
|
end
|
210
216
|
|
211
217
|
desc "Run private specs (#{name}) with profiling formatter"
|
212
218
|
task "specs:#{name}_profiled:private" do
|
219
|
+
require "lib/merb-core/test/run_specs"
|
213
220
|
run_specs("spec/private/**/*_spec.rb", spec_cmd, "-c -f o")
|
214
221
|
end
|
215
222
|
|
216
223
|
desc "Run public specs (#{name}) with profiling formatter"
|
217
224
|
task "specs:#{name}_profiled:public" do
|
225
|
+
require "lib/merb-core/test/run_specs"
|
218
226
|
run_specs("spec/public/**/*_spec.rb", spec_cmd, "-c -f o")
|
219
227
|
end
|
220
228
|
end
|
@@ -222,9 +230,9 @@ end
|
|
222
230
|
setup_specs("mri", "spec")
|
223
231
|
setup_specs("jruby", "jruby -S spec")
|
224
232
|
|
225
|
-
task "specs"
|
226
|
-
task "specs:private"
|
227
|
-
task "specs:public"
|
233
|
+
task "specs" => ["specs:mri"]
|
234
|
+
task "specs:private" => ["specs:mri:private"]
|
235
|
+
task "specs:public" => ["specs:mri:public"]
|
228
236
|
|
229
237
|
desc "Run coverage suite"
|
230
238
|
task :rcov do
|
@@ -281,7 +289,7 @@ task :check_syntax do
|
|
281
289
|
end
|
282
290
|
|
283
291
|
##############################################################################
|
284
|
-
# SVN
|
292
|
+
# Git and SVN
|
285
293
|
##############################################################################
|
286
294
|
namespace :repo do
|
287
295
|
|
@@ -328,7 +336,7 @@ def contributors(since_release = nil)
|
|
328
336
|
git_log(since_release).split("\n").uniq.sort
|
329
337
|
end
|
330
338
|
|
331
|
-
PREVIOUS_RELEASE = '0.9.
|
339
|
+
PREVIOUS_RELEASE = '0.9.7'
|
332
340
|
namespace :history do
|
333
341
|
namespace :update do
|
334
342
|
desc "updates contributors list"
|
data/lib/merb-core.rb
CHANGED
@@ -7,20 +7,22 @@ require 'rubygems'
|
|
7
7
|
root_key = %w[-m --merb-root].detect { |o| ARGV.index(o) }
|
8
8
|
root = ARGV[ARGV.index(root_key) + 1] if root_key
|
9
9
|
root = root.to_a.empty? ? Dir.getwd : root
|
10
|
-
if File.directory?(gems_dir = File.join(root, 'gems'))
|
10
|
+
if File.directory?(gems_dir = File.join(root, 'gems')) && !$BUNDLE
|
11
11
|
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(gems_dir)
|
12
12
|
# Warn if local merb-core is available but not loaded.
|
13
|
-
if
|
13
|
+
if File.expand_path($0).index(root) != 0 &&
|
14
14
|
(local_mc = Dir[File.join(gems_dir, 'specifications', 'merb-core-*.gemspec')].last)
|
15
|
-
puts "Warning: please use bin
|
15
|
+
puts "Warning: please use bin/#{File.basename($0)} to load #{File.basename(local_mc, '.gemspec')} from ./gems"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
require 'thread'
|
19
20
|
require 'set'
|
20
21
|
require 'fileutils'
|
21
22
|
require 'socket'
|
22
23
|
require 'pathname'
|
23
24
|
require "extlib"
|
25
|
+
require "extlib/dictionary"
|
24
26
|
|
25
27
|
__DIR__ = File.dirname(__FILE__)
|
26
28
|
|
@@ -28,13 +30,12 @@ $LOAD_PATH.unshift __DIR__ unless
|
|
28
30
|
$LOAD_PATH.include?(__DIR__) ||
|
29
31
|
$LOAD_PATH.include?(File.expand_path(__DIR__))
|
30
32
|
|
31
|
-
require 'merb-core' / 'vendor' / 'facets'
|
32
|
-
|
33
33
|
module Merb
|
34
34
|
# Create stub module for global controller helpers.
|
35
35
|
module GlobalHelpers; end
|
36
36
|
|
37
37
|
class << self
|
38
|
+
attr_accessor :exiting
|
38
39
|
|
39
40
|
# Merge environment settings
|
40
41
|
# Can allow you to have a "localdev" that runs like your "development"
|
@@ -84,7 +85,6 @@ module Merb
|
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
87
|
-
|
88
88
|
# Startup Merb by setting up the Config and starting the server.
|
89
89
|
# This is where Merb application environment and root path are set.
|
90
90
|
#
|
@@ -92,18 +92,24 @@ module Merb
|
|
92
92
|
# argv<String, Hash>::
|
93
93
|
# The config arguments to start Merb with. Defaults to +ARGV+.
|
94
94
|
def start(argv=ARGV)
|
95
|
+
# Hardcode the log stream to STDOUT
|
96
|
+
Merb::Config[:log_stream] = STDOUT
|
95
97
|
if Hash === argv
|
96
98
|
Merb::Config.setup(argv)
|
97
99
|
else
|
98
100
|
Merb::Config.parse_args(argv)
|
99
101
|
end
|
102
|
+
Merb::Config[:log_stream] = STDOUT
|
103
|
+
|
100
104
|
Merb.environment = Merb::Config[:environment]
|
101
105
|
Merb.root = Merb::Config[:merb_root]
|
102
106
|
case Merb::Config[:action]
|
103
107
|
when :kill
|
104
|
-
Merb::Server.kill(Merb::Config[:port],
|
108
|
+
Merb::Server.kill(Merb::Config[:port], 2)
|
105
109
|
when :kill_9
|
106
110
|
Merb::Server.kill(Merb::Config[:port], 9)
|
111
|
+
when :fast_deploy
|
112
|
+
Merb::Server.kill("main", "HUP")
|
107
113
|
else
|
108
114
|
Merb::Server.start(Merb::Config[:port], Merb::Config[:cluster])
|
109
115
|
end
|
@@ -262,21 +268,43 @@ module Merb
|
|
262
268
|
end
|
263
269
|
|
264
270
|
# Logger settings
|
265
|
-
|
271
|
+
def logger
|
272
|
+
Thread.current[:merb_logger] ||= Merb::Logger.new
|
273
|
+
end
|
274
|
+
|
275
|
+
def logger=(obj)
|
276
|
+
unless obj
|
277
|
+
Thread.current[:merb_logger] = nil
|
278
|
+
end
|
279
|
+
end
|
266
280
|
|
267
281
|
# ==== Returns
|
268
282
|
# String::
|
269
283
|
# The path to the log file. If this Merb instance is running as a daemon
|
270
284
|
# this will return +STDOUT+.
|
271
|
-
def
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
285
|
+
def log_stream(port = "main")
|
286
|
+
@streams ||= {}
|
287
|
+
@streams[port] ||= begin
|
288
|
+
log = if Merb.testing?
|
289
|
+
log_path / "merb_test.log"
|
290
|
+
elsif !Merb::Config[:daemonize] && !Merb::Config[:force_logging]
|
291
|
+
STDOUT
|
292
|
+
else
|
293
|
+
log_path / "merb.#{port}.log"
|
294
|
+
end
|
295
|
+
|
296
|
+
if log.is_a?(IO)
|
297
|
+
stream = log
|
298
|
+
elsif File.exist?(log)
|
299
|
+
stream = File.open(log, (File::WRONLY | File::APPEND))
|
300
|
+
else
|
301
|
+
FileUtils.mkdir_p(File.dirname(log))
|
302
|
+
stream = File.open(log, (File::WRONLY | File::APPEND | File::CREAT))
|
303
|
+
stream.write("#{Time.now.httpdate} #{Merb::Config[:log_delimiter]} " \
|
304
|
+
"info #{Merb::Config[:log_delimiter]} Logfile created\n")
|
305
|
+
end
|
306
|
+
stream.sync = true
|
307
|
+
stream
|
280
308
|
end
|
281
309
|
end
|
282
310
|
|
@@ -321,13 +349,41 @@ module Merb
|
|
321
349
|
# r<Merb::Router::Behavior>::
|
322
350
|
# The root behavior upon which new routes can be added.
|
323
351
|
def flat!(framework = {})
|
324
|
-
|
352
|
+
default = {
|
353
|
+
:framework => { :public => [Merb.root / "public", nil] },
|
354
|
+
:session_store => 'none',
|
355
|
+
:exception_details => true
|
356
|
+
}
|
357
|
+
|
358
|
+
Merb::Config[:framework] = default.merge(framework)
|
325
359
|
|
326
360
|
Merb::Router.prepare do |r|
|
327
361
|
yield(r) if block_given?
|
328
362
|
r.default_routes
|
329
363
|
end
|
330
364
|
end
|
365
|
+
|
366
|
+
def fatal!(str, e = nil)
|
367
|
+
Merb.logger.fatal!
|
368
|
+
Merb.logger.fatal!("\e[1;31;47mFATAL: #{str}\e[0m")
|
369
|
+
Merb.logger.fatal!
|
370
|
+
|
371
|
+
print_colorized_backtrace(e) if e && Merb::Config[:verbose]
|
372
|
+
exit(1)
|
373
|
+
end
|
374
|
+
|
375
|
+
def print_colorized_backtrace(e)
|
376
|
+
e.backtrace.map! do |line|
|
377
|
+
line.gsub!(/^#{Merb.framework_root}/, "\e[34mFRAMEWORK_ROOT\e[31m")
|
378
|
+
end
|
379
|
+
|
380
|
+
Merb.logger.fatal! "\e[34mFRAMEWORK_ROOT\e[0m = #{Merb.framework_root}"
|
381
|
+
Merb.logger.fatal!
|
382
|
+
Merb.logger.fatal! "\e[31m#{e.class}: \e[1;31;47m#{e.message}\e[0m"
|
383
|
+
e.backtrace.each do |line|
|
384
|
+
Merb.logger.fatal! "\e[31m#{line}\e[0m"
|
385
|
+
end
|
386
|
+
end
|
331
387
|
|
332
388
|
# Set up default variables under Merb
|
333
389
|
attr_accessor :klass_hashes, :orm, :test_framework, :template_engine
|
@@ -468,7 +524,7 @@ module Merb
|
|
468
524
|
# Boolean:: True if Merb environment is testing for instance,
|
469
525
|
# Merb is running with RSpec, Test::Unit of other testing facility.
|
470
526
|
def testing?
|
471
|
-
$TESTING || Merb::Config[:testing]
|
527
|
+
$TESTING ||= env?(:test) || Merb::Config[:testing]
|
472
528
|
end
|
473
529
|
|
474
530
|
# Ask the question about which environment you're in.
|
@@ -544,7 +600,7 @@ module Merb
|
|
544
600
|
# Recommended way to find out what paths Rakefiles
|
545
601
|
# are loaded from.
|
546
602
|
def rakefiles
|
547
|
-
@rakefiles ||= [
|
603
|
+
@rakefiles ||= []
|
548
604
|
end
|
549
605
|
|
550
606
|
# === Returns
|
@@ -558,12 +614,12 @@ module Merb
|
|
558
614
|
end
|
559
615
|
|
560
616
|
# ==== Parameters
|
561
|
-
# *rakefiles:: Rakefile
|
617
|
+
# *rakefiles:: Rakefile paths to add to the list of Rakefiles.
|
562
618
|
#
|
563
619
|
# ==== Notes
|
564
620
|
# Recommended way to add Rakefiles load path for plugins authors.
|
565
621
|
def add_rakefiles(*rakefiles)
|
566
|
-
@rakefiles ||= [
|
622
|
+
@rakefiles ||= []
|
567
623
|
@rakefiles += rakefiles
|
568
624
|
end
|
569
625
|
|
@@ -577,6 +633,15 @@ module Merb
|
|
577
633
|
@generators += generators
|
578
634
|
end
|
579
635
|
|
636
|
+
# Install a signal handler for a given signal unless signals have
|
637
|
+
# been disabled with Merb.disable(:signals)
|
638
|
+
# ==== Parameters
|
639
|
+
# signal:: The name of the signal to install a handler for.
|
640
|
+
# &block:: The block to be run when the given signal is received.
|
641
|
+
def trap(signal, &block)
|
642
|
+
Kernel.trap(signal, &block) unless Merb.disabled?(:signals)
|
643
|
+
end
|
644
|
+
|
580
645
|
end
|
581
646
|
end
|
582
647
|
|
@@ -588,4 +653,4 @@ require 'merb-core/version'
|
|
588
653
|
require 'merb-core/controller/mime'
|
589
654
|
|
590
655
|
# Set the environment if it hasn't already been set.
|
591
|
-
Merb.environment ||= ENV['MERB_ENV'] || Merb::Config[:environment] || (Merb.testing? ? 'test' : 'development')
|
656
|
+
Merb.environment ||= ENV['MERB_ENV'] || Merb::Config[:environment] || (Merb.testing? ? 'test' : 'development')
|