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,80 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'manifest'))
|
|
9
|
+
|
|
10
|
+
module SC
|
|
11
|
+
class Tools
|
|
12
|
+
|
|
13
|
+
desc "build [TARGET..]", "Builds one or more targets"
|
|
14
|
+
method_options(
|
|
15
|
+
MANIFEST_OPTIONS.merge(:entries => :optional, :clean => false))
|
|
16
|
+
|
|
17
|
+
def build(*targets)
|
|
18
|
+
|
|
19
|
+
# Copy some key props to the env
|
|
20
|
+
SC.env.build_prefix = options.buildroot if options.buildroot
|
|
21
|
+
SC.env.stating_prefix = options.stageroot if options.stageroot
|
|
22
|
+
SC.env.use_symlink = options.symlink
|
|
23
|
+
SC.env.clean = options.clean
|
|
24
|
+
|
|
25
|
+
# Get entries option
|
|
26
|
+
entry_filters = nil
|
|
27
|
+
if options[:entries]
|
|
28
|
+
entry_filters = options[:entries].split(',')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Get the manifests to build
|
|
32
|
+
manifests = build_manifests(targets)
|
|
33
|
+
|
|
34
|
+
# First clean all manifests
|
|
35
|
+
# Do this before building so we don't accidentally erase already build
|
|
36
|
+
# nested targets.
|
|
37
|
+
if SC.env.clean
|
|
38
|
+
manifests.each do |manifest|
|
|
39
|
+
build_root = manifest.target.build_root
|
|
40
|
+
info "Cleaning #{build_root}"
|
|
41
|
+
FileUtils.rm_r(build_root) if File.directory?(build_root)
|
|
42
|
+
|
|
43
|
+
staging_root = manifest.target.staging_root
|
|
44
|
+
info "Cleaning #{staging_root}"
|
|
45
|
+
FileUtils.rm_r(staging_root) if File.directory?(staging_root)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Now build entries for each manifest...
|
|
50
|
+
manifests.each do |manifest|
|
|
51
|
+
|
|
52
|
+
# get entries. If "entries" option was specified, use to filter
|
|
53
|
+
# filename. Must match end of filename.
|
|
54
|
+
entries = manifest.entries
|
|
55
|
+
if entry_filters
|
|
56
|
+
entries = entries.select do |entry|
|
|
57
|
+
is_allowed = false
|
|
58
|
+
entry_filters.each do |filter|
|
|
59
|
+
is_allowed = entry.filename =~ /#{filter}$/
|
|
60
|
+
break if is_allowed
|
|
61
|
+
end
|
|
62
|
+
is_allowed
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# if there are entries to build, log and build
|
|
67
|
+
if entries.size > 0
|
|
68
|
+
info "Building entries for #{manifest.target.target_name}:#{manifest.language}..."
|
|
69
|
+
|
|
70
|
+
entries.each do |entry|
|
|
71
|
+
info " #{entry.filename} -> #{entry.build_path}"
|
|
72
|
+
entry.build!
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
module SC
|
|
10
|
+
class Tools
|
|
11
|
+
|
|
12
|
+
################################################
|
|
13
|
+
## COMMAND LINE
|
|
14
|
+
##
|
|
15
|
+
|
|
16
|
+
desc "build-number TARGET", "Computes a build number for the target"
|
|
17
|
+
def build_number(*targets)
|
|
18
|
+
target = requires_target!(*targets)
|
|
19
|
+
$stdout << target.prepare!.build_number
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
module SC
|
|
9
|
+
|
|
10
|
+
# Generates components for SproutCore. The generator allows the user
|
|
11
|
+
# to quickly set up a SproutCore framework using any of the built in
|
|
12
|
+
# templates such as the project itself, apps, models, views, controllers
|
|
13
|
+
# and more
|
|
14
|
+
#
|
|
15
|
+
# The template files will be copied to their target location and also be
|
|
16
|
+
# parsed through the Erubis templating system. Template file paths can
|
|
17
|
+
# contain instance variables in the form of _class_name_ which in turn would
|
|
18
|
+
# be the value of class_name once generated.
|
|
19
|
+
#
|
|
20
|
+
# To develop a new generator, you can add it to the sproutcore/gen/
|
|
21
|
+
# directory with the following file structure:
|
|
22
|
+
# gen/
|
|
23
|
+
# <generator_name>/ - singular directory name of the generator
|
|
24
|
+
# Buildfile - contains all config options and build tasks
|
|
25
|
+
# README - prints when generator is done
|
|
26
|
+
# templates/ - contains all the files you want to generate
|
|
27
|
+
# USAGE - prints when user gives uses --help option
|
|
28
|
+
#
|
|
29
|
+
class Tools
|
|
30
|
+
|
|
31
|
+
def show_help(generator_name=nil, generator=nil)
|
|
32
|
+
if generator_name
|
|
33
|
+
if generator.nil?
|
|
34
|
+
warn("There is no #{generator_name} generator")
|
|
35
|
+
else
|
|
36
|
+
generator.log_usage
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
SC.logger << "Available generators:\n"
|
|
40
|
+
SC::Generator.installed_generators_for(project).each do |name|
|
|
41
|
+
SC.logger << " #{name}\n"
|
|
42
|
+
end
|
|
43
|
+
SC.logger << "Type sc-gen GENERATOR --help for specific usage\n\n"
|
|
44
|
+
end
|
|
45
|
+
return 0
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
desc "sc-gen generator Namespace[.ClassName] [--target=TARGET_NAME] [--filename=FILE_NAME]",
|
|
49
|
+
"Generates SproutCore components"
|
|
50
|
+
|
|
51
|
+
method_options(
|
|
52
|
+
MANIFEST_OPTIONS.merge(:help => :optional,
|
|
53
|
+
:filename => :optional,
|
|
54
|
+
:target => :optional,
|
|
55
|
+
'--dry-run' => false,
|
|
56
|
+
:force => false))
|
|
57
|
+
|
|
58
|
+
def gen(*arguments)
|
|
59
|
+
return show_help if arguments.empty?
|
|
60
|
+
|
|
61
|
+
# backwards compatibility case: client is a synonym for 'app'
|
|
62
|
+
name = arguments[0]=='client' ? 'app' : arguments[0]
|
|
63
|
+
|
|
64
|
+
# Load generator
|
|
65
|
+
generator_project = self.project || SC.builtin_project
|
|
66
|
+
generator = generator_project.generator_for name,
|
|
67
|
+
:arguments => arguments,
|
|
68
|
+
:filename => options[:filename],
|
|
69
|
+
:target_name => options[:target],
|
|
70
|
+
:dry_run => options['dry-run'],
|
|
71
|
+
:force => options[:force]
|
|
72
|
+
|
|
73
|
+
# if no generator could be found, or if we just asked to show help,
|
|
74
|
+
# just return the help...
|
|
75
|
+
return show_help(name, generator) if generator.nil? || options[:help]
|
|
76
|
+
|
|
77
|
+
begin
|
|
78
|
+
# Prepare generator and then log some debug info
|
|
79
|
+
generator.prepare!
|
|
80
|
+
info "Loading generator Buildfile at: #{generator.buildfile.loaded_paths.last}"
|
|
81
|
+
|
|
82
|
+
debug "\nSETTINGS"
|
|
83
|
+
generator.each { |k,v| debug("#{k}: #{v}") }
|
|
84
|
+
|
|
85
|
+
# Now, run the generator
|
|
86
|
+
generator.build!
|
|
87
|
+
|
|
88
|
+
rescue Exception => error_message
|
|
89
|
+
warn "For specific help on how to use this generator, type: sc-gen #{name} --help"
|
|
90
|
+
fatal! error_message.to_s
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
SC.logger << "\n"
|
|
94
|
+
generator.log_readme
|
|
95
|
+
return 0
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
module SC
|
|
9
|
+
class Tools
|
|
10
|
+
|
|
11
|
+
desc "sc-init PROJECT [APP]",
|
|
12
|
+
"Generates a SproutCore project with an initial application"
|
|
13
|
+
method_options('--dry-run' => false, :force => false)
|
|
14
|
+
def init(project_name, app_name=nil)
|
|
15
|
+
|
|
16
|
+
# Generate the project
|
|
17
|
+
project_gen = SC.builtin_project.generator_for 'project',
|
|
18
|
+
:arguments => ['project', project_name],
|
|
19
|
+
:dry_run => options['dry-run'],
|
|
20
|
+
:force => options[:force]
|
|
21
|
+
project_gen.prepare!.build!
|
|
22
|
+
|
|
23
|
+
# Next, get the project root & app name
|
|
24
|
+
project_root = project_gen.build_root / project_gen.filename
|
|
25
|
+
app_name = project_gen.filename if app_name.nil?
|
|
26
|
+
|
|
27
|
+
# And get the app generator and run it
|
|
28
|
+
project = SC::Project.load project_root, :parent => SC.builtin_project
|
|
29
|
+
generator = project.generator_for 'app',
|
|
30
|
+
:arguments => ['app', app_name],
|
|
31
|
+
:dry_run => options['dry-run'],
|
|
32
|
+
:force => options[:force]
|
|
33
|
+
generator.prepare!.build!
|
|
34
|
+
|
|
35
|
+
project_gen.log_file(project_gen.source_root / 'INIT')
|
|
36
|
+
return 0
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
module SC
|
|
9
|
+
class Tools
|
|
10
|
+
|
|
11
|
+
# Standard manifest options. Used by build tool as well.
|
|
12
|
+
MANIFEST_OPTIONS = { :languages => :optional,
|
|
13
|
+
:symlink => false,
|
|
14
|
+
:buildroot => :optional,
|
|
15
|
+
:stageroot => :optional,
|
|
16
|
+
:format => :optional,
|
|
17
|
+
:output => :output,
|
|
18
|
+
:all => false,
|
|
19
|
+
['--include-required', '-r'] => false }
|
|
20
|
+
|
|
21
|
+
desc "manifest [TARGET..]", "Generates a manifest for the specified targets"
|
|
22
|
+
method_options(MANIFEST_OPTIONS.merge(
|
|
23
|
+
:format => :optional,
|
|
24
|
+
:only => :optional,
|
|
25
|
+
:except => :optional,
|
|
26
|
+
:hidden => false ))
|
|
27
|
+
def manifest(*targets)
|
|
28
|
+
|
|
29
|
+
# Copy some key props to the env
|
|
30
|
+
SC.env.build_prefix = options.buildroot if options.buildroot
|
|
31
|
+
SC.env.staging_prefix = options.stageroot if options.stageroot
|
|
32
|
+
SC.env.use_symlink = options.symlink
|
|
33
|
+
|
|
34
|
+
# Verify format
|
|
35
|
+
format = (options.format || 'yaml').to_s.downcase.to_sym
|
|
36
|
+
if ![:yaml, :json].include?(format)
|
|
37
|
+
raise "Format must be yaml or json"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Get allowed keys
|
|
41
|
+
only_keys = nil
|
|
42
|
+
if options[:only]
|
|
43
|
+
only_keys = (options[:only] || '').to_s.split(',')
|
|
44
|
+
only_keys.map! { |k| k.to_sym }
|
|
45
|
+
only_keys = nil if only_keys.size == 0
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
except_keys = nil
|
|
49
|
+
if options[:except]
|
|
50
|
+
except_keys = (options[:except] || '').to_s.split(',')
|
|
51
|
+
except_keys.map! { |k| k.to_sym }
|
|
52
|
+
except_keys = nil if except_keys.size == 0
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# call core method to actually build the manifests...
|
|
56
|
+
manifests = build_manifests(*targets)
|
|
57
|
+
|
|
58
|
+
# now convert them to hashes...
|
|
59
|
+
manifests.map! do |manifest|
|
|
60
|
+
manifest.to_hash :hidden => options.hidden,
|
|
61
|
+
:only => only_keys, :except => except_keys
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Serialize'em
|
|
65
|
+
case format
|
|
66
|
+
when :yaml
|
|
67
|
+
output = ["# SproutCore Build Manifest v1.0", manifests.to_yaml].join("\n")
|
|
68
|
+
when :json
|
|
69
|
+
output = mainfests.to_json
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# output ...
|
|
73
|
+
if options.output
|
|
74
|
+
file = File.open(options.output, 'w')
|
|
75
|
+
file.write(output)
|
|
76
|
+
file.close
|
|
77
|
+
else
|
|
78
|
+
$stdout << output
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# Project: Abbot - SproutCore Build Tools
|
|
3
|
+
# Copyright: ©2009 Apple, Inc.
|
|
4
|
+
# portions copyright @2006-2009 Sprout Systems, Inc.
|
|
5
|
+
# and contributors
|
|
6
|
+
# ===========================================================================
|
|
7
|
+
|
|
8
|
+
module SC
|
|
9
|
+
|
|
10
|
+
class Tools
|
|
11
|
+
|
|
12
|
+
desc "server", "Starts the development server"
|
|
13
|
+
method_options :daemonize => false,
|
|
14
|
+
:port => :optional,
|
|
15
|
+
:host => :optional,
|
|
16
|
+
:irb => false
|
|
17
|
+
def server
|
|
18
|
+
prepare_mode!('debug') # set mode again, using debug as default
|
|
19
|
+
|
|
20
|
+
SC.env.build_prefix = options.buildroot if options.buildroot
|
|
21
|
+
SC.env.staging_prefix = options.stageroot if options.stageroot
|
|
22
|
+
|
|
23
|
+
# get project and start service.
|
|
24
|
+
project = requires_project!
|
|
25
|
+
|
|
26
|
+
# start shell if passed
|
|
27
|
+
if options.irb
|
|
28
|
+
require 'irb'
|
|
29
|
+
require 'irb/completion'
|
|
30
|
+
if File.exists? ".irbrc"
|
|
31
|
+
ENV['IRBRC'] = ".irbrc"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
SC.project = project
|
|
35
|
+
SC.logger << "SproutCore v#{SC::VERSION} Interactive Shell\n"
|
|
36
|
+
SC.logger << "SC.project = #{project.project_root}\n"
|
|
37
|
+
ARGV.clear # do not pass onto IRB
|
|
38
|
+
IRB.start
|
|
39
|
+
else
|
|
40
|
+
SC::Rack::Service.start(options.merge(:project => project))
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "build:copy" do
|
|
4
|
+
|
|
5
|
+
include SC::SpecHelpers
|
|
6
|
+
include SC::BuildSpecHelpers
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
std_before
|
|
10
|
+
@task_name = 'build:copy'
|
|
11
|
+
|
|
12
|
+
@entry = @manifest.entry_for('demo.html')
|
|
13
|
+
@src_path = @entry.source_path
|
|
14
|
+
@dst_path = @entry.build_path
|
|
15
|
+
|
|
16
|
+
@entry.build_task.should == 'build:copy' # precondition
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
after do
|
|
20
|
+
std_after
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "copies from source to dst_path if dst_path does not exist" do
|
|
24
|
+
File.exist?(@dst_path).should be_false # precondition
|
|
25
|
+
|
|
26
|
+
run_task @entry, @dst_path
|
|
27
|
+
files_eql(@src_path, @dst_path).should be_true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "does not run if newer file exists at dst_path" do
|
|
31
|
+
write_dummy(@dst_path)
|
|
32
|
+
make_newer(@dst_path, @src_path)
|
|
33
|
+
|
|
34
|
+
run_task
|
|
35
|
+
|
|
36
|
+
is_dummy(@dst_path).should be_true # make sure task did not copy
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "replaces dst_path if older file exists at dst_path" do
|
|
40
|
+
write_dummy(@dst_path)
|
|
41
|
+
make_newer(@src_path, @dst_path)
|
|
42
|
+
|
|
43
|
+
run_task
|
|
44
|
+
|
|
45
|
+
is_dummy(@dst_path).should be_false # should overrwite older file
|
|
46
|
+
files_eql(@src_path, @dst_path).should be_true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "does not run if dst_path == src_path" do
|
|
50
|
+
task = @buildfile.lookup('build:copy')
|
|
51
|
+
expected_count = task.execute_count
|
|
52
|
+
|
|
53
|
+
@dst_path = @src_path
|
|
54
|
+
run_task
|
|
55
|
+
|
|
56
|
+
task.execute_count.should == expected_count # did not execute!
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
|
2
|
+
|
|
3
|
+
module SC::BuildSpecHelpers
|
|
4
|
+
|
|
5
|
+
def std_before
|
|
6
|
+
@project = temp_project :real_world
|
|
7
|
+
@target = @project.target_for :sproutcore
|
|
8
|
+
@buildfile = @target.buildfile
|
|
9
|
+
@manifest = @target.manifest_for(:language => :fr)
|
|
10
|
+
|
|
11
|
+
@target.prepare! # make sure its ready for the manifest...
|
|
12
|
+
@manifest.build! # get a basic manifest good to go...
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def std_after
|
|
16
|
+
@project.cleanup
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run_task(entry=nil, dst_path=nil)
|
|
20
|
+
entry ||= @entry
|
|
21
|
+
@buildfile.invoke @task_name,
|
|
22
|
+
:entry => entry,
|
|
23
|
+
:manifest => @manifest,
|
|
24
|
+
:target => @target,
|
|
25
|
+
:config => @target.config,
|
|
26
|
+
:project => @project,
|
|
27
|
+
:src_path => @src_path || entry.source_path,
|
|
28
|
+
:src_paths => @src_path.nil? ? entry.source_paths : [@src_path],
|
|
29
|
+
:dst_path => dst_path || @dst_path || entry.build_path
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def entry_for(filename)
|
|
33
|
+
@manifest.entry_for filename, :hidden => true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|