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
@@ -0,0 +1,98 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w(.. spec_helper))
|
2
|
+
|
3
|
+
describe "manifest:prepare_build_tasks:sass" do
|
4
|
+
|
5
|
+
include SC::SpecHelpers
|
6
|
+
include SC::ManifestSpecHelpers
|
7
|
+
|
8
|
+
before do
|
9
|
+
std_before
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_task
|
13
|
+
@manifest.prepare!
|
14
|
+
super('manifest:prepare_build_tasks:sass')
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
|
18
|
+
should_run('manifest:prepare_build_tasks:setup') { run_task }
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create a transform entry (with entry_type == :css) for every sass entry" do
|
22
|
+
run_task
|
23
|
+
entries = @manifest.entries(:hidden => true)
|
24
|
+
|
25
|
+
# find all entries referencing original source...
|
26
|
+
source_entries = entries.reject do |entry|
|
27
|
+
!(entry.original? && entry.filename =~ /\.sass$/)
|
28
|
+
end
|
29
|
+
source_entries.size.should > 0 # precondition
|
30
|
+
|
31
|
+
# final all test transform entries.
|
32
|
+
test_entries = entries.reject { |e| e.entry_type != :css }
|
33
|
+
test_entries.size.should eql(source_entries.size) # 1 for each entry?
|
34
|
+
test_entries.each do |entry|
|
35
|
+
source_entries.should include(entry.source_entry)
|
36
|
+
source_entries.delete(entry.source_entry) # avoid double counting
|
37
|
+
end
|
38
|
+
|
39
|
+
# none should be left...
|
40
|
+
source_entries.size.should == 0
|
41
|
+
end
|
42
|
+
|
43
|
+
# check the format of each entry...
|
44
|
+
describe "sass -> css transform entry" do
|
45
|
+
|
46
|
+
before do
|
47
|
+
run_task
|
48
|
+
@entries = @manifest.entries.reject do |e|
|
49
|
+
!(e.entry_type == :css && e.source_entry.filename =~ /\.sass$/)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "adds 'source' to filename + build_path + url" do
|
54
|
+
@entries.each do |entry|
|
55
|
+
entry.filename.should =~ /^source\//
|
56
|
+
entry.build_path.should =~ /source/
|
57
|
+
entry.url.should =~ /source/
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "changes the filename + build_path + url ext to .css" do
|
62
|
+
@entries.each do |entry|
|
63
|
+
File.extname(entry.filename).should == '.css'
|
64
|
+
File.extname(entry.build_path).should == '.css'
|
65
|
+
File.extname(entry.url).should == '.css'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "assigns a build_task of build:sass" do
|
70
|
+
@entries.each do |entry|
|
71
|
+
entry.build_task.to_s.should == 'build:sass'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "hides the source entry" do
|
76
|
+
@entries.each do |entry|
|
77
|
+
entry.source_entry.should be_hidden
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
#### NOTE: Currently build directives such as sc_require() and
|
82
|
+
#### sc_resource() are not supported in sass files. These rules test that
|
83
|
+
#### some basics are filled in anyway. Feel free to add support for said
|
84
|
+
#### directive processing if you need it and change these tests! :-)
|
85
|
+
it "sets the entry.resource => stylesheet" do
|
86
|
+
@entries.each do |entry|
|
87
|
+
entry.resource.should == 'stylesheet'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it "sets the entry.required => []" do
|
92
|
+
@entries.each do |entry|
|
93
|
+
entry.required.should == []
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end # describe sass -> css transform entry
|
98
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w(.. spec_helper))
|
2
|
+
|
3
|
+
# Creates combined entries for javascript & css
|
4
|
+
describe "manifest:prepare_build_tasks:Strings" do
|
5
|
+
|
6
|
+
include SC::SpecHelpers
|
7
|
+
include SC::ManifestSpecHelpers
|
8
|
+
|
9
|
+
before do
|
10
|
+
std_before
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_task
|
14
|
+
@manifest.prepare!
|
15
|
+
super('manifest:prepare_build_tasks:strings')
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should run setup & javascript as prereq" do
|
19
|
+
should_run("manifest:prepare_build_tasks:setup") { run_task }
|
20
|
+
should_run("manifest:prepare_build_tasks:javascript") { run_task }
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should add strings entry if strings.js is found" do
|
24
|
+
run_task
|
25
|
+
@manifest.entry_for('source/lproj/strings.js').should_not be_nil # precondition
|
26
|
+
@manifest.entry_for('strings.yaml', :hidden => true).should_not be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "transform entry" do
|
30
|
+
|
31
|
+
before do
|
32
|
+
run_task
|
33
|
+
@entry = @manifest.entry_for('strings.yaml', :hidden => true)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should hide entry" do
|
37
|
+
@entry.should be_hidden
|
38
|
+
end
|
39
|
+
|
40
|
+
it "has entry_type = :strings" do
|
41
|
+
@entry.entry_type.should == :strings
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should not hide source entry" do
|
45
|
+
@entry.source_entry.should_not be_hidden
|
46
|
+
end
|
47
|
+
|
48
|
+
it "has source/lproj/strings.js as source entry" do
|
49
|
+
@entry.source_entry.filename.should == 'source/lproj/strings.js'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "has ext of 'yaml'" do
|
53
|
+
@entry.ext.should == 'yaml'
|
54
|
+
@entry.filename.should =~ /\.yaml$/
|
55
|
+
end
|
56
|
+
|
57
|
+
it "has build task of build:strings" do
|
58
|
+
@entry.build_task.to_s.should == 'build:strings'
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w(.. spec_helper))
|
2
|
+
|
3
|
+
describe "manifest:prepare_build_tasks:tests" do
|
4
|
+
|
5
|
+
include SC::SpecHelpers
|
6
|
+
include SC::ManifestSpecHelpers
|
7
|
+
|
8
|
+
before do
|
9
|
+
std_before #load real_world project
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_task(load_tests=true)
|
13
|
+
@manifest.prepare!
|
14
|
+
@target.config.load_tests = load_tests # force...
|
15
|
+
super('manifest:prepare_build_tasks:tests')
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should run manifest:localize & manifest:catalog as prereq" do
|
19
|
+
should_run('manifest:catalog') { run_task }
|
20
|
+
should_run('manifest:localize') { run_task }
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create a transform entry (with entry_type == :test) for every test entry with a javascript transform entry in between" do
|
24
|
+
run_task
|
25
|
+
entries = @manifest.entries(:hidden => true)
|
26
|
+
|
27
|
+
# find all entries referencing original source...
|
28
|
+
source_entries = entries.reject do |entry|
|
29
|
+
!(entry.original? && entry.filename =~ /^tests\//)
|
30
|
+
end
|
31
|
+
source_entries.size.should > 0 # precondition
|
32
|
+
|
33
|
+
# final all test transform entries - i.e. those working on single tests.
|
34
|
+
test_entries = entries.select do |e|
|
35
|
+
e.entry_type == :test && e.transform?
|
36
|
+
end
|
37
|
+
|
38
|
+
test_entries.size.should eql(source_entries.size) # 1 for each entry?
|
39
|
+
test_entries.each do |entry|
|
40
|
+
|
41
|
+
# if the source_entry is a javascript, then there should be a transform
|
42
|
+
# in between to handle things list static_url()
|
43
|
+
original = entry.source_entry
|
44
|
+
if original.ext == 'js'
|
45
|
+
original.should be_transform
|
46
|
+
original.build_task.should == 'build:javascript'
|
47
|
+
original = original.source_entry # get true original to test with...
|
48
|
+
end
|
49
|
+
|
50
|
+
# get original and delete from found originals to make sure chain
|
51
|
+
# exists...
|
52
|
+
original.should be_original # precondition
|
53
|
+
source_entries.should include(original)
|
54
|
+
source_entries.delete(original) # avoid double counting
|
55
|
+
end
|
56
|
+
|
57
|
+
# none should be left...
|
58
|
+
source_entries.size.should == 0
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should create a composite entry for all tests" do
|
62
|
+
run_task
|
63
|
+
|
64
|
+
# find all entries referencing original source...
|
65
|
+
entries = @manifest.entries(:hidden => true)
|
66
|
+
source_entries = entries.reject do |entry|
|
67
|
+
!(entry.original? && entry.filename =~ /^tests\//)
|
68
|
+
end
|
69
|
+
source_entries.sort! { |a,b| a.filename.to_s <=> b.filename.to_s }
|
70
|
+
|
71
|
+
# find composite test entry
|
72
|
+
entry = @manifest.entry_for 'tests.html', :entry_type => :test
|
73
|
+
entry.should_not be_nil
|
74
|
+
|
75
|
+
# get originals. since some entries will be JS transforms, just walk
|
76
|
+
# back...
|
77
|
+
originals = entry.source_entries.map do |entry|
|
78
|
+
entry.transform? ? entry.source_entry : entry
|
79
|
+
end
|
80
|
+
found = originals.sort { |a,b| a.filename.to_s <=> b.filename.to_s }
|
81
|
+
found.should == source_entries
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should create a composite entry for each nested directory" do
|
85
|
+
run_task
|
86
|
+
|
87
|
+
# find all entries referencing original source...
|
88
|
+
entries = @manifest.entries(:hidden => true)
|
89
|
+
source_entries = entries.reject do |entry|
|
90
|
+
!(entry.original? && entry.filename =~ /^tests\/nested\//)
|
91
|
+
end
|
92
|
+
source_entries.sort! { |a,b| a.filename.to_s <=> b.filename.to_s }
|
93
|
+
|
94
|
+
# find composite test entry
|
95
|
+
entry = @manifest.entry_for 'tests/nested.html', :entry_type => :test
|
96
|
+
entry.should_not be_nil
|
97
|
+
originals = entry.source_entries.map do |entry|
|
98
|
+
entry.transform? ? entry.source_entry : entry
|
99
|
+
end
|
100
|
+
found = originals.sort { |a,b| a.filename.to_s <=> b.filename.to_s }
|
101
|
+
found.should == source_entries
|
102
|
+
end
|
103
|
+
|
104
|
+
# check the format of each entry...
|
105
|
+
describe "transform entry" do
|
106
|
+
|
107
|
+
before do
|
108
|
+
run_task
|
109
|
+
@entries = @manifest.entries.reject { |e| e.entry_type != :test }
|
110
|
+
end
|
111
|
+
|
112
|
+
it "changes the filename + build_path + url ext to .html" do
|
113
|
+
@entries.each do |entry|
|
114
|
+
File.extname(entry.filename).should == '.html'
|
115
|
+
File.extname(entry.build_path).should == '.html'
|
116
|
+
File.extname(entry.url).should == '.html'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it "assigns a build_task of build:test" do
|
121
|
+
@entries.each do |entry|
|
122
|
+
extname = File.extname(entry.source_entry.filename)[1..-1]
|
123
|
+
entry.build_task.to_s.should == "build:test"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should create a composite entry to generate a -index.json with test entries as source (excluding composite summary entries)" do
|
130
|
+
run_task
|
131
|
+
entry = @manifest.entry_for('tests/-index.json')
|
132
|
+
|
133
|
+
entry.should_not be_nil
|
134
|
+
entry.entry_type.should == :resource
|
135
|
+
entry.build_task.to_s.should == 'build:test_index'
|
136
|
+
|
137
|
+
expected = @manifest.entries.select do |e|
|
138
|
+
e.entry_type == :test && e.transform?
|
139
|
+
end
|
140
|
+
|
141
|
+
entry.source_entries.size.should eql(expected.size)
|
142
|
+
entry.source_entries.each do |entry|
|
143
|
+
expected.should include(entry)
|
144
|
+
expected.delete(entry) # avoid double counting
|
145
|
+
end
|
146
|
+
expected.size.should == 0 # should have an empty size...
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should not hide -index.json source_entries (since they are test that need to be built)" do
|
150
|
+
run_task
|
151
|
+
entry = @manifest.entry_for('tests/-index.json')
|
152
|
+
entry.source_entries.each do |entry|
|
153
|
+
entry.should_not be_hidden
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should not generate an -index.json entry if tests not loaded" do
|
158
|
+
run_task(false)
|
159
|
+
entry = @manifest.entry_for('tests/-index.json')
|
160
|
+
entry.should be_nil
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
+
|
3
|
+
describe "manifest:prepare" do
|
4
|
+
|
5
|
+
include SC::SpecHelpers
|
6
|
+
include SC::ManifestSpecHelpers
|
7
|
+
|
8
|
+
before do
|
9
|
+
std_before
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_task; super('manifest:prepare'); end
|
13
|
+
|
14
|
+
it "sets build_root => target.build_root/language/build_number" do
|
15
|
+
run_task
|
16
|
+
expected = File.join(@target.build_root, 'fr', @target.build_number)
|
17
|
+
@manifest.build_root.should == expected
|
18
|
+
end
|
19
|
+
|
20
|
+
it "sets staging_root => staging_root/language/build_number" do
|
21
|
+
run_task
|
22
|
+
expected = File.join(@target.staging_root, 'fr', @target.build_number)
|
23
|
+
@manifest.staging_root.should == expected
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sets url_root => url_root/language/build_number" do
|
27
|
+
run_task
|
28
|
+
expected = [@target.url_root, 'fr', @target.build_number] * '/'
|
29
|
+
@manifest.url_root.should == expected
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets source_root => target.source_root" do
|
33
|
+
run_task
|
34
|
+
@manifest.source_root.should == @target.source_root
|
35
|
+
end
|
36
|
+
|
37
|
+
it "sets index_root => index_root/language/build_number" do
|
38
|
+
run_task
|
39
|
+
expected = [@target.index_root, 'fr', @target.build_number] * '/'
|
40
|
+
@manifest.index_root.should == expected
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
+
|
3
|
+
module SC::ManifestSpecHelpers
|
4
|
+
|
5
|
+
def std_before
|
6
|
+
@project = fixture_project :real_world
|
7
|
+
@target = @project.target_for :sproutcore
|
8
|
+
@buildfile = @target.buildfile
|
9
|
+
@config = @target.config
|
10
|
+
@manifest = @target.manifest_for(:language => :fr)
|
11
|
+
|
12
|
+
@target.prepare! # make sure its ready for the manifest...
|
13
|
+
end
|
14
|
+
|
15
|
+
def run_task(task_name)
|
16
|
+
@buildfile.invoke task_name,
|
17
|
+
:manifest => @manifest,
|
18
|
+
:target => @target,
|
19
|
+
:project => @project,
|
20
|
+
:config => @config
|
21
|
+
end
|
22
|
+
|
23
|
+
def entry_for(filename, opts={})
|
24
|
+
@manifest.entry_for(filename, opts) || @manifest.entry_for(filename, opts.merge(:hidden => true))
|
25
|
+
end
|
26
|
+
|
27
|
+
# Verifies that the named task runs when the passed block is executed
|
28
|
+
def should_run(task_name, &block)
|
29
|
+
task = @buildfile.lookup(task_name)
|
30
|
+
first_count = task.invoke_count
|
31
|
+
yield if block_given?
|
32
|
+
task.invoke_count.should > first_count
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. spec_helper])
|
2
|
+
|
3
|
+
describe "namespace :target" do
|
4
|
+
|
5
|
+
include SC::SpecHelpers
|
6
|
+
|
7
|
+
# Invoked when a new target is created to fill in some standard values
|
8
|
+
describe "target:prepare" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
@project = fixture_project :real_world
|
12
|
+
@target = @project.target_for :sproutcore
|
13
|
+
@buildfile = @target.buildfile
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_task
|
17
|
+
@buildfile.invoke 'target:prepare',
|
18
|
+
:target => @target, :project => @project, :config => @target.config
|
19
|
+
end
|
20
|
+
|
21
|
+
### loadable -- if true, the target should have index.html and other files
|
22
|
+
### generated to make it loadable in the browser.
|
23
|
+
it "sets target.loadable? if target_type == :app" do
|
24
|
+
@target.target_type = :app
|
25
|
+
run_task
|
26
|
+
@target.should be_loadable
|
27
|
+
end
|
28
|
+
|
29
|
+
### URL_ROOT -- used to compute the url for static assets
|
30
|
+
it "uses config.url_root if present" do
|
31
|
+
@target.config.url_root = 'foo'
|
32
|
+
run_task
|
33
|
+
@target.url_root.should eql('foo')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "computes url_root => /url_prefix/target_name" do
|
37
|
+
@target.config.url_root.should be_nil # precondition
|
38
|
+
@target.config.url_prefix.should eql('static') # precondition
|
39
|
+
run_task
|
40
|
+
@target.url_root.should eql("/static/sproutcore")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should collapse an empty url_prefix" do
|
44
|
+
@target.config.url_root.should be_nil # precondition
|
45
|
+
@target.config.url_prefix = ''
|
46
|
+
|
47
|
+
run_task
|
48
|
+
@target.url_root.should eql("/sproutcore")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should collapse an nil url_prefix" do
|
52
|
+
@target.config.url_root.should be_nil # precondition
|
53
|
+
@target.config.url_prefix = nil
|
54
|
+
|
55
|
+
run_task
|
56
|
+
@target.url_root.should eql("/sproutcore")
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
### INDEX_ROOT -- used to compute the URLs used to access index files
|
61
|
+
it "uses config.index_root if present" do
|
62
|
+
@target.config.index_root = 'foo'
|
63
|
+
run_task
|
64
|
+
@target.index_root.should eql('foo')
|
65
|
+
end
|
66
|
+
|
67
|
+
it "computes index_root => /index_prefix/target_name" do
|
68
|
+
@target.config.index_root.should be_nil # precondition
|
69
|
+
@target.config.index_prefix = 'static'
|
70
|
+
run_task
|
71
|
+
@target.index_root.should eql("/static/sproutcore")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should collapse an empty index_prefix" do
|
75
|
+
@target.config.index_root.should be_nil # precondition
|
76
|
+
@target.config.index_prefix = ''
|
77
|
+
|
78
|
+
run_task
|
79
|
+
@target.index_root.should eql("/sproutcore")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should collapse an nil index_prefix" do
|
83
|
+
@target.config.index_root.should be_nil # precondition
|
84
|
+
@target.config.index_prefix = nil
|
85
|
+
|
86
|
+
run_task
|
87
|
+
@target.index_root.should eql("/sproutcore")
|
88
|
+
end
|
89
|
+
|
90
|
+
### BUILD_ROOT -- Used to compute the root location for building files
|
91
|
+
it "uses config.build_root if present, expanded" do
|
92
|
+
@target.config.build_root = 'foo'
|
93
|
+
run_task
|
94
|
+
@target.build_root.should eql(File.expand_path('foo'))
|
95
|
+
end
|
96
|
+
|
97
|
+
it "computes build_root => /project_root/build_prefix/url_prefix/target_name, expanded" do
|
98
|
+
@target.config.build_root.should be_nil # precondition
|
99
|
+
@target.config.url_prefix = 'static'
|
100
|
+
@target.config.build_prefix = 'tmp/foo'
|
101
|
+
run_task
|
102
|
+
|
103
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp foo static sproutcore)))
|
104
|
+
@target.build_root.should eql(expected)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should collapse an empty build_prefix" do
|
108
|
+
@target.config.url_prefix = 'static'
|
109
|
+
@target.config.build_prefix = ''
|
110
|
+
|
111
|
+
run_task
|
112
|
+
|
113
|
+
expected = File.expand_path(File.join(@project.project_root, %w(static sproutcore)))
|
114
|
+
@target.build_root.should eql(expected)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should collapse an nil build_prefix" do
|
118
|
+
@target.config.url_prefix = 'static'
|
119
|
+
@target.config.build_prefix = nil
|
120
|
+
|
121
|
+
run_task
|
122
|
+
|
123
|
+
expected = File.expand_path(File.join(@project.project_root, %w(static sproutcore)))
|
124
|
+
@target.build_root.should eql(expected)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should collapse an empty url_prefix" do
|
128
|
+
@target.config.url_prefix = ''
|
129
|
+
@target.config.build_prefix = 'tmp/build'
|
130
|
+
|
131
|
+
run_task
|
132
|
+
|
133
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp build sproutcore)))
|
134
|
+
@target.build_root.should eql(expected)
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should collapse an nil url_prefix" do
|
138
|
+
@target.config.url_prefix = nil
|
139
|
+
@target.config.build_prefix = 'tmp/build'
|
140
|
+
|
141
|
+
run_task
|
142
|
+
|
143
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp build sproutcore)))
|
144
|
+
@target.build_root.should eql(expected)
|
145
|
+
end
|
146
|
+
|
147
|
+
### STAGING_ROOT -- Used to compute the root location for staging
|
148
|
+
it "uses config.staging_root if present, expanded" do
|
149
|
+
@target.config.staging_root = 'foo'
|
150
|
+
run_task
|
151
|
+
@target.staging_root.should eql(File.expand_path('foo'))
|
152
|
+
end
|
153
|
+
|
154
|
+
it "computes staging_root => /project_root/staging_prefix/url_prefix/target_name, expanded" do
|
155
|
+
@target.config.staging_root.should be_nil # precondition
|
156
|
+
@target.config.url_prefix = 'static'
|
157
|
+
@target.config.staging_prefix = 'tmp/foo'
|
158
|
+
run_task
|
159
|
+
|
160
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp foo static sproutcore)))
|
161
|
+
@target.staging_root.should eql(expected)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should collapse an empty staging_prefix" do
|
165
|
+
@target.config.url_prefix = 'static'
|
166
|
+
@target.config.staging_prefix = ''
|
167
|
+
|
168
|
+
run_task
|
169
|
+
|
170
|
+
expected = File.expand_path(File.join(@project.project_root, %w(static sproutcore)))
|
171
|
+
@target.staging_root.should eql(expected)
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should collapse an nil staging_prefix" do
|
175
|
+
@target.config.url_prefix = 'static'
|
176
|
+
@target.config.staging_prefix = nil
|
177
|
+
|
178
|
+
run_task
|
179
|
+
|
180
|
+
expected = File.expand_path(File.join(@project.project_root, %w(static sproutcore)))
|
181
|
+
@target.staging_root.should eql(expected)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should collapse an empty url_prefix" do
|
185
|
+
@target.config.url_prefix = ''
|
186
|
+
@target.config.staging_prefix = 'tmp/build'
|
187
|
+
|
188
|
+
run_task
|
189
|
+
|
190
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp build sproutcore)))
|
191
|
+
@target.staging_root.should eql(expected)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should collapse an nil url_prefix" do
|
195
|
+
@target.config.url_prefix = nil
|
196
|
+
@target.config.staging_prefix = 'tmp/build'
|
197
|
+
|
198
|
+
run_task
|
199
|
+
|
200
|
+
expected = File.expand_path(File.join(@project.project_root, %w(tmp build sproutcore)))
|
201
|
+
@target.staging_root.should eql(expected)
|
202
|
+
end
|
203
|
+
|
204
|
+
### BUILD_NUMBER - the build number
|
205
|
+
|
206
|
+
it "should compute a build number for the target" do
|
207
|
+
@target.build_number.should be_nil #precondition
|
208
|
+
run_task
|
209
|
+
@target.build_number.should_not be_nil
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|