rad_core 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -3
- data/lib/components/config.rb +6 -0
- data/lib/components/controller.rb +5 -0
- data/lib/components/controller.yml +3 -0
- data/lib/components/conveyors.rb +7 -0
- data/lib/components/environment.rb +5 -0
- data/lib/components/environment.yml +3 -0
- data/lib/components/flash.rb +5 -0
- data/lib/components/html.rb +4 -0
- data/lib/components/html.yml +3 -0
- data/lib/components/http.rb +6 -0
- data/lib/components/http.yml +13 -0
- data/lib/components/logger.rb +5 -0
- data/lib/components/mailer.rb +9 -0
- data/lib/components/remote.rb +4 -0
- data/lib/components/router.rb +13 -0
- data/lib/components/router.yml +2 -0
- data/lib/components/template.rb +8 -0
- data/lib/components/template.yml +1 -0
- data/lib/components/web.rb +8 -0
- data/lib/components/workspace.rb +1 -0
- data/lib/rad/{support → _support}/active_support/locales/en/actionpack.yml +0 -0
- data/lib/rad/{support → _support}/active_support/locales/en/activesupport.yml +0 -0
- data/lib/rad/_support/active_support/locales/ru/actionview.yml +162 -0
- data/lib/rad/_support/active_support/locales/ru/activesupport.yml +16 -0
- data/lib/rad/_support/active_support/locales/ru/datetime.yml +49 -0
- data/lib/rad/{support → _support}/active_support/micelaneous.rb +0 -0
- data/lib/rad/{support → _support}/active_support/time.rb +0 -0
- data/lib/rad/{support → _support}/active_support.rb +14 -2
- data/lib/rad/{support → _support}/addressable.rb +0 -0
- data/lib/rad/_support/callbacks.rb +166 -0
- data/lib/rad/_support/class_loader.rb +9 -0
- data/lib/rad/_support/encoding.rb +3 -0
- data/lib/rad/_support/exception.rb +45 -0
- data/lib/rad/_support/extensions.rb +20 -0
- data/lib/rad/_support/filters.rb +32 -0
- data/lib/rad/{support → _support}/hacks_and_fixes.rb +0 -0
- data/lib/rad/{support → _support}/mime.rb +6 -0
- data/lib/rad/{support → _support}/module.rb +7 -9
- data/lib/rad/_support/require.rb +62 -0
- data/lib/rad/{support → _support}/rson.rb +0 -0
- data/lib/rad/{support → _support}/ruby_ext_with_active_support.rb +0 -0
- data/lib/rad/{support → _support}/string.rb +9 -1
- data/lib/rad/controller/_abstract/micelaneous.rb +27 -0
- data/lib/rad/controller/_abstract/render.rb +159 -0
- data/lib/rad/controller/_abstract/responder.rb +13 -0
- data/lib/rad/controller/_abstract.rb +37 -0
- data/lib/rad/controller/_context.rb +15 -0
- data/lib/rad/controller/_http.rb +50 -0
- data/lib/rad/controller/_require.rb +19 -0
- data/lib/rad/controller/abstract.rb +1 -0
- data/lib/rad/controller/context.rb +1 -0
- data/lib/rad/controller/http.rb +1 -0
- data/lib/rad/controller/processors/controller_caller.rb +22 -24
- data/lib/rad/controller/processors/controller_error_handling.rb +46 -48
- data/lib/rad/controller/processors/controller_logger.rb +7 -9
- data/lib/rad/controller.rb +1 -28
- data/lib/rad/conveyors/_conveyor.rb +73 -0
- data/lib/rad/conveyors/_conveyors.rb +19 -0
- data/lib/rad/conveyors/_params.rb +10 -0
- data/lib/rad/conveyors/_processor.rb +13 -0
- data/lib/rad/conveyors/_require.rb +10 -0
- data/lib/rad/conveyors/_workspace.rb +34 -0
- data/lib/rad/conveyors/params.rb +1 -0
- data/lib/rad/conveyors/processor.rb +1 -0
- data/lib/rad/conveyors/processors/conveyor_logger.rb +23 -0
- data/lib/rad/conveyors/workspace.rb +1 -0
- data/lib/rad/conveyors.rb +1 -0
- data/lib/rad/core_web/_controller_micelaneous_helper.rb +17 -0
- data/lib/rad/core_web/_require.rb +25 -0
- data/lib/rad/core_web/_router/abstract_routing_helper.rb +20 -0
- data/lib/rad/core_web/_router/controller_routing_helper.rb +56 -0
- data/lib/rad/core_web/_router/view_routing_helper.rb +57 -0
- data/lib/rad/environment/_config.rb +27 -0
- data/lib/rad/environment/_environment.rb +17 -0
- data/lib/rad/environment/_files_helper.rb +55 -0
- data/lib/rad/environment/_logger.rb +53 -0
- data/lib/rad/environment/_require.rb +24 -0
- data/lib/rad/environment/config.rb +1 -111
- data/lib/rad/environment.rb +1 -55
- data/lib/{rad_core → rad}/gems.rb +2 -3
- data/lib/rad/html/_flash.rb +40 -0
- data/lib/rad/html/_helpers/basic_html_helper.rb +72 -0
- data/lib/rad/html/_helpers/flash_helper.rb +3 -0
- data/lib/rad/html/_helpers/form_helper.rb +114 -0
- data/lib/rad/html/_helpers/html_helper.rb +3 -0
- data/lib/rad/html/_helpers/javascript_helper.rb +27 -0
- data/lib/rad/html/_helpers/model_helper.rb +143 -0
- data/lib/rad/html/_require.rb +15 -0
- data/lib/rad/html/processors/prepare_flash.rb +22 -23
- data/lib/rad/html/processors/scoped_params.rb +18 -21
- data/lib/rad/html.rb +1 -26
- data/lib/rad/http/_http.rb +11 -0
- data/lib/rad/http/_http_adapter.rb +44 -0
- data/lib/rad/http/_request.rb +50 -0
- data/lib/rad/http/_require.rb +33 -0
- data/lib/rad/http/_response.rb +84 -0
- data/lib/rad/http/{support → _support}/rack/fixes.rb +0 -0
- data/lib/rad/http/_support/rack/rack_adapter.rb +57 -0
- data/lib/rad/http/processors/evaluate_format.rb +16 -19
- data/lib/rad/http/processors/http_logger.rb +10 -12
- data/lib/rad/http/processors/http_writer.rb +24 -26
- data/lib/rad/http/processors/prepare_params.rb +19 -18
- data/lib/rad/http/request.rb +1 -0
- data/lib/rad/http/response.rb +1 -0
- data/lib/rad/http.rb +1 -48
- data/lib/rad/mailer/_letter.rb +28 -0
- data/lib/rad/mailer/_mailer.rb +13 -0
- data/lib/rad/mailer/_mailer_controller.rb +38 -0
- data/lib/rad/mailer/_require.rb +7 -0
- data/lib/rad/mailer/mailer_controller.rb +1 -0
- data/lib/rad/mailer/processors/letter_builder.rb +34 -0
- data/lib/rad/mailer.rb +1 -0
- data/lib/rad/profiles/mailer.rb +5 -0
- data/lib/rad/profiles/web.rb +29 -52
- data/lib/rad/remote/_remote_controller.rb +9 -0
- data/lib/rad/remote/_require.rb +6 -0
- data/lib/rad/remote/processors/remote_caller.rb +44 -46
- data/lib/rad/remote/processors/remote_logger.rb +8 -10
- data/lib/rad/remote/remote_controller.rb +1 -0
- data/lib/rad/remote.rb +1 -9
- data/lib/rad/router/_abstract_router.rb +50 -0
- data/lib/rad/router/_alias_router.rb +124 -0
- data/lib/rad/router/_basic_router.rb +72 -0
- data/lib/rad/router/_configurator.rb +19 -0
- data/lib/rad/router/_core_routing_helper.rb +39 -0
- data/lib/rad/router/_default_format_processor.rb +10 -0
- data/lib/rad/router/_object_router.rb +184 -0
- data/lib/rad/router/_require.rb +31 -0
- data/lib/rad/router/_restful_router.rb +124 -0
- data/lib/rad/router/_router.rb +294 -0
- data/lib/rad/router/_simple_router.rb +21 -0
- data/lib/rad/router/abstract_router.rb +1 -0
- data/lib/rad/router/alias_router.rb +1 -0
- data/lib/rad/router/configurator.rb +1 -0
- data/lib/rad/router/micelaneous_router.rb +1 -0
- data/lib/rad/router/object_router.rb +1 -0
- data/lib/rad/router/processors/router.rb +23 -0
- data/lib/rad/router/restful_router.rb +1 -0
- data/lib/rad/{html/include_into_controller.rb → router/simple_router.rb} +0 -0
- data/lib/rad/router.rb +1 -29
- data/lib/rad/spec/controller.rb +20 -11
- data/lib/rad/spec/environment.rb +22 -38
- data/lib/rad/spec/http.rb +13 -86
- data/lib/rad/spec/http_controller.rb +105 -0
- data/lib/rad/spec/mailer.rb +27 -0
- data/lib/rad/spec/remote.rb +2 -2
- data/lib/rad/spec/router.rb +9 -11
- data/lib/rad/spec/template.rb +8 -2
- data/lib/rad/spec/xhtml.rb +0 -2
- data/lib/rad/spec.rb +4 -2
- data/lib/rad/template/_context.rb +92 -0
- data/lib/rad/template/_relative_path_resolver.rb +8 -0
- data/lib/rad/template/_require.rb +15 -0
- data/lib/rad/template/{support → _support}/tilt.rb +0 -0
- data/lib/rad/template/{support → _support}/tilt_fixes.rb +0 -0
- data/lib/rad/template/_template.rb +175 -0
- data/lib/rad/template/template_context.rb +1 -62
- data/lib/rad/template.rb +1 -25
- data/lib/rad.rb +8 -0
- data/readme.md +40 -12
- data/spec/controller/{abstract_controller_spec → abstract_spec}/views/OperationsOrderSpec/action.erb +0 -0
- data/spec/controller/{abstract_controller_spec → abstract_spec}/views/ViewVariablesSpec/action.erb +0 -0
- data/spec/controller/abstract_spec.rb +126 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/NamespaceSpec/ClassSpec}/show.erb +0 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/item_spec}/actions.erb +0 -0
- data/spec/controller/{controller_context_spec/views/NamespaceSpec/ClassSpec → context_spec/views/item_spec}/show.erb +0 -0
- data/spec/controller/{controller_context_spec/views/ItemSpec → context_spec/views/item_spec}/update.erb +0 -0
- data/spec/controller/{controller_context_spec → context_spec}/views/namespace_spec/class_spec/update.erb +0 -0
- data/spec/controller/{controller_context_spec/views/PageSpec → context_spec/views/page_spec}/actions.erb +0 -0
- data/spec/controller/{controller_context_spec/views/PageSpec → context_spec/views/page_spec}/show.erb +0 -0
- data/spec/controller/context_spec.rb +123 -0
- data/spec/controller/error_handling_spec.rb +21 -27
- data/spec/controller/{controller_helper_spec → helper_spec}/views/HelperMethodSpec/action.erb +0 -0
- data/spec/controller/{controller_helper_spec → helper_spec}/views/HelperSpec/action.erb +0 -0
- data/spec/controller/{controller_helper_spec.rb → helper_spec.rb} +7 -13
- data/spec/controller/{http_controller_spec.rb → http_spec.rb} +17 -23
- data/spec/controller/{controller_render_spec/views/AlreadyRenderedSpec → render_spec/views/already_rendered_spec}/action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AlreadyRenderedSpec → render_spec/views/already_rendered_spec}/custom_template.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AnotherActionSpec → render_spec/views/another_action_spec}/another_action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/AnotherLayout → render_spec/views/another_layout}/action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/ForbidPartialAsActionSpec → render_spec/views/forbid_partial_as_action_spec}/_action.erb +0 -0
- data/spec/controller/{controller_render_spec/views/FormatSpec → render_spec/views/format_spec}/action.html.erb +0 -0
- data/spec/controller/{controller_render_spec/views/FormatSpec → render_spec/views/format_spec}/action.js.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutFiltersSpec → render_spec/views/layout_filters_spec}/action_with_layout.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutFiltersSpec → render_spec/views/layout_filters_spec}/action_without_layout.erb +0 -0
- data/spec/controller/{controller_render_spec/views/LayoutSpec → render_spec/views/layout_spec}/action.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/admin.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/app.html.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/layouts/app.js.erb +0 -0
- data/spec/controller/{controller_render_spec/views/MultipleActions → render_spec/views/multiple_actions}/actions.haml +0 -0
- data/spec/controller/render_spec/views/relative_spec/a/form.erb +1 -0
- data/spec/controller/render_spec/views/relative_spec/a/show.erb +1 -0
- data/spec/controller/render_spec/views/relative_spec/b/form.erb +1 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/some_template.erb +0 -0
- data/spec/controller/{controller_render_spec → render_spec}/views/standalone.html.erb +0 -0
- data/spec/controller/{controller_render_spec.rb → render_spec.rb} +37 -27
- data/spec/{conveyor/conveyor_spec.rb → conveyors/conveyors_spec.rb} +36 -14
- data/spec/environment/config_spec.rb +13 -21
- data/spec/environment/environment_spec.rb +14 -41
- data/spec/environment/logger_spec.rb +4 -13
- data/spec/environment/minimal_app_spec/app.rb +1 -1
- data/spec/environment/minimal_app_spec.rb +12 -14
- data/spec/environment/standard_app_spec/app/lib/app/init.rb +1 -1
- data/spec/environment/standard_app_spec/plugin_a/lib/plugin_a/init.rb +1 -1
- data/spec/environment/standard_app_spec.rb +17 -25
- data/spec/html/basic_html_helper_spec.rb +7 -4
- data/spec/html/form_helper_spec.rb +5 -5
- data/spec/html/javascript_helper_spec.rb +9 -5
- data/spec/html/model_helper_spec.rb +9 -6
- data/spec/html/scoped_params_spec.rb +2 -2
- data/spec/html/spec_helper.rb +16 -24
- data/spec/http/http_spec.rb +14 -35
- data/spec/http/micelaneous_spec.rb +3 -3
- data/spec/{mail → mailer}/mail_controller_spec/views/body_template_spec/signup.erb +0 -0
- data/spec/{mail → mailer}/mail_controller_spec.rb +36 -12
- data/spec/mailer/spec_helper.rb +5 -0
- data/spec/remote/remote_spec.rb +23 -8
- data/spec/router/alias_router_spec.rb +29 -30
- data/spec/router/basic_router_spec.rb +44 -0
- data/spec/router/configurator_spec.rb +9 -6
- data/spec/router/integration_spec.rb +10 -7
- data/spec/router/object_router_spec.rb +186 -0
- data/spec/router/persistent_params_spec.rb +4 -4
- data/spec/router/restful_router_spec.rb +61 -53
- data/spec/router/{basic_spec.rb → router_spec.rb} +26 -23
- data/spec/router/routing_helper_spec.rb +5 -6
- data/spec/spec_helper.rb +4 -0
- data/spec/support/callbacks_spec.rb +1 -1
- data/spec/support/filters_spec.rb +2 -2
- data/spec/support/spec_helper.rb +1 -1
- data/spec/template/template_spec/views/format_for_partials/dialog.js.erb +1 -1
- data/spec/template/template_spec/views/nested/format/a.erb +1 -1
- data/spec/template/template_spec/views/nested/format/b.js.erb +1 -0
- data/spec/template/template_spec/views/nesting_format/dialog.js.erb +1 -1
- data/spec/template/template_spec.rb +62 -48
- data/spec/template/tilt_spec/views/concat_and_capture.erb +1 -1
- data/spec/template/tilt_spec/views/concat_and_capture.haml +1 -1
- data/spec/template/tilt_spec.rb +17 -19
- data/spec/{integration → web}/basic_spec/views/smoke_test_spec/action.erb +0 -0
- data/spec/{integration → web}/basic_spec.rb +31 -12
- data/spec/{integration → web}/controller_routing_helper_spec.rb +13 -11
- data/spec/{integration → web}/flash_spec.rb +57 -42
- data/spec/{integration → web}/spec_helper_spec.rb +11 -10
- data/spec/{integration → web}/view_routing_helper_spec.rb +44 -36
- metadata +338 -318
- data/lib/rad/controller/abstract_controller/micelaneous.rb +0 -31
- data/lib/rad/controller/abstract_controller/render.rb +0 -160
- data/lib/rad/controller/abstract_controller/responder.rb +0 -17
- data/lib/rad/controller/abstract_controller.rb +0 -64
- data/lib/rad/controller/controller_context.rb +0 -15
- data/lib/rad/controller/http_controller.rb +0 -48
- data/lib/rad/conveyor/conveyor.rb +0 -74
- data/lib/rad/conveyor/conveyors.rb +0 -20
- data/lib/rad/conveyor/params.rb +0 -14
- data/lib/rad/conveyor/processor.rb +0 -68
- data/lib/rad/conveyor/processors/conveyor_logger.rb +0 -25
- data/lib/rad/conveyor/workspace.rb +0 -36
- data/lib/rad/conveyor.rb +0 -29
- data/lib/rad/environment/dependency_resolver.rb +0 -107
- data/lib/rad/environment/environment.rb +0 -29
- data/lib/rad/environment/files_helper.rb +0 -55
- data/lib/rad/environment/logger.rb +0 -21
- data/lib/rad/html/flash.rb +0 -42
- data/lib/rad/html/helpers/basic_html_helper.rb +0 -83
- data/lib/rad/html/helpers/flash_helper.rb +0 -5
- data/lib/rad/html/helpers/form_helper.rb +0 -115
- data/lib/rad/html/helpers/html_helper.rb +0 -5
- data/lib/rad/html/helpers/javascript_helper.rb +0 -18
- data/lib/rad/html/helpers/model_helper.rb +0 -135
- data/lib/rad/http/http.rb +0 -21
- data/lib/rad/http/http_adapter.rb +0 -36
- data/lib/rad/http/middleware/static_files.rb +0 -21
- data/lib/rad/http/support/rack/rack_adapter.rb +0 -67
- data/lib/rad/http/support/rack/request.rb +0 -42
- data/lib/rad/http/support/rack/response.rb +0 -86
- data/lib/rad/integration/controller_micelaneous_helper.rb +0 -19
- data/lib/rad/integration/router/abstract_routing_helper.rb +0 -22
- data/lib/rad/integration/router/controller_routing_helper.rb +0 -58
- data/lib/rad/integration/router/view_routing_helper.rb +0 -104
- data/lib/rad/integration.rb +0 -30
- data/lib/rad/mail/letter.rb +0 -30
- data/lib/rad/mail/mail_controller.rb +0 -31
- data/lib/rad/mail/mailer.rb +0 -23
- data/lib/rad/mail/processors/letter_builder.rb +0 -36
- data/lib/rad/mail.rb +0 -15
- data/lib/rad/profiles/mail.rb +0 -16
- data/lib/rad/profiles/web_require.rb +0 -5
- data/lib/rad/remote/remote.rb +0 -15
- data/lib/rad/router/core/configurator.rb +0 -25
- data/lib/rad/router/core/core_routing_helper.rb +0 -41
- data/lib/rad/router/core/default_format_processor.rb +0 -12
- data/lib/rad/router/core/processors/router.rb +0 -29
- data/lib/rad/router/core/router.rb +0 -271
- data/lib/rad/router/core/simple_router.rb +0 -23
- data/lib/rad/router/routers/abstract_router.rb +0 -62
- data/lib/rad/router/routers/alias_router.rb +0 -113
- data/lib/rad/router/routers/restful_router.rb +0 -113
- data/lib/rad/spec/mail.rb +0 -31
- data/lib/rad/spec/view.rb +0 -10
- data/lib/rad/support/buffered_logger.rb +0 -44
- data/lib/rad/support/callbacks.rb +0 -168
- data/lib/rad/support/exception.rb +0 -31
- data/lib/rad/support/filters.rb +0 -34
- data/lib/rad/support/format.rb +0 -17
- data/lib/rad/support/micon.rb +0 -13
- data/lib/rad/support.rb +0 -63
- data/lib/rad/template/template.rb +0 -250
- data/spec/controller/abstract_controller_spec.rb +0 -132
- data/spec/controller/controller_context_spec.rb +0 -123
- data/spec/controller/controller_render_spec/views/rem ExplicitRenderSpec/action.erb +0 -1
- data/spec/controller/controller_render_spec/views/rem ExplicitRenderSpec/another_action.erb +0 -1
- data/spec/controller/spec_helper.rb +0 -19
- data/spec/conveyor/spec_helper.rb +0 -3
- data/spec/environment/config_spec/config.default.yml +0 -3
- data/spec/environment/config_spec/config.development.yml +0 -3
- data/spec/environment/config_spec/config.yml +0 -5
- data/spec/environment/spec_helper.rb +0 -1
- data/spec/http/http_spec/app/lib/app/init.rb +0 -10
- data/spec/http/http_spec/app/runtime/public/emptygit +0 -0
- data/spec/http/http_spec/plugin_a/lib/plugin_a/init.rb +0 -0
- data/spec/http/http_spec/plugin_b/lib/plugin_b/init.rb +0 -5
- data/spec/http/http_spec/plugin_b/static/emptygit +0 -0
- data/spec/http/spec_helper.rb +0 -5
- data/spec/integration/spec_helper.rb +0 -5
- data/spec/mail/spec_helper.rb +0 -7
- data/spec/remote/spec_helper.rb +0 -17
- data/spec/router/spec_helper.rb +0 -20
- data/spec/template/spec_helper.rb +0 -6
- data/spec/template/template_spec/views/nested/format/b.erb +0 -1
data/Rakefile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'rake_ext'
|
2
2
|
|
3
3
|
project(
|
4
|
-
name: '
|
5
|
-
|
6
|
-
|
4
|
+
name: 'rad',
|
5
|
+
official_name: 'rad_core',
|
6
|
+
gem: true,
|
7
|
+
summary: 'General purposed Web/App Framework',
|
7
8
|
|
8
9
|
author: 'Alexey Petrushin',
|
9
10
|
homepage: 'http://github.com/alexeypetrushin/rad_core'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
rad.register :router, depends_on: [:conveyors, :http] do
|
2
|
+
require 'rad/router/_require'
|
3
|
+
|
4
|
+
Rad::Router.new(
|
5
|
+
:class,
|
6
|
+
[
|
7
|
+
[:alias_router, Rad::Router::AliasRouter.new],
|
8
|
+
[:basic_router, Rad::Router::BasicRouter.new],
|
9
|
+
[:restful_router, Rad::Router::RestfulRouter.new],
|
10
|
+
[:simple_router, Rad::Router::SimpleRouter.new]
|
11
|
+
]
|
12
|
+
)
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
prefixes: ['', '_']
|
@@ -0,0 +1 @@
|
|
1
|
+
rad.register :workspace, depends_on: :conveyors, scope: :cycle
|
File without changes
|
File without changes
|
@@ -0,0 +1,162 @@
|
|
1
|
+
ru:
|
2
|
+
number:
|
3
|
+
# Используется в number_with_delimiter()
|
4
|
+
# Также является установками по умолчанию для 'currency', 'percentage', 'precision', 'human'
|
5
|
+
#
|
6
|
+
# Used in number_with_delimiter()
|
7
|
+
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
|
8
|
+
format:
|
9
|
+
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
|
10
|
+
separator: "."
|
11
|
+
# Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
|
12
|
+
delimiter: " "
|
13
|
+
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
|
14
|
+
precision: 3
|
15
|
+
|
16
|
+
# Used in number_to_currency()
|
17
|
+
currency:
|
18
|
+
format:
|
19
|
+
# Формат отображения валюты и обозначение самой валюты
|
20
|
+
#
|
21
|
+
#
|
22
|
+
# Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
|
23
|
+
format: "%n %u"
|
24
|
+
unit: "руб."
|
25
|
+
# These three are to override number.format and are optional
|
26
|
+
separator: "."
|
27
|
+
delimiter: " "
|
28
|
+
precision: 2
|
29
|
+
|
30
|
+
# Used in number_to_percentage()
|
31
|
+
percentage:
|
32
|
+
format:
|
33
|
+
# These three are to override number.format and are optional
|
34
|
+
# separator:
|
35
|
+
delimiter: ""
|
36
|
+
|
37
|
+
# Used in number_to_precision()
|
38
|
+
precision:
|
39
|
+
format:
|
40
|
+
# These three are to override number.format and are optional
|
41
|
+
# separator:
|
42
|
+
delimiter: ""
|
43
|
+
# precision:
|
44
|
+
|
45
|
+
# Used in number_to_human_size()
|
46
|
+
human:
|
47
|
+
format:
|
48
|
+
# These three are to override number.format and are optional
|
49
|
+
# separator:
|
50
|
+
delimiter: ""
|
51
|
+
precision: 1
|
52
|
+
|
53
|
+
# Rails 2.2
|
54
|
+
# storage_units: [байт, КБ, МБ, ГБ, ТБ]
|
55
|
+
|
56
|
+
# Rails 2.3
|
57
|
+
storage_units:
|
58
|
+
# Storage units output formatting.
|
59
|
+
# %u is the storage unit, %n is the number (default: 2 MB)
|
60
|
+
format: "%n %u"
|
61
|
+
units:
|
62
|
+
byte:
|
63
|
+
one: "байт"
|
64
|
+
few: "байта"
|
65
|
+
many: "байт"
|
66
|
+
other: "байта"
|
67
|
+
kb: "КБ"
|
68
|
+
mb: "МБ"
|
69
|
+
gb: "ГБ"
|
70
|
+
tb: "ТБ"
|
71
|
+
|
72
|
+
# Используется в хелперах distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
73
|
+
#
|
74
|
+
#
|
75
|
+
# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
76
|
+
datetime:
|
77
|
+
distance_in_words:
|
78
|
+
half_a_minute: "меньше минуты"
|
79
|
+
less_than_x_seconds:
|
80
|
+
one: "меньше %{count} секунды"
|
81
|
+
few: "меньше %{count} секунд"
|
82
|
+
many: "меньше %{count} секунд"
|
83
|
+
other: "меньше %{count} секунды"
|
84
|
+
x_seconds:
|
85
|
+
one: "%{count} секунда"
|
86
|
+
few: "%{count} секунды"
|
87
|
+
many: "%{count} секунд"
|
88
|
+
other: "%{count} секунды"
|
89
|
+
less_than_x_minutes:
|
90
|
+
one: "меньше %{count} минуты"
|
91
|
+
few: "меньше %{count} минут"
|
92
|
+
many: "меньше %{count} минут"
|
93
|
+
other: "меньше %{count} минуты"
|
94
|
+
x_minutes:
|
95
|
+
one: "%{count} минуту"
|
96
|
+
few: "%{count} минуты"
|
97
|
+
many: "%{count} минут"
|
98
|
+
other: "%{count} минуты"
|
99
|
+
about_x_hours:
|
100
|
+
one: "около %{count} часа"
|
101
|
+
few: "около %{count} часов"
|
102
|
+
many: "около %{count} часов"
|
103
|
+
other: "около %{count} часа"
|
104
|
+
x_days:
|
105
|
+
one: "%{count} день"
|
106
|
+
few: "%{count} дня"
|
107
|
+
many: "%{count} дней"
|
108
|
+
other: "%{count} дня"
|
109
|
+
about_x_months:
|
110
|
+
one: "около %{count} месяца"
|
111
|
+
few: "около %{count} месяцев"
|
112
|
+
many: "около %{count} месяцев"
|
113
|
+
other: "около %{count} месяца"
|
114
|
+
x_months:
|
115
|
+
one: "%{count} месяц"
|
116
|
+
few: "%{count} месяца"
|
117
|
+
many: "%{count} месяцев"
|
118
|
+
other: "%{count} месяца"
|
119
|
+
about_x_years:
|
120
|
+
one: "около %{count} года"
|
121
|
+
few: "около %{count} лет"
|
122
|
+
many: "около %{count} лет"
|
123
|
+
other: "около %{count} лет"
|
124
|
+
over_x_years:
|
125
|
+
one: "больше %{count} года"
|
126
|
+
few: "больше %{count} лет"
|
127
|
+
many: "больше %{count} лет"
|
128
|
+
other: "больше %{count} лет"
|
129
|
+
almost_x_years:
|
130
|
+
one: "почти %{count} год"
|
131
|
+
few: "почти %{count} года"
|
132
|
+
many: "почти %{count} лет"
|
133
|
+
other: "почти %{count} лет"
|
134
|
+
prompts:
|
135
|
+
year: "Год"
|
136
|
+
month: "Месяц"
|
137
|
+
day: "День"
|
138
|
+
hour: "Часов"
|
139
|
+
minute: "Минут"
|
140
|
+
second: "Секунд"
|
141
|
+
|
142
|
+
# Используется в хелпере error_messages_for
|
143
|
+
activerecord:
|
144
|
+
errors:
|
145
|
+
template:
|
146
|
+
# Заголовок сообщения об ошибке
|
147
|
+
header:
|
148
|
+
one: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
149
|
+
few: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
150
|
+
many: "%{model}: сохранение не удалось из-за %{count} ошибок"
|
151
|
+
other: "%{model}: сохранение не удалось из-за %{count} ошибки"
|
152
|
+
|
153
|
+
# Первый параграф сообщения об ошибке. Можно использовать макрос %{count}
|
154
|
+
#
|
155
|
+
#
|
156
|
+
# The variable :count is also available
|
157
|
+
body: "Проблемы возникли со следующими полями:"
|
158
|
+
|
159
|
+
support:
|
160
|
+
select:
|
161
|
+
# default value for :prompt => true in FormOptionsHelper
|
162
|
+
prompt: "Выберите: "
|
@@ -0,0 +1,16 @@
|
|
1
|
+
ru:
|
2
|
+
# Используется в array.to_sentence
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# Used in array.to_sentence.
|
6
|
+
support:
|
7
|
+
array:
|
8
|
+
# Rails 2.2
|
9
|
+
sentence_connector: "и"
|
10
|
+
skip_last_comma: true
|
11
|
+
|
12
|
+
# Rails 2.3
|
13
|
+
words_connector: ", "
|
14
|
+
two_words_connector: " и "
|
15
|
+
last_word_connector: " и "
|
16
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
ru:
|
2
|
+
date:
|
3
|
+
formats:
|
4
|
+
# Форматы указываются в виде, поддерживаемом strftime.
|
5
|
+
# По умолчанию используется default.
|
6
|
+
# Можно добавлять собственные форматы
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# Use the strftime parameters for formats.
|
10
|
+
# When no format has been given, it uses default.
|
11
|
+
# You can provide other formats here if you like!
|
12
|
+
default: "%d.%m.%Y"
|
13
|
+
short: "%d %b"
|
14
|
+
long: "%d %B %Y"
|
15
|
+
|
16
|
+
# Названия дней недели -- контекстные и отдельностоящие
|
17
|
+
day_names: [воскресенье, понедельник, вторник, среда, четверг, пятница, суббота]
|
18
|
+
standalone_day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
|
19
|
+
abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
|
20
|
+
|
21
|
+
# Названия месяцев -- сокращенные и полные, плюс отдельностоящие.
|
22
|
+
# Не забудьте nil в начале массиве (~)
|
23
|
+
#
|
24
|
+
#
|
25
|
+
# Don't forget the nil at the beginning; there's no such thing as a 0th month
|
26
|
+
month_names: [~, января, февраля, марта, апреля, мая, июня, июля, августа, сентября, октября, ноября, декабря]
|
27
|
+
standalone_month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь]
|
28
|
+
abbr_month_names: [~, янв., февр., марта, апр., мая, июня, июля, авг., сент., окт., нояб., дек.]
|
29
|
+
standalone_abbr_month_names: [~, янв., февр., март, апр., май, июнь, июль, авг., сент., окт., нояб., дек.]
|
30
|
+
|
31
|
+
# Порядок компонентов даты для хелперов
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# Used in date_select and datime_select.
|
35
|
+
order:
|
36
|
+
- :day
|
37
|
+
- :month
|
38
|
+
- :year
|
39
|
+
|
40
|
+
time:
|
41
|
+
# Форматы времени
|
42
|
+
formats:
|
43
|
+
default: "%a, %d %b %Y, %H:%M:%S %z"
|
44
|
+
short: "%d %b, %H:%M"
|
45
|
+
long: "%d %B %Y, %H:%M"
|
46
|
+
|
47
|
+
# am/pm решено перевести как "утра/вечера" :)
|
48
|
+
am: "утра"
|
49
|
+
pm: "вечера"
|
File without changes
|
File without changes
|
@@ -1,3 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# Some features of ActiveSupport conflicting with Rad, skipping it
|
3
|
+
#
|
4
|
+
%w(
|
5
|
+
active_support/dependencies.rb
|
6
|
+
).each do |relative_path|
|
7
|
+
$LOAD_PATH.each do |base_path|
|
8
|
+
absolute_path = "#{base_path}/#{relative_path}"
|
9
|
+
$LOADED_FEATURES << absolute_path if File.exist? absolute_path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
1
13
|
require 'active_support/all'
|
2
14
|
|
3
15
|
# gem 'activesupport' #, '= 2.3.5'
|
@@ -39,8 +51,8 @@ require 'active_support/all'
|
|
39
51
|
%w(
|
40
52
|
micelaneous
|
41
53
|
time
|
42
|
-
).each{|f| require "rad/
|
43
|
-
|
54
|
+
).each{|f| require "rad/_support/active_support/#{f}"}
|
55
|
+
require 'yaml_fix'
|
44
56
|
|
45
57
|
#
|
46
58
|
# Locales
|
File without changes
|
@@ -0,0 +1,166 @@
|
|
1
|
+
module Rad::Callbacks
|
2
|
+
class AbstractCallback
|
3
|
+
attr_accessor :executor, :terminator
|
4
|
+
attr_reader :conditions
|
5
|
+
def conditions= conditions
|
6
|
+
@conditions = {}
|
7
|
+
conditions.each do |k, v|
|
8
|
+
@conditions[k.to_sym] = if v.is_a? Symbol
|
9
|
+
v.to_s
|
10
|
+
elsif v.is_a? Array
|
11
|
+
v.collect{|e| e.to_s}
|
12
|
+
else
|
13
|
+
v
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@conditions
|
17
|
+
end
|
18
|
+
|
19
|
+
def terminate? target, result
|
20
|
+
unless terminator.nil?
|
21
|
+
if terminator.is_a? Proc
|
22
|
+
terminator.call target, result
|
23
|
+
else
|
24
|
+
result == terminator
|
25
|
+
end
|
26
|
+
else
|
27
|
+
false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def run? target, inf
|
32
|
+
if cond = conditions[:if]
|
33
|
+
evaluate_if(cond, target, inf)
|
34
|
+
elsif cond = conditions[:unless]
|
35
|
+
!evaluate_if(cond, target, inf)
|
36
|
+
elsif cond = conditions[:only]
|
37
|
+
evaluate_only(cond, inf)
|
38
|
+
elsif cond = conditions[:except]
|
39
|
+
!evaluate_only(cond, inf)
|
40
|
+
else
|
41
|
+
true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_to_chain target, inf, &the_next
|
46
|
+
if run? target, inf
|
47
|
+
build_block target, &the_next
|
48
|
+
else
|
49
|
+
the_next
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
alias_method :deep_clone, :clone
|
54
|
+
|
55
|
+
protected
|
56
|
+
def evaluate_if cond, target, inf
|
57
|
+
if cond.is_a? String
|
58
|
+
target.send cond
|
59
|
+
elsif cond.is_a? Proc
|
60
|
+
cond.call target, inf
|
61
|
+
else
|
62
|
+
must_be.never_called
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def evaluate_only cond, inf
|
67
|
+
method = inf[:method].to_s
|
68
|
+
if cond.is_a? String
|
69
|
+
cond == method
|
70
|
+
elsif cond.is_a? Array
|
71
|
+
cond.include? method
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class BeforeCallback < AbstractCallback
|
77
|
+
def build_block target, &the_next
|
78
|
+
lambda do
|
79
|
+
result = if executor.string_or_symbol?
|
80
|
+
target.send executor
|
81
|
+
elsif executor.is_a? Proc
|
82
|
+
executor.call target
|
83
|
+
else
|
84
|
+
must_be.never_called
|
85
|
+
end
|
86
|
+
|
87
|
+
the_next.call unless terminate? target, result
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class AroundCallback < AbstractCallback
|
93
|
+
def build_block target, &the_next
|
94
|
+
lambda do
|
95
|
+
if executor.string_or_symbol?
|
96
|
+
target.send executor, &the_next
|
97
|
+
elsif executor.is_a? Proc
|
98
|
+
executor.call target, the_next
|
99
|
+
else
|
100
|
+
must_be.never_called
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class AfterCallback < AbstractCallback
|
107
|
+
def build_block target, &the_next
|
108
|
+
lambda do
|
109
|
+
result = if executor.string_or_symbol?
|
110
|
+
target.send executor
|
111
|
+
elsif executor.is_a? Proc
|
112
|
+
executor.call target
|
113
|
+
else
|
114
|
+
must_be.never_called
|
115
|
+
end
|
116
|
+
|
117
|
+
the_next.call unless terminate? target, result
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def run_callbacks callback_name, additional_information = {}, &block
|
123
|
+
callback_name = callback_name.to_s
|
124
|
+
block.must_be.defined
|
125
|
+
|
126
|
+
callbacks = self.class.callbacks[callback_name]
|
127
|
+
chain_head = block
|
128
|
+
if callbacks and !callbacks.empty?
|
129
|
+
callbacks.reverse_each do |callback|
|
130
|
+
block = callback.add_to_chain self, additional_information, &chain_head
|
131
|
+
chain_head = block if block
|
132
|
+
end
|
133
|
+
end
|
134
|
+
chain_head.call
|
135
|
+
end
|
136
|
+
|
137
|
+
module ClassMethods
|
138
|
+
inheritable_accessor :callbacks, {}
|
139
|
+
|
140
|
+
def set_callback callback_name, type, *executor_or_options, &block
|
141
|
+
# parsing arguments
|
142
|
+
type, callback_name = type.to_s, callback_name.to_s
|
143
|
+
opt = executor_or_options.extract_options!
|
144
|
+
"You can't provide both method name and block for filter!" if block and !executor_or_options.empty?
|
145
|
+
executor = block || executor_or_options.first
|
146
|
+
|
147
|
+
type.must_be.in %w{before around after}
|
148
|
+
executor.must_be.defined
|
149
|
+
|
150
|
+
# creating callback
|
151
|
+
callback = case type
|
152
|
+
when 'before' then BeforeCallback.new
|
153
|
+
when 'around' then AroundCallback.new
|
154
|
+
when 'after' then AfterCallback.new
|
155
|
+
end
|
156
|
+
|
157
|
+
callback.executor = executor
|
158
|
+
callback.terminator = opt.delete :terminator
|
159
|
+
callback.conditions = opt
|
160
|
+
|
161
|
+
callbacks[callback_name] ||= []
|
162
|
+
callbacks[callback_name] << callback
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Exception.metaclass_eval do
|
2
|
+
attr_accessor :filters
|
3
|
+
end
|
4
|
+
|
5
|
+
Exception.filters = []
|
6
|
+
Exception.filters = %w(
|
7
|
+
/gems/haml
|
8
|
+
/gems/tilt
|
9
|
+
/gems/facets
|
10
|
+
/gems/rack
|
11
|
+
/gems/mongrel
|
12
|
+
/gems/rspec
|
13
|
+
/gems/thin
|
14
|
+
|
15
|
+
/timeout.rb
|
16
|
+
/bin/spec
|
17
|
+
|
18
|
+
lib/fake_gem
|
19
|
+
rubygems/custom_require
|
20
|
+
|
21
|
+
/rad/template
|
22
|
+
/rad/template
|
23
|
+
|
24
|
+
/face/view_builder
|
25
|
+
/face/view_helper
|
26
|
+
|
27
|
+
/rad/_support
|
28
|
+
|
29
|
+
/monitor
|
30
|
+
/synchronize
|
31
|
+
/class_loader
|
32
|
+
/micon
|
33
|
+
|
34
|
+
internal:lib/
|
35
|
+
)
|
36
|
+
|
37
|
+
# Uncomment this line to disable filtering
|
38
|
+
# Exception.filters = []
|
39
|
+
|
40
|
+
Exception.class_eval do
|
41
|
+
alias_method :set_backtrace_without_filter, :set_backtrace
|
42
|
+
def set_backtrace array
|
43
|
+
set_backtrace_without_filter array.sfilter(::Exception.filters)
|
44
|
+
end
|
45
|
+
end
|