sproutit-sproutcore 1.0.0.20090407205609
Sign up to get free protection for your applications and to get access to all the features.
- 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,304 @@
|
|
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
|
+
# Buildfile tasks are rake tasks with a few extras added to support
|
11
|
+
# unique buildfile constraints. Much of this source code is borrowed from
|
12
|
+
# Rake 0.8.3
|
13
|
+
#
|
14
|
+
class Buildfile::Task
|
15
|
+
include Cloneable
|
16
|
+
|
17
|
+
# List of prerequisites for a task.
|
18
|
+
attr_reader :prerequisites
|
19
|
+
|
20
|
+
# List of actions attached to a task.
|
21
|
+
attr_reader :actions
|
22
|
+
|
23
|
+
# Application owning this task.
|
24
|
+
attr_accessor :application
|
25
|
+
|
26
|
+
# Comment for this task. Restricted to a single line of no more than 50
|
27
|
+
# characters.
|
28
|
+
attr_reader :comment
|
29
|
+
|
30
|
+
# Full text of the (possibly multi-line) comment.
|
31
|
+
attr_reader :full_comment
|
32
|
+
|
33
|
+
# Array of nested namespaces names used for task lookup by this task.
|
34
|
+
attr_reader :scope
|
35
|
+
|
36
|
+
# The number of times this task has been invoked. Use to ensure that
|
37
|
+
# the task was invoked during some call chain...
|
38
|
+
attr_reader :invoke_count
|
39
|
+
|
40
|
+
# The number of times the task was actually executed. This may differ
|
41
|
+
# from the invoke_count if the task was invoked but was not needed.
|
42
|
+
attr_reader :execute_count
|
43
|
+
|
44
|
+
# Various options you can set on the task to control log level, etc.
|
45
|
+
attr_reader :task_options
|
46
|
+
|
47
|
+
# Return task name
|
48
|
+
def to_s
|
49
|
+
name
|
50
|
+
end
|
51
|
+
|
52
|
+
def inspect
|
53
|
+
"<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of sources for task.
|
57
|
+
attr_writer :sources
|
58
|
+
def sources
|
59
|
+
@sources ||= []
|
60
|
+
end
|
61
|
+
|
62
|
+
# First source from a rule (nil if no sources)
|
63
|
+
def source
|
64
|
+
@sources.first if defined?(@sources)
|
65
|
+
end
|
66
|
+
|
67
|
+
IGNORE = %w(@lock @application)
|
68
|
+
def dup(app=nil)
|
69
|
+
app = application if app.nil?
|
70
|
+
sibling = self.class.new(name, app)
|
71
|
+
self.instance_variables.each do |key|
|
72
|
+
next if IGNORE.include?(key)
|
73
|
+
sibling.instance_variable_set(key, self.instance_variable_get(key))
|
74
|
+
end
|
75
|
+
sibling.taint if tainted?
|
76
|
+
sibling
|
77
|
+
end
|
78
|
+
|
79
|
+
# Create a task named +task_name+ with no actions or prerequisites. Use
|
80
|
+
# +enhance+ to add actions and prerequisites.
|
81
|
+
def initialize(task_name, app)
|
82
|
+
@name = task_name.to_s
|
83
|
+
@prerequisites = []
|
84
|
+
@actions = []
|
85
|
+
@full_comment = nil
|
86
|
+
@comment = nil
|
87
|
+
@lock = Monitor.new
|
88
|
+
@application = app
|
89
|
+
@scope = app.current_scope
|
90
|
+
@arg_names = nil
|
91
|
+
@invoke_count = @execute_count = 0
|
92
|
+
@task_options = {}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Enhance a task with prerequisites or actions. Returns self.
|
96
|
+
def enhance(deps=nil, &block)
|
97
|
+
@prerequisites |= deps if deps
|
98
|
+
@actions << block if block_given?
|
99
|
+
self
|
100
|
+
end
|
101
|
+
|
102
|
+
# Name of the task, including any namespace qualifiers.
|
103
|
+
def name
|
104
|
+
@name.to_s
|
105
|
+
end
|
106
|
+
|
107
|
+
# Name of task with argument list description.
|
108
|
+
def name_with_args # :nodoc:
|
109
|
+
if arg_description
|
110
|
+
"#{name}#{arg_description}"
|
111
|
+
else
|
112
|
+
name
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Argument description (nil if none).
|
117
|
+
def arg_description # :nodoc:
|
118
|
+
@arg_names ? "[#{(arg_names || []).join(',')}]" : nil
|
119
|
+
end
|
120
|
+
|
121
|
+
# Name of arguments for this task.
|
122
|
+
def arg_names
|
123
|
+
@arg_names || []
|
124
|
+
end
|
125
|
+
|
126
|
+
# Clear the existing prerequisites and actions of a rake task.
|
127
|
+
def clear
|
128
|
+
clear_prerequisites
|
129
|
+
clear_actions
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# Clear the existing prerequisites of a rake task.
|
134
|
+
def clear_prerequisites
|
135
|
+
prerequisites.clear
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Clear the existing actions on a rake task.
|
140
|
+
def clear_actions
|
141
|
+
actions.clear
|
142
|
+
self
|
143
|
+
end
|
144
|
+
|
145
|
+
# Invoke the task if it is needed. Prerequites are invoked first.
|
146
|
+
def invoke(*args)
|
147
|
+
task_args = TaskArguments.new(arg_names, args)
|
148
|
+
invoke_with_call_chain(task_args, InvocationChain::EMPTY)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Same as invoke, but explicitly pass a call chain to detect
|
152
|
+
# circular dependencies.
|
153
|
+
def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
|
154
|
+
unless invocation_chain.already_invoked?(self)
|
155
|
+
invocation_chain = InvocationChain.append(self, invocation_chain)
|
156
|
+
@lock.synchronize do
|
157
|
+
|
158
|
+
# Use logging options to decide what to output
|
159
|
+
# one of :env, :name, :none
|
160
|
+
log_opt = task_options[:log] || :env
|
161
|
+
if [:name, :env].include?(log_opt)
|
162
|
+
SC.logger.debug "invoke ~ #{name} #{format_trace_flags}"
|
163
|
+
end
|
164
|
+
|
165
|
+
if log_opt == :env
|
166
|
+
TASK_ENV.each do |key, value|
|
167
|
+
next if %w(config task_env).include?(key.to_s.downcase)
|
168
|
+
SC.logger.debug " #{key} = #{value.inspect}"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
invocation_chain = invoke_prerequisites(task_args, invocation_chain)
|
173
|
+
@invoke_count += 1
|
174
|
+
execute(task_args) if needed?
|
175
|
+
end
|
176
|
+
end
|
177
|
+
return invocation_chain
|
178
|
+
end
|
179
|
+
protected :invoke_with_call_chain
|
180
|
+
|
181
|
+
# Invoke all the prerequisites of a task.
|
182
|
+
def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
|
183
|
+
@prerequisites.each { |n|
|
184
|
+
prereq = application[n, @scope]
|
185
|
+
prereq_args = task_args.new_scope(prereq.arg_names)
|
186
|
+
invocation_chain = prereq.invoke_with_call_chain(prereq_args, invocation_chain)
|
187
|
+
}
|
188
|
+
return invocation_chain
|
189
|
+
end
|
190
|
+
|
191
|
+
# Format the trace flags for display.
|
192
|
+
def format_trace_flags
|
193
|
+
flags = []
|
194
|
+
flags << "first_time" unless @already_invoked
|
195
|
+
flags << "not_needed" unless needed?
|
196
|
+
flags.empty? ? "" : "(" + flags.join(", ") + ")"
|
197
|
+
end
|
198
|
+
private :format_trace_flags
|
199
|
+
|
200
|
+
# Execute the actions associated with this task.
|
201
|
+
def execute(args=nil)
|
202
|
+
@execute_count += 1
|
203
|
+
args ||= EMPTY_TASK_ARGS
|
204
|
+
return if SC.env.dryrun
|
205
|
+
|
206
|
+
@actions.each do |act|
|
207
|
+
case act.arity
|
208
|
+
when 1
|
209
|
+
act.call(self)
|
210
|
+
else
|
211
|
+
act.call(self, args)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Is this task needed?
|
217
|
+
def needed?
|
218
|
+
true
|
219
|
+
end
|
220
|
+
|
221
|
+
# Timestamp for this task. Basic tasks return the current time for their
|
222
|
+
# time stamp. Other tasks can be more sophisticated.
|
223
|
+
def timestamp
|
224
|
+
@prerequisites.collect { |p| application[p].timestamp }.max || Time.now
|
225
|
+
end
|
226
|
+
|
227
|
+
# Add a description to the task. The description can consist of an option
|
228
|
+
# argument list (enclosed brackets) and an optional comment.
|
229
|
+
def add_description(description)
|
230
|
+
return if ! description
|
231
|
+
comment = description.strip
|
232
|
+
add_comment(comment) if comment && ! comment.empty?
|
233
|
+
end
|
234
|
+
|
235
|
+
# Add task options.
|
236
|
+
def add_options(task_options)
|
237
|
+
return if !task_options
|
238
|
+
@task_options = task_options
|
239
|
+
end
|
240
|
+
|
241
|
+
# Writing to the comment attribute is the same as adding a description.
|
242
|
+
def comment=(description)
|
243
|
+
add_description(description)
|
244
|
+
end
|
245
|
+
|
246
|
+
# Add a comment to the task. If a comment alread exists, separate
|
247
|
+
# the new comment with " / ".
|
248
|
+
def add_comment(comment)
|
249
|
+
if @full_comment
|
250
|
+
@full_comment << " / "
|
251
|
+
else
|
252
|
+
@full_comment = ''
|
253
|
+
end
|
254
|
+
@full_comment << comment
|
255
|
+
if @full_comment =~ /\A([^.]+?\.)( |$)/
|
256
|
+
@comment = $1
|
257
|
+
else
|
258
|
+
@comment = @full_comment
|
259
|
+
end
|
260
|
+
end
|
261
|
+
private :add_comment
|
262
|
+
|
263
|
+
# Set the names of the arguments for this task. +args+ should be
|
264
|
+
# an array of symbols, one for each argument name.
|
265
|
+
def set_arg_names(args)
|
266
|
+
@arg_names = args.map { |a| a.to_sym }
|
267
|
+
end
|
268
|
+
|
269
|
+
# Return a string describing the internal state of a task. Useful for
|
270
|
+
# debugging.
|
271
|
+
def investigation
|
272
|
+
result = "------------------------------\n"
|
273
|
+
result << "Investigating #{name}\n"
|
274
|
+
result << "class: #{self.class}\n"
|
275
|
+
result << "task needed: #{needed?}\n"
|
276
|
+
result << "timestamp: #{timestamp}\n"
|
277
|
+
result << "pre-requisites: \n"
|
278
|
+
prereqs = @prerequisites.collect {|name| application[name]}
|
279
|
+
prereqs.sort! {|a,b| a.timestamp <=> b.timestamp}
|
280
|
+
prereqs.each do |p|
|
281
|
+
result << "--#{p.name} (#{p.timestamp})\n"
|
282
|
+
end
|
283
|
+
latest_prereq = @prerequisites.collect{|n| application[n].timestamp}.max
|
284
|
+
result << "latest-prerequisite time: #{latest_prereq}\n"
|
285
|
+
result << "................................\n\n"
|
286
|
+
return result
|
287
|
+
end
|
288
|
+
|
289
|
+
class <<self
|
290
|
+
|
291
|
+
# Apply the scope to the task name according to the rules for
|
292
|
+
# this kind of task. Generic tasks will accept the scope as
|
293
|
+
# part of the name.
|
294
|
+
def scope_name(scope, task_name)
|
295
|
+
(scope + [task_name]).join(':')
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|
303
|
+
|
304
|
+
|
@@ -0,0 +1,86 @@
|
|
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
|
+
# TaskAguments manage the arguments passed to a task. Borrowed from Rake
|
11
|
+
# 0.8.3
|
12
|
+
#
|
13
|
+
class TaskArguments
|
14
|
+
include Enumerable
|
15
|
+
|
16
|
+
attr_reader :names
|
17
|
+
|
18
|
+
# Create a TaskArgument object with a list of named arguments
|
19
|
+
# (given by :names) and a set of associated values (given by
|
20
|
+
# :values). :parent is the parent argument object.
|
21
|
+
def initialize(names, values, parent=nil)
|
22
|
+
@names = names
|
23
|
+
@parent = parent
|
24
|
+
@hash = {}
|
25
|
+
names.each_with_index { |name, i|
|
26
|
+
@hash[name.to_sym] = values[i] unless values[i].nil?
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a new argument scope using the prerequisite argument
|
31
|
+
# names.
|
32
|
+
def new_scope(names)
|
33
|
+
values = names.collect { |n| self[n] }
|
34
|
+
self.class.new(names, values, self)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Find an argument value by name or index.
|
38
|
+
def [](index)
|
39
|
+
lookup(index.to_sym)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Specify a hash of default values for task arguments. Use the
|
43
|
+
# defaults only if there is no specific value for the given
|
44
|
+
# argument.
|
45
|
+
def with_defaults(defaults)
|
46
|
+
@hash = defaults.merge(@hash)
|
47
|
+
end
|
48
|
+
|
49
|
+
def each(&block)
|
50
|
+
@hash.each(&block)
|
51
|
+
end
|
52
|
+
|
53
|
+
def method_missing(sym, *args, &block)
|
54
|
+
lookup(sym.to_sym)
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_hash
|
58
|
+
@hash
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_s
|
62
|
+
@hash.inspect
|
63
|
+
end
|
64
|
+
|
65
|
+
def inspect
|
66
|
+
to_s
|
67
|
+
end
|
68
|
+
|
69
|
+
protected
|
70
|
+
|
71
|
+
def lookup(name)
|
72
|
+
if @hash.has_key?(name)
|
73
|
+
@hash[name]
|
74
|
+
elsif ENV.has_key?(name.to_s)
|
75
|
+
ENV[name.to_s]
|
76
|
+
elsif ENV.has_key?(name.to_s.upcase)
|
77
|
+
ENV[name.to_s.upcase]
|
78
|
+
elsif @parent
|
79
|
+
@parent.lookup(name)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
EMPTY_TASK_ARGS = TaskArguments.new([], [])
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,193 @@
|
|
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
|
+
# Manages a set of tasks. Borrowed from Rake 0.8.3
|
11
|
+
module TaskManager
|
12
|
+
# Track the last comment made in the Rakefile.
|
13
|
+
attr_accessor :last_description
|
14
|
+
alias :last_comment :last_description # Backwards compatibility
|
15
|
+
|
16
|
+
attr_accessor :last_task_options
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
super
|
20
|
+
@tasks = Hash.new
|
21
|
+
@rules = Array.new
|
22
|
+
@scope = Array.new
|
23
|
+
@last_description = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_rule(*args, &block)
|
27
|
+
pattern, arg_names, deps = resolve_args(args)
|
28
|
+
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
|
29
|
+
@rules << [pattern, deps, block]
|
30
|
+
end
|
31
|
+
|
32
|
+
def define_task(task_class, *args, &block)
|
33
|
+
task_name, arg_names, deps = resolve_args(args)
|
34
|
+
task_name = task_class.scope_name(@scope, task_name)
|
35
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
36
|
+
deps = deps.collect {|d| d.to_s }
|
37
|
+
task = intern(task_class, task_name)
|
38
|
+
task.set_arg_names(arg_names) unless arg_names.empty?
|
39
|
+
task.add_description(@last_description)
|
40
|
+
task.add_options(@last_task_options)
|
41
|
+
@last_description = nil
|
42
|
+
task.enhance(deps, &block)
|
43
|
+
task
|
44
|
+
end
|
45
|
+
|
46
|
+
# Lookup a task. Return an existing task if found, otherwise
|
47
|
+
# create a task of the current type.
|
48
|
+
def intern(task_class, task_name)
|
49
|
+
@tasks[task_name.to_s] ||= task_class.new(task_name, self)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Find a matching task for +task_name+.
|
53
|
+
def [](task_name, scopes=nil)
|
54
|
+
task_name = task_name.to_s
|
55
|
+
self.lookup(task_name, scopes) or
|
56
|
+
raise "Don't know how to build task '#{task_name}'"
|
57
|
+
end
|
58
|
+
|
59
|
+
# Resolve the arguments for a task/rule. Returns a triplet of
|
60
|
+
# [task_name, arg_name_list, prerequisites].
|
61
|
+
def resolve_args(args)
|
62
|
+
if args.last.is_a?(Hash)
|
63
|
+
deps = args.pop
|
64
|
+
resolve_args_with_dependencies(args, deps)
|
65
|
+
else
|
66
|
+
resolve_args_without_dependencies(args)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Resolve task arguments for a task or rule when there are no
|
71
|
+
# dependencies declared.
|
72
|
+
#
|
73
|
+
# The patterns recognized by this argument resolving function are:
|
74
|
+
#
|
75
|
+
# task :t
|
76
|
+
# task :t, [:a]
|
77
|
+
# task :t, :a (deprecated)
|
78
|
+
#
|
79
|
+
def resolve_args_without_dependencies(args)
|
80
|
+
task_name = args.shift
|
81
|
+
if args.size == 1 && args.first.respond_to?(:to_ary)
|
82
|
+
arg_names = args.first.to_ary
|
83
|
+
else
|
84
|
+
arg_names = args
|
85
|
+
end
|
86
|
+
[task_name, arg_names, []]
|
87
|
+
end
|
88
|
+
private :resolve_args_without_dependencies
|
89
|
+
|
90
|
+
# Resolve task arguments for a task or rule when there are
|
91
|
+
# dependencies declared.
|
92
|
+
#
|
93
|
+
# The patterns recognized by this argument resolving function are:
|
94
|
+
#
|
95
|
+
# task :t => [:d]
|
96
|
+
# task :t, [a] => [:d]
|
97
|
+
# task :t, :needs => [:d] (deprecated)
|
98
|
+
# task :t, :a, :needs => [:d] (deprecated)
|
99
|
+
#
|
100
|
+
def resolve_args_with_dependencies(args, hash) # :nodoc:
|
101
|
+
fail "Task Argument Error" if hash.size != 1
|
102
|
+
key, value = hash.map { |k, v| [k,v] }.first
|
103
|
+
if args.empty?
|
104
|
+
task_name = key
|
105
|
+
arg_names = []
|
106
|
+
deps = value
|
107
|
+
elsif key == :needs
|
108
|
+
task_name = args.shift
|
109
|
+
arg_names = args
|
110
|
+
deps = value
|
111
|
+
else
|
112
|
+
task_name = args.shift
|
113
|
+
arg_names = key
|
114
|
+
deps = value
|
115
|
+
end
|
116
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
117
|
+
[task_name, arg_names, deps]
|
118
|
+
end
|
119
|
+
private :resolve_args_with_dependencies
|
120
|
+
|
121
|
+
# List of all defined tasks in this application.
|
122
|
+
def tasks
|
123
|
+
@tasks.values.sort_by { |t| t.name }
|
124
|
+
end
|
125
|
+
|
126
|
+
# Clear all tasks in this application.
|
127
|
+
def clear
|
128
|
+
@tasks.clear
|
129
|
+
@rules.clear
|
130
|
+
end
|
131
|
+
|
132
|
+
# Lookup a task, using scope and the scope hints in the task name.
|
133
|
+
# This method performs straight lookups without trying to
|
134
|
+
# synthesize file tasks or rules. Special scope names (e.g. '^')
|
135
|
+
# are recognized. If no scope argument is supplied, use the
|
136
|
+
# current scope. Return nil if the task cannot be found.
|
137
|
+
def lookup(task_name, initial_scope=nil)
|
138
|
+
initial_scope ||= @scope
|
139
|
+
task_name = task_name.to_s
|
140
|
+
if task_name =~ /^rake:/
|
141
|
+
scopes = []
|
142
|
+
task_name = task_name.sub(/^rake:/, '')
|
143
|
+
elsif task_name =~ /^(\^+)/
|
144
|
+
scopes = initial_scope[0, initial_scope.size - $1.size]
|
145
|
+
task_name = task_name.sub(/^(\^+)/, '')
|
146
|
+
else
|
147
|
+
scopes = initial_scope
|
148
|
+
end
|
149
|
+
lookup_in_scope(task_name, scopes)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Lookup the task name
|
153
|
+
def lookup_in_scope(name, scope)
|
154
|
+
n = scope.size
|
155
|
+
while n >= 0
|
156
|
+
tn = (scope[0,n] + [name]).join(':')
|
157
|
+
task = @tasks[tn]
|
158
|
+
return task if task
|
159
|
+
n -= 1
|
160
|
+
end
|
161
|
+
nil
|
162
|
+
end
|
163
|
+
private :lookup_in_scope
|
164
|
+
|
165
|
+
# Return the list of scope names currently active in the task
|
166
|
+
# manager.
|
167
|
+
def current_scope
|
168
|
+
@scope.dup
|
169
|
+
end
|
170
|
+
|
171
|
+
# Evaluate the block in a nested namespace named +name+. Create
|
172
|
+
# an anonymous namespace if +name+ is nil.
|
173
|
+
def in_namespace(name)
|
174
|
+
name ||= generate_name
|
175
|
+
@scope.push(name)
|
176
|
+
ns = NameSpace.new(self, @scope)
|
177
|
+
yield(ns)
|
178
|
+
ns
|
179
|
+
ensure
|
180
|
+
@scope.pop
|
181
|
+
end
|
182
|
+
|
183
|
+
private
|
184
|
+
|
185
|
+
# Generate an anonymous namespace name.
|
186
|
+
def generate_name
|
187
|
+
@seed ||= 0
|
188
|
+
@seed += 1
|
189
|
+
"_anon_#{@seed}"
|
190
|
+
end
|
191
|
+
|
192
|
+
end # TaskManager
|
193
|
+
end
|