sproutit-sproutcore 1.0.0.20090407205609
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Buildfile +115 -0
- data/History.txt +7 -0
- data/README.txt +102 -0
- data/Rakefile +54 -0
- data/Todo.txt +1 -0
- data/bin/sc-build +13 -0
- data/bin/sc-build-number +13 -0
- data/bin/sc-gen +13 -0
- data/bin/sc-init +13 -0
- data/bin/sc-manifest +13 -0
- data/bin/sc-server +13 -0
- data/bin/sproutcore +14 -0
- data/buildtasks/build.rake +73 -0
- data/buildtasks/entry.rake +59 -0
- data/buildtasks/manifest.rake +469 -0
- data/buildtasks/render.rake +21 -0
- data/buildtasks/target.rake +42 -0
- data/gen/Buildfile +16 -0
- data/gen/app/Buildfile +36 -0
- data/gen/app/README +1 -0
- data/gen/app/USAGE +13 -0
- data/gen/app/templates/apps/{target_name}/core.js +27 -0
- data/gen/app/templates/apps/{target_name}/english.lproj/loading.rhtml +9 -0
- data/gen/app/templates/apps/{target_name}/english.lproj/main_page.js +22 -0
- data/gen/app/templates/apps/{target_name}/english.lproj/strings.js +15 -0
- data/gen/app/templates/apps/{target_name}/main.js +30 -0
- data/gen/controller/Buildfile +18 -0
- data/gen/controller/README +1 -0
- data/gen/controller/USAGE +13 -0
- data/gen/controller/templates/controllers/{filename}.js +18 -0
- data/gen/controller/templates/tests/controllers/{filename}.js +15 -0
- data/gen/framework/Buildfile +36 -0
- data/gen/framework/README +1 -0
- data/gen/framework/USAGE +13 -0
- data/gen/framework/templates/frameworks/{target_name}/core.js +21 -0
- data/gen/framework/templates/frameworks/{target_name}/english.lproj/strings.js +15 -0
- data/gen/language/Buildfile +26 -0
- data/gen/language/README +1 -0
- data/gen/language/USAGE +13 -0
- data/gen/language/templates/{filename}/strings.js +14 -0
- data/gen/model/Buildfile +16 -0
- data/gen/model/README +1 -0
- data/gen/model/USAGE +15 -0
- data/gen/model/templates/fixtures/{filename}.js +35 -0
- data/gen/model/templates/models/{filename}.js +19 -0
- data/gen/model/templates/tests/models/{filename}.js +15 -0
- data/gen/project/Buildfile +45 -0
- data/gen/project/INIT +3 -0
- data/gen/project/README +1 -0
- data/gen/project/USAGE +2 -0
- data/gen/project/templates/{filename}/Buildfile +7 -0
- data/gen/project/templates/{filename}/README +7 -0
- data/gen/test/Buildfile +25 -0
- data/gen/test/README +1 -0
- data/gen/test/USAGE +12 -0
- data/gen/test/templates/tests/{filename}.js +15 -0
- data/gen/theme/Buildfile +36 -0
- data/gen/theme/README +1 -0
- data/gen/theme/USAGE +13 -0
- data/gen/theme/templates/themes/{target_name}/english.lproj/strings.js +15 -0
- data/gen/view/Buildfile +18 -0
- data/gen/view/README +1 -0
- data/gen/view/USAGE +13 -0
- data/gen/view/templates/tests/views/{filename}.js +15 -0
- data/gen/view/templates/views/{filename}.js +18 -0
- data/lib/sproutcore.rb +130 -0
- data/lib/sproutcore/builders/base.rb +79 -0
- data/lib/sproutcore/builders/combine.rb +37 -0
- data/lib/sproutcore/builders/html.rb +177 -0
- data/lib/sproutcore/builders/javascript.rb +55 -0
- data/lib/sproutcore/builders/minify.rb +67 -0
- data/lib/sproutcore/builders/sass.rb +55 -0
- data/lib/sproutcore/builders/strings.rb +44 -0
- data/lib/sproutcore/builders/stylesheet.rb +40 -0
- data/lib/sproutcore/builders/test.rb +58 -0
- data/lib/sproutcore/builders/test_index.rb +26 -0
- data/lib/sproutcore/buildfile.rb +483 -0
- data/lib/sproutcore/buildfile/build_task.rb +33 -0
- data/lib/sproutcore/buildfile/buildfile_dsl.rb +162 -0
- data/lib/sproutcore/buildfile/cloneable.rb +34 -0
- data/lib/sproutcore/buildfile/early_time.rb +29 -0
- data/lib/sproutcore/buildfile/invocation_chain.rb +64 -0
- data/lib/sproutcore/buildfile/namespace.rb +33 -0
- data/lib/sproutcore/buildfile/string_ext.rb +198 -0
- data/lib/sproutcore/buildfile/task.rb +304 -0
- data/lib/sproutcore/buildfile/task_arguments.rb +86 -0
- data/lib/sproutcore/buildfile/task_manager.rb +193 -0
- data/lib/sproutcore/deprecated/view_helper.rb +662 -0
- data/lib/sproutcore/helpers/capture_helper.rb +30 -0
- data/lib/sproutcore/helpers/cssmin.rb +202 -0
- data/lib/sproutcore/helpers/dom_id_helper.rb +21 -0
- data/lib/sproutcore/helpers/entry_sorter.rb +105 -0
- data/lib/sproutcore/helpers/packed_optimizer.rb +102 -0
- data/lib/sproutcore/helpers/static_helper.rb +268 -0
- data/lib/sproutcore/helpers/tag_helper.rb +117 -0
- data/lib/sproutcore/helpers/text_helper.rb +303 -0
- data/lib/sproutcore/models/generator.rb +493 -0
- data/lib/sproutcore/models/hash_struct.rb +109 -0
- data/lib/sproutcore/models/manifest.rb +342 -0
- data/lib/sproutcore/models/manifest_entry.rb +232 -0
- data/lib/sproutcore/models/project.rb +270 -0
- data/lib/sproutcore/models/target.rb +403 -0
- data/lib/sproutcore/rack/builder.rb +269 -0
- data/lib/sproutcore/rack/dev.rb +51 -0
- data/lib/sproutcore/rack/docs.rb +24 -0
- data/lib/sproutcore/rack/proxy.rb +92 -0
- data/lib/sproutcore/rack/service.rb +141 -0
- data/lib/sproutcore/rack/test_runner.rb +24 -0
- data/lib/sproutcore/render_engines/erubis.rb +55 -0
- data/lib/sproutcore/render_engines/haml.rb +39 -0
- data/lib/sproutcore/tools.rb +311 -0
- data/lib/sproutcore/tools/build.rb +80 -0
- data/lib/sproutcore/tools/build_number.rb +23 -0
- data/lib/sproutcore/tools/gen.rb +99 -0
- data/lib/sproutcore/tools/init.rb +40 -0
- data/lib/sproutcore/tools/manifest.rb +84 -0
- data/lib/sproutcore/tools/server.rb +45 -0
- data/spec/buildtasks/build/copy_spec.rb +60 -0
- data/spec/buildtasks/build/spec_helper.rb +36 -0
- data/spec/buildtasks/manifest/catalog_spec.rb +48 -0
- data/spec/buildtasks/manifest/hide_buildfiles_spec.rb +125 -0
- data/spec/buildtasks/manifest/localize_spec.rb +97 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +246 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +87 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb +175 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb +65 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +70 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +152 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb +98 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb +64 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb +163 -0
- data/spec/buildtasks/manifest/prepare_spec.rb +43 -0
- data/spec/buildtasks/manifest/spec_helper.rb +35 -0
- data/spec/buildtasks/target_spec.rb +214 -0
- data/spec/fixtures/builder_tests/Buildfile +15 -0
- data/spec/fixtures/builder_tests/apps/combine_test/a.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/b.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/c.js +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/a.css +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/b.css +1 -0
- data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/c.css +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/bar1_sample.rhtml +2 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/erb_sample.html.erb +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/icons/image.png +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/image.jpg +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/rhtml_sample.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/apps/html_test/english.lproj/style.css +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/french.lproj/french-icons/fr.png +0 -0
- data/spec/fixtures/builder_tests/apps/html_test/french.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/apps/html_test/lib/layout_template.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/html_test/scripts.js +0 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/sc_static.js +15 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/sc_super.js +4 -0
- data/spec/fixtures/builder_tests/apps/javascript_test/strings.js +7 -0
- data/spec/fixtures/builder_tests/apps/sass_test/sample.sass +3 -0
- data/spec/fixtures/builder_tests/apps/strings_test/lproj/strings.js +8 -0
- data/spec/fixtures/builder_tests/apps/stylesheet_test/build_directives.css +9 -0
- data/spec/fixtures/builder_tests/apps/stylesheet_test/sc_static.css +12 -0
- data/spec/fixtures/builder_tests/apps/test_test/lib/alt_layout.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/lib/test_layout.rhtml +3 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test.js +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test2.js +1 -0
- data/spec/fixtures/builder_tests/apps/test_test/tests/rhtml_test.rhtml +4 -0
- data/spec/fixtures/builder_tests/frameworks/debug/core.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/debug/english.lproj/dummy.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/qunit/core.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/qunit/english.lproj/dummy.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/req_style_1.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_1/req_js_1.js +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/req_style_2.css +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/javascript.js +1 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/lib/alt_layout.rhtml +0 -0
- data/spec/fixtures/builder_tests/frameworks/req_target_2/req_js_2.js +0 -0
- data/spec/fixtures/builder_tests/themes/sample_theme/Buildfile +1 -0
- data/spec/fixtures/buildfiles/basic/Buildfile +16 -0
- data/spec/fixtures/buildfiles/basic/task_module.rake +6 -0
- data/spec/fixtures/buildfiles/installed/Buildfile +7 -0
- data/spec/fixtures/buildfiles/installed/Buildfile2 +5 -0
- data/spec/fixtures/buildfiles/project_test/Buildfile +4 -0
- data/spec/fixtures/buildfiles/project_test/not_project/Buildfile +2 -0
- data/spec/fixtures/buildfiles/project_test/not_project/child/PLACEHOLDER +0 -0
- data/spec/fixtures/entry_for_project/Buildfile +1 -0
- data/spec/fixtures/entry_for_project/apps/test_app/entry.txt +0 -0
- data/spec/fixtures/entry_for_project/apps/test_app/frameworks/nested/PLACEHOLDER +0 -0
- data/spec/fixtures/entry_for_project/frameworks/shared/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/Buildfile +8 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/Buildfile +5 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/custom_foos/foos/not_foo1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/nested/Buildfile +8 -0
- data/spec/fixtures/find_targets/nested/apps/app1/Buildfile +1 -0
- data/spec/fixtures/find_targets/nested/apps/app1/apps/nested_app/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/clients/client1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/frameworks/framework1/frameworks/framework1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/frameworks/framework2/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/themes/theme1/PLACEHOLDER +0 -0
- data/spec/fixtures/find_targets/standard/themes/theme2/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/English.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/FreNCH.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/caps_long_names/UnknOWN.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/english.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/french.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/german.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/italian.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/japanese.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/spanish.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/long_names/unknown.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/no_names/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/de.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-CA.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-GB.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en-US.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/en.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/es.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/foo.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/fr.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/it.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/languages/apps/short_names/ja.lproj/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/1.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/B.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/a/b.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/b/a.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/c.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/core.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/B.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/b.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/b/a.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/c.css +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/lproj/strings.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/utils.js +1 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/a.js +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/b.js +3 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/c.js +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/a.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/b.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/c.css +2 -0
- data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/d.js +1 -0
- data/spec/fixtures/real_world/Buildfile +12 -0
- data/spec/fixtures/real_world/apps/account/README +1 -0
- data/spec/fixtures/real_world/apps/calendar/README +1 -0
- data/spec/fixtures/real_world/apps/contacts/README_BEFORE_EDITING +1 -0
- data/spec/fixtures/real_world/apps/files/README +1 -0
- data/spec/fixtures/real_world/apps/mail/README +1 -0
- data/spec/fixtures/real_world/apps/mobile_photos/README +1 -0
- data/spec/fixtures/real_world/apps/photos/README +1 -0
- data/spec/fixtures/real_world/apps/uploader/README +1 -0
- data/spec/fixtures/real_world/frameworks/core_files/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/core_photos/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/shared/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +26 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/README +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/test_runner/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/core.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/debug/debug-resource.html +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/debug/sample_debug.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/demo2.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/debug/sample_debug-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.css +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.html +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo2.sass +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.haml +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.rhtml +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/has_require.css +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_require.css +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_sc_resource.rhtml +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/protocols/sample-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.css +6 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.rhtml +3 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/strings.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/tests/sample-loc.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample-json-fixture.json +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample_fixtures.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/application/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/costello/core.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/data_store/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/debug/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/desktop/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/empty_theme/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/foundation/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/mobile/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/qunit/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/uploader/PLACEHOLDER +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/french-resource.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/strings.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/german-resource.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/strings.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/has_require.js +4 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/lib/index.html +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/no_require.js +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/protocols/sample.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/sc_resource.js +6 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample1.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample2.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.js +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.rhtml +1 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/themes/standard_theme/README +0 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/views/view.js +1 -0
- data/spec/fixtures/real_world/generators/sample_custom/Buildfile +0 -0
- data/spec/fixtures/real_world/generators/sample_custom/templates/{filename}.js +1 -0
- data/spec/fixtures/recursive_project/Buildfile +8 -0
- data/spec/fixtures/recursive_project/frameworks/sproutcore/frameworks/costello/PLACEHOLDER +0 -0
- data/spec/lib/builders/combine_spec.rb +67 -0
- data/spec/lib/builders/html_spec.rb +577 -0
- data/spec/lib/builders/javascript_spec.rb +81 -0
- data/spec/lib/builders/sass_spec.rb +43 -0
- data/spec/lib/builders/spec_helper.rb +30 -0
- data/spec/lib/builders/strings_spec.rb +52 -0
- data/spec/lib/builders/stylesheet_spec.rb +63 -0
- data/spec/lib/builders/test_index_spec.rb +44 -0
- data/spec/lib/builders/test_spec.rb +135 -0
- data/spec/lib/buildfile/config_for_spec.rb +81 -0
- data/spec/lib/buildfile/define_spec.rb +59 -0
- data/spec/lib/buildfile/dup_spec.rb +65 -0
- data/spec/lib/buildfile/invoke_spec.rb +130 -0
- data/spec/lib/buildfile/load_spec.rb +49 -0
- data/spec/lib/buildfile/task/dup_spec.rb +55 -0
- data/spec/lib/buildfile/task_defined_spec.rb +17 -0
- data/spec/lib/buildfile_commands/build_task_spec.rb +19 -0
- data/spec/lib/buildfile_commands/config_spec.rb +97 -0
- data/spec/lib/buildfile_commands/import_spec.rb +17 -0
- data/spec/lib/buildfile_commands/namespace_spec.rb +18 -0
- data/spec/lib/buildfile_commands/proxies_spec.rb +38 -0
- data/spec/lib/buildfile_commands/replace_task_spec.rb +29 -0
- data/spec/lib/buildfile_commands/task_spec.rb +36 -0
- data/spec/lib/helpers/packing_optimizer/optimize_spec.rb +26 -0
- data/spec/lib/models/hash_struct/deep_clone_spec.rb +27 -0
- data/spec/lib/models/hash_struct/has_options_spec.rb +32 -0
- data/spec/lib/models/hash_struct/hash_spec.rb +64 -0
- data/spec/lib/models/hash_struct/merge_spec.rb +26 -0
- data/spec/lib/models/hash_struct/method_missing.rb +41 -0
- data/spec/lib/models/manifest/add_entry_spec.rb +36 -0
- data/spec/lib/models/manifest/add_transform_spec.rb +90 -0
- data/spec/lib/models/manifest/build_spec.rb +78 -0
- data/spec/lib/models/manifest/entry_for_spec.rb +94 -0
- data/spec/lib/models/manifest/find_entry.rb +84 -0
- data/spec/lib/models/manifest/prepare_spec.rb +62 -0
- data/spec/lib/models/manifest_entry/cacheable_url_spec.rb +31 -0
- data/spec/lib/models/manifest_entry/prepare_spec.rb +54 -0
- data/spec/lib/models/project/add_target_spec.rb +44 -0
- data/spec/lib/models/project/buildfile_spec.rb +35 -0
- data/spec/lib/models/project/find_targets_for_spec.rb +77 -0
- data/spec/lib/models/project/load_nearest_project_spec.rb +23 -0
- data/spec/lib/models/project/target_for_spec.rb +33 -0
- data/spec/lib/models/project/targets_spec.rb +62 -0
- data/spec/lib/models/target/compute_build_number_spec.rb +125 -0
- data/spec/lib/models/target/config_spec.rb +30 -0
- data/spec/lib/models/target/expand_required_targets_spec.rb +48 -0
- data/spec/lib/models/target/installed_languages_spec.rb +47 -0
- data/spec/lib/models/target/lproj_for_spec.rb +38 -0
- data/spec/lib/models/target/manifest_for_spec.rb +42 -0
- data/spec/lib/models/target/parent_target_spec.rb +21 -0
- data/spec/lib/models/target/prepare_spec.rb +53 -0
- data/spec/lib/models/target/required_targets_spec.rb +119 -0
- data/spec/lib/models/target/target_for_spec.rb +56 -0
- data/spec/lib/tools/build_number_spec.rb +28 -0
- data/spec/lib/tools/gen_spec.rb +207 -0
- data/spec/lib/tools/tools_spec.rb +78 -0
- data/spec/spec_helper.rb +138 -0
- data/sproutcore.gemspec +47 -0
- data/vendor/github_gem_lint.rb +22 -0
- data/vendor/yui-compressor/yuicompressor-2.4.2.jar +0 -0
- metadata +1084 -0
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// strings.js
|
@@ -0,0 +1 @@
|
|
1
|
+
// utils.js
|
@@ -0,0 +1 @@
|
|
1
|
+
// tests loading resources from within english.lproj
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Project-level Buildfile
|
2
|
+
|
3
|
+
# required because this buildfile lives inside of the source dir which itself
|
4
|
+
# has a Buildfile
|
5
|
+
project!
|
6
|
+
|
7
|
+
# This is the generic requirement for most apps. Of course SproutCore will
|
8
|
+
# override this for itself, so you don't have to worry about it causing
|
9
|
+
# trouble.
|
10
|
+
config :all, :required => :sproutcore
|
11
|
+
|
12
|
+
config :mobile_photos, :required => 'sproutcore/mobile'
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
Note: the buildtasks/manifest/prepare_build_tasks/html_spec.rb assumes this (contacts) target contains NO .rhtml or .haml fragments.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
@@ -0,0 +1 @@
|
|
1
|
+
This file added to ensure git creates this directory.
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Framework-level Buildfile
|
2
|
+
|
3
|
+
# By default, all of these frameworks don't require anything.
|
4
|
+
# This is necessary since the default buildfile requires sproutcore.
|
5
|
+
config :all, :required => []
|
6
|
+
|
7
|
+
config :sproutcore, :required => :desktop
|
8
|
+
|
9
|
+
config :foundation,
|
10
|
+
:required => :costello
|
11
|
+
|
12
|
+
config :application,
|
13
|
+
:required => %w(costello foundation)
|
14
|
+
|
15
|
+
config :data_store,
|
16
|
+
:required => %w(costello foundation)
|
17
|
+
|
18
|
+
config :desktop,
|
19
|
+
:required => %w(costello foundation application data_store)
|
20
|
+
|
21
|
+
config :mobile,
|
22
|
+
:required => %w(costello foundation application data_store)
|
23
|
+
|
24
|
+
%w(uploader docs test_runner).each do |target_name|
|
25
|
+
config target_name, :required => :sproutcore
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Sample README
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<!-- another test -->
|
File without changes
|
File without changes
|
data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<% # demo ErB %>
|
File without changes
|
data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js
ADDED
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
/* this CSS has no requires */
|
@@ -0,0 +1 @@
|
|
1
|
+
<% # does not contain an sc_resource() call.. %>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// English Strings
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{ JSON! }
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// French Strings
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<!-- Sample INdex.html -->
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Javascript with no requires */
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<!-- Sample tests -->
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// Sample View.js
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= filename %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This buildfile causes the sproutcore/costello target to require the
|
2
|
+
# sproutcore project, which requires the sproutcore/costello target (i.e.
|
3
|
+
# a recursive reference)
|
4
|
+
#
|
5
|
+
# Test against this project to ensure this sort of thing does not cause
|
6
|
+
# infinite loops
|
7
|
+
config :all, :required => :sproutcore
|
8
|
+
config :sproutcore, :required => :costello
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
+
|
3
|
+
describe SC::Builder::Combine do
|
4
|
+
|
5
|
+
include SC::SpecHelpers
|
6
|
+
include SC::BuilderSpecHelper
|
7
|
+
|
8
|
+
before do
|
9
|
+
std_before :combine_test
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
std_after
|
14
|
+
end
|
15
|
+
|
16
|
+
def verify_combine(main_entryname, filename_ext, src_root=nil)
|
17
|
+
# generate artificial entries to test.
|
18
|
+
source_entries = %w(a b c).map do |filename|
|
19
|
+
filename = filename.ext(filename_ext)
|
20
|
+
source_path = File.join(*([@target.source_root, src_root, filename.ext(filename_ext)].compact))
|
21
|
+
@entry = @manifest.add_entry filename,
|
22
|
+
:source_path => source_path,
|
23
|
+
:staging_path => source_path,
|
24
|
+
:build_path => source_path
|
25
|
+
|
26
|
+
File.exist?(@entry.source_path).should be_true # precondition
|
27
|
+
@entry
|
28
|
+
end
|
29
|
+
|
30
|
+
# generate wrapper to entry...
|
31
|
+
filename = main_entryname.ext(filename_ext)
|
32
|
+
@entry = @manifest.add_composite filename,
|
33
|
+
:source_entries => source_entries,
|
34
|
+
:ordered_entries => source_entries
|
35
|
+
|
36
|
+
@dst_path = @entry.build_path
|
37
|
+
|
38
|
+
# Generate expected...
|
39
|
+
expected = <<EOF
|
40
|
+
/* >>>>>>>>>> BEGIN a.#{filename_ext} */
|
41
|
+
CONTENT: a
|
42
|
+
|
43
|
+
/* >>>>>>>>>> BEGIN b.#{filename_ext} */
|
44
|
+
CONTENT: b !important - no newline at end
|
45
|
+
/* >>>>>>>>>> BEGIN c.#{filename_ext} */
|
46
|
+
CONTENT: c
|
47
|
+
|
48
|
+
EOF
|
49
|
+
|
50
|
+
# OK, now do the build...
|
51
|
+
SC::Builder::Combine.build(@entry, @dst_path)
|
52
|
+
|
53
|
+
# And read in the result
|
54
|
+
result = File.readlines(@dst_path)*""
|
55
|
+
result.should eql(expected)
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
it "should combine JavaScript files according to ordered_entries, with separators in between" do
|
60
|
+
verify_combine 'javascript', 'js'
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should combine CSS files according to ordered_entries with separators in between" do
|
64
|
+
verify_combine 'stylesheet', 'css', 'english.lproj'
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,577 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
+
describe SC::Builder::Html do
|
3
|
+
|
4
|
+
include SC::SpecHelpers
|
5
|
+
include SC::BuilderSpecHelper
|
6
|
+
|
7
|
+
before do
|
8
|
+
std_before :html_test
|
9
|
+
|
10
|
+
# most of these tests assume load_debug is turned off like it would be
|
11
|
+
# in production mode
|
12
|
+
@target.config.load_debug = false
|
13
|
+
@target.config.theme = nil
|
14
|
+
@target.config.timestamp_urls = false
|
15
|
+
|
16
|
+
# make sure all targets have the same settings...
|
17
|
+
@target.expand_required_targets.each do |t|
|
18
|
+
t.config.timestamp_urls = false
|
19
|
+
end
|
20
|
+
|
21
|
+
# run std rules to run manifest. Then verify preconditions to make sure
|
22
|
+
# no other changes to the build system effect the ability of these tests
|
23
|
+
# to run properly.
|
24
|
+
@manifest.build!
|
25
|
+
@index_entry = @manifest.entry_for('index.html')
|
26
|
+
@bar_entry = @manifest.entry_for('bar1.html')
|
27
|
+
end
|
28
|
+
|
29
|
+
after do
|
30
|
+
std_after
|
31
|
+
end
|
32
|
+
|
33
|
+
it "VERIFY PRECONDITIONS" do
|
34
|
+
@target.should be_loadable
|
35
|
+
|
36
|
+
# target should require one other target...
|
37
|
+
(req = @target.required_targets).size.should == 1
|
38
|
+
req.first.target_name.should == :'/req_target_2'
|
39
|
+
|
40
|
+
# the required target should itself require another target...
|
41
|
+
(req = req.first.required_targets).size.should == 1
|
42
|
+
req.first.target_name.should == :'/req_target_1'
|
43
|
+
|
44
|
+
# Verify index entry -- should have erb_sample + rhtml_sample entries
|
45
|
+
@index_entry.should_not be_nil
|
46
|
+
@index_entry.should be_include_required_targets
|
47
|
+
entry_names = @index_entry.source_entries.map { |e| e.filename }.sort
|
48
|
+
entry_names.should == %w(erb_sample.html.erb rhtml_sample.rhtml)
|
49
|
+
|
50
|
+
# Verify bar entry - should have 1 entry
|
51
|
+
@bar_entry.should_not be_nil
|
52
|
+
entry_names = @bar_entry.source_entries.map { |e| e.filename }.sort
|
53
|
+
entry_names.should == %w(bar1_sample.rhtml)
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "layout_path" do
|
57
|
+
|
58
|
+
before do
|
59
|
+
@index_builder = SC::Builder::Html.new(@index_entry)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "initially resolves layout_path using layout config for target" do
|
63
|
+
# see the Buildfile for the fixture project to see this config.
|
64
|
+
@index_builder.layout_path.should == File.join(@project.project_root, %w(apps html_test lib layout_template.rhtml))
|
65
|
+
end
|
66
|
+
|
67
|
+
it "changes its resolved path if you alter the layout variable" do
|
68
|
+
# use helper method...
|
69
|
+
@index_builder.sc_resource('index',
|
70
|
+
:layout => 'req_target_2:lib/alt_layout.rhtml')
|
71
|
+
|
72
|
+
@index_builder.layout_path.should == File.join(@project.project_root, %w(frameworks req_target_2 lib alt_layout.rhtml))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
describe "render an index.html entry" do
|
79
|
+
|
80
|
+
it "should render html, including any content from required targets" do
|
81
|
+
result = SC::Builder::Html.new(@index_entry).render
|
82
|
+
result.should =~ /erb_sample/
|
83
|
+
result.should =~ /rhtml_sample/
|
84
|
+
|
85
|
+
# verify it included the other items..
|
86
|
+
result.should =~ /req_target_1_sample/
|
87
|
+
result.should =~ /req_target_2_sample/
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "building non-index entries" do
|
93
|
+
|
94
|
+
it "should render html, including only items from the target itself" do
|
95
|
+
result = SC::Builder::Html.new(@bar_entry).render
|
96
|
+
result.should =~ /bar1_sample/
|
97
|
+
|
98
|
+
# verify it did not include other targets..
|
99
|
+
result.should_not =~ /req_target_1_sample/
|
100
|
+
result.should_not =~ /req_target_2_sample/
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "expand_required_targets helper" do
|
106
|
+
|
107
|
+
it "returns the required targets for a typical target" do
|
108
|
+
@builder = SC::Builder::Html.new(@index_entry)
|
109
|
+
@builder.expand_required_targets(@target).should == @target.expand_required_targets
|
110
|
+
end
|
111
|
+
|
112
|
+
it "include debug targets if load_debug is true" do
|
113
|
+
@builder = SC::Builder::Html.new(@index_entry)
|
114
|
+
@target.config.debug_required.should_not be_nil # precondition
|
115
|
+
|
116
|
+
@target.config.load_debug = true
|
117
|
+
@builder.expand_required_targets(@target).should == @target.expand_required_targets(:debug => true)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "includes theme if theme is specified and target is app" do
|
121
|
+
@builder = SC::Builder::Html.new(@index_entry)
|
122
|
+
@target.config.theme = :sample_theme
|
123
|
+
|
124
|
+
expected = @project.target_for :sample_theme
|
125
|
+
expected.should_not be_nil #precondition
|
126
|
+
@builder.expand_required_targets(@target).should include(expected)
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
# templates should expect to be able to access certain environmental
|
132
|
+
# variables and other commands when running. This API is exposed as methods
|
133
|
+
# on the HTML builder object itself.
|
134
|
+
describe "API for templates" do
|
135
|
+
|
136
|
+
before do
|
137
|
+
# get the simplest builder...
|
138
|
+
@builder = SC::Builder::Html.new(@bar_entry)
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "Basic properties" do
|
142
|
+
it "exposes entry = current entry" do
|
143
|
+
@builder.entry.should == @bar_entry
|
144
|
+
end
|
145
|
+
|
146
|
+
it "exposes current target as both 'target' & 'bundle' (for backwards compatibility)" do
|
147
|
+
@builder.bundle.should == @target
|
148
|
+
@builder.target.should == @target
|
149
|
+
end
|
150
|
+
|
151
|
+
it "exposes current project as both 'project' & 'library' (for backwards compatibility)" do
|
152
|
+
@builder.project.should == @project
|
153
|
+
@builder.library.should == @project
|
154
|
+
end
|
155
|
+
|
156
|
+
it "exposes output filename as 'filename'" do
|
157
|
+
@builder.filename.should == 'bar1.html'
|
158
|
+
end
|
159
|
+
|
160
|
+
it "exposes current language as 'language'" do
|
161
|
+
@builder.language.should == :en
|
162
|
+
end
|
163
|
+
|
164
|
+
it "exposes bundle_name & target_name" do
|
165
|
+
expected = @target.target_name.to_s.sub(/^\//,'')
|
166
|
+
@builder.target_name.should == expected
|
167
|
+
@builder.bundle_name.should == expected
|
168
|
+
end
|
169
|
+
|
170
|
+
it "exposes title - titlizes target name, respects config.title" do
|
171
|
+
@target.config.title = nil
|
172
|
+
@builder.title.should == 'Html Test'
|
173
|
+
|
174
|
+
@target.config.title = 'TEST'
|
175
|
+
@builder.title.should == "TEST"
|
176
|
+
end
|
177
|
+
|
178
|
+
it "exposes config" do
|
179
|
+
@builder.config.should == @target.config
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
# Static helper contains methods needed to generate a SproutCore app
|
185
|
+
# such as static_url, sc_resource, etc.
|
186
|
+
describe "StaticHelper" do
|
187
|
+
|
188
|
+
it "exposes static_url() & sc_static() alias" do
|
189
|
+
@builder.static_url('icons/image').should =~ /icons\/image.png/
|
190
|
+
@builder.static_url('image.jpg').should =~ /image.jpg/
|
191
|
+
|
192
|
+
@builder.sc_static('icons/image').should =~ /icons\/image.png/
|
193
|
+
@builder.sc_static('image.jpg').should =~ /image.jpg/
|
194
|
+
end
|
195
|
+
|
196
|
+
it "takes a :language option for static_url to select an alternate manifest (deprecated - supported for backwards compatibility)" do
|
197
|
+
@builder.static_url('fr.png', :language => :fr).should =~ /french-icons\/fr.png/
|
198
|
+
|
199
|
+
@builder.sc_static('fr.png', :language => :fr).should =~ /french-icons\/fr.png/
|
200
|
+
end
|
201
|
+
|
202
|
+
it "respects the timestamp_url option for static_url()" do
|
203
|
+
@target.config.timestamp_urls = false
|
204
|
+
@builder.static_url('icons/image').should_not =~ /\?.+$/
|
205
|
+
|
206
|
+
@target.config.timestamp_urls = true
|
207
|
+
@builder.static_url('icons/image').should =~ /\?.+$/
|
208
|
+
end
|
209
|
+
|
210
|
+
it "accepts sc_resource(rsrc_name, opts). :layout opt may be used to set layout. otherwise this is scanned for during manifest building" do
|
211
|
+
@builder.sc_resource('foo', :layout => 'bar')
|
212
|
+
@builder.instance_variable_get('@layout').should == 'bar'
|
213
|
+
end
|
214
|
+
|
215
|
+
describe "exposes theme_name()" do
|
216
|
+
|
217
|
+
it "returns passed default value or 'sc-theme' if no theme is configd" do
|
218
|
+
@target.config.theme = nil # precondition
|
219
|
+
@builder.theme_name.should == 'sc-theme'
|
220
|
+
@builder.theme_name(:default => 'foo').should == 'foo'
|
221
|
+
end
|
222
|
+
|
223
|
+
it "returns targets theme_name config if set" do
|
224
|
+
@target.config.theme = 'sample_theme'
|
225
|
+
@target.config.theme_name = "foo"
|
226
|
+
@builder.theme_name.should == 'foo'
|
227
|
+
end
|
228
|
+
|
229
|
+
it "returns theme_name set in theme target if set and not overridden in app itself" do
|
230
|
+
@target.config.theme = 'sample_theme'
|
231
|
+
@target.config.theme_name = nil # precondition
|
232
|
+
|
233
|
+
# this value is set in the sample_theme/Buildfile
|
234
|
+
@builder.theme_name.should == 'sample_theme_name'
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "exposes loc()" do
|
239
|
+
|
240
|
+
it "maps passed string to local target strings.js, if present" do
|
241
|
+
@builder.loc('local_string').should eql('LOCAL STRING')
|
242
|
+
end
|
243
|
+
|
244
|
+
it "maps passed string to required target strings.js, otherwise" do
|
245
|
+
@builder.loc('req_string').should eql('REQ STRING')
|
246
|
+
end
|
247
|
+
|
248
|
+
it "accepts a language option to loc a different language (deprecated - included for backward compatibility)" do
|
249
|
+
@builder.loc('local_string', :language => :fr).should eql('LOCAL STRING FR')
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
describe "exposes stylesheets_for_client()" do
|
255
|
+
|
256
|
+
# look for link tags in order...
|
257
|
+
def expect_links(result, urls = [])
|
258
|
+
urls = urls.dup # don't corrupt original array
|
259
|
+
result.scan /\<link.+href\=\"([^\"]+)\"[^\<]+\/\>/ do |m|
|
260
|
+
$1.should == urls.shift
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# look for link tags in order...
|
265
|
+
def expect_imports(result, urls = [])
|
266
|
+
urls = urls.dup # don't corrupt original array
|
267
|
+
result.scan /@import\s+url\(\'(.+)\'\)/ do |m|
|
268
|
+
$1.should == urls.shift
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
it "generates a link to stylesheet.css entries for all required targets if CONFIG.combine_stylesheetss = true" do
|
273
|
+
# figure expected urls...
|
274
|
+
urls = %w(req_target_1 req_target_2 html_test).map do |target_name|
|
275
|
+
t = @project.target_for(target_name)
|
276
|
+
t.manifest_for(:language => :en).build!.entry_for('stylesheet.css').url
|
277
|
+
end
|
278
|
+
|
279
|
+
@target.config.combine_stylesheets = true
|
280
|
+
result = @builder.stylesheets_for_client
|
281
|
+
expect_links(result, urls)
|
282
|
+
|
283
|
+
# also works for @import
|
284
|
+
result = @builder.stylesheets_for_client(:include_method => :import)
|
285
|
+
expect_imports(result, urls)
|
286
|
+
end
|
287
|
+
|
288
|
+
it "generates a link to the ordered entries of each stylesheet.css for all required targets if CONFIG.combine_stylesheetss = false" do
|
289
|
+
# figure expected urls...
|
290
|
+
urls = %w(req_target_1 req_target_2 html_test).map do |target_name|
|
291
|
+
t = @project.target_for(target_name)
|
292
|
+
e = t.manifest_for(:language => :en).build!.entry_for('stylesheet.css')
|
293
|
+
e.ordered_entries.map { |e| e.url }
|
294
|
+
end
|
295
|
+
urls.flatten!
|
296
|
+
|
297
|
+
@target.config.combine_stylesheets = false
|
298
|
+
result = @builder.stylesheets_for_client
|
299
|
+
expect_links(result, urls)
|
300
|
+
|
301
|
+
result = @builder.stylesheets_for_client(:include_method => :import)
|
302
|
+
expect_imports(result, urls)
|
303
|
+
end
|
304
|
+
|
305
|
+
it "adds stylehseet_libs to end of styles" do
|
306
|
+
@target.config.stylesheet_libs = %w(foo bar)
|
307
|
+
result = @builder.stylesheets_for_client
|
308
|
+
result.should =~ /href=\"foo\"/
|
309
|
+
result.should =~ /href=\"bar\"/
|
310
|
+
end
|
311
|
+
|
312
|
+
describe "timestamp_urls support" do
|
313
|
+
|
314
|
+
def test_timestamps(should_have)
|
315
|
+
result = @builder.stylesheets_for_client
|
316
|
+
matches = 0
|
317
|
+
result.scan(/href=\"([^\"]+)\"/) do |m|
|
318
|
+
m=m.first # look @ match...
|
319
|
+
matches += 1
|
320
|
+
if should_have
|
321
|
+
m.should =~ /\?.+$/
|
322
|
+
else
|
323
|
+
m.should_not =~ /\?.+$/
|
324
|
+
end
|
325
|
+
end
|
326
|
+
matches.should > 0 # should match some urls...
|
327
|
+
end
|
328
|
+
|
329
|
+
it "does NOT timestamp to all urls if timestamp_urls is false" do
|
330
|
+
# simulate having timestamp_urls set true in the root buildfile
|
331
|
+
@target.config.timestamp_urls = false # preconditon
|
332
|
+
@target.expand_required_targets.each do |t|
|
333
|
+
t.config.timestamp_urls = false
|
334
|
+
end
|
335
|
+
test_timestamps false
|
336
|
+
end
|
337
|
+
|
338
|
+
it "does timestamp all urls if timestamp_urls is true" do
|
339
|
+
# simulate having timestamp_urls set true in the root buildfile
|
340
|
+
@target.config.timestamp_urls = true # precondition
|
341
|
+
@target.expand_required_targets.each do |t|
|
342
|
+
t.config.timestamp_urls = true
|
343
|
+
end
|
344
|
+
test_timestamps true
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
|
349
|
+
it "adds stylesheet for debug if CONFIG.load_debug" do
|
350
|
+
# figure expected urls...
|
351
|
+
t = @project.target_for(:debug)
|
352
|
+
url = t.manifest_for(:language => :en).build!.entry_for('stylesheet.css').url
|
353
|
+
url = /#{Regexp.escape url}/
|
354
|
+
|
355
|
+
@target.config.combine_stylesheets = true
|
356
|
+
@target.config.load_debug = true
|
357
|
+
result = @builder.stylesheets_for_client
|
358
|
+
result.should =~ url
|
359
|
+
|
360
|
+
# also works for @import
|
361
|
+
result = @builder.stylesheets_for_client(:include_method => :import)
|
362
|
+
result.should =~ url
|
363
|
+
end
|
364
|
+
|
365
|
+
it "does NOT add stylesheet for test if CONFIG.load_test" do
|
366
|
+
# figure expected urls...
|
367
|
+
t = @project.target_for(:qunit)
|
368
|
+
url = t.manifest_for(:language => :en).build!.entry_for('stylesheet.css').url
|
369
|
+
url = /#{Regexp.escape url}/
|
370
|
+
|
371
|
+
@target.config.combine_stylesheets = true
|
372
|
+
@target.config.load_test = true
|
373
|
+
result = @builder.stylesheets_for_client
|
374
|
+
result.should_not =~ url
|
375
|
+
|
376
|
+
# also works for @import
|
377
|
+
result = @builder.stylesheets_for_client(:include_method => :import)
|
378
|
+
result.should_not =~ url
|
379
|
+
end
|
380
|
+
|
381
|
+
end
|
382
|
+
|
383
|
+
describe "exposes javascript_for_client()" do
|
384
|
+
|
385
|
+
# look for link tags in order...
|
386
|
+
def expect_scripts(result, urls = [])
|
387
|
+
urls = urls.dup # don't corrupt original array
|
388
|
+
result.scan /\<script.+src\=\"([^\"]+)\"[^\<]+\>\s*\<\/script\>/ do |m|
|
389
|
+
$1.should == urls.shift
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
it "generates a link to javascript.js entries for all required targets if CONFIG.combine_javascript = true" do
|
394
|
+
# figure expected urls...
|
395
|
+
urls = %w(req_target_1 req_target_2 html_test).map do |target_name|
|
396
|
+
t = @project.target_for(target_name)
|
397
|
+
t.manifest_for(:language => :en).build!.entry_for('javascript.js').url
|
398
|
+
end
|
399
|
+
|
400
|
+
@target.config.combine_javascript = true
|
401
|
+
result = @builder.javascripts_for_client
|
402
|
+
expect_scripts(result, urls)
|
403
|
+
end
|
404
|
+
|
405
|
+
it "generates a link to the ordered entries of each javascript.js for all required targets if CONFIG.combine_javascript = false" do
|
406
|
+
# figure expected urls...
|
407
|
+
urls = %w(req_target_1 req_target_2 html_test).map do |target_name|
|
408
|
+
t = @project.target_for(target_name)
|
409
|
+
e = t.manifest_for(:language => :en).build!.entry_for('javascript.js', :combined => true)
|
410
|
+
e.ordered_entries.map { |e| e.url }
|
411
|
+
end
|
412
|
+
urls.flatten!
|
413
|
+
|
414
|
+
@target.config.combine_javascript = false
|
415
|
+
result = @builder.javascripts_for_client
|
416
|
+
expect_scripts(result, urls)
|
417
|
+
end
|
418
|
+
|
419
|
+
it "adds preferredLanguage definition" do
|
420
|
+
result = @builder.javascripts_for_client
|
421
|
+
result.should =~ /String.preferredLanguage = "en"/
|
422
|
+
end
|
423
|
+
|
424
|
+
it "adds javascript_libs to end of scripts" do
|
425
|
+
@target.config.javascript_libs = %w(foo bar)
|
426
|
+
result = @builder.javascripts_for_client
|
427
|
+
result.should =~ /src=\"foo\"/
|
428
|
+
result.should =~ /src=\"bar\"/
|
429
|
+
end
|
430
|
+
|
431
|
+
it "adds link to debug JS if CONFIG.load_debug = true" do
|
432
|
+
# figure expected urls...
|
433
|
+
t = @project.target_for(:debug)
|
434
|
+
url = t.manifest_for(:language => :en).build!.entry_for('javascript.js').url
|
435
|
+
url = /#{Regexp.escape url}/
|
436
|
+
|
437
|
+
@target.config.combine_javascript = true
|
438
|
+
@target.config.load_debug = true
|
439
|
+
result = @builder.javascripts_for_client
|
440
|
+
result.should =~ url
|
441
|
+
end
|
442
|
+
|
443
|
+
it "does NOT add link to test, even if load_test is true" do
|
444
|
+
# figure expected urls...
|
445
|
+
t = @project.target_for(:qunit)
|
446
|
+
url = t.manifest_for(:language => :en).build!.entry_for('javascript.js').url
|
447
|
+
url = /#{Regexp.escape url}/
|
448
|
+
|
449
|
+
@target.config.combine_javascript = true
|
450
|
+
@target.config.load_test = true
|
451
|
+
result = @builder.javascripts_for_client
|
452
|
+
result.should_not =~ url
|
453
|
+
end
|
454
|
+
|
455
|
+
describe "timestamp_urls support" do
|
456
|
+
|
457
|
+
def test_timestamps(should_have)
|
458
|
+
result = @builder.javascripts_for_client
|
459
|
+
matches = 0
|
460
|
+
result.scan(/src=\"([^\"]+)\"/) do |m|
|
461
|
+
matches += 1
|
462
|
+
m = m.first # look @ match
|
463
|
+
if should_have
|
464
|
+
m.should =~ /\?.+$/
|
465
|
+
else
|
466
|
+
m.should_not =~ /\?.+$/
|
467
|
+
end
|
468
|
+
end
|
469
|
+
matches.should > 0 # should match some urls...
|
470
|
+
end
|
471
|
+
|
472
|
+
it "does NOT timestamp to all urls if timestamp_urls is false" do
|
473
|
+
@target.config.timestamp_urls = false # preconditon
|
474
|
+
@target.expand_required_targets.each do |t|
|
475
|
+
t.config.timestamp_urls = false
|
476
|
+
end
|
477
|
+
test_timestamps false
|
478
|
+
end
|
479
|
+
|
480
|
+
it "does timestamp all urls if timestamp_urls is true" do
|
481
|
+
@target.config.timestamp_urls = true # precondition
|
482
|
+
@target.expand_required_targets.each do |t|
|
483
|
+
t.config.timestamp_urls = true
|
484
|
+
end
|
485
|
+
test_timestamps true
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
end
|
490
|
+
|
491
|
+
end
|
492
|
+
|
493
|
+
describe "TagHelpers" do
|
494
|
+
it "exposes tag(br) => <br />" do
|
495
|
+
@builder.tag(:br).should =~ /<br ?\/>/ # don't care if space is added
|
496
|
+
end
|
497
|
+
|
498
|
+
it "exposes content_tag(h1, 'hello_world')" do
|
499
|
+
@builder.content_tag(:h1, 'hello world').should == '<h1>hello world</h1>'
|
500
|
+
end
|
501
|
+
|
502
|
+
it "exposes cdata_section('hello world')" do
|
503
|
+
@builder.cdata_section('hello world').should == "<![CDATA[hello world]]>"
|
504
|
+
end
|
505
|
+
|
506
|
+
it "exposes escape_once('1 & 2')" do
|
507
|
+
@builder.escape_once("1 > 2 & 3").should == "1 > 2 & 3"
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
describe "TextHelper" do
|
512
|
+
|
513
|
+
it "exposes highlight(str, highlight_str, repl_Str)" do
|
514
|
+
@builder.highlight('You searched for: rails', 'rails').should == 'You searched for: <strong class="highlight">rails</strong>'
|
515
|
+
end
|
516
|
+
|
517
|
+
it "exposes pluralize(cnt, 'foo')" do
|
518
|
+
@builder.pluralize(1, 'person').should == '1 person'
|
519
|
+
@builder.pluralize(2, 'person').should == '2 people'
|
520
|
+
@builder.pluralize(3, 'person', 'users').should == '3 users'
|
521
|
+
end
|
522
|
+
|
523
|
+
begin
|
524
|
+
gem 'RedCloth'
|
525
|
+
require 'redcloth'
|
526
|
+
|
527
|
+
it "exposes textilize('foo')" do
|
528
|
+
@builder.textilize("h1. foo").should == "<h1>foo</h1>"
|
529
|
+
end
|
530
|
+
rescue LoadError
|
531
|
+
puts "WARNING: Not testing textilize() because RedCloth is not installed"
|
532
|
+
end
|
533
|
+
|
534
|
+
begin
|
535
|
+
gem 'bluecloth'
|
536
|
+
require 'bluecloth'
|
537
|
+
|
538
|
+
it "exposes markdown('foo')" do
|
539
|
+
@builder.markdown("# foo").should == "<h1>foo</h1>"
|
540
|
+
end
|
541
|
+
rescue LoadError
|
542
|
+
puts "WARNING: Not testing markdown() because BlueCloth is not installed"
|
543
|
+
end
|
544
|
+
|
545
|
+
## TODO: Test remaining methods from TextHelper are added.
|
546
|
+
end
|
547
|
+
|
548
|
+
describe "DomIdHelper" do
|
549
|
+
|
550
|
+
it "generates a unique ID each time it is called" do
|
551
|
+
seen_ids = []
|
552
|
+
10.times do
|
553
|
+
next_id = @builder.dom_id!
|
554
|
+
seen_ids.should_not include(seen_ids)
|
555
|
+
seen_ids << next_id
|
556
|
+
end
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
describe "CaptureHelper" do
|
561
|
+
|
562
|
+
it "returns the results of the passed block - optionally passing through renderer (not tested)" do
|
563
|
+
result = @builder.capture { 'result' }
|
564
|
+
result.should == 'result'
|
565
|
+
end
|
566
|
+
|
567
|
+
it "adds the result of the passed block to the builder as an instance variable called @content_for_foo" do
|
568
|
+
result = @builder.content_for(:foo) { "result" }
|
569
|
+
@builder.instance_variable_get('@content_for_foo').should == 'result'
|
570
|
+
result.should == ''
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
end
|
575
|
+
|
576
|
+
|
577
|
+
end
|