rango 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/CONTRIBUTORS +1 -0
- data/README.textile +4 -1
- data/bin/rango +1 -1
- data/lib/rango.rb +78 -12
- data/lib/rango/contrib/pagination.rb +2 -0
- data/lib/rango/controller.rb +58 -12
- data/lib/rango/environments.rb +26 -0
- data/lib/rango/exceptions.rb +2 -14
- data/lib/rango/gv.rb +7 -90
- data/lib/rango/gv/static.rb +22 -0
- data/lib/rango/helpers.rb +0 -1
- data/lib/rango/helpers/assets.rb +2 -0
- data/lib/rango/helpers/general.rb +1 -0
- data/lib/rango/helpers/syntax.rb +2 -0
- data/lib/rango/mini.rb +30 -0
- data/lib/rango/mixins/application.rb +5 -3
- data/lib/rango/mixins/configurable.rb +1 -0
- data/lib/rango/mixins/render.rb +13 -84
- data/lib/rango/orm/tasks/datamapper.rake +2 -2
- data/lib/rango/project.rb +2 -2
- data/lib/rango/rack/middlewares/basic.rb +15 -11
- data/lib/rango/rack/request.rb +5 -3
- data/lib/rango/router.rb +20 -2
- data/lib/rango/router/adapters/rack_mount.rb +0 -1
- data/lib/rango/router/adapters/rack_router.rb +0 -1
- data/lib/rango/router/adapters/urlmap.rb +0 -1
- data/lib/rango/router/adapters/usher.rb +0 -1
- data/lib/rango/settings/framework.rb +2 -43
- data/lib/rango/templates/{erubis.rb → exts/erubis.rb} +0 -19
- data/lib/rango/templates/exts/tilt.rb +16 -0
- data/lib/rango/templates/helpers.rb +107 -0
- data/lib/rango/templates/template.rb +44 -115
- data/lib/rango/utils.rb +9 -4
- data/spec/rango/controller_spec.rb +3 -1
- data/spec/rango/environments_spec.rb +68 -0
- data/spec/rango/gv_spec.rb +10 -0
- data/spec/rango/mini_spec.rb +58 -0
- data/spec/rango/project_spec.rb +1 -1
- data/spec/rango/templates/template_spec.rb +81 -0
- data/spec/rango/utils_spec.rb +33 -0
- data/spec/rango_spec.rb +3 -17
- data/spec/spec_helper.rb +5 -3
- data/spec/stubs/config.ru +5 -0
- data/spec/stubs/templates/capture.html.erb +1 -1
- data/spec/stubs/templates/erubis.html.erubis +2 -0
- data/spec/stubs/templates/inheritance/basic/base.html.haml +2 -0
- data/spec/stubs/templates/inheritance/basic/index.html.haml +2 -0
- data/spec/stubs/templates/inheritance/capture/erb/base.html.erb +3 -0
- data/spec/stubs/templates/inheritance/capture/erb/index.html.erb +4 -0
- data/spec/stubs/templates/inheritance/capture/erubis/base.html.erubis +3 -0
- data/spec/stubs/templates/inheritance/capture/erubis/index.html.erubis +4 -0
- data/spec/stubs/templates/inheritance/capture/haml/base.html.haml +2 -0
- data/spec/stubs/templates/inheritance/capture/haml/index.html.haml +3 -0
- data/spec/stubs/templates/test.html.haml +1 -0
- data/spec/stubs/templates/variables.html.haml +1 -0
- data/stubs/app/content/init.rb.rbt +2 -1
- data/stubs/app/content/views.rb.rbt +2 -0
- data/stubs/bigapp/content/views/%controller%.rb.rbt +2 -0
- data/stubs/project/content/config.ru.rbt +3 -0
- data/stubs/project/content/init.rb.rbt +11 -5
- data/stubs/project/content/settings.rb +0 -2
- data/stubs/project/content/settings_local.rb.rbt +1 -1
- data/stubs/project/content/templates/base.html.haml.rbt +1 -0
- metadata +42 -329
- data/examples/README.textile +0 -12
- data/examples/blog/Gemfile +0 -80
- data/examples/blog/Rakefile +0 -12
- data/examples/blog/TODO.txt +0 -0
- data/examples/blog/bin/autospec +0 -3
- data/examples/blog/bin/css2sass +0 -3
- data/examples/blog/bin/cucumber +0 -3
- data/examples/blog/bin/haml +0 -3
- data/examples/blog/bin/html2haml +0 -3
- data/examples/blog/bin/htmldiff +0 -3
- data/examples/blog/bin/launchy +0 -3
- data/examples/blog/bin/ldiff +0 -3
- data/examples/blog/bin/nokogiri +0 -3
- data/examples/blog/bin/racksh +0 -3
- data/examples/blog/bin/rackup +0 -3
- data/examples/blog/bin/rake +0 -3
- data/examples/blog/bin/rango +0 -3
- data/examples/blog/bin/sass +0 -3
- data/examples/blog/bin/shotgun +0 -3
- data/examples/blog/bin/simple-templater +0 -3
- data/examples/blog/bin/spec +0 -3
- data/examples/blog/bin/tt +0 -3
- data/examples/blog/blog/init.rb +0 -9
- data/examples/blog/blog/models.rb +0 -21
- data/examples/blog/blog/views.rb +0 -16
- data/examples/blog/config.ru +0 -19
- data/examples/blog/gems/cache/addressable-2.1.1.gem +0 -0
- data/examples/blog/gems/cache/builder-2.1.2.gem +0 -0
- data/examples/blog/gems/cache/bundler-0.7.0.gem +0 -0
- data/examples/blog/gems/cache/cli-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/configuration-1.1.0.gem +0 -0
- data/examples/blog/gems/cache/cucumber-0.4.4.gem +0 -0
- data/examples/blog/gems/cache/data_objects-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/diff-lcs-1.1.2.gem +0 -0
- data/examples/blog/gems/cache/dm-core-0.10.1.gem +0 -0
- data/examples/blog/gems/cache/dm-timestamps-0.10.1.gem +0 -0
- data/examples/blog/gems/cache/do_mysql-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/do_sqlite3-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/extlib-0.9.13.gem +0 -0
- data/examples/blog/gems/cache/fuzzyhash-0.0.9.gem +0 -0
- data/examples/blog/gems/cache/haml-2.2.14.gem +0 -0
- data/examples/blog/gems/cache/launchy-0.3.3.gem +0 -0
- data/examples/blog/gems/cache/media-path-0.1.gem +0 -0
- data/examples/blog/gems/cache/nokogiri-1.4.0.gem +0 -0
- data/examples/blog/gems/cache/polyglot-0.2.9.gem +0 -0
- data/examples/blog/gems/cache/rack-1.0.1.gem +0 -0
- data/examples/blog/gems/cache/rack-test-0.5.2.gem +0 -0
- data/examples/blog/gems/cache/racksh-0.9.4.2.gem +0 -0
- data/examples/blog/gems/cache/rake-0.8.7.gem +0 -0
- data/examples/blog/gems/cache/rango-0.1.0.gem +0 -0
- data/examples/blog/gems/cache/rspec-1.2.9.gem +0 -0
- data/examples/blog/gems/cache/rubyexts-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/shotgun-0.4.gem +0 -0
- data/examples/blog/gems/cache/simple-templater-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/examples/blog/gems/cache/treetop-1.4.2.gem +0 -0
- data/examples/blog/gems/cache/usher-0.5.11.gem +0 -0
- data/examples/blog/gems/cache/webrat-0.5.3.gem +0 -0
- data/examples/blog/init.rb +0 -49
- data/examples/blog/settings.rb +0 -15
- data/examples/blog/settings_local.rb +0 -6
- data/examples/blog/spec/blog/init_spec.rb +0 -7
- data/examples/blog/spec/blog/models_spec.rb +0 -28
- data/examples/blog/spec/blog/views_spec.rb +0 -22
- data/examples/blog/spec/spec.opts +0 -5
- data/examples/blog/spec/spec_helper.rb +0 -27
- data/examples/blog/templates/base.html.haml +0 -16
- data/examples/blog/templates/index.html.haml +0 -12
- data/lib/rango/boot.rb +0 -55
- data/lib/rango/helpers/README +0 -179
- data/lib/rango/helpers/merb-helpers.rb +0 -3
- data/lib/rango/helpers/merb-helpers/core_ext.rb +0 -58
- data/lib/rango/helpers/merb-helpers/core_ext/numeric.rb +0 -389
- data/lib/rango/helpers/merb-helpers/date_time_formatting.rb +0 -146
- data/lib/rango/helpers/merb-helpers/date_time_helpers.rb +0 -191
- data/lib/rango/helpers/merb-helpers/form/builder.rb +0 -450
- data/lib/rango/helpers/merb-helpers/form/helpers.rb +0 -453
- data/lib/rango/helpers/merb-helpers/form_helpers.rb +0 -21
- data/lib/rango/helpers/merb-helpers/tag_helpers.rb +0 -63
- data/lib/rango/helpers/merb-helpers/text_helpers.rb +0 -73
- data/lib/rango/loggers/logger.rb +0 -100
- data/lib/rango/mixins/chainable.rb +0 -68
- data/lib/rango/mixins/hookable.rb +0 -32
- data/lib/rango/mixins/import.rb +0 -89
- data/lib/rango/mixins/mini.rb +0 -29
- data/lib/rango/mixins/strategy.rb +0 -28
- data/lib/rango/rango.rb +0 -93
- data/lib/rango/router/specification.txt +0 -11
- data/lib/rango/templates/adapter.rb +0 -19
- data/lib/rango/templates/adapters/erb.rb +0 -63
- data/lib/rango/templates/adapters/erubis.rb +0 -65
- data/lib/rango/templates/adapters/haml.rb +0 -26
- data/lib/rango/templates/templates.txt +0 -39
- data/spec/factories.rb +0 -22
- data/spec/rango/boot_spec.rb +0 -15
- data/spec/rango/helpers/merb-helpers/core_ext/numeric_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/core_ext_spec.rb +0 -21
- 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/fixture/app/controllers/application.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_check_box.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_file_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_hidden_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_option_tag.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_password_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_radio_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_radio_group.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_select.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_text_area.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_text_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/check_box.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/custom_builder.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/delete_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/exceptions.rb +0 -25
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/field_set.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/fields_for.rb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/file_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/foo.rb +0 -23
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/form.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/form_for.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/hacker.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/hidden_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/label.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/numeric_ext.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/option_tag.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/password_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/radio_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/radio_group.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/relative_date.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/relative_date_span.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/select.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/specs_controller.rb +0 -13
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/submit.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/tag_helper.rb +0 -23
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/text_area.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/text_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/helpers/global_helpers.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/models/fake_dm_model.rb +0 -27
- data/spec/rango/helpers/merb-helpers/fixture/app/models/first_generic_fake_model.rb +0 -59
- data/spec/rango/helpers/merb-helpers/fixture/app/models/hacker_generic_model.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/models/second_generic_fake_model.rb +0 -20
- data/spec/rango/helpers/merb-helpers/fixture/app/models/third_generic_fake_model.rb +0 -5
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/basic.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/basic_unchecked.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/checked.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/errors.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/on_and_off.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/raise_value_error.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/additional_attributes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/takes_string.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/with_label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/errors.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/hidden_error.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/grouped.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/nested.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/text_and_value.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/attributes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_button_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/hashes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/mixed.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/override_id.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/blank.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/multiple.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/prompt.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/with_options.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/with_options_with_blank.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_area_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_area_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/button_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/button_with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/disabled_button.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/on_off_is_boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raise_unless_both_on_and_off.html.erb +0 -2
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raises_error_if_not_boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raises_error_if_on_off_and_boolean_false.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/simple.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/to_string.html.erb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/unchecked.html.erb +0 -2
- data/spec/rango/helpers/merb-helpers/fixture/app/views/custom_builder_specs/everything.html.erb +0 -10
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_explicit_url.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_extra_params.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/simple_delete.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/client_error.html.erb +0 -37
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/internal_server_error.html.erb +0 -216
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/not_acceptable.html.erb +0 -38
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/not_found.html.erb +0 -40
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/midstream.html.erb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/nil.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fieldset_specs/legend.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/makes_multipart.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/foo/bar.html.erb +0 -0
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_for_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/create_a_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/create_a_multipart_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/fake_delete_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/fake_put_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/get_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/post_by_default.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/resourceful_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/file_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/hidden_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/option_tag.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/password_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/radio_button.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/radio_group.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/text_area.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/text_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic_with_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic_with_class.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/layout/application.html.erb +0 -11
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/minutes_to_hours.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/to_concurrency_default.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/two_digits.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/array.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/clean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/collection.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/multiple_selects.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/no_extra_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/optgroups.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/selected.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/with_blank.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/with_prompt.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/password_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/password_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/checked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/unchecked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/checked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/hash.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/specific_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_span_specs/date_span_on_same_day.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_span_specs/date_span_on_same_day_on_different_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_date_with_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_date_without_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_today.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_tomorrow.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_yesterday.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/blank.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/multiple.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/selected.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/disabled_submit.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/submit_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/submit_with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/nested_tags.html.erb +0 -5
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_content.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_content_in_the_block.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/nil.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/class.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/symbolized_name.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/development.rb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/production.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/test.rb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/config/init.rb +0 -48
- data/spec/rango/helpers/merb-helpers/fixture/config/rack.rb +0 -13
- data/spec/rango/helpers/merb-helpers/fixture/config/router.rb +0 -40
- data/spec/rango/helpers/merb-helpers/fixture/public/images/merb.jpg +0 -0
- data/spec/rango/helpers/merb-helpers/fixture/public/merb.fcgi +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/public/stylesheets/master.css +0 -119
- 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/merb_helpers_config_spec.rb +0 -85
- data/spec/rango/helpers/merb-helpers/merb_helpers_date_time_spec.rb +0 -270
- data/spec/rango/helpers/merb-helpers/merb_helpers_form_spec.rb +0 -1372
- data/spec/rango/helpers/merb-helpers/merb_helpers_tag_helper_spec.rb +0 -46
- data/spec/rango/helpers/merb-helpers/merb_helpers_text_spec.rb +0 -71
- data/spec/rango/helpers/merb-helpers/numeric_extlib_spec.rb +0 -138
- data/spec/rango/helpers/merb-helpers/ordinalize_spec.rb +0 -55
- 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_spec.rb +0 -0
- data/spec/rango/mixins/chainable_spec.rb +0 -0
- data/spec/rango/mixins/hookable_spec.rb +0 -0
- data/spec/rango/mixins/import_spec.rb +0 -0
- data/spec/rango/mixins/mini_spec.rb +0 -0
- data/spec/rango/mixins/strategy_spec.rb +0 -0
- data/spec/rango/rango_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 -117
- data/spec/rango/templates/adapters/haml_spec.rb +0 -0
- data/spec/rango/templates/adapters/template_helpers.rb +0 -38
data/lib/rango/helpers.rb
CHANGED
data/lib/rango/helpers/assets.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
# TODO: javascript "application" => media/javascripts/application.js
|
4
4
|
# ... but what if I need full path? It should be tested if file exist, of course
|
5
5
|
# javascript Path.new("design/whatever.js")
|
6
|
+
require "rango/helpers"
|
7
|
+
|
6
8
|
module Rango
|
7
9
|
module Helpers
|
8
10
|
# stolen from pupu (but it's OK, it's my code)
|
data/lib/rango/helpers/syntax.rb
CHANGED
data/lib/rango/mini.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Rango::Mini is the most low-level part which can render
|
4
|
+
# templates standalone. More low-level is only the RenderMixin.
|
5
|
+
# See http://wiki.github.com/botanicus/rango/template-rendering
|
6
|
+
|
7
|
+
require "rango/router"
|
8
|
+
require "rango/mixins/render"
|
9
|
+
require "rango/rack/request"
|
10
|
+
|
11
|
+
module Rango
|
12
|
+
module Mini
|
13
|
+
include Rango::RenderMixin
|
14
|
+
extend self # so you can run Rango::Mini.app
|
15
|
+
def app(&block)
|
16
|
+
raise ArgumentError, "Block is required" unless block_given?
|
17
|
+
lambda do |env|
|
18
|
+
Rango::Router.set_rack_env(env)
|
19
|
+
request = Rango::Request.new(env)
|
20
|
+
response = Rack::Response.new
|
21
|
+
body = block.call(request, response)
|
22
|
+
# TODO: check how rack test if object is stringable, probably not this way
|
23
|
+
raise ArgumentError, "It has to return a valid rack body, #{body.inspect} returned" unless body.respond_to?(:each) || body.is_a?(String)
|
24
|
+
response.write(body)
|
25
|
+
array = response.finish
|
26
|
+
[array[0], array[1], body] # we don't want to have Rack::Response instance instead body, it's mess!
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require "rubyexts/mixins/import"
|
4
|
+
|
3
5
|
module Rango
|
4
6
|
module ApplicationMixin
|
5
|
-
include
|
7
|
+
include RubyExts::ImportMixin
|
6
8
|
# @since 0.0.1
|
7
9
|
# @see Path
|
8
10
|
# @return [Path] Path reprezentation of project root directory.
|
@@ -17,9 +19,9 @@ module Rango
|
|
17
19
|
end
|
18
20
|
|
19
21
|
# @since 0.0.1
|
20
|
-
# @return [
|
22
|
+
# @return [RubyExts::Logger] Logger for project related stuff.
|
21
23
|
def logger
|
22
|
-
@logger ||=
|
24
|
+
@logger ||= RubyExts::Logger.new
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
data/lib/rango/mixins/render.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require "rango/project"
|
3
4
|
require "rango/router"
|
4
5
|
require "rango/templates/template"
|
5
6
|
|
@@ -7,65 +8,8 @@ require "rango/templates/template"
|
|
7
8
|
module Rango
|
8
9
|
module RenderMixin
|
9
10
|
include Rango::UrlHelper
|
11
|
+
extend self # so you can use Rango::RenderMixin.render
|
10
12
|
|
11
|
-
# @since 0.0.1
|
12
|
-
# @return [Rango::Request]
|
13
|
-
# @see Rango::Request
|
14
|
-
attr_accessor :request, :params, :cookies, :response
|
15
|
-
# @since 0.0.1
|
16
|
-
# @return [Hash] Hash with params from request. For example <code>{messages: {success: "You're logged in"}, post: {id: 2}}</code>
|
17
|
-
attr_accessor :params
|
18
|
-
|
19
|
-
attribute :status
|
20
|
-
attribute :headers, Hash.new
|
21
|
-
|
22
|
-
# @since 0.0.1
|
23
|
-
# @return [Rango::Logger] Logger for logging project related stuff.
|
24
|
-
# @see Rango::Logger
|
25
|
-
attribute :logger, Project.logger
|
26
|
-
|
27
|
-
# The rails-style flash messages
|
28
|
-
# @since 0.0.2
|
29
|
-
def message
|
30
|
-
@message ||= (request.GET[:msg] || Hash.new)
|
31
|
-
end
|
32
|
-
|
33
|
-
# @since 0.0.2
|
34
|
-
def redirect(url, options = Hash.new)
|
35
|
-
self.status = 302
|
36
|
-
|
37
|
-
# for example ?msg[error]=foo
|
38
|
-
[:error, :success, :notice].each do |type|
|
39
|
-
if msg = (options[type] || message[type])
|
40
|
-
url.concat("?msg[#{type}]=#{msg}")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
self.headers["Location"] = URI.escape(url)
|
45
|
-
return String.new
|
46
|
-
end
|
47
|
-
|
48
|
-
# Calls the capture method for the selected template engine.
|
49
|
-
#
|
50
|
-
# ==== Parameters
|
51
|
-
# *args:: Arguments to pass to the block.
|
52
|
-
# &block:: The block to call.
|
53
|
-
#
|
54
|
-
# ==== Returns
|
55
|
-
# String:: The output of a template block or the return value of a non-template block converted to a string.
|
56
|
-
#
|
57
|
-
# :api: public
|
58
|
-
def capture(*args, &block)
|
59
|
-
ret = nil
|
60
|
-
|
61
|
-
captured = send("capture_#{Project.settings.template_engine}", *args) do |*args|
|
62
|
-
ret = yield *args
|
63
|
-
end
|
64
|
-
|
65
|
-
# return captured value only if it is not empty
|
66
|
-
captured.empty? ? ret.to_s : captured
|
67
|
-
end
|
68
|
-
|
69
13
|
# class Posts < Rango::Controller
|
70
14
|
# def context
|
71
15
|
# Object.new
|
@@ -82,46 +26,31 @@ module Rango
|
|
82
26
|
# This context will be extended by same crucial methods from template mixin
|
83
27
|
# We are in context of current controller by default
|
84
28
|
def context
|
85
|
-
|
29
|
+
Object.new.extend(Rango::Helpers)
|
86
30
|
end
|
87
31
|
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
|
93
|
-
|
94
|
-
# :api: public
|
95
|
-
def concat(str, binding)
|
96
|
-
self.send("concat_#{Project.settings.template_engine}", str, binding)
|
97
|
-
end
|
98
|
-
|
99
|
-
# view:
|
100
|
-
# render "index"
|
101
|
-
# template:
|
102
|
-
# extends "base.html" if layout
|
103
|
-
# This is helper can works as render layout: false for AJAX requests when you probably would like to render just the page without layout
|
104
|
-
def layout
|
105
|
-
request.ajax?
|
106
|
-
end
|
107
|
-
|
108
|
-
# RENDERING #
|
109
|
-
def template_location(extension = "html")
|
110
|
-
File.join(self.controller_name, "#{self.env[:action]}.#{extension}")
|
32
|
+
# def show
|
33
|
+
# locals[:post] = Post.get(params[:id])
|
34
|
+
# render "show.html", locals
|
35
|
+
# end
|
36
|
+
def locals
|
37
|
+
@locals ||= {message: self.message}
|
111
38
|
end
|
112
39
|
|
113
40
|
# TODO: extensions handling
|
114
41
|
# @since 0.0.2
|
115
42
|
def render(template, locals = Hash.new)
|
43
|
+
Rango.logger.inspect(locals: locals.merge(request: self.request.to_s))
|
44
|
+
locals = {request: self.request}.merge(locals)
|
116
45
|
if self.class.respond_to?(:before_render_filters) # generic views, plain rack etc
|
117
46
|
run_filters2 self.class.before_render_filters, template, locals
|
118
47
|
end
|
119
48
|
template, locals = self.template_location, template if template.is_a?(Hash) && locals.empty?
|
120
|
-
template2 = Rango::Templates::Template.new(template, self.context
|
49
|
+
template2 = Rango::Templates::Template.new(template, self.context)
|
121
50
|
if self.class.respond_to?(:after_render_filters)
|
122
51
|
run_filters2 self.class.after_render_filters, template2
|
123
52
|
end
|
124
|
-
return template2.render
|
53
|
+
return template2.render(locals)
|
125
54
|
end
|
126
55
|
|
127
56
|
# @since 0.0.2
|
@@ -6,7 +6,7 @@ namespace :db do
|
|
6
6
|
task :automigrate, :environment do |task, args|
|
7
7
|
RANGO_ENV = args.environment || ENV["RANGO_ENV"] || "development"
|
8
8
|
Rake::Task[:environment].invoke
|
9
|
-
Rango.logger.info("[#{Rango.environment}] Migrating
|
9
|
+
Rango.logger.info("[#{Rango.environment}] Migrating databases ...")
|
10
10
|
result = DataMapper.auto_migrate!
|
11
11
|
Rango.logger.debug("Result: #{result.inspect}")
|
12
12
|
end
|
@@ -16,7 +16,7 @@ namespace :db do
|
|
16
16
|
task :autupgrade, :environment do |task, args|
|
17
17
|
RANGO_ENV = args.environment || ENV["RANGO_ENV"] || "development"
|
18
18
|
Rake::Task[:environment].invoke
|
19
|
-
Rango.logger.info("[#{Rango.environment}] Upgrading
|
19
|
+
Rango.logger.info("[#{Rango.environment}] Upgrading databases ...")
|
20
20
|
result = DataMapper.auto_upgrade!
|
21
21
|
Rango.logger.debug("Result: #{result.inspect}")
|
22
22
|
end
|
data/lib/rango/project.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require "rango/settings"
|
4
|
-
require "rango/mixins/import"
|
5
4
|
require "rango/mixins/application"
|
6
5
|
require "rango/mixins/configurable"
|
6
|
+
require "rubyexts/mixins/import"
|
7
7
|
|
8
8
|
class Project
|
9
9
|
class << self
|
10
|
-
include
|
10
|
+
include RubyExts::ImportMixin
|
11
11
|
include Rango::ApplicationMixin
|
12
12
|
include Rango::Configurable
|
13
13
|
# @since 0.0.1
|
@@ -19,11 +19,12 @@ module Rango
|
|
19
19
|
class Basic
|
20
20
|
attr_accessor :before, :after
|
21
21
|
def initialize(app, &block)
|
22
|
+
@@called = false unless defined?(@@called) # I'm not entirely sure why we have to do this
|
22
23
|
@app = app.extend(Rango::RackDebug)
|
23
24
|
|
24
25
|
#, key: 'rack.session', domain: 'foo.com', path: '/', expire_after: 2592000, secret: 'change_me'
|
25
26
|
self.before = [Rango::Middlewares::Encoding, Rack::MethodOverride, [Rack::Session::Cookie, path: '/']]
|
26
|
-
self.after = [Rack::ContentType, Rack::ContentLength,
|
27
|
+
self.after = [Rack::ContentType, Rack::ContentLength, Rack::Head]
|
27
28
|
|
28
29
|
self.static_files_serving
|
29
30
|
|
@@ -36,18 +37,21 @@ module Rango
|
|
36
37
|
def call(env)
|
37
38
|
# Matryoshka principle
|
38
39
|
# MethodOverride.new(Encoding.new(@app))
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
unless @@called
|
41
|
+
middlewares = self.before.reverse + self.after.reverse
|
42
|
+
@app = middlewares.inject(@app) do |app, klass|
|
43
|
+
args = Array.new
|
44
|
+
if klass.is_a?(Array)
|
45
|
+
klass, args = klass
|
46
|
+
args = [args]
|
47
|
+
Rango.logger.debug("#{klass}.new(app, #{args.map { |arg| arg.inspect }.join(", ")})")
|
48
|
+
else
|
49
|
+
Rango.logger.debug("#{klass}.new(app)")
|
50
|
+
end
|
51
|
+
klass.new(app, *args).extend(RackDebug)
|
48
52
|
end
|
49
|
-
klass.new(app, *args).extend(RackDebug)
|
50
53
|
end
|
54
|
+
@@called = true
|
51
55
|
@app.call(env)
|
52
56
|
end
|
53
57
|
|
data/lib/rango/rack/request.rb
CHANGED
@@ -36,13 +36,15 @@
|
|
36
36
|
# http://rack.rubyforge.org/doc/
|
37
37
|
# http://rack.rubyforge.org/doc/classes/Rack/Request.html
|
38
38
|
|
39
|
+
require "rack"
|
40
|
+
require "rubyexts/try"
|
39
41
|
require "rubyexts/hash" # Hash#except
|
40
42
|
|
41
43
|
module Rango
|
42
44
|
module Session
|
43
45
|
end
|
44
46
|
|
45
|
-
class Request < Rack::Request
|
47
|
+
class Request < ::Rack::Request
|
46
48
|
# @since 0.0.1
|
47
49
|
# @return [Hash] Original Rack environment.
|
48
50
|
attr_reader :env
|
@@ -61,8 +63,8 @@ module Rango
|
|
61
63
|
@env = env
|
62
64
|
# /path will be transformed to path/
|
63
65
|
@path = env["PATH_INFO"]
|
64
|
-
@path.chomp!("/") if @path.length > 1 # so let the / just if the path is only /
|
65
|
-
@method = env["REQUEST_METHOD"].downcase
|
66
|
+
@path.chomp!("/") if @path && @path.length > 1 # so let the / just if the path is only /
|
67
|
+
@method = env["REQUEST_METHOD"].try(:downcase)
|
66
68
|
self.extend_session
|
67
69
|
end
|
68
70
|
|
data/lib/rango/router.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require "rango" # for helpers
|
4
|
+
|
3
5
|
module Rango
|
4
6
|
module UrlHelper
|
5
7
|
# url(:login)
|
@@ -11,7 +13,18 @@ module Rango
|
|
11
13
|
Helpers.send(:include, UrlHelper)
|
12
14
|
|
13
15
|
class Router
|
14
|
-
@@routers
|
16
|
+
@@routers ||= Hash.new
|
17
|
+
|
18
|
+
def self.router
|
19
|
+
@@router
|
20
|
+
rescue
|
21
|
+
raise "You have to run Rango::Router.use(router_name) first!"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.router=(router)
|
25
|
+
@@router = router
|
26
|
+
end
|
27
|
+
|
15
28
|
def self.implement(router, &block)
|
16
29
|
@@routers[router] = block
|
17
30
|
end
|
@@ -19,8 +32,13 @@ module Rango
|
|
19
32
|
def self.use(router)
|
20
33
|
require_relative "router/adapters/#{router}"
|
21
34
|
Rango.logger.debug("Using router #{router}")
|
22
|
-
define_method(:set_rack_env, @@routers[router])
|
23
35
|
@@router = router
|
24
36
|
end
|
37
|
+
|
38
|
+
def self.set_rack_env(env)
|
39
|
+
unless env["rango.router.params"]
|
40
|
+
@@routers[self.router].call(env)
|
41
|
+
end
|
42
|
+
end
|
25
43
|
end
|
26
44
|
end
|
@@ -5,10 +5,6 @@ require "rango/settings"
|
|
5
5
|
module Rango
|
6
6
|
module Settings
|
7
7
|
class Framework < Settings
|
8
|
-
# @since 0.0.1
|
9
|
-
# @return [Boolean] explanation
|
10
|
-
hattribute :debug, true
|
11
|
-
|
12
8
|
# @since 0.0.1
|
13
9
|
# @return [String] Path to your +media+ directory.
|
14
10
|
hattribute :media_root, lambda { File.join(Project.root, "media") }
|
@@ -21,49 +17,12 @@ module Rango
|
|
21
17
|
# @return [Array[String]] Array with paths where Rango will trying to find templates.
|
22
18
|
hattribute :template_dirs, ["templates"]
|
23
19
|
|
24
|
-
# @since 0.0.1
|
25
|
-
# @return [String] Name of your database or path to the database if you are using SQLite3.
|
26
|
-
hattribute :database_name, lambda { "#{Rango.environment}.db" }
|
27
|
-
|
28
|
-
# @since 0.0.2
|
29
|
-
# @return [String] Array of emails.
|
30
|
-
hattribute :admins, Array.new
|
31
|
-
|
32
|
-
# @since 0.0.1
|
33
|
-
# @return [String] Database adapter.
|
34
|
-
hattribute :database_adapter, "sqlite3"
|
35
|
-
|
36
|
-
# @since 0.0.1
|
37
|
-
# @return [String] explanation
|
38
|
-
# hattribute :logger_strategy, "fireruby"
|
39
|
-
|
40
|
-
# @since 0.0.1
|
41
|
-
# @return [Boolean] ORM. Can be datamapper or nil.
|
42
|
-
hattribute :orm
|
43
|
-
|
44
|
-
# @since 0.0.1
|
45
|
-
# @return [Boolean] Template engine. Can be haml, erb, erubis or nil (so just plain html will be returned).
|
46
|
-
hattribute :template_engine, "haml"
|
47
|
-
|
48
|
-
# @since 0.0.1
|
49
|
-
# @return [Boolean] Testing engine. Can be rspec or nil.
|
50
|
-
hattribute :testing_engine
|
51
|
-
|
52
|
-
# @since 0.0.1
|
53
|
-
# @return [Boolean] Features engine. Can be cucumber or nil.
|
54
|
-
hattribute :features_engine
|
55
|
-
|
56
20
|
# @since 0.0.2
|
57
21
|
hattribute :mime_formats, Array.new
|
58
22
|
|
59
23
|
# @since 0.0.2
|
60
|
-
|
61
|
-
|
62
|
-
# @since 0.0.2
|
63
|
-
hattribute :gems_directory, lambda { File.join(Project.root, "gems") }
|
64
|
-
|
65
|
-
# @since 0.0.2
|
66
|
-
hattribute :sources_directory, lambda { File.join(Project.root, "sources") }
|
24
|
+
# Just informative for plugins, it doesn't really do anything
|
25
|
+
hattribute :orm
|
67
26
|
|
68
27
|
# @since 0.0.2
|
69
28
|
# Project.settings.erubis.pattern
|