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,44 @@
|
|
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__), 'base'))
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
module SC
|
12
|
+
|
13
|
+
# This builder is used to generate a file containing all of the loc strings
|
14
|
+
# for a particular manifest. The strings file is used when generating
|
15
|
+
# HTML try to map localized strings
|
16
|
+
class Builder::Strings < Builder::Base
|
17
|
+
|
18
|
+
def build(dst_path)
|
19
|
+
data = parse_strings_js(entry.source_path)
|
20
|
+
writelines dst_path, [data.to_yaml]
|
21
|
+
end
|
22
|
+
|
23
|
+
def parse_strings_js(source_path)
|
24
|
+
return {} if !File.exists?(source_path)
|
25
|
+
|
26
|
+
# read the file in and strip out comments...
|
27
|
+
str = File.read(source_path)
|
28
|
+
str = str.gsub(/\/\/.*$/,'').gsub(/\/\*.*\*\//m,'')
|
29
|
+
|
30
|
+
# Now build the hash
|
31
|
+
ret = {}
|
32
|
+
str.scan(/['"](.+)['"]\s*:\s*['"](.+)['"],?\s*$/) do |x,y|
|
33
|
+
# x & y are JS strings that must be evaled as such..
|
34
|
+
#x = eval(%("#{x}"))
|
35
|
+
y = eval(%[<<__EOF__\n#{y}\n__EOF__]).chop
|
36
|
+
ret[x] = y
|
37
|
+
end
|
38
|
+
return ret
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
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
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'base'))
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
module SC
|
12
|
+
|
13
|
+
# This builder is used to process a single CSS stylesheet. Converts any
|
14
|
+
# build tool directives (such as sc_require() and sc_resource()) into
|
15
|
+
# comments. It will also substitute any calls to sc_static() (or
|
16
|
+
# static_url()) This builder does NOT handle combining multiple stylesheets
|
17
|
+
# into one. See the Builder::CombineStylesheets builder instead.
|
18
|
+
#
|
19
|
+
class Builder::Stylesheet < Builder::Base
|
20
|
+
|
21
|
+
def build(dst_path)
|
22
|
+
lines = readlines(entry.source_path).map { |l| rewrite_inline_code(l) }
|
23
|
+
writelines dst_path, lines
|
24
|
+
end
|
25
|
+
|
26
|
+
# Rewrites any inline content such as static urls. Subclasseses can
|
27
|
+
# override this to rewrite any other inline content.
|
28
|
+
#
|
29
|
+
# The default will rewrite calls to static_url().
|
30
|
+
def rewrite_inline_code(line)
|
31
|
+
# look for sc_require, require or sc_resource. wrap in comment
|
32
|
+
line = line.gsub(/((sc_require|require|sc_resource)\(\s*['"].*["']\s*\)\s*\;)/, '/* \1 */')
|
33
|
+
line = replace_static_url(line)
|
34
|
+
end
|
35
|
+
|
36
|
+
def static_url(url=''); "url('#{url}')" ; end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,58 @@
|
|
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__), 'html'))
|
9
|
+
|
10
|
+
module SC
|
11
|
+
|
12
|
+
# Builds an HTML files. This will setup an HtmlContext and then invokes
|
13
|
+
# the render engines for each source before finally rendering the layout.
|
14
|
+
class Builder::Test < Builder::Html
|
15
|
+
|
16
|
+
def initialize(entry)
|
17
|
+
super(entry)
|
18
|
+
@layout = @target.config.test_layout || 'lib/test.rhtml'
|
19
|
+
end
|
20
|
+
|
21
|
+
# Always include any required test targets as well when loading unit
|
22
|
+
# tests.
|
23
|
+
def expand_required_targets(target, opts = {})
|
24
|
+
opts[:test] = true
|
25
|
+
super(target, opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def render_entry(entry)
|
31
|
+
entry.stage!
|
32
|
+
|
33
|
+
case entry.ext
|
34
|
+
when 'js':
|
35
|
+
render_jstest(entry)
|
36
|
+
when 'rhtml':
|
37
|
+
entry.target.buildfile.invoke 'render:erubis',
|
38
|
+
:entry => entry,
|
39
|
+
:src_path => entry.staging_path,
|
40
|
+
:context => self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_content_for_key; :body; end
|
45
|
+
|
46
|
+
# Renders an individual test into a script tag. Also places the test
|
47
|
+
# into its own closure so that globals defined by one test will not
|
48
|
+
# conflict with any others.
|
49
|
+
def render_jstest(entry)
|
50
|
+
lines = readlines(entry.staging_path)
|
51
|
+
lines.unshift %[<script type="text/javascript">\n(function() {\n]
|
52
|
+
lines.push %[\n})();\n</script>\n]
|
53
|
+
@content_for_final = (@content_for_final || '') + lines.join("")
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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__), 'base'))
|
9
|
+
|
10
|
+
module SC
|
11
|
+
|
12
|
+
# Builds an HTML files. This will setup an HtmlContext and then invokes
|
13
|
+
# the render engines for each source before finally rendering the layout.
|
14
|
+
class Builder::TestIndex < Builder::Base
|
15
|
+
|
16
|
+
def build(dst_path)
|
17
|
+
require 'json'
|
18
|
+
items = entry.source_entries.map do |e|
|
19
|
+
{ "filename" => e.filename.ext(''), "url" => e.url }
|
20
|
+
end
|
21
|
+
writelines dst_path, [items.to_json]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,483 @@
|
|
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.join(File.dirname(__FILE__), 'models', 'hash_struct')
|
9
|
+
require File.join(File.dirname(__FILE__), 'buildfile', 'cloneable')
|
10
|
+
require File.join(File.dirname(__FILE__), 'buildfile', 'task_manager')
|
11
|
+
|
12
|
+
module SC
|
13
|
+
|
14
|
+
# A Buildfile is a special type of file that contains the configurations and
|
15
|
+
# build tasks used for a particular project or project target. Buildfiles
|
16
|
+
# are based on Rake but largely use their own syntax and helper methods.
|
17
|
+
#
|
18
|
+
# Whenever you create a project, you will often also add a Buildfile,
|
19
|
+
# sc-config, or sc-config.rb file. All of these files are laoded into the
|
20
|
+
# build system using this class. The other model objects will then
|
21
|
+
# reference their buildfile to extract configuration information and to find
|
22
|
+
# key tasks required for the build process.
|
23
|
+
#
|
24
|
+
# == Loading a Buildfile
|
25
|
+
#
|
26
|
+
# To load a buildfile, just use the load() method:
|
27
|
+
#
|
28
|
+
# buildfile = Buildfile.load('/path/to/buildfile')
|
29
|
+
#
|
30
|
+
# You can also load multiple buildfiles by calling the load!() method on
|
31
|
+
# an exising Buildfile object or by passing a directory with several
|
32
|
+
# buildfiles in it:
|
33
|
+
#
|
34
|
+
# buildfile = Buildfile.new
|
35
|
+
# buildfile.load!('buildfile1').load!('buildfile2')
|
36
|
+
#
|
37
|
+
# == Defining a Buildfile
|
38
|
+
#
|
39
|
+
# Finally, you can also define new settings on a buildfile directly. Simply
|
40
|
+
# use the define() method:
|
41
|
+
#
|
42
|
+
# buildfile = Buildfile.define do
|
43
|
+
# task :demo_task
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# You can also define additional tasks on an existing buildfile object like
|
47
|
+
# so:
|
48
|
+
#
|
49
|
+
# buildfile = Buildfile.new
|
50
|
+
# buildfile.define! do
|
51
|
+
# task :demo_task
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# When you call define!() on a buildfile, the block is executed in the
|
55
|
+
# context of the buildfile object, just like a Buildfile loaded from disk.
|
56
|
+
# You will not usually use define!() on a buildfile in normal code, but it
|
57
|
+
# is very useful for unit testing.
|
58
|
+
#
|
59
|
+
# == Executing Tasks
|
60
|
+
#
|
61
|
+
# Once a buildfile is loaded, you can execute tasks on the buildfile using
|
62
|
+
# the invoke() method. You should pass the name of the task you want
|
63
|
+
# to execute along with any constants you want set for the task to access:
|
64
|
+
#
|
65
|
+
# buildfile.invoke :demo_task, :context => my_context
|
66
|
+
#
|
67
|
+
# With the above example, the demo_task could access the "context" as a
|
68
|
+
# global constant like do:
|
69
|
+
#
|
70
|
+
# task :demo_task do
|
71
|
+
# CONTEXT.name = "demo!"
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# == Accessing Configs
|
75
|
+
#
|
76
|
+
# Configs are stored in a "normalized" state in the "configs" property. You
|
77
|
+
# can access configs directly this way, but the more useful way to access
|
78
|
+
# configs is through the config_for() method. Pass the name of the target
|
79
|
+
# that is the current "focus" of the config:
|
80
|
+
#
|
81
|
+
# config = buildfile.config_for('/sproutcore') # target always starts w /
|
82
|
+
#
|
83
|
+
# Configs can be specified in different "contexts" by the buildfile. When
|
84
|
+
# you call this method, the configs will be merged together, layering any
|
85
|
+
# configs that are targeted specifically at the /sproutcore target over the
|
86
|
+
# top of globally defined configs. The current build mode is also reflected
|
87
|
+
# in this call.
|
88
|
+
#
|
89
|
+
class Buildfile
|
90
|
+
|
91
|
+
# Default buildfile names. Override with SC.env.buildfile_names
|
92
|
+
BUILDFILE_NAMES = %w(Buildfile sc-config sc-config.rb)
|
93
|
+
|
94
|
+
include Cloneable
|
95
|
+
include TaskManager
|
96
|
+
|
97
|
+
# The location of the buildfile represented by this object.
|
98
|
+
attr_accessor :path
|
99
|
+
|
100
|
+
################################################
|
101
|
+
# CLASS METHODS
|
102
|
+
#
|
103
|
+
|
104
|
+
# Determines if this directory has a buildfile or not...
|
105
|
+
def self.has_buildfile?(dir_path, buildfile_names=nil)
|
106
|
+
buildfile_names ||= (SC.env.buildfile_names || BUILDFILE_NAMES)
|
107
|
+
buildfile_names.each do |path|
|
108
|
+
path = File.join(dir_path, path)
|
109
|
+
return true if File.exist?(path) && !File.directory?(path)
|
110
|
+
end
|
111
|
+
return false
|
112
|
+
end
|
113
|
+
|
114
|
+
# Loads the buildfile at the specified path. This simply creates a new
|
115
|
+
# instance and loads it.
|
116
|
+
#
|
117
|
+
# === Params
|
118
|
+
# path:: the path to laod at
|
119
|
+
#
|
120
|
+
# === Returns
|
121
|
+
# A new Buildfile instance
|
122
|
+
#
|
123
|
+
def self.load(path)
|
124
|
+
self.new.load!(path)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Creates a new buildfile and then gives you an opportunity to define
|
128
|
+
# its contents by executing the passed block in the context of the
|
129
|
+
# buildfile.
|
130
|
+
#
|
131
|
+
# === Returns
|
132
|
+
# A new buildfile instance
|
133
|
+
#
|
134
|
+
def self.define(&block)
|
135
|
+
self.new.define!(&block)
|
136
|
+
end
|
137
|
+
|
138
|
+
################################################
|
139
|
+
# TASK METHODS
|
140
|
+
#
|
141
|
+
|
142
|
+
attr_reader :current_path
|
143
|
+
|
144
|
+
# Extend the buildfile dynamically by executing the named task. This
|
145
|
+
# will yield the block if given after making the buildfile the current
|
146
|
+
# build file.
|
147
|
+
#
|
148
|
+
# === Params
|
149
|
+
# string:: optional string to eval
|
150
|
+
# &block:: optional block to execute
|
151
|
+
#
|
152
|
+
# === Returns
|
153
|
+
# self
|
154
|
+
#
|
155
|
+
def define!(string=nil, &block)
|
156
|
+
context = reset_define_context :current_mode => :all
|
157
|
+
instance_eval(string) if string
|
158
|
+
instance_eval(&block) if block_given?
|
159
|
+
load_imports
|
160
|
+
reset_define_context context
|
161
|
+
return self
|
162
|
+
end
|
163
|
+
|
164
|
+
def task_defined?(task_name)
|
165
|
+
!!lookup(task_name)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Loads the contents of the passed file into the buildfile object. The
|
169
|
+
# contents will be executed in the context of the buildfile object. If
|
170
|
+
# the filename passed is nil or the file does not exist, this will simply
|
171
|
+
# do nothing.
|
172
|
+
#
|
173
|
+
# === Params
|
174
|
+
# filename:: the buildfile to load or a directory
|
175
|
+
# buildfile_names:: optional array of names to search in directory
|
176
|
+
#
|
177
|
+
# === Returns
|
178
|
+
# self
|
179
|
+
|
180
|
+
def load!(filename=nil, buildfile_names=nil)
|
181
|
+
|
182
|
+
# If a directory is passed, look for any buildfile and load them...
|
183
|
+
if File.directory?(filename)
|
184
|
+
|
185
|
+
# search directory for buildfiles and load them.
|
186
|
+
buildfile_names ||= (SC.env.buildfile_names || BUILDFILE_NAMES)
|
187
|
+
buildfile_names.each do |path|
|
188
|
+
path = File.join(filename, path)
|
189
|
+
next unless File.exist?(path) && !File.directory?(path)
|
190
|
+
load!(path)
|
191
|
+
end
|
192
|
+
|
193
|
+
elsif File.exist?(filename)
|
194
|
+
old_path = @current_path
|
195
|
+
@current_path = filename
|
196
|
+
loaded_paths << filename # save loaded paths
|
197
|
+
define!(File.read(filename)) if filename && File.exist?(filename)
|
198
|
+
@current_path = old_path
|
199
|
+
end
|
200
|
+
return self
|
201
|
+
end
|
202
|
+
|
203
|
+
def loaded_paths; @loaded_paths ||= []; end
|
204
|
+
|
205
|
+
# Executes the name task. Unlike invoke_task, this method will execute
|
206
|
+
# the task even if it has already been executed before. You can also
|
207
|
+
# pass a hash of additional constants that will be set on the global
|
208
|
+
# namespace before the task is invoked.
|
209
|
+
#
|
210
|
+
# === Params
|
211
|
+
# task_name:: the full name of the task, including namespaces
|
212
|
+
# consts:: Optional hash of constant values to set on the env
|
213
|
+
def invoke(task_name, consts = nil)
|
214
|
+
consts = set_kernel_consts consts # save to restore
|
215
|
+
self[task_name.to_s].invoke
|
216
|
+
set_kernel_consts consts # clear constants
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns true if the buildfile has the named task defined
|
220
|
+
#
|
221
|
+
# === Params
|
222
|
+
# task_name:: the full name of the task, including namespaces
|
223
|
+
def has_task?(task_name)
|
224
|
+
!self[task_name.to_s].nil?
|
225
|
+
end
|
226
|
+
|
227
|
+
################################################
|
228
|
+
# RAKE SUPPORT
|
229
|
+
#
|
230
|
+
|
231
|
+
# Add a file to the list of files to be imported.
|
232
|
+
def add_import(fn)
|
233
|
+
@pending_imports << fn
|
234
|
+
end
|
235
|
+
|
236
|
+
# Load the pending list of imported files.
|
237
|
+
def load_imports
|
238
|
+
while fn = @pending_imports.shift
|
239
|
+
next if @imported.member?(fn)
|
240
|
+
if fn_task = lookup(fn)
|
241
|
+
fn_task.invoke
|
242
|
+
end
|
243
|
+
load!(fn)
|
244
|
+
@imported << fn
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# Support redefining a task...
|
249
|
+
def intern(task_class, task_name)
|
250
|
+
ret = super(task_class, task_name)
|
251
|
+
ret.clear if @is_redefining
|
252
|
+
return ret
|
253
|
+
end
|
254
|
+
|
255
|
+
# Application options from the command line
|
256
|
+
attr_reader :options
|
257
|
+
|
258
|
+
################################################
|
259
|
+
# CONFIG METHODS
|
260
|
+
#
|
261
|
+
|
262
|
+
def current_mode
|
263
|
+
@define_context.current_mode
|
264
|
+
end
|
265
|
+
|
266
|
+
def current_mode=(new_mode)
|
267
|
+
@define_context.current_mode = new_mode
|
268
|
+
end
|
269
|
+
|
270
|
+
# Configures the buildfile for use with the specified target. Call this
|
271
|
+
# BEFORE you load any actual file contents.
|
272
|
+
#
|
273
|
+
# === Returns
|
274
|
+
# self
|
275
|
+
#
|
276
|
+
def for_target(target)
|
277
|
+
@target_name = target.target_name.to_s
|
278
|
+
return self
|
279
|
+
end
|
280
|
+
|
281
|
+
# The namespace for this buildfile. This should be name equal to the
|
282
|
+
# namespace of the target that owns the buildfile, if there is one
|
283
|
+
attr_reader :target_name
|
284
|
+
|
285
|
+
# The hash of configs as loaded from the files. The configs are stored
|
286
|
+
# by mode and then by config name. To get a merged config, use
|
287
|
+
# config_for().
|
288
|
+
attr_reader :configs
|
289
|
+
|
290
|
+
# The hash of proxy commands
|
291
|
+
|
292
|
+
# Merge the passed hash of options into the config hash. This method
|
293
|
+
# is usually used by the config global helper
|
294
|
+
#
|
295
|
+
# === Params
|
296
|
+
# config_name:: the name of the config to set
|
297
|
+
# config_mode:: the mode to store the config. If omitted use current
|
298
|
+
# opts: the config options to merge in
|
299
|
+
#
|
300
|
+
# === Returns
|
301
|
+
# receiver
|
302
|
+
#
|
303
|
+
def add_config(config_name, config_mode, opts=nil)
|
304
|
+
# Normalize Params
|
305
|
+
if opts.nil?
|
306
|
+
opts = config_mode; config_mode = nil
|
307
|
+
end
|
308
|
+
config_mode = current_mode if config_mode.nil?
|
309
|
+
|
310
|
+
# Normalize the config name -- :all or 'all' is OK, absolute OK.
|
311
|
+
config_name = config_name.to_s
|
312
|
+
if config_name != 'all' && (config_name[0..0] != '/')
|
313
|
+
if target_name && (config_name == File.basename(target_name))
|
314
|
+
config_name = target_name
|
315
|
+
else
|
316
|
+
config_name = [target_name, config_name].join('/')
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
# Perform Merge
|
321
|
+
mode_configs = (self.configs[config_mode.to_sym] ||= HashStruct.new)
|
322
|
+
config = (mode_configs[config_name.to_sym] ||= HashStruct.new)
|
323
|
+
config.merge!(opts)
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the merged config setting for the config name and mode. If
|
327
|
+
# no mode is specified the :all mode is assumed.
|
328
|
+
#
|
329
|
+
# This will merge config hashes in the following order (mode/name):
|
330
|
+
#
|
331
|
+
# all:all -> mode:all -> all:config -> mode:config
|
332
|
+
#
|
333
|
+
#
|
334
|
+
|
335
|
+
# === Params
|
336
|
+
# config_name:: The config name
|
337
|
+
# mode_name:: optional mode name
|
338
|
+
#
|
339
|
+
# === Returns
|
340
|
+
# merged config -- a HashStruct
|
341
|
+
def config_for(config_name, mode_name=nil)
|
342
|
+
mode_name = :all if mode_name.nil? || mode_name.to_s.size == 0
|
343
|
+
config_name = :all if config_name.nil? || config_name.to_s.size == 0
|
344
|
+
|
345
|
+
# collect the hashes
|
346
|
+
all_configs = configs[:all]
|
347
|
+
cur_configs = configs[mode_name]
|
348
|
+
ret = HashStruct.new
|
349
|
+
|
350
|
+
# now merge em! -- note that this assumes the merge method will handle
|
351
|
+
# self.merge(self) & self.merge(nil) gracefully
|
352
|
+
ret.merge!(all_configs[:all]) if all_configs
|
353
|
+
ret.merge!(cur_configs[:all]) if cur_configs
|
354
|
+
ret.merge!(all_configs[config_name]) if all_configs
|
355
|
+
ret.merge!(cur_configs[config_name]) if cur_configs
|
356
|
+
|
357
|
+
# Done -- return result
|
358
|
+
return ret
|
359
|
+
end
|
360
|
+
|
361
|
+
################################################
|
362
|
+
# PROJECT & TARGET METHODS
|
363
|
+
#
|
364
|
+
|
365
|
+
# This is set if you use the project helper method in your buildfile.
|
366
|
+
attr_accessor :project_name
|
367
|
+
|
368
|
+
def project_type; @project_type || :default; end
|
369
|
+
attr_writer :project_type
|
370
|
+
|
371
|
+
# Returns YES if this buildfile appears to represent a project. If you
|
372
|
+
# use the project() helper method, it will set this
|
373
|
+
def project?; @is_project || false; end
|
374
|
+
def project!; @is_project = true; end
|
375
|
+
|
376
|
+
################################################
|
377
|
+
# PROXY METHODS
|
378
|
+
#
|
379
|
+
|
380
|
+
# The hash of all proxies paths and their options
|
381
|
+
attr_reader :proxies
|
382
|
+
|
383
|
+
# Adds a proxy to the list of proxy paths. These are used only in server
|
384
|
+
# mode to proxy certain URLs. If you call this method with the same
|
385
|
+
# proxy path more than once, the options will be merged.
|
386
|
+
#
|
387
|
+
# === Params
|
388
|
+
# :proxy_path the URL to proxy
|
389
|
+
# :opts any proxy options
|
390
|
+
#
|
391
|
+
# === Returns
|
392
|
+
# receiver
|
393
|
+
#
|
394
|
+
def add_proxy(proxy_path, opts={})
|
395
|
+
@proxies[proxy_path] = HashStruct.new(opts)
|
396
|
+
return self
|
397
|
+
end
|
398
|
+
|
399
|
+
################################################
|
400
|
+
# INTERNAL SUPPORT
|
401
|
+
#
|
402
|
+
|
403
|
+
def initialize
|
404
|
+
super
|
405
|
+
@configs = HashStruct.new
|
406
|
+
@proxies = HashStruct.new
|
407
|
+
@pending_imports = []
|
408
|
+
@imported = []
|
409
|
+
@options = HashStruct.new
|
410
|
+
end
|
411
|
+
|
412
|
+
# When dup'ing, rewrite the @tasks hash to use clones of the tasks
|
413
|
+
# the point to the new application object.
|
414
|
+
def dup
|
415
|
+
ret = super
|
416
|
+
|
417
|
+
# Make sure the tasks themselves are cloned
|
418
|
+
tasks = ret.instance_variable_get('@tasks')
|
419
|
+
tasks.each do | key, task |
|
420
|
+
tasks[key] = task.dup(ret)
|
421
|
+
end
|
422
|
+
|
423
|
+
# Deep clone the config and proxy hashes as well...
|
424
|
+
%w(@configs @proxies @options).each do |ivar|
|
425
|
+
cloned_ivar = instance_variable_get(ivar).deep_clone
|
426
|
+
ret.instance_variable_set(ivar, cloned_ivar)
|
427
|
+
end
|
428
|
+
|
429
|
+
ret.instance_variable_set('@is_project', false) # transient - do not dup
|
430
|
+
|
431
|
+
return ret
|
432
|
+
end
|
433
|
+
|
434
|
+
protected
|
435
|
+
|
436
|
+
# Save off the old define context and replace it with the passed context
|
437
|
+
# This is used during a call to define()
|
438
|
+
def reset_define_context(context=nil)
|
439
|
+
ret = @define_context
|
440
|
+
@define_context = HashStruct.new(context || {})
|
441
|
+
return ret
|
442
|
+
end
|
443
|
+
|
444
|
+
# For each key in the passed hash, this will register a global
|
445
|
+
def set_kernel_consts(env = nil)
|
446
|
+
return env if env.nil?
|
447
|
+
|
448
|
+
# for each item in the passed environment, convert to uppercase constant
|
449
|
+
# and set in global namespace. Save the old value so that it can be
|
450
|
+
# restored later.
|
451
|
+
ret = {}
|
452
|
+
env.each do |key, value|
|
453
|
+
const_key = key.to_s.upcase.to_sym
|
454
|
+
|
455
|
+
# Save the old const value
|
456
|
+
ret[key] = Kernel.const_get(const_key) rescue nil
|
457
|
+
|
458
|
+
# Reset
|
459
|
+
Kernel.const_reset(const_key, value)
|
460
|
+
end
|
461
|
+
|
462
|
+
# Also, save env. Used mostly for logging
|
463
|
+
ret['TASK_ENV'] = Kernel.const_get('TASK_ENV') rescue nil
|
464
|
+
Kernel.const_reset('TASK_ENV', env)
|
465
|
+
|
466
|
+
return ret
|
467
|
+
end
|
468
|
+
|
469
|
+
end
|
470
|
+
|
471
|
+
end
|
472
|
+
|
473
|
+
# Add public method to kernel to remove defined constant using private
|
474
|
+
# method.
|
475
|
+
module Kernel
|
476
|
+
def const_reset(key, value)
|
477
|
+
remove_const(key) if const_defined?(key)
|
478
|
+
const_set key, value
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
SC.require_all_libs_relative_to(__FILE__)
|
483
|
+
|