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,79 @@
|
|
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
|
+
# Builder classes implement the more complex algorithms for building
|
11
|
+
# resources in SproutCore such as building HTML, JavaScript or CSS.
|
12
|
+
# Builders are usually invoked from within build tasks which are, in-turn,
|
13
|
+
# selected by the manifest.
|
14
|
+
#
|
15
|
+
module Builder
|
16
|
+
|
17
|
+
# The base class extended by most builder classes. This contains some
|
18
|
+
# default functionality for handling loading and writing files. Usually
|
19
|
+
# you will want to consult the specific classes instead for more info.
|
20
|
+
#
|
21
|
+
class Base
|
22
|
+
# entry the current builder is working on
|
23
|
+
attr_accessor :entry
|
24
|
+
|
25
|
+
def initialize(entry=nil)
|
26
|
+
@entry =entry
|
27
|
+
end
|
28
|
+
|
29
|
+
# override this method in subclasses to actually do build
|
30
|
+
def build(dst_path)
|
31
|
+
end
|
32
|
+
|
33
|
+
# main entry called by build tasls
|
34
|
+
def self.build(entry, dst_path)
|
35
|
+
new(entry).build(dst_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Reads the lines from the source file. If the source file does not
|
39
|
+
# exist, returns empty array.
|
40
|
+
def readlines(src_path)
|
41
|
+
if File.exist?(src_path) && !File.directory?(src_path)
|
42
|
+
File.readlines(src_path)
|
43
|
+
else
|
44
|
+
[]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# joins the array of lines. this is where you can also do any final
|
49
|
+
# post-processing on the build
|
50
|
+
def joinlines(lines)
|
51
|
+
lines * ""
|
52
|
+
end
|
53
|
+
|
54
|
+
# writes the passed lines to the named file
|
55
|
+
def writelines(dst_path, lines)
|
56
|
+
FileUtils.mkdir_p(File.dirname(dst_path))
|
57
|
+
f = File.open(dst_path, 'w')
|
58
|
+
f.write joinlines(lines)
|
59
|
+
f.close
|
60
|
+
end
|
61
|
+
|
62
|
+
# Handles occurances of sc_static() or static_url()
|
63
|
+
def replace_static_url(line)
|
64
|
+
line.gsub(/(sc_static|static_url)\(\s*['"](.+)['"]\s*\)/) do | rsrc |
|
65
|
+
static_entry = entry.manifest.find_entry($2)
|
66
|
+
static_url(static_entry.nil? ? '' : static_entry.cacheable_url)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Generates the proper output for a given static url and a given target
|
71
|
+
# this is often overridden by subclasses. the default just wraps in
|
72
|
+
# quotes.
|
73
|
+
def static_url(url='')
|
74
|
+
["'", url.gsub('"','\"'),"'"].join('')
|
75
|
+
end
|
76
|
+
end # class
|
77
|
+
|
78
|
+
end # module Builder
|
79
|
+
end # module SC
|
@@ -0,0 +1,37 @@
|
|
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 combines several javascript files into a single file. It is
|
14
|
+
# used to prepare a single javascript file for production use. This build
|
15
|
+
# tool expects the javascript files to have already been processed for any
|
16
|
+
# build directives such sc_static().
|
17
|
+
#
|
18
|
+
class Builder::Combine < Builder::Base
|
19
|
+
|
20
|
+
def build(dst_path)
|
21
|
+
lines = []
|
22
|
+
entries = entry.ordered_entries || entry.source_entries
|
23
|
+
|
24
|
+
entries.each do |entry|
|
25
|
+
src_path = entry.stage!.staging_path
|
26
|
+
next unless File.exist?(src_path)
|
27
|
+
|
28
|
+
lines << "/* >>>>>>>>>> BEGIN #{entry.filename} */\n"
|
29
|
+
lines += readlines(src_path)
|
30
|
+
lines << "\n"
|
31
|
+
end
|
32
|
+
writelines dst_path, lines
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,177 @@
|
|
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::Html < Builder::Base
|
15
|
+
|
16
|
+
include SC::Helpers::TagHelper
|
17
|
+
include SC::Helpers::TextHelper
|
18
|
+
include SC::Helpers::CaptureHelper
|
19
|
+
include SC::Helpers::StaticHelper
|
20
|
+
include SC::Helpers::DomIdHelper
|
21
|
+
include SC::ViewHelpers
|
22
|
+
|
23
|
+
# the entry we are building
|
24
|
+
attr_reader :entry
|
25
|
+
|
26
|
+
# bundle is an alias for target included for backwards compatibility
|
27
|
+
attr_reader :target, :bundle
|
28
|
+
|
29
|
+
# the full set of entries we plan to build
|
30
|
+
attr_reader :entries
|
31
|
+
|
32
|
+
# the final filename
|
33
|
+
attr_reader :filename
|
34
|
+
|
35
|
+
# the current builder language
|
36
|
+
attr_reader :language
|
37
|
+
|
38
|
+
# library is an alias for project for backwards compatibility
|
39
|
+
attr_reader :project, :library
|
40
|
+
|
41
|
+
# the current render
|
42
|
+
attr_reader :renderer
|
43
|
+
|
44
|
+
# manifest owning the current entry
|
45
|
+
attr_reader :manifest
|
46
|
+
|
47
|
+
def target_name; target.target_name.to_s.sub(/^\//,''); end
|
48
|
+
alias_method :bundle_name, :target_name # backwards compat
|
49
|
+
|
50
|
+
def config; target.config; end
|
51
|
+
|
52
|
+
# The entry for the layout we want to build. this will be used to
|
53
|
+
# stage the layout if needed..
|
54
|
+
def layout_entry
|
55
|
+
@manifest.entry_for(@layout) || @manifest.entry_for(@layout, :hidden => true)
|
56
|
+
end
|
57
|
+
|
58
|
+
# the path to the current layout for the resource. this is computed
|
59
|
+
# from the layout property, which is a relative pathname.
|
60
|
+
def layout_path
|
61
|
+
entry = layout_entry
|
62
|
+
entry.nil? ? nil : entry.staging_path
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(entry)
|
66
|
+
super(entry)
|
67
|
+
@target = @bundle = entry.manifest.target
|
68
|
+
@filename = entry.filename
|
69
|
+
@language = @entry.manifest.language
|
70
|
+
@project = @library = @target.project
|
71
|
+
@manifest = entry.manifest
|
72
|
+
@renderer = nil
|
73
|
+
|
74
|
+
# set the current layout from the target's config.layout
|
75
|
+
@layout = @target.config.layout || 'lib/index.rhtml'
|
76
|
+
|
77
|
+
# find all entries -- use source_Entries + required if needed
|
78
|
+
@entries = entry.source_entries.dup
|
79
|
+
if entry.include_required_targets?
|
80
|
+
@target.expand_required_targets.each do |target|
|
81
|
+
cur_manifest = target.manifest_for(@manifest.variation).build!
|
82
|
+
cur_entry = cur_manifest.entry_for(entry.filename, :combined => true) || cur_manifest.entry_for(entry.filename, :hidden => true, :combined => true)
|
83
|
+
next if cur_entry.nil?
|
84
|
+
@entries += cur_entry.source_entries
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Returns the expanded list of required targets for the passed target.
|
90
|
+
# This method can be overridden by subclasses to provide specific
|
91
|
+
# config settings.
|
92
|
+
def expand_required_targets(target, opts = {})
|
93
|
+
opts[:debug] = target.config.load_debug
|
94
|
+
opts[:theme] = true
|
95
|
+
return target.expand_required_targets(opts)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Renders the html file, returning the resulting string which can be
|
99
|
+
# written to a file.
|
100
|
+
def render
|
101
|
+
# render each entry...
|
102
|
+
@entries.each { |entry| render_entry(entry) }
|
103
|
+
|
104
|
+
# then finally compile the layout.
|
105
|
+
if self.layout_path.nil?
|
106
|
+
raise "html_builder could not find a layout file for #{@layout}"
|
107
|
+
end
|
108
|
+
|
109
|
+
compile(SC::RenderEngine::Erubis.new(self), self.layout_path, :_final_)
|
110
|
+
return @content_for__final_
|
111
|
+
end
|
112
|
+
|
113
|
+
def build(dst_path)
|
114
|
+
writelines dst_path, [self.render]
|
115
|
+
end
|
116
|
+
|
117
|
+
def default_content_for_key; :resources; end
|
118
|
+
|
119
|
+
# Loads the passed input file and then hands it to the render_engine
|
120
|
+
# instance to compile th file. the results will be targeted at the
|
121
|
+
# @content_for_resources area by default unless you pass an optional
|
122
|
+
# content_for_key or otherwise override in your template.
|
123
|
+
#
|
124
|
+
# === Params
|
125
|
+
# render_engine:: A render engine instance
|
126
|
+
# input_path:: The file to load
|
127
|
+
# content_for_key:: optional target for content
|
128
|
+
#
|
129
|
+
# === Returns
|
130
|
+
# self
|
131
|
+
#
|
132
|
+
def compile(render_engine, input_path, content_for_key = nil)
|
133
|
+
content_for_key = self.default_content_for_key if content_for_key.nil?
|
134
|
+
|
135
|
+
if !File.exist?(input_path)
|
136
|
+
raise "html_builder could compile file at #{input_path} because the file could not be found"
|
137
|
+
end
|
138
|
+
|
139
|
+
old_renderer = @renderer
|
140
|
+
@renderer = render_engine # save for capture...
|
141
|
+
|
142
|
+
input = File.read(input_path)
|
143
|
+
content_for content_for_key do
|
144
|
+
_render_compiled_template( render_engine.compile(input) )
|
145
|
+
end
|
146
|
+
|
147
|
+
@render = old_renderer
|
148
|
+
return self
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
# Renders a single entry. The entry will be staged and then its
|
154
|
+
# render task will be executed.
|
155
|
+
def render_entry(entry)
|
156
|
+
entry.stage!
|
157
|
+
entry.target.buildfile.invoke entry.render_task,
|
158
|
+
:entry => entry,
|
159
|
+
:src_path => entry.staging_path,
|
160
|
+
:context => self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Renders a compiled template within this context
|
164
|
+
def _render_compiled_template(compiled_template)
|
165
|
+
self.instance_eval "def __render(); #{compiled_template}; end"
|
166
|
+
begin
|
167
|
+
self.send(:__render) do |*names|
|
168
|
+
self.instance_variable_get("@content_for_#{names.first}")
|
169
|
+
end
|
170
|
+
ensure
|
171
|
+
class << self; self end.class_eval{ remove_method(:__render) } rescue nil
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 build is used to process a single javascript file. It will
|
14
|
+
# substitute any calls to sc_super and sc_static() (or static_url()). It
|
15
|
+
# does NOT product a combined JavaScript for production. See the
|
16
|
+
# Builder::CombinedJavaScript for more.
|
17
|
+
class Builder::JavaScript < Builder::Base
|
18
|
+
|
19
|
+
def build(dst_path)
|
20
|
+
lines = readlines(entry.source_path).map { |l| rewrite_inline_code(l) }
|
21
|
+
writelines dst_path, lines
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns true if the current entry is a localized strings file. These
|
25
|
+
# files receive some specialized processing to allow for server-side only
|
26
|
+
# strings. -- You can name a string key beginning with "@@" and it will
|
27
|
+
# be removed.
|
28
|
+
def localized_strings?
|
29
|
+
@lstrings ||= entry.localized? && entry.filename =~ /strings.js$/
|
30
|
+
end
|
31
|
+
|
32
|
+
# Rewrites inline content for a single line
|
33
|
+
def rewrite_inline_code(line)
|
34
|
+
|
35
|
+
# Fors strings file, remove server-side keys (i.e '@@foo' = 'bar')
|
36
|
+
if localized_strings?
|
37
|
+
line = line.gsub(/["']@@.*["']\s*?:\s*?["'].*["']\s*,\s*$/,'')
|
38
|
+
|
39
|
+
# Otherwise process sc_super
|
40
|
+
else
|
41
|
+
if line.match(/sc_super\(\s*\)/)
|
42
|
+
line = line.gsub(/sc_super\(\s*\)/, 'arguments.callee.base.apply(this,arguments)')
|
43
|
+
elsif line.match(/sc_super\(.+?\)/)
|
44
|
+
SC.logger.warn "\nWARNING: Calling sc_super() with arguments is DEPRECATED. Please use sc_super() only.\n\n"
|
45
|
+
line = line.gsub(/sc_super\((.+?)\)/, 'arguments.callee.base.apply(this, \1)')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# and finally rewrite static_url
|
50
|
+
return replace_static_url(line)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,67 @@
|
|
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 combines several javascript files into a single file. It is
|
14
|
+
# used to prepare a single javascript file for production use. This build
|
15
|
+
# tool expects the javascript files to have already been processed for any
|
16
|
+
# build directives such sc_static().
|
17
|
+
#
|
18
|
+
class Builder::Minify < Builder::Base
|
19
|
+
|
20
|
+
# main entry called by build tasls
|
21
|
+
def self.build(entry, dst_path, kind)
|
22
|
+
new(entry, kind).build(dst_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(entry=nil, kind=nil)
|
26
|
+
super(entry)
|
27
|
+
@kind = kind
|
28
|
+
end
|
29
|
+
|
30
|
+
# override this method in subclasses to actually do build
|
31
|
+
def build(dst_path)
|
32
|
+
send("build_#{@kind}".to_sym, dst_path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_css(dst_path)
|
36
|
+
yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))
|
37
|
+
jar_path = File.join(yui_root, 'yuicompressor-2.4.2.jar')
|
38
|
+
FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...
|
39
|
+
filecompress = "java -jar " + jar_path + " --charset utf-8 " + entry.source_path + " -o " + dst_path
|
40
|
+
SC.logger.info 'Compressing CSS with YUI .... '+ dst_path
|
41
|
+
SC.logger.debug `#{filecompress}`
|
42
|
+
|
43
|
+
if $?.exitstatus != 0
|
44
|
+
SC.logger.fatal("!!!!YUI compressor failed, please check that your css code is valid.")
|
45
|
+
SC.logger.fatal("!!!!Failed compressing CSS... "+ dst_path)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Minify some javascript by invoking the YUI compressor.
|
50
|
+
def build_javascript(dst_path)
|
51
|
+
yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))
|
52
|
+
jar_path = File.join(yui_root, 'yuicompressor-2.4.2.jar')
|
53
|
+
FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...
|
54
|
+
filecompress = "java -jar " + jar_path + " --charset utf-8 " + entry.source_path + " -o " + dst_path
|
55
|
+
SC.logger.info 'Compressing with YUI .... '+ dst_path
|
56
|
+
SC.logger.debug `#{filecompress}`
|
57
|
+
|
58
|
+
if $?.exitstatus != 0
|
59
|
+
SC.logger.fatal("!!!!YUI compressor failed, please check that your js code is valid and doesn't contain reserved statements like debugger;")
|
60
|
+
SC.logger.fatal("!!!!Failed compressing ... "+ dst_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 build can compile a Sass stylesheet. At this point it does no
|
14
|
+
# further processing than simply executing the Sass. It would be nice to
|
15
|
+
# add support for sc_static and other directives at some point.
|
16
|
+
#
|
17
|
+
class Builder::Sass < Builder::Base
|
18
|
+
|
19
|
+
def build(dst_path)
|
20
|
+
begin
|
21
|
+
require 'sass'
|
22
|
+
rescue
|
23
|
+
raise "Cannot compile #{entry.source_path} because sass is not installed. Please try 'sudo gem install haml' and try again"
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
content = readlines(entry.source_path)*''
|
28
|
+
content = ::Sass::Engine.new(content).render
|
29
|
+
writelines dst_path, [content]
|
30
|
+
rescue Exception => e
|
31
|
+
|
32
|
+
# explain sass syntax error a bit more...
|
33
|
+
if e.is_a? Sass::SyntaxError
|
34
|
+
e_string = "#{e.class}: #{e.message}"
|
35
|
+
e_string << "\non line #{e.sass_line}"
|
36
|
+
e_string << " of #{@entry.source_path}"
|
37
|
+
if File.exists?(@entry.source_path)
|
38
|
+
e_string << "\n\n"
|
39
|
+
min = [e.sass_line - 5, 0].max
|
40
|
+
File.read(@entry.source_path).rstrip.split("\n")[
|
41
|
+
min .. e.sass_line + 5
|
42
|
+
].each_with_index do |line, i|
|
43
|
+
e_string << "#{min + i + 1}: #{line}\n"
|
44
|
+
end # File.read
|
45
|
+
end # if File.exists?
|
46
|
+
raise e_string
|
47
|
+
else
|
48
|
+
raise e # reraise
|
49
|
+
end
|
50
|
+
end # rescue
|
51
|
+
end # def
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|