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/mixins/mini.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/mixins/render"
|
4
|
-
|
5
|
-
# run app { |request, response|
|
6
|
-
# if request.env["PATH_INFO"].match(/^\/admin/)
|
7
|
-
# redirect ""
|
8
|
-
# else
|
9
|
-
# render "index"
|
10
|
-
# end
|
11
|
-
# }
|
12
|
-
module Rango
|
13
|
-
module Mini
|
14
|
-
include Rango::RenderMixin
|
15
|
-
def app(&block)
|
16
|
-
lambda do |env|
|
17
|
-
request = Rango::Request.new(env)
|
18
|
-
response = Rack::Response.new
|
19
|
-
body = block.call(request, response)
|
20
|
-
# TODO: check how rack test if object is stringable, probably not this way
|
21
|
-
raise ArgumentError unless body.respond_to?(:each) || body.is_a?(String)
|
22
|
-
response.write(body)
|
23
|
-
response.finish
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
Rack::Builder.send(:include, Rango::Mini)
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Include this module to strategy superclass
|
4
|
-
module Rango
|
5
|
-
module StrategyMixin
|
6
|
-
class << self
|
7
|
-
attribute :strategies, Array.new
|
8
|
-
|
9
|
-
def register
|
10
|
-
self.strategies.push(self)
|
11
|
-
end
|
12
|
-
|
13
|
-
def find(*args)
|
14
|
-
self.strategies.find { |strategy| strategy.match?(*args) }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def match?(*args)
|
19
|
-
raise "This method must be redefined in subclasses"
|
20
|
-
end
|
21
|
-
|
22
|
-
def run(*args)
|
23
|
-
raise "This method must be redefined in subclasses"
|
24
|
-
end
|
25
|
-
|
26
|
-
# define setup method if you need it
|
27
|
-
end
|
28
|
-
end
|
data/lib/rango/rango.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/exceptions"
|
4
|
-
require "rango/loggers/logger"
|
5
|
-
require "rango/rack/middlewares/basic"
|
6
|
-
require "rango/project"
|
7
|
-
require "rango/utils"
|
8
|
-
|
9
|
-
module Rango
|
10
|
-
# all the helpers are in Rango::Helpers
|
11
|
-
# so if you want to register your own, just
|
12
|
-
# Rango::Helpers.send(:include, Pupu::Helpers)
|
13
|
-
Helpers ||= Module.new
|
14
|
-
|
15
|
-
class << self
|
16
|
-
# @since 0.0.1
|
17
|
-
# @return [String] Returns current environment name. Possibilities are +development+ or +production+.
|
18
|
-
attribute :environment, "development"
|
19
|
-
|
20
|
-
# @since 0.0.2
|
21
|
-
# @example
|
22
|
-
# Rango.path
|
23
|
-
# # => /usr/lib/ruby/lib/ruby/site_ruby/1.8/rango
|
24
|
-
# @return [Path] Rango root path
|
25
|
-
def path
|
26
|
-
@path ||= MediaPath.new(self.root)
|
27
|
-
end
|
28
|
-
|
29
|
-
# @since 0.0.1
|
30
|
-
# @example
|
31
|
-
# Rango.root
|
32
|
-
# # => /usr/lib/ruby/lib/ruby/site_ruby/1.8/rango
|
33
|
-
# @return [Rango::Logger] Logger for logging framework-related stuff. For logging project-relating stuff please use Project.logger.
|
34
|
-
# @see Project::logger
|
35
|
-
def logger
|
36
|
-
@logger ||= Rango::Logger.new
|
37
|
-
end
|
38
|
-
|
39
|
-
# @since 0.0.1
|
40
|
-
# @example
|
41
|
-
# Rango.boot # require init.rb
|
42
|
-
# Rango.boot { require_relative "config/init.rb" } # custom boot
|
43
|
-
# @param [Hash] options You can specify flat: true for sinatra-like flat application.
|
44
|
-
# @return [Boolean] Returns true if boot succeed or false if not. If ARGV includes "-i", IRB interactive session will start.
|
45
|
-
def boot(options = Hash.new, &block)
|
46
|
-
self.environment = options[:environment] if options[:environment]
|
47
|
-
require "rango/boot"
|
48
|
-
block.call if block_given?
|
49
|
-
self.bootloaders.each do |name, bootloader|
|
50
|
-
logger.debug "Calling bootloader #{name}"
|
51
|
-
bootloader.call
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# @since 0.0.2
|
56
|
-
def reboot(options = Hash.new)
|
57
|
-
self.boot(options.merge(force: true))
|
58
|
-
end
|
59
|
-
|
60
|
-
attribute :bootloaders, Hash.new
|
61
|
-
def after_boot(name, &block)
|
62
|
-
self.bootloaders[name] = block
|
63
|
-
end
|
64
|
-
|
65
|
-
# Start IRB interactive session
|
66
|
-
# @since 0.0.1
|
67
|
-
def interactive
|
68
|
-
ARGV.delete("-i") # otherwise irb will read it
|
69
|
-
ENV["RACK_ENV"] = Rango.environment # for racksh
|
70
|
-
unless try_require("racksh/boot")
|
71
|
-
Rango.logger.info("For more goodies install racksh gem")
|
72
|
-
try_require "irb/completion" # some people can have ruby compliled without readline
|
73
|
-
Rango::Utils.load_rackup # so you can use Project.router etc
|
74
|
-
end
|
75
|
-
require "irb"
|
76
|
-
require "rango/utils"
|
77
|
-
IRB.start
|
78
|
-
end
|
79
|
-
|
80
|
-
# clever environments support
|
81
|
-
attribute :development_environments, ["development"]
|
82
|
-
attribute :testing_environments, ["test", "spec", "cucumber"]
|
83
|
-
attribute :production_environments, ["stage", "production"]
|
84
|
-
|
85
|
-
questionable :testing, lambda { self.testing_environments.include?(Rango.environment) }
|
86
|
-
questionable :development, lambda { self.development_environments.include?(Rango.environment) }
|
87
|
-
questionable :production, lambda { self.production_environments.include?(Rango.environment) }
|
88
|
-
|
89
|
-
def environment?(environment)
|
90
|
-
self.environment.eql?(environment.to_s)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
=== Introduction ===
|
2
|
-
Rango doesn't have its own router, so you can use what you like or write your own. The only thing you need to do is set few variables in rack env.
|
3
|
-
|
4
|
-
=== Rack env ===
|
5
|
-
env["rango.router.params"]
|
6
|
-
env["rango.router.app"]
|
7
|
-
|
8
|
-
=== Available routers ===
|
9
|
-
Rack::URLMap
|
10
|
-
rack-router
|
11
|
-
Usher
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Rango
|
4
|
-
module Templates
|
5
|
-
class << self
|
6
|
-
# @since 0.0.2
|
7
|
-
def engine(name)
|
8
|
-
Rango::Templates.const_get(name.to_s.capitalize + "Adapter")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Adapter
|
13
|
-
# @since 0.0.2
|
14
|
-
def proceed(io)
|
15
|
-
raise "This must be redefined in subclasses!"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# This adapter is intended just for little applications which we like to have without external applications or for testing. For normal application it's much better to use Erubis, which is much faster and has more useful features.
|
4
|
-
|
5
|
-
# Does NOT support:
|
6
|
-
# - caching
|
7
|
-
# - autoescaping
|
8
|
-
# - contexts
|
9
|
-
|
10
|
-
require "erb"
|
11
|
-
require "rango/templates/adapter"
|
12
|
-
|
13
|
-
module Rango
|
14
|
-
module Templates
|
15
|
-
class ErbAdapter < Adapter
|
16
|
-
# @since 0.0.3
|
17
|
-
def initialize
|
18
|
-
not_implemented("cache files") if Project.settings.template.caching
|
19
|
-
not_implemented("autoescape") if Project.settings.template.autoescaping
|
20
|
-
end
|
21
|
-
|
22
|
-
# @since 0.0.2
|
23
|
-
def render(io, context)
|
24
|
-
ERB.new(io.read).result(context.binding)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
def not_implemented(feature)
|
29
|
-
raise NotImplementedError, "ErbAdapter don't know how to #{feature}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
module RenderMixin
|
35
|
-
# ==== Parameters
|
36
|
-
# *args:: Arguments to pass to the block.
|
37
|
-
# &block:: The template block to call.
|
38
|
-
#
|
39
|
-
# ==== Returns
|
40
|
-
# String:: The output of the block.
|
41
|
-
#
|
42
|
-
# ==== Examples
|
43
|
-
# Capture being used in a .html.erb page:
|
44
|
-
#
|
45
|
-
# <% @foo = capture do %>
|
46
|
-
# <p>Some Foo content!</p>
|
47
|
-
# <% end %>
|
48
|
-
#
|
49
|
-
# :api: private
|
50
|
-
def capture_erb(*args, &block)
|
51
|
-
_old_buf, @_erb_buf = @_erb_buf, ""
|
52
|
-
block.call(*args)
|
53
|
-
ret = @_erb_buf
|
54
|
-
@_erb_buf = _old_buf
|
55
|
-
ret
|
56
|
-
end
|
57
|
-
|
58
|
-
# :api: private
|
59
|
-
def concat_erb(string, binding)
|
60
|
-
@_erb_buf << string
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Features:
|
4
|
-
# - autoescaping
|
5
|
-
# - caching
|
6
|
-
# - preprocessing (not yet, see ticket #68)
|
7
|
-
|
8
|
-
require "erubis"
|
9
|
-
require "rango/templates/adapter"
|
10
|
-
|
11
|
-
module Erubis
|
12
|
-
class FastEscapedEruby < FastEruby
|
13
|
-
include EscapeEnhancer
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module Rango
|
18
|
-
module Templates
|
19
|
-
class ErubisAdapter < Adapter
|
20
|
-
# @since 0.0.2
|
21
|
-
def render(io, context = Hash.new)
|
22
|
-
if Project.settings.erubis.custom_class
|
23
|
-
klass = Project.settings.erubis.custom_class
|
24
|
-
elsif Project.settings.template.autoescape
|
25
|
-
klass = Erubis::FastEscapedEruby
|
26
|
-
else
|
27
|
-
klass = Erubis::FastEruby
|
28
|
-
end
|
29
|
-
pattern = Project.settings.erubis.pattern
|
30
|
-
# Erubis::Engine.load_file is good for caching
|
31
|
-
# http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-caching
|
32
|
-
if Project.settings.template.caching
|
33
|
-
begin
|
34
|
-
template = klass.load_file(io.path, pattern: pattern, filename: io.path)
|
35
|
-
rescue NoMethodError
|
36
|
-
Rango.logger.error("Class #{klass} must respond to load_file method if you like to use caching")
|
37
|
-
end
|
38
|
-
else
|
39
|
-
template = klass.new(io.read, pattern: pattern, filename: io.path)
|
40
|
-
end
|
41
|
-
template.extend(CaptureErubis)
|
42
|
-
return template.result(context)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
module CaptureErubis
|
48
|
-
# @example Capture being used in a .html.erb page:
|
49
|
-
# <% @foo = capture do %>
|
50
|
-
# <p>Some Foo content!</p>
|
51
|
-
# <% end %>
|
52
|
-
#
|
53
|
-
# @params [*args] Arguments to pass to the block.
|
54
|
-
# @params [&block] The template block to call.
|
55
|
-
# @return [String] The output of the block.
|
56
|
-
# @api private
|
57
|
-
def capture_erubis(*args, &block)
|
58
|
-
_old_buf, @_erb_buf = @_erb_buf, ""
|
59
|
-
block.call(*args)
|
60
|
-
@_erb_buf.dup.tap do |buf|
|
61
|
-
@_erb_buf = _old_buf
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Features:
|
4
|
-
# - autoescaping
|
5
|
-
# - caching (not yet)
|
6
|
-
|
7
|
-
require "haml"
|
8
|
-
require "rango/templates/adapter"
|
9
|
-
|
10
|
-
module Rango
|
11
|
-
module Templates
|
12
|
-
class HamlAdapter < Adapter
|
13
|
-
# @since 0.0.2
|
14
|
-
def render(io, scope, locals = Hash.new)
|
15
|
-
options = Project.settings.haml.to_hash ### FIXME
|
16
|
-
options[:filename] = io.path
|
17
|
-
if File.exist?("#{io.path}.cache")
|
18
|
-
eval(File.read("#{io.path}.cache"), scope)
|
19
|
-
else
|
20
|
-
engine = Haml::Engine.new(io.read, options)
|
21
|
-
engine.render(scope, locals)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
1) local template variables
|
2
|
-
render "index", post: Post.first
|
3
|
-
+ we will get exception when we have unitialized variable (@unitialized is nil)
|
4
|
-
+ it's the same as in partials, no problem to take part of template and create new partial from it
|
5
|
-
+ we have full controll what goes to the template
|
6
|
-
2) instance controller variables
|
7
|
-
@post = Post.first
|
8
|
-
render "index"
|
9
|
-
3) combination
|
10
|
-
-> something is really important and we need ensure it is initialized, but something is optional and definitely is easier to do @foo.nil? than defined?(foo)
|
11
|
-
|
12
|
-
1) same namespace as controller
|
13
|
-
2) different namespace than controller
|
14
|
-
|
15
|
-
def index
|
16
|
-
@context[:post] = Post.first
|
17
|
-
render "index"
|
18
|
-
end
|
19
|
-
|
20
|
-
def index
|
21
|
-
render "index", post: Post.first
|
22
|
-
end
|
23
|
-
|
24
|
-
... hard to say => user must decide
|
25
|
-
|
26
|
-
list = ['<aaa>', 'b&b', '"ccc"']
|
27
|
-
puts eruby.result(binding())
|
28
|
-
|
29
|
-
!!!! binding works with local variables !!!
|
30
|
-
|
31
|
-
|
32
|
-
nechceme definice views, chceme @post, chceme request
|
33
|
-
|
34
|
-
Project.settings => OpenStruct
|
35
|
-
|
36
|
-
Project.settings.template.format = :html
|
37
|
-
Project.settings.template.format_version = 5
|
38
|
-
Project.settings.template.caching = Rango.development?
|
39
|
-
- for helpers
|
data/spec/factories.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rack/mock"
|
4
|
-
|
5
|
-
class Factory
|
6
|
-
class << self
|
7
|
-
def rack_env(environment = Hash.new)
|
8
|
-
{"PATH_INFO" => "/blog/post/a-slug", "REQUEST_METHOD" => "GET"}.merge(environment)
|
9
|
-
end
|
10
|
-
|
11
|
-
def request
|
12
|
-
require "rango/rack/request"
|
13
|
-
Rango::Request.new(self.rack_env)
|
14
|
-
end
|
15
|
-
|
16
|
-
def controller
|
17
|
-
require "rango/controller"
|
18
|
-
params = Hash.new
|
19
|
-
Rango::Controller.new(self.request, params)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/spec/rango/boot_spec.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../spec_helper"
|
4
|
-
|
5
|
-
describe Rango do
|
6
|
-
describe ".environment" do
|
7
|
-
it "should have environment" do
|
8
|
-
Rango.should respond_to(:environment)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should be development by default" do
|
12
|
-
Rango.environment.should eql("development")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../../../spec_helper"
|
4
|
-
|
5
|
-
describe "String" do
|
6
|
-
before :each do
|
7
|
-
@str = "This is a fairly long string to test with!"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should default to appending ..." do
|
11
|
-
@str.truncate(5).should == "Th..."
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should default to a length of 30" do
|
15
|
-
@str.truncate().should == "This is a fairly long strin..."
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should truncate to a given length with a given suffix" do
|
19
|
-
@str.truncate(15, "--more").should == "This is a--more"
|
20
|
-
end
|
21
|
-
end
|