rango 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/LICENSE +20 -0
- data/README.textile +18 -0
- data/bin/rango +30 -0
- data/doc/head/Array.html +114 -0
- data/doc/head/AttributeMixin.html +613 -0
- data/doc/head/Class.html +102 -0
- data/doc/head/ColoredString.html +476 -0
- data/doc/head/Hash.html +643 -0
- data/doc/head/Kernel.html +641 -0
- data/doc/head/Object.html +140 -0
- data/doc/head/ObjectSpace.html +103 -0
- data/doc/head/Path.html +2499 -0
- data/doc/head/Range.html +109 -0
- data/doc/head/Rango.html +397 -0
- data/doc/head/Rango/ApplicationMixin.html +396 -0
- data/doc/head/Rango/Bundling.html +23 -0
- data/doc/head/Rango/Bundling/RequireStrategy.html +283 -0
- data/doc/head/Rango/Bundling/Strategy.html +703 -0
- data/doc/head/Rango/CallableStrategy.html +300 -0
- data/doc/head/Rango/Chainable.html +181 -0
- data/doc/head/Rango/Configurable.html +199 -0
- data/doc/head/Rango/Controller.html +962 -0
- data/doc/head/Rango/ControllerMixin.html +860 -0
- data/doc/head/Rango/ControllerStrategy.html +264 -0
- data/doc/head/Rango/DependencyStrategy.html +116 -0
- data/doc/head/Rango/Dispatcher.html +305 -0
- data/doc/head/Rango/Form.html +162 -0
- data/doc/head/Rango/GemDependencyStrategy.html +210 -0
- data/doc/head/Rango/Generator.html +93 -0
- data/doc/head/Rango/GenericViews.html +128 -0
- data/doc/head/Rango/GitDependencyStrategy.html +224 -0
- data/doc/head/Rango/GithubDependencyStrategy.html +118 -0
- data/doc/head/Rango/Handler.html +474 -0
- data/doc/head/Rango/Helpers.html +1271 -0
- data/doc/head/Rango/Hookable.html +202 -0
- data/doc/head/Rango/ImportMixin.html +755 -0
- data/doc/head/Rango/Logger.html +920 -0
- data/doc/head/Rango/ModelForm.html +42 -0
- data/doc/head/Rango/Project.html +516 -0
- data/doc/head/Rango/RenderMixin.html +23 -0
- data/doc/head/Rango/Request.html +1177 -0
- data/doc/head/Rango/Route.html +751 -0
- data/doc/head/Rango/Router.html +42 -0
- data/doc/head/Rango/Router/Dispatcher.html +311 -0
- data/doc/head/Rango/RouterStrategy.html +258 -0
- data/doc/head/Rango/Session.html +23 -0
- data/doc/head/Rango/Settings.html +23 -0
- data/doc/head/Rango/Settings/Erubis.html +23 -0
- data/doc/head/Rango/Settings/Framework.html +198 -0
- data/doc/head/Rango/Settings/Haml.html +23 -0
- data/doc/head/Rango/SimpleTemplate.html +187 -0
- data/doc/head/Rango/StrategyMixin.html +261 -0
- data/doc/head/Rango/Tasks.html +251 -0
- data/doc/head/Rango/Template.html +95 -0
- data/doc/head/Rango/Template/Adapter.html +90 -0
- data/doc/head/Rango/Templates.html +116 -0
- data/doc/head/Rango/Templates/Adapter.html +128 -0
- data/doc/head/Rango/Templates/Template.html +636 -0
- data/doc/head/Rango/Templates/TemplateHelpers.html +328 -0
- data/doc/head/RangoThor.html +205 -0
- data/doc/head/String.html +163 -0
- data/doc/head/TimeDSL.html +612 -0
- data/doc/head/all-methods.html +2012 -0
- data/doc/head/all-namespaces.html +114 -0
- data/doc/head/app.js +18 -0
- data/doc/head/index.html +18 -0
- data/doc/head/jquery.js +11 -0
- data/doc/head/readme.html +34 -0
- data/doc/head/style.css +68 -0
- data/doc/head/syntax_highlight.css +21 -0
- data/doc/versions/0.0.1/Rango.html +1025 -0
- data/doc/versions/0.0.1/Rango/CallableStrategy.html +166 -0
- data/doc/versions/0.0.1/Rango/ControllerStrategy.html +180 -0
- data/doc/versions/0.0.1/Rango/Route.html +340 -0
- data/doc/versions/0.0.1/Rango/Router.html +502 -0
- data/doc/versions/0.0.1/Rango/RouterStrategy.html +94 -0
- data/doc/versions/0.0.1/Rango/Template.html +28 -0
- data/doc/versions/0.0.1/Rango/Template/Adapter.html +90 -0
- data/doc/versions/0.0.1/all-methods.html +228 -0
- data/doc/versions/0.0.1/all-namespaces.html +36 -0
- data/doc/versions/0.0.1/app.js +18 -0
- data/doc/versions/0.0.1/index.html +18 -0
- data/doc/versions/0.0.1/jquery.js +11 -0
- data/doc/versions/0.0.1/readme.html +137 -0
- data/doc/versions/0.0.1/style.css +68 -0
- data/doc/versions/0.0.1/syntax_highlight.css +21 -0
- data/lib/rango.rb +25 -0
- data/lib/rango/boot.rb +54 -0
- data/lib/rango/bundling/dependency.rb +65 -0
- data/lib/rango/bundling/strategies/copy.rb +36 -0
- data/lib/rango/bundling/strategies/gem.rb +55 -0
- data/lib/rango/bundling/strategies/git.rb +71 -0
- data/lib/rango/bundling/strategies/hg.rb +9 -0
- data/lib/rango/bundling/strategy.rb +85 -0
- data/lib/rango/cli/generator.rb +15 -0
- data/lib/rango/cli/project.rb +87 -0
- data/lib/rango/cli/simple_template.rb +47 -0
- data/lib/rango/contrib/pagination.rb +15 -0
- data/lib/rango/contrib/pagination/README.textile +21 -0
- data/lib/rango/contrib/pagination/TODO +3 -0
- data/lib/rango/contrib/pagination/_pagination.html.haml +39 -0
- data/lib/rango/contrib/pagination/adapters/datamapper.rb +22 -0
- data/lib/rango/contrib/pagination/helpers.rb +12 -0
- data/lib/rango/contrib/pagination/page.rb +107 -0
- data/lib/rango/contrib/pagination/strategies.rb +49 -0
- data/lib/rango/contrib/syndication.rb +1 -0
- data/lib/rango/exceptions.rb +269 -0
- data/lib/rango/ext.rb +14 -0
- data/lib/rango/ext/attribute.rb +140 -0
- data/lib/rango/ext/class.rb +99 -0
- data/lib/rango/ext/colored_string.rb +105 -0
- data/lib/rango/ext/core_ext.rb +52 -0
- data/lib/rango/ext/hash.rb +21 -0
- data/lib/rango/ext/kernel.rb +74 -0
- data/lib/rango/ext/object_space.rb +11 -0
- data/lib/rango/ext/path.rb +222 -0
- data/lib/rango/ext/random.rb +22 -0
- data/lib/rango/ext/string.rb +16 -0
- data/lib/rango/ext/thor.rb +32 -0
- data/lib/rango/ext/time_dsl.rb +63 -0
- data/lib/rango/ext/try.rb +30 -0
- data/lib/rango/forms/form.rb +29 -0
- data/lib/rango/generic_views/static.rb +7 -0
- data/lib/rango/helpers.rb +24 -0
- data/lib/rango/helpers/README +179 -0
- data/lib/rango/helpers/assets.rb +29 -0
- data/lib/rango/helpers/general.rb +41 -0
- data/lib/rango/helpers/merb-helpers.rb +40 -0
- data/lib/rango/helpers/merb-helpers/core_ext.rb +58 -0
- data/lib/rango/helpers/merb-helpers/core_ext/numeric.rb +388 -0
- data/lib/rango/helpers/merb-helpers/date_time_formatting.rb +158 -0
- data/lib/rango/helpers/merb-helpers/date_time_helpers.rb +191 -0
- data/lib/rango/helpers/merb-helpers/form/builder.rb +447 -0
- data/lib/rango/helpers/merb-helpers/form/helpers.rb +451 -0
- data/lib/rango/helpers/merb-helpers/form_helpers.rb +19 -0
- data/lib/rango/helpers/merb-helpers/tag_helpers.rb +63 -0
- data/lib/rango/helpers/merb-helpers/text_helpers.rb +63 -0
- data/lib/rango/helpers/merb-helpers/time_dsl.rb +61 -0
- data/lib/rango/helpers/spec/core_ext_spec.rb +21 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/application.rb +4 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_check_box.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_file_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_hidden_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_option_tag.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_password_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_radio_button.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_radio_group.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_select.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_text_area.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/bound_text_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/button.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/check_box.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/custom_builder.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/delete_button.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/exceptions.rb +25 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/field_set.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/fields_for.rb +3 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/file_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/foo.rb +23 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/form.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/form_for.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/hacker.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/hidden_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/label.rb +3 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/numeric_ext.rb +3 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/option_tag.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/password_field.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/radio_button.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/radio_group.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/relative_date.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/relative_date_span.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/select.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/specs_controller.rb +11 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/submit.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/tag_helper.rb +21 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/text_area.rb +2 -0
- data/lib/rango/helpers/spec/fixture/app/controllers/text_field.rb +3 -0
- data/lib/rango/helpers/spec/fixture/app/helpers/global_helpers.rb +8 -0
- data/lib/rango/helpers/spec/fixture/app/models/fake_dm_model.rb +25 -0
- data/lib/rango/helpers/spec/fixture/app/models/first_generic_fake_model.rb +57 -0
- data/lib/rango/helpers/spec/fixture/app/models/hacker_generic_model.rb +5 -0
- data/lib/rango/helpers/spec/fixture/app/models/second_generic_fake_model.rb +18 -0
- data/lib/rango/helpers/spec/fixture/app/models/third_generic_fake_model.rb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/basic.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/basic_unchecked.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/checked.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/errors.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/on_and_off.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_check_box_specs/raise_value_error.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_file_field_specs/additional_attributes.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_file_field_specs/takes_string.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_file_field_specs/with_label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_hidden_field_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_hidden_field_specs/errors.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_hidden_field_specs/hidden_error.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_hidden_field_specs/label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_option_tag_specs/grouped.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_option_tag_specs/nested.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_option_tag_specs/text_and_value.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_password_field_specs/attributes.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_password_field_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_password_field_specs/label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_radio_button_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_radio_group_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_radio_group_specs/hashes.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_radio_group_specs/mixed.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_radio_group_specs/override_id.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/blank.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/multiple.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/prompt.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/with_options.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_select_specs/with_options_with_blank.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_text_area_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_text_area_specs/label.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/bound_text_field_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/button_specs/button_with_label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/button_specs/button_with_values.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/button_specs/disabled_button.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/boolean.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/on_off_is_boolean.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/raise_unless_both_on_and_off.html.erb +2 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/raises_error_if_not_boolean.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/raises_error_if_on_off_and_boolean_false.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/simple.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/to_string.html.erb +8 -0
- data/lib/rango/helpers/spec/fixture/app/views/check_box_specs/unchecked.html.erb +2 -0
- data/lib/rango/helpers/spec/fixture/app/views/custom_builder_specs/everything.html.erb +10 -0
- data/lib/rango/helpers/spec/fixture/app/views/delete_button_specs/delete_with_explicit_url.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/delete_button_specs/delete_with_extra_params.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/delete_button_specs/delete_with_label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/delete_button_specs/simple_delete.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/exeptions/client_error.html.erb +37 -0
- data/lib/rango/helpers/spec/fixture/app/views/exeptions/internal_server_error.html.erb +216 -0
- data/lib/rango/helpers/spec/fixture/app/views/exeptions/not_acceptable.html.erb +38 -0
- data/lib/rango/helpers/spec/fixture/app/views/exeptions/not_found.html.erb +40 -0
- data/lib/rango/helpers/spec/fixture/app/views/fields_for_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/fields_for_specs/midstream.html.erb +7 -0
- data/lib/rango/helpers/spec/fixture/app/views/fields_for_specs/nil.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/fieldset_specs/legend.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/file_field_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/file_field_specs/makes_multipart.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/file_field_specs/with_label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/file_field_specs/with_values.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/foo/bar.html.erb +0 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_for_specs/basic.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/create_a_form.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/create_a_multipart_form.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/fake_delete_if_set.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/fake_put_if_set.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/get_if_set.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/post_by_default.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/form_specs/resourceful_form.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/file_field.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/hidden_field.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/option_tag.html.erb +4 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/password_field.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/radio_button.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/radio_group.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/text_area.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hacker/text_field.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/hidden_field_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/hidden_field_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/hidden_field_specs/label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/label_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/label_specs/basic_with_attributes.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/label_specs/basic_with_class.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/layout/application.html.erb +11 -0
- data/lib/rango/helpers/spec/fixture/app/views/numeric_ext_specs/minutes_to_hours.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/numeric_ext_specs/to_concurrency_default.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/numeric_ext_specs/two_digits.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/array.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/clean.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/collection.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/multiple_selects.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/no_extra_attributes.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/optgroups.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/selected.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/with_blank.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/option_tag_specs/with_prompt.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/password_field_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/password_field_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_button_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_button_specs/checked.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_button_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_button_specs/label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_button_specs/unchecked.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_group_specs/attributes.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_group_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_group_specs/checked.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_group_specs/hash.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/radio_group_specs/specific_attributes.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_span_specs/date_span_on_same_day.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_span_specs/date_span_on_same_day_on_different_year.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_specs/relative_date_with_year.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_specs/relative_date_without_year.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_specs/relative_today.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_specs/relative_tomorrow.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/relative_date_specs/relative_yesterday.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/select_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/select_specs/blank.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/select_specs/multiple.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/select_specs/selected.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/submit_specs/disabled_submit.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/submit_specs/submit_with_label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/submit_specs/submit_with_values.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/tag_helper/nested_tags.html.erb +5 -0
- data/lib/rango/helpers/spec/fixture/app/views/tag_helper/tag_with_attributes.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/tag_helper/tag_with_content.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/tag_helper/tag_with_content_in_the_block.html.erb +3 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_area_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_area_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_area_specs/label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_area_specs/nil.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_field_specs/basic.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_field_specs/class.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_field_specs/disabled.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_field_specs/label.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/app/views/text_field_specs/symbolized_name.html.erb +1 -0
- data/lib/rango/helpers/spec/fixture/config/environments/development.rb +6 -0
- data/lib/rango/helpers/spec/fixture/config/environments/production.rb +5 -0
- data/lib/rango/helpers/spec/fixture/config/environments/test.rb +6 -0
- data/lib/rango/helpers/spec/fixture/config/init.rb +46 -0
- data/lib/rango/helpers/spec/fixture/config/rack.rb +11 -0
- data/lib/rango/helpers/spec/fixture/config/router.rb +38 -0
- data/lib/rango/helpers/spec/fixture/public/images/merb.jpg +0 -0
- data/lib/rango/helpers/spec/fixture/public/merb.fcgi +4 -0
- data/lib/rango/helpers/spec/fixture/public/stylesheets/master.css +119 -0
- data/lib/rango/helpers/spec/merb_helpers_config_spec.rb +84 -0
- data/lib/rango/helpers/spec/merb_helpers_date_time_spec.rb +270 -0
- data/lib/rango/helpers/spec/merb_helpers_form_spec.rb +1371 -0
- data/lib/rango/helpers/spec/merb_helpers_tag_helper_spec.rb +42 -0
- data/lib/rango/helpers/spec/merb_helpers_text_spec.rb +69 -0
- data/lib/rango/helpers/spec/numeric_extlib_spec.rb +137 -0
- data/lib/rango/helpers/spec/ordinalize_spec.rb +53 -0
- data/lib/rango/helpers/spec/spec_helper.rb +160 -0
- data/lib/rango/helpers/spec/time_dsl_spec.rb +45 -0
- data/lib/rango/helpers/syntax.rb +28 -0
- data/lib/rango/loggers/fireruby.rb +1 -0
- data/lib/rango/loggers/logger.rb +100 -0
- data/lib/rango/mixins/application.rb +25 -0
- data/lib/rango/mixins/configurable.rb +20 -0
- data/lib/rango/mixins/controller.rb +113 -0
- data/lib/rango/mixins/import.rb +89 -0
- data/lib/rango/mixins/strategy.rb +28 -0
- data/lib/rango/mvc/controller.rb +139 -0
- data/lib/rango/mvc/strategies.rb +6 -0
- data/lib/rango/orm/adapters/datamapper/fields.rb +3 -0
- data/lib/rango/orm/adapters/datamapper/setup.rb +16 -0
- data/lib/rango/orm/adapters/datamapper/support.rb +15 -0
- data/lib/rango/orm/adapters/datamapper/tasks.thor +41 -0
- data/lib/rango/orm/adapters/datamapper/types/unicode_string.rb +15 -0
- data/lib/rango/project.rb +28 -0
- data/lib/rango/rack/dispatcher.rb +61 -0
- data/lib/rango/rack/middlewares/emails.rb +7 -0
- data/lib/rango/rack/middlewares/encoding.rb +25 -0
- data/lib/rango/rack/middlewares/static.rb +49 -0
- data/lib/rango/rack/request.rb +166 -0
- data/lib/rango/rango.rb +75 -0
- data/lib/rango/router/adapters/basic.rb +21 -0
- data/lib/rango/router/adapters/rack-router.rb +18 -0
- data/lib/rango/router/dispatcher.rb +29 -0
- data/lib/rango/router/specification.txt +16 -0
- data/lib/rango/settings.rb +87 -0
- data/lib/rango/settings/erubis.rb +13 -0
- data/lib/rango/settings/framework.rb +85 -0
- data/lib/rango/settings/haml.rb +35 -0
- data/lib/rango/support/cucumber/steps/given_steps.rb +5 -0
- data/lib/rango/support/cucumber/steps/then_steps.rb +41 -0
- data/lib/rango/support/cucumber/steps/when_steps.rb +54 -0
- data/lib/rango/tasks/bundle.thor +28 -0
- data/lib/rango/tasks/stats.thor +0 -0
- data/lib/rango/templates/adapter.rb +19 -0
- data/lib/rango/templates/adapters/erb.rb +45 -0
- data/lib/rango/templates/adapters/erubis.rb +60 -0
- data/lib/rango/templates/adapters/haml.rb +17 -0
- data/lib/rango/templates/template.rb +123 -0
- data/rango.gemspec +35 -0
- data/spec/factories.rb +21 -0
- data/spec/rango/auth/core/authenticated_helper_spec.rb +0 -0
- data/spec/rango/auth/core/authentication_spec.rb +0 -0
- data/spec/rango/auth/core/callbacks_spec.rb +0 -0
- data/spec/rango/auth/core/errors_spec.rb +0 -0
- data/spec/rango/auth/core/responses_spec.rb +0 -0
- data/spec/rango/auth/core/session_mixin_spec.rb +0 -0
- data/spec/rango/auth/core/spec/helpers/authentication_helper_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/activation_fixture_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/authentication_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/callbacks_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/customizations_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/errors_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/failed_login_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/merb-auth-core_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/router_helper_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/merb-auth-core/strategy_spec_spec.rb +0 -0
- data/spec/rango/auth/core/spec/spec_helper_spec.rb +0 -0
- data/spec/rango/auth/core/strategy_spec.rb +0 -0
- data/spec/rango/auth/core_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/redirect_back_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/salted_user/ar_salted_user_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/salted_user/dm_salted_user_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/salted_user/relaxdb_salted_user_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/salted_user/sq_salted_user_spec.rb +0 -0
- data/spec/rango/auth/more/mixins/salted_user_spec.rb +0 -0
- data/spec/rango/auth/more/spec/merb-auth-more_spec_spec.rb +0 -0
- data/spec/rango/auth/more/spec/mixins/redirect_back_spec_spec.rb +0 -0
- data/spec/rango/auth/more/spec/mixins/salted_user_spec_spec.rb +0 -0
- data/spec/rango/auth/more/spec/spec_helper_spec.rb +0 -0
- data/spec/rango/auth/more/strategies/abstract_password_spec.rb +0 -0
- data/spec/rango/auth/more/strategies/basic/basic_auth_spec.rb +0 -0
- data/spec/rango/auth/more/strategies/basic/openid_spec.rb +0 -0
- data/spec/rango/auth/more/strategies/basic/password_form_spec.rb +0 -0
- data/spec/rango/auth/more_spec.rb +0 -0
- data/spec/rango/auth/slice/exceptions_spec.rb +0 -0
- data/spec/rango/auth/slice/merb-auth-slice-password_spec.rb +0 -0
- data/spec/rango/auth/slice/sessions_spec.rb +0 -0
- data/spec/rango/auth/slice/spec_helper_spec.rb +0 -0
- data/spec/rango/auth/slice/xsessions_spec.rb +0 -0
- data/spec/rango/boot_spec.rb +19 -0
- data/spec/rango/bundling/dependency_spec.rb +0 -0
- data/spec/rango/bundling/strategies_spec.rb +0 -0
- data/spec/rango/cli/project_spec.rb +0 -0
- data/spec/rango/contrib/pagination/adapters/dm_spec.rb +0 -0
- data/spec/rango/contrib/pagination/helpers_spec.rb +0 -0
- data/spec/rango/contrib/pagination/page_spec.rb +94 -0
- data/spec/rango/contrib/pagination/strategies_spec.rb +0 -0
- data/spec/rango/contrib/pagination_spec.rb +0 -0
- data/spec/rango/contrib/syndication_spec.rb +0 -0
- data/spec/rango/exceptions_spec.rb +0 -0
- data/spec/rango/ext/attribute_spec.rb +0 -0
- data/spec/rango/ext/colored_string_spec.rb +0 -0
- data/spec/rango/ext/core_ext_spec.rb +0 -0
- data/spec/rango/ext/kernel_spec.rb +0 -0
- data/spec/rango/ext/path_spec.rb +0 -0
- data/spec/rango/ext/string_spec.rb +0 -0
- data/spec/rango/ext/thor_spec.rb +0 -0
- data/spec/rango/ext/time_dsl_spec.rb +0 -0
- data/spec/rango/ext_spec.rb +0 -0
- data/spec/rango/forms/form_spec.rb +0 -0
- data/spec/rango/generators_spec.rb +0 -0
- data/spec/rango/generic_views/static_spec.rb +0 -0
- data/spec/rango/helpers/assets_spec.rb +0 -0
- data/spec/rango/helpers/general_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/core_ext/numeric_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/core_ext_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/date_time_formatting_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/date_time_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/form/builder_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/form/helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/form_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/tag_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/text_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/time_dsl_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers_spec.rb +0 -0
- data/spec/rango/helpers/spec/core_ext_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/application_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_check_box_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_file_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_hidden_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_option_tag_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_password_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_radio_button_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_radio_group_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_select_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_text_area_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/bound_text_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/button_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/check_box_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/custom_builder_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/delete_button_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/exceptions_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/field_set_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/fields_for_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/file_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/foo_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/form_for_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/form_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/hacker_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/hidden_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/label_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/numeric_ext_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/option_tag_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/password_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/radio_button_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/radio_group_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/relative_date_span_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/relative_date_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/select_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/specs_controller_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/submit_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/tag_helper_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/text_area_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/controllers/text_field_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/helpers/global_helpers_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/models/fake_dm_model_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/models/first_generic_fake_model_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/models/hacker_generic_model_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/models/second_generic_fake_model_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/app/models/third_generic_fake_model_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/environments/development_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/environments/production_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/environments/test_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/init_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/rack_spec.rb +0 -0
- data/spec/rango/helpers/spec/fixture/config/router_spec.rb +0 -0
- data/spec/rango/helpers/spec/merb_helpers_config_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/merb_helpers_date_time_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/merb_helpers_form_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/merb_helpers_tag_helper_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/merb_helpers_text_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/numeric_extlib_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/ordinalize_spec_spec.rb +0 -0
- data/spec/rango/helpers/spec/spec_helper_spec.rb +0 -0
- data/spec/rango/helpers/spec/time_dsl_spec_spec.rb +0 -0
- data/spec/rango/helpers/syntax_spec.rb +0 -0
- data/spec/rango/helpers_spec.rb +0 -0
- data/spec/rango/loggers/fireruby_spec.rb +0 -0
- data/spec/rango/loggers/logger_spec.rb +0 -0
- data/spec/rango/mixins/application_spec.rb +0 -0
- data/spec/rango/mixins/controller_spec.rb +0 -0
- data/spec/rango/mixins/import_spec.rb +0 -0
- data/spec/rango/mvc/controller_spec.rb +24 -0
- data/spec/rango/mvc/strategies_spec.rb +0 -0
- data/spec/rango/orm/adapters/dm/fields_spec.rb +0 -0
- data/spec/rango/orm/adapters/dm/setup_spec.rb +0 -0
- data/spec/rango/project_spec.rb +46 -0
- data/spec/rango/rack/dispatcher_spec.rb +0 -0
- data/spec/rango/rack/middlewares/emails_spec.rb +0 -0
- data/spec/rango/rack/middlewares/static_spec.rb +0 -0
- data/spec/rango/rack/request_spec.rb +18 -0
- data/spec/rango/rango_spec.rb +0 -0
- data/spec/rango/router/route_spec.rb +0 -0
- data/spec/rango/router/router_spec.rb +0 -0
- data/spec/rango/router/strategies_spec.rb +0 -0
- data/spec/rango/settings_spec.rb +26 -0
- data/spec/rango/spec/cucumber_spec.rb +0 -0
- data/spec/rango/spec/rspec_spec.rb +0 -0
- data/spec/rango/templates/adapter_spec.rb +0 -0
- data/spec/rango/templates/adapters/erb_spec.rb +0 -0
- data/spec/rango/templates/adapters/erubis_spec.rb +0 -0
- data/spec/rango/templates/adapters/haml_spec.rb +0 -0
- data/spec/rango/templates/template_spec.rb +0 -0
- data/spec/rango_spec.rb +37 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/stubs/flat.rb +0 -0
- data/stubs/app/content/init.rb.rbt +6 -0
- data/stubs/app/content/models.rb.rbt +9 -0
- data/stubs/app/content/views.rb.rbt +10 -0
- data/stubs/app/preprocess.rb +13 -0
- data/stubs/bigapp/content/init.rb +0 -0
- data/stubs/bigapp/content/views/application.rb +0 -0
- data/stubs/bigapp/preprocess.rb +5 -0
- data/stubs/features/content/env.rb +36 -0
- data/stubs/flat/content/flat.ru.rbt +19 -0
- data/stubs/flat/preprocess.rb +5 -0
- data/stubs/project/content/TODO +0 -0
- data/stubs/project/content/Thorfile +12 -0
- data/stubs/project/content/config.ru +34 -0
- data/stubs/project/content/init.rb +14 -0
- data/stubs/project/content/settings.rb.rbt +10 -0
- data/stubs/project/content/settings_local.rb.rbt +6 -0
- data/stubs/project/content/templates/base.html.haml.rbt +29 -0
- data/stubs/project/preprocess.rb +5 -0
- data/stubs/pupu/preprocess.rb +5 -0
- data/stubs/stub/content/metadata.yml +2 -0
- data/stubs/stub/content/postprocess.rb +7 -0
- data/stubs/stub/content/preprocess.rb +5 -0
- data/stubs/stub/preprocess.rb +5 -0
- data/support/Rango.tmbundle/Commands/Documentation for current word.tmCommand +22 -0
- data/support/Rango.tmbundle/Commands/Got to import.tmCommand +23 -0
- data/support/Rango.tmbundle/Commands/Rango console.tmCommand +22 -0
- data/support/Rango.tmbundle/Commands/Rango server.tmCommand +22 -0
- data/support/Rango.tmbundle/Commands/Read documentation.tmCommand +22 -0
- data/support/Rango.tmbundle/Snippets/Method with yardoc.tmSnippet +20 -0
- data/support/Rango.tmbundle/Snippets/Project_configure.tmSnippet +18 -0
- data/support/Rango.tmbundle/Snippets/Project_import.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Project_logger_debug.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Project_logger_error.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Project_logger_fatal.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Project_logger_inspect.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Project_logger_warn.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_dependency.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_import.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_logger_debug.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_logger_error.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_logger_fatal.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_logger_inspect.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/Rango_logger_warn.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/controller.tmSnippet +28 -0
- data/support/Rango.tmbundle/Snippets/doc.tmSnippet +20 -0
- data/support/Rango.tmbundle/Snippets/match.tmSnippet +16 -0
- data/support/Rango.tmbundle/Snippets/thor task.tmSnippet +19 -0
- data/support/Rango.tmbundle/info.plist +37 -0
- data/support/hooks/commit-msg +13 -0
- data/support/hooks/post-commit +4 -0
- data/support/hooks/pre-commit +4 -0
- data/support/hooks/pre-rebase +169 -0
- data/support/hooks/prepare-commit-msg +36 -0
- data/tasks/hooks.thor +26 -0
- data/tasks/package.thor +49 -0
- data/tasks/release.thor +72 -0
- data/tasks/repair.thor +75 -0
- data/tasks/spec.thor +39 -0
- data/tasks/stats.thor +66 -0
- data/tasks/yardoc.thor +16 -0
- data/templates/errors/404.html.erb +52 -0
- data/templates/errors/406.html.erb +1 -0
- data/templates/errors/500.html.erb +48 -0
- metadata +866 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Rango.import("templates/template")
|
4
|
+
Rango.import("mixins/controller")
|
5
|
+
|
6
|
+
class Rango
|
7
|
+
class Controller
|
8
|
+
include Rango::HttpExceptions
|
9
|
+
include Rango::Helpers
|
10
|
+
include Rango::ControllerMixin
|
11
|
+
include Rango::Templates::TemplateHelpers
|
12
|
+
|
13
|
+
extend Rango::Router::Dispatcher
|
14
|
+
|
15
|
+
class << self
|
16
|
+
# @since 0.0.2
|
17
|
+
attribute :before_filters, Hash.new
|
18
|
+
|
19
|
+
# @since 0.0.2
|
20
|
+
attribute :after_filters, Hash.new
|
21
|
+
|
22
|
+
# @since 0.0.2
|
23
|
+
attribute :autorendering, false
|
24
|
+
|
25
|
+
def inherited(subclass)
|
26
|
+
Rango.logger.debug("Inheritting filters from #{self.inspect} to #{subclass.inspect}")
|
27
|
+
subclass.before_filters = self.before_filters
|
28
|
+
subclass.after_filters = self.after_filters
|
29
|
+
subclass.autorendering = self.autorendering
|
30
|
+
end
|
31
|
+
|
32
|
+
# before :login
|
33
|
+
# before :login, actions: [:send]
|
34
|
+
# @since 0.0.2
|
35
|
+
def before(action = nil, options = Hash.new, &block)
|
36
|
+
self.before_filters[action || block] = options
|
37
|
+
end
|
38
|
+
|
39
|
+
# @since 0.0.2
|
40
|
+
def after(action = nil, options = Hash.new, &block)
|
41
|
+
self.after_filters[action || block] = options
|
42
|
+
end
|
43
|
+
|
44
|
+
# [master] Change Merb::Controller to respond to #call and return a Rack Array. (wycats)http://rubyurl.com/BhoY
|
45
|
+
# @since 0.0.2
|
46
|
+
def call(env)
|
47
|
+
self.set_rack_env(env)
|
48
|
+
request = Rango::Request.new(env)
|
49
|
+
options = env["rango.router.params"]
|
50
|
+
method = options[:action] || :index
|
51
|
+
response = Rack::Response.new
|
52
|
+
controller = self.new(request, options.merge(request.params))
|
53
|
+
controller.response = response
|
54
|
+
Rango.logger.info("#{self.name}.call(env) with method #{method}")
|
55
|
+
# Rango.logger.inspect(before: ::Application.get_filters(:before), after: ::Application.get_filters(:after))
|
56
|
+
# Rango.logger.inspect(before: get_filters(:before), after: get_filters(:after))
|
57
|
+
controller.run_filters(:before, method.to_sym)
|
58
|
+
# If you don't care about arguments or if you prefer usage of params.
|
59
|
+
args = controller.params.map { |key, value| value }
|
60
|
+
if controller.method(method).arity.eql?(0)
|
61
|
+
Rango.logger.info("Calling method #{self.name}##{method} without arguments")
|
62
|
+
value = controller.method(method).call
|
63
|
+
else
|
64
|
+
Rango.logger.info("Calling method #{self.name}##{method} with arguments #{args.inspect}")
|
65
|
+
value = controller.method(method).call(*args)
|
66
|
+
end
|
67
|
+
controller.autorender if self.autorendering
|
68
|
+
controller.run_filters(:after, method)
|
69
|
+
response.body = proceed_value(value)
|
70
|
+
response.status = controller.status if controller.status
|
71
|
+
response.headers.merge!(controller.headers)
|
72
|
+
return response.finish
|
73
|
+
end
|
74
|
+
|
75
|
+
# @experimental
|
76
|
+
def route_to(env, action, params = Hash.new)
|
77
|
+
env["rango.controller"] = self
|
78
|
+
env["rango.controller.action"] = action
|
79
|
+
env["rango.router.params"] = params
|
80
|
+
env["rango.action"] = action
|
81
|
+
Rango::Router::Dispatcher.route_to(env, self)
|
82
|
+
end
|
83
|
+
|
84
|
+
def proceed_value(value)
|
85
|
+
case value
|
86
|
+
when true, false then value.to_s
|
87
|
+
when nil then String.new
|
88
|
+
else value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def controller?
|
93
|
+
true
|
94
|
+
end
|
95
|
+
|
96
|
+
# @since 0.0.2
|
97
|
+
def get_filters(type)
|
98
|
+
self.send("#{type}_filters")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def initialize(request, params)
|
103
|
+
@request = request
|
104
|
+
@params = params
|
105
|
+
@cookies = request.cookies
|
106
|
+
@session = request.session
|
107
|
+
Rango.logger.inspect(params: params, cookies: cookies, session: session)
|
108
|
+
end
|
109
|
+
attr_reader :session
|
110
|
+
|
111
|
+
def route_to(action, params = Hash.new)
|
112
|
+
self.class.route_to(request.env, action, params)
|
113
|
+
end
|
114
|
+
|
115
|
+
# @since 0.0.2
|
116
|
+
def run_filters(name, method)
|
117
|
+
# Rango.logger.debug(self.class.instance_variables)
|
118
|
+
# Rango.logger.inspect(name: name, method: method)
|
119
|
+
self.class.get_filters(name).each do |filter_method, options|
|
120
|
+
begin
|
121
|
+
unless options[:except] && options[:except].include?(method)
|
122
|
+
if filter_method.is_a?(Symbol) && self.respond_to?(filter_method)
|
123
|
+
Rango.logger.info("Calling filter #{filter_method} for controller #{self}")
|
124
|
+
self.send(filter_method)
|
125
|
+
elsif filter_method.respond_to?(:call)
|
126
|
+
Rango.logger.info("Calling filter #{filter_method.inspect} for controller #{self}")
|
127
|
+
self.instance_eval(&filter_method)
|
128
|
+
else
|
129
|
+
Rango.logger.error("Filter #{filter_method} doesn't exists!")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
rescue SkipFilter
|
133
|
+
Rango.logger.info("Skipping #{name} filter")
|
134
|
+
next
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Rango.dependency "dm-core", gem: true
|
4
|
+
require_relative "support"
|
5
|
+
|
6
|
+
begin
|
7
|
+
adapter = Project.settings.database_adapter
|
8
|
+
path = Project.settings.database_name
|
9
|
+
DataMapper.setup(:default, "#{adapter}://#{Project.root}/#{path}")
|
10
|
+
rescue Exception => exception
|
11
|
+
Rango.logger.exception(exception)
|
12
|
+
Rango.logger.fatal("Database connection can't be established, exiting")
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
16
|
+
Rango.logger.info("DataMapper started with database #{path}")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require "rango/ext/thor"
|
4
|
+
|
5
|
+
class Db < Rango::Tasks
|
6
|
+
def initialize(*args)
|
7
|
+
self.boot
|
8
|
+
super(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
# @since 0.0.2
|
12
|
+
desc "automigrate", "Automigrate the database. It will destroy all the data!"
|
13
|
+
def automigrate
|
14
|
+
unless Rango.debug && @opts[:force]
|
15
|
+
abort "You are in production environment. This operation will destroy all your data. If you are sure what you are doing, use thor db:automigrate --force"
|
16
|
+
end
|
17
|
+
Rango.logger.info("Migrating database #{Project.settings.database_name} ...")
|
18
|
+
result = DataMapper.auto_migrate!
|
19
|
+
Rango.logger.debug("Result: #{result.inspect}")
|
20
|
+
end
|
21
|
+
|
22
|
+
# @since 0.0.2
|
23
|
+
desc "autoupgrade", "Autoupgrade the database structure. Data should stay untouched."
|
24
|
+
def autoupgrade
|
25
|
+
Rango.logger.info("Upgrading database #{Project.settings.database_name} ...")
|
26
|
+
result = DataMapper.auto_upgrade!
|
27
|
+
Rango.logger.debug("Result: #{result.inspect}")
|
28
|
+
end
|
29
|
+
|
30
|
+
# @since 0.0.2
|
31
|
+
desc "migrate", "Run migrations."
|
32
|
+
def migrate
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "report", "Report count of objects in database"
|
36
|
+
def report
|
37
|
+
Rango::ORM::DataMapper.models.each do |model_class|
|
38
|
+
puts "#{model_class}: #{model_class.count}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Rango.import("settings")
|
4
|
+
Rango.import("mixins/application")
|
5
|
+
Rango.import("mixins/configurable")
|
6
|
+
|
7
|
+
class Project
|
8
|
+
class << self
|
9
|
+
include Rango::ImportMixin
|
10
|
+
include Rango::ApplicationMixin
|
11
|
+
include Rango::Configurable
|
12
|
+
# @since 0.0.1
|
13
|
+
# @return [String] String reprezentation of project root directory.
|
14
|
+
root = attribute :root, Dir.pwd
|
15
|
+
|
16
|
+
# @since 0.0.1
|
17
|
+
# @return [Rango::Settings::Framework] Project settings.
|
18
|
+
attribute :settings, Rango::Settings::Framework.new
|
19
|
+
|
20
|
+
# @since 0.0.1
|
21
|
+
# @return [Rango::Router] Project main router.
|
22
|
+
attribute :router
|
23
|
+
|
24
|
+
def bundled?
|
25
|
+
@bundled ||= File.directory?(File.join(Project.root, "gems"))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative "middlewares/encoding"
|
4
|
+
|
5
|
+
class Rango::Dispatcher
|
6
|
+
class << self
|
7
|
+
def app
|
8
|
+
Rack::Builder.new do
|
9
|
+
use Rango::Middlewares::Encoding
|
10
|
+
use Rack::ContentLength
|
11
|
+
use Rack::MethodOverride # _method: put etc
|
12
|
+
|
13
|
+
# serve static files
|
14
|
+
if Project.settings.media_prefix
|
15
|
+
# use Rack::Static, :urls => ["/media"]
|
16
|
+
# will serve all requests beginning with /media from the "media" folder
|
17
|
+
# located in the current directory (ie media/*).
|
18
|
+
|
19
|
+
# use Rack::Static, :urls => ["/css", "/images"], :root => "public"
|
20
|
+
# will serve all requests beginning with /css or /images from the folder
|
21
|
+
# "public" in the current directory (ie public/css/* and public/images/*)
|
22
|
+
Rango.logger.info("Media files are available on #{Project.settings.media_prefix}")
|
23
|
+
options = {urls: [Project.settings.media_prefix]}
|
24
|
+
use Rack::Static, options
|
25
|
+
else
|
26
|
+
Rango.logger.info("Media files are routed directly to the /")
|
27
|
+
Rango.import("rack/middlewares/static.rb")
|
28
|
+
use Rango::Static
|
29
|
+
end
|
30
|
+
|
31
|
+
# cookies
|
32
|
+
use Rack::Session::Cookie, path: '/'
|
33
|
+
#, key: 'rack.session', domain: 'foo.com', path: '/', expire_after: 2592000, secret: 'change_me'
|
34
|
+
|
35
|
+
# use Rack::Reloader
|
36
|
+
run Rango::Dispatcher.new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_reader :request
|
42
|
+
|
43
|
+
# @since 0.0.2
|
44
|
+
def call(env)
|
45
|
+
request = Rango::Request.new(env)
|
46
|
+
route = Project.router.find(request.path)
|
47
|
+
return route.call(request)
|
48
|
+
rescue Rango::HttpExceptions::Error404 => exception
|
49
|
+
return [exception.status, exception.headers, exception.body]
|
50
|
+
# Let other error except 404 handle rack
|
51
|
+
# rescue Rango::HttpExceptions::HttpError => exception
|
52
|
+
# return [exception.status, exception.headers, exception.body]
|
53
|
+
# rescue Exception => exception
|
54
|
+
# Project.logger.exception(exception)
|
55
|
+
# @body = ["<h1>#{exception.message}</h1>"]
|
56
|
+
# exception.backtrace.each do |trace|
|
57
|
+
# @body.push("<li>#{trace}</li>")
|
58
|
+
# end
|
59
|
+
# return ["500", headers, self.body]
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# rack seems to have problems with encoding, so this middleware enforce UTF-8 for all the strings in rack env
|
4
|
+
class Rango
|
5
|
+
module Middlewares
|
6
|
+
class Encoding
|
7
|
+
def initialize(app, encoding = ::Encoding.default_external)
|
8
|
+
@app = app
|
9
|
+
@encoding = encoding
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
env.each do |key, value|
|
14
|
+
env[try_force_encoding(key)] = try_force_encoding(value)
|
15
|
+
end
|
16
|
+
return @app.call(env)
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
def try_force_encoding(object)
|
21
|
+
object.respond_to?(:force_encoding) ? object.dup.force_encoding(@encoding) : object
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# stolen from rails
|
2
|
+
require 'rack/utils'
|
3
|
+
|
4
|
+
class Rango
|
5
|
+
class Static
|
6
|
+
FILE_METHODS = %w(GET HEAD).freeze
|
7
|
+
|
8
|
+
# @since 0.0.2
|
9
|
+
def initialize(app)
|
10
|
+
@app = app
|
11
|
+
@file_server = ::Rack::File.new(Project.settings.media_root)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @since 0.0.2
|
15
|
+
def call(env)
|
16
|
+
path = env['PATH_INFO'].chomp('/')
|
17
|
+
method = env['REQUEST_METHOD']
|
18
|
+
|
19
|
+
prefix = Project.settings.media_prefix.chomp("/")
|
20
|
+
prefix_regexp = Regexp.new(%r[^#{prefix}/])
|
21
|
+
if path.match(prefix_regexp) && FILE_METHODS.include?(method)
|
22
|
+
if file_exist?(path)
|
23
|
+
return @file_server.call(env)
|
24
|
+
# else
|
25
|
+
# cached_path = directory_exist?(path) ? "#{path}/index" : path
|
26
|
+
# cached_path += ::ActionController::Base.page_cache_extension
|
27
|
+
#
|
28
|
+
# if file_exist?(cached_path)
|
29
|
+
# env['PATH_INFO'] = cached_path
|
30
|
+
# return @file_server.call(env)
|
31
|
+
# end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
@app.call(env)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def file_exist?(path)
|
40
|
+
full_path = File.join(@file_server.root, ::Rack::Utils.unescape(path))
|
41
|
+
File.file?(full_path) && File.readable?(full_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
def directory_exist?(path)
|
45
|
+
full_path = File.join(@file_server.root, ::Rack::Utils.unescape(path))
|
46
|
+
Dir.exist?(full_path) && File.readable?(full_path)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# Rack env keys (localhost, url /test):
|
4
|
+
# SERVER_SOFTWARE: thin 1.0.0 codename That's What She Said
|
5
|
+
# rack.input: #<StringIO:0x44cb7c>
|
6
|
+
# rack.version: [0, 3]
|
7
|
+
# rack.errors: #<IO:<STDERR>>
|
8
|
+
# rack.multithread: false
|
9
|
+
# rack.multiprocess: false
|
10
|
+
# rack.run_once: false
|
11
|
+
# REQUEST_METHOD: GET
|
12
|
+
# PATH_INFO: /test
|
13
|
+
# PATH_INFO: /test
|
14
|
+
# REQUEST_URI: /test
|
15
|
+
# HTTP_VERSION: HTTP/1.1
|
16
|
+
# HTTP_HOST: localhost:3000
|
17
|
+
# HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7
|
18
|
+
# HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
19
|
+
# HTTP_ACCEPT_LANGUAGE: en-us,en;q=0.5
|
20
|
+
# HTTP_ACCEPT_ENCODING: gzip,deflate
|
21
|
+
# HTTP_ACCEPT_CHARSET: UTF-8,*
|
22
|
+
# HTTP_KEEP_ALIVE: 300
|
23
|
+
# HTTP_CONNECTION: keep-alive
|
24
|
+
# HTTP_COOKIE: _session_id=BAh7CCIJdXNlciIbYWRtaW5AbWVnYXNhbW9sZXBreS5jeiIeYXV0aGVudGlj%250AYXRpb25fc3RyYXRlZ2llczAiDnJldHVybl90bzA%253D--e22dfc52e97832a60c396b743d03c1c48a4ca294
|
25
|
+
# HTTP_X_FIRELOGGER: 0.3
|
26
|
+
# GATEWAY_INTERFACE: CGI/1.2
|
27
|
+
# SERVER_NAME: localhost
|
28
|
+
# SERVER_PORT: 3000
|
29
|
+
# QUERY_STRING:
|
30
|
+
# SERVER_PROTOCOL: HTTP/1.1
|
31
|
+
# rack.url_scheme: http
|
32
|
+
# SCRIPT_NAME:
|
33
|
+
# REMOTE_ADDR: 127.0.0.1
|
34
|
+
|
35
|
+
# TODO: specs
|
36
|
+
# http://rack.rubyforge.org/doc/
|
37
|
+
# http://rack.rubyforge.org/doc/classes/Rack/Request.html
|
38
|
+
|
39
|
+
class Rango
|
40
|
+
module Session
|
41
|
+
end
|
42
|
+
|
43
|
+
class Request < Rack::Request
|
44
|
+
# @since 0.0.1
|
45
|
+
# @return [Hash] Original Rack environment.
|
46
|
+
attr_reader :env
|
47
|
+
|
48
|
+
# @since 0.0.2
|
49
|
+
attribute :message, Hash.new
|
50
|
+
|
51
|
+
# @since 0.0.1
|
52
|
+
# @example: blog/post/rango-released
|
53
|
+
# @return [Hash] Original Rack environment.
|
54
|
+
attr_reader :path
|
55
|
+
|
56
|
+
# @since 0.0.1
|
57
|
+
# @param [Hash] env Rack environment.
|
58
|
+
def initialize(env)
|
59
|
+
@env = env
|
60
|
+
# /path will be transformed to path/
|
61
|
+
@path = env["PATH_INFO"]
|
62
|
+
@path.chomp!("/") if @path.length > 1 # so let the / just if the path is only /
|
63
|
+
@method = env["REQUEST_METHOD"].downcase
|
64
|
+
self.extend_session
|
65
|
+
end
|
66
|
+
|
67
|
+
def GET
|
68
|
+
super.deep_symbolize_keys.except(:_method)
|
69
|
+
end
|
70
|
+
|
71
|
+
def POST
|
72
|
+
super.deep_symbolize_keys.except(:_method) if self.post?
|
73
|
+
end
|
74
|
+
|
75
|
+
def PUT
|
76
|
+
if self.put?
|
77
|
+
if @env["rack.request.form_input"].eql? @env["rack.input"]
|
78
|
+
@env["rack.request.form_hash"]
|
79
|
+
elsif form_data?
|
80
|
+
@env["rack.request.form_input"] = @env["rack.input"]
|
81
|
+
unless @env["rack.request.form_hash"] =
|
82
|
+
Utils::Multipart.parse_multipart(env)
|
83
|
+
@env["rack.request.form_vars"] = @env["rack.input"].read
|
84
|
+
@env["rack.request.form_hash"] = Utils.parse_query(@env["rack.request.form_vars"])
|
85
|
+
@env["rack.input"].rewind if @env["rack.input"].respond_to?(:rewind)
|
86
|
+
end
|
87
|
+
@env["rack.request.form_hash"].deep_symbolize_keys.except(:_method)
|
88
|
+
else
|
89
|
+
{}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def DELETE
|
95
|
+
{}.deep_symbolize_keys.except(:_method)
|
96
|
+
end
|
97
|
+
|
98
|
+
def params
|
99
|
+
@params = Hash.new
|
100
|
+
[self.GET, self.POST, self.PUT, self.DELETE].each do |data|
|
101
|
+
@params.merge!(data) if data.respond_to?(:merge) # Hash, Mash and friends
|
102
|
+
end
|
103
|
+
@params.deep_symbolize_keys.except(:msg, :_method)
|
104
|
+
end
|
105
|
+
|
106
|
+
def cookies
|
107
|
+
super.except("rack.session").symbolize_keys
|
108
|
+
end
|
109
|
+
|
110
|
+
def form
|
111
|
+
data = env["rack.request.form_hash"] || Hash.new
|
112
|
+
data.deep_symbolize_keys.except(:_method)
|
113
|
+
end
|
114
|
+
|
115
|
+
def session
|
116
|
+
# Rango.logger.inspect(session: @env['rack.session'])
|
117
|
+
@env['rack.session'] ||= {}
|
118
|
+
end
|
119
|
+
|
120
|
+
def ajax?
|
121
|
+
env["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest"
|
122
|
+
end
|
123
|
+
|
124
|
+
# TODO: use extend method
|
125
|
+
def extend_session
|
126
|
+
class << session
|
127
|
+
include Rango::Session
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# @since 0.0.1
|
132
|
+
# @example: "cz"
|
133
|
+
# @return [String] Top level domain.
|
134
|
+
def tld
|
135
|
+
host.match(/^localhost/) ? nil : host.split(".").last
|
136
|
+
end
|
137
|
+
|
138
|
+
# @since 0.0.1
|
139
|
+
# @example: "101ideas.cz"
|
140
|
+
# @return [String] Domain name.
|
141
|
+
def domain
|
142
|
+
if host.match(/^localhost/)
|
143
|
+
return host.split(".").last
|
144
|
+
else
|
145
|
+
return host.split(".").last(2).join(".")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# @since 0.0.1
|
150
|
+
# @example: "blog" or "user.blog"
|
151
|
+
# @return [String] Subdomain name.
|
152
|
+
def subdomain
|
153
|
+
parts = host.split(".")
|
154
|
+
index = parts.index(self.domain)
|
155
|
+
parts[0..(index - 1)]
|
156
|
+
end
|
157
|
+
|
158
|
+
def base_url
|
159
|
+
require "uri"
|
160
|
+
fragments = URI.split("http://localhost:2000/foo/bar?q=foo")
|
161
|
+
fragments = fragments[0..4]
|
162
|
+
5.times { fragments.push(nil) }
|
163
|
+
URI::HTTP.new(*fragments).to_s
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|