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.
Files changed (382) hide show
  1. data/Buildfile +115 -0
  2. data/History.txt +7 -0
  3. data/README.txt +102 -0
  4. data/Rakefile +54 -0
  5. data/Todo.txt +1 -0
  6. data/bin/sc-build +13 -0
  7. data/bin/sc-build-number +13 -0
  8. data/bin/sc-gen +13 -0
  9. data/bin/sc-init +13 -0
  10. data/bin/sc-manifest +13 -0
  11. data/bin/sc-server +13 -0
  12. data/bin/sproutcore +14 -0
  13. data/buildtasks/build.rake +73 -0
  14. data/buildtasks/entry.rake +59 -0
  15. data/buildtasks/manifest.rake +469 -0
  16. data/buildtasks/render.rake +21 -0
  17. data/buildtasks/target.rake +42 -0
  18. data/gen/Buildfile +16 -0
  19. data/gen/app/Buildfile +36 -0
  20. data/gen/app/README +1 -0
  21. data/gen/app/USAGE +13 -0
  22. data/gen/app/templates/apps/{target_name}/core.js +27 -0
  23. data/gen/app/templates/apps/{target_name}/english.lproj/loading.rhtml +9 -0
  24. data/gen/app/templates/apps/{target_name}/english.lproj/main_page.js +22 -0
  25. data/gen/app/templates/apps/{target_name}/english.lproj/strings.js +15 -0
  26. data/gen/app/templates/apps/{target_name}/main.js +30 -0
  27. data/gen/controller/Buildfile +18 -0
  28. data/gen/controller/README +1 -0
  29. data/gen/controller/USAGE +13 -0
  30. data/gen/controller/templates/controllers/{filename}.js +18 -0
  31. data/gen/controller/templates/tests/controllers/{filename}.js +15 -0
  32. data/gen/framework/Buildfile +36 -0
  33. data/gen/framework/README +1 -0
  34. data/gen/framework/USAGE +13 -0
  35. data/gen/framework/templates/frameworks/{target_name}/core.js +21 -0
  36. data/gen/framework/templates/frameworks/{target_name}/english.lproj/strings.js +15 -0
  37. data/gen/language/Buildfile +26 -0
  38. data/gen/language/README +1 -0
  39. data/gen/language/USAGE +13 -0
  40. data/gen/language/templates/{filename}/strings.js +14 -0
  41. data/gen/model/Buildfile +16 -0
  42. data/gen/model/README +1 -0
  43. data/gen/model/USAGE +15 -0
  44. data/gen/model/templates/fixtures/{filename}.js +35 -0
  45. data/gen/model/templates/models/{filename}.js +19 -0
  46. data/gen/model/templates/tests/models/{filename}.js +15 -0
  47. data/gen/project/Buildfile +45 -0
  48. data/gen/project/INIT +3 -0
  49. data/gen/project/README +1 -0
  50. data/gen/project/USAGE +2 -0
  51. data/gen/project/templates/{filename}/Buildfile +7 -0
  52. data/gen/project/templates/{filename}/README +7 -0
  53. data/gen/test/Buildfile +25 -0
  54. data/gen/test/README +1 -0
  55. data/gen/test/USAGE +12 -0
  56. data/gen/test/templates/tests/{filename}.js +15 -0
  57. data/gen/theme/Buildfile +36 -0
  58. data/gen/theme/README +1 -0
  59. data/gen/theme/USAGE +13 -0
  60. data/gen/theme/templates/themes/{target_name}/english.lproj/strings.js +15 -0
  61. data/gen/view/Buildfile +18 -0
  62. data/gen/view/README +1 -0
  63. data/gen/view/USAGE +13 -0
  64. data/gen/view/templates/tests/views/{filename}.js +15 -0
  65. data/gen/view/templates/views/{filename}.js +18 -0
  66. data/lib/sproutcore.rb +130 -0
  67. data/lib/sproutcore/builders/base.rb +79 -0
  68. data/lib/sproutcore/builders/combine.rb +37 -0
  69. data/lib/sproutcore/builders/html.rb +177 -0
  70. data/lib/sproutcore/builders/javascript.rb +55 -0
  71. data/lib/sproutcore/builders/minify.rb +67 -0
  72. data/lib/sproutcore/builders/sass.rb +55 -0
  73. data/lib/sproutcore/builders/strings.rb +44 -0
  74. data/lib/sproutcore/builders/stylesheet.rb +40 -0
  75. data/lib/sproutcore/builders/test.rb +58 -0
  76. data/lib/sproutcore/builders/test_index.rb +26 -0
  77. data/lib/sproutcore/buildfile.rb +483 -0
  78. data/lib/sproutcore/buildfile/build_task.rb +33 -0
  79. data/lib/sproutcore/buildfile/buildfile_dsl.rb +162 -0
  80. data/lib/sproutcore/buildfile/cloneable.rb +34 -0
  81. data/lib/sproutcore/buildfile/early_time.rb +29 -0
  82. data/lib/sproutcore/buildfile/invocation_chain.rb +64 -0
  83. data/lib/sproutcore/buildfile/namespace.rb +33 -0
  84. data/lib/sproutcore/buildfile/string_ext.rb +198 -0
  85. data/lib/sproutcore/buildfile/task.rb +304 -0
  86. data/lib/sproutcore/buildfile/task_arguments.rb +86 -0
  87. data/lib/sproutcore/buildfile/task_manager.rb +193 -0
  88. data/lib/sproutcore/deprecated/view_helper.rb +662 -0
  89. data/lib/sproutcore/helpers/capture_helper.rb +30 -0
  90. data/lib/sproutcore/helpers/cssmin.rb +202 -0
  91. data/lib/sproutcore/helpers/dom_id_helper.rb +21 -0
  92. data/lib/sproutcore/helpers/entry_sorter.rb +105 -0
  93. data/lib/sproutcore/helpers/packed_optimizer.rb +102 -0
  94. data/lib/sproutcore/helpers/static_helper.rb +268 -0
  95. data/lib/sproutcore/helpers/tag_helper.rb +117 -0
  96. data/lib/sproutcore/helpers/text_helper.rb +303 -0
  97. data/lib/sproutcore/models/generator.rb +493 -0
  98. data/lib/sproutcore/models/hash_struct.rb +109 -0
  99. data/lib/sproutcore/models/manifest.rb +342 -0
  100. data/lib/sproutcore/models/manifest_entry.rb +232 -0
  101. data/lib/sproutcore/models/project.rb +270 -0
  102. data/lib/sproutcore/models/target.rb +403 -0
  103. data/lib/sproutcore/rack/builder.rb +269 -0
  104. data/lib/sproutcore/rack/dev.rb +51 -0
  105. data/lib/sproutcore/rack/docs.rb +24 -0
  106. data/lib/sproutcore/rack/proxy.rb +92 -0
  107. data/lib/sproutcore/rack/service.rb +141 -0
  108. data/lib/sproutcore/rack/test_runner.rb +24 -0
  109. data/lib/sproutcore/render_engines/erubis.rb +55 -0
  110. data/lib/sproutcore/render_engines/haml.rb +39 -0
  111. data/lib/sproutcore/tools.rb +311 -0
  112. data/lib/sproutcore/tools/build.rb +80 -0
  113. data/lib/sproutcore/tools/build_number.rb +23 -0
  114. data/lib/sproutcore/tools/gen.rb +99 -0
  115. data/lib/sproutcore/tools/init.rb +40 -0
  116. data/lib/sproutcore/tools/manifest.rb +84 -0
  117. data/lib/sproutcore/tools/server.rb +45 -0
  118. data/spec/buildtasks/build/copy_spec.rb +60 -0
  119. data/spec/buildtasks/build/spec_helper.rb +36 -0
  120. data/spec/buildtasks/manifest/catalog_spec.rb +48 -0
  121. data/spec/buildtasks/manifest/hide_buildfiles_spec.rb +125 -0
  122. data/spec/buildtasks/manifest/localize_spec.rb +97 -0
  123. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +246 -0
  124. data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +87 -0
  125. data/spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb +175 -0
  126. data/spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb +65 -0
  127. data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +70 -0
  128. data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +152 -0
  129. data/spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb +98 -0
  130. data/spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb +64 -0
  131. data/spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb +163 -0
  132. data/spec/buildtasks/manifest/prepare_spec.rb +43 -0
  133. data/spec/buildtasks/manifest/spec_helper.rb +35 -0
  134. data/spec/buildtasks/target_spec.rb +214 -0
  135. data/spec/fixtures/builder_tests/Buildfile +15 -0
  136. data/spec/fixtures/builder_tests/apps/combine_test/a.js +1 -0
  137. data/spec/fixtures/builder_tests/apps/combine_test/b.js +1 -0
  138. data/spec/fixtures/builder_tests/apps/combine_test/c.js +1 -0
  139. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/a.css +1 -0
  140. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/b.css +1 -0
  141. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/c.css +1 -0
  142. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/bar1_sample.rhtml +2 -0
  143. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/erb_sample.html.erb +1 -0
  144. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/icons/image.png +0 -0
  145. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/image.jpg +0 -0
  146. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/rhtml_sample.rhtml +1 -0
  147. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/strings.js +4 -0
  148. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/style.css +0 -0
  149. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/french-icons/fr.png +0 -0
  150. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/strings.js +4 -0
  151. data/spec/fixtures/builder_tests/apps/html_test/lib/layout_template.rhtml +1 -0
  152. data/spec/fixtures/builder_tests/apps/html_test/scripts.js +0 -0
  153. data/spec/fixtures/builder_tests/apps/javascript_test/sc_static.js +15 -0
  154. data/spec/fixtures/builder_tests/apps/javascript_test/sc_super.js +4 -0
  155. data/spec/fixtures/builder_tests/apps/javascript_test/strings.js +7 -0
  156. data/spec/fixtures/builder_tests/apps/sass_test/sample.sass +3 -0
  157. data/spec/fixtures/builder_tests/apps/strings_test/lproj/strings.js +8 -0
  158. data/spec/fixtures/builder_tests/apps/stylesheet_test/build_directives.css +9 -0
  159. data/spec/fixtures/builder_tests/apps/stylesheet_test/sc_static.css +12 -0
  160. data/spec/fixtures/builder_tests/apps/test_test/lib/alt_layout.rhtml +1 -0
  161. data/spec/fixtures/builder_tests/apps/test_test/lib/test_layout.rhtml +3 -0
  162. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test.js +1 -0
  163. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test2.js +1 -0
  164. data/spec/fixtures/builder_tests/apps/test_test/tests/rhtml_test.rhtml +4 -0
  165. data/spec/fixtures/builder_tests/frameworks/debug/core.js +0 -0
  166. data/spec/fixtures/builder_tests/frameworks/debug/english.lproj/dummy.css +0 -0
  167. data/spec/fixtures/builder_tests/frameworks/qunit/core.js +0 -0
  168. data/spec/fixtures/builder_tests/frameworks/qunit/english.lproj/dummy.css +0 -0
  169. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/req_style_1.css +0 -0
  170. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/strings.js +4 -0
  171. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/test.rhtml +1 -0
  172. data/spec/fixtures/builder_tests/frameworks/req_target_1/req_js_1.js +0 -0
  173. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/req_style_2.css +0 -0
  174. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/test.rhtml +1 -0
  175. data/spec/fixtures/builder_tests/frameworks/req_target_2/javascript.js +1 -0
  176. data/spec/fixtures/builder_tests/frameworks/req_target_2/lib/alt_layout.rhtml +0 -0
  177. data/spec/fixtures/builder_tests/frameworks/req_target_2/req_js_2.js +0 -0
  178. data/spec/fixtures/builder_tests/themes/sample_theme/Buildfile +1 -0
  179. data/spec/fixtures/buildfiles/basic/Buildfile +16 -0
  180. data/spec/fixtures/buildfiles/basic/task_module.rake +6 -0
  181. data/spec/fixtures/buildfiles/installed/Buildfile +7 -0
  182. data/spec/fixtures/buildfiles/installed/Buildfile2 +5 -0
  183. data/spec/fixtures/buildfiles/project_test/Buildfile +4 -0
  184. data/spec/fixtures/buildfiles/project_test/not_project/Buildfile +2 -0
  185. data/spec/fixtures/buildfiles/project_test/not_project/child/PLACEHOLDER +0 -0
  186. data/spec/fixtures/entry_for_project/Buildfile +1 -0
  187. data/spec/fixtures/entry_for_project/apps/test_app/entry.txt +0 -0
  188. data/spec/fixtures/entry_for_project/apps/test_app/frameworks/nested/PLACEHOLDER +0 -0
  189. data/spec/fixtures/entry_for_project/frameworks/shared/PLACEHOLDER +0 -0
  190. data/spec/fixtures/find_targets/custom/Buildfile +8 -0
  191. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar1/PLACEHOLDER +0 -0
  192. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar2/PLACEHOLDER +0 -0
  193. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo1/PLACEHOLDER +0 -0
  194. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo2/PLACEHOLDER +0 -0
  195. data/spec/fixtures/find_targets/custom/foos/custom_foos/Buildfile +5 -0
  196. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo1/PLACEHOLDER +0 -0
  197. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo2/PLACEHOLDER +0 -0
  198. data/spec/fixtures/find_targets/custom/foos/custom_foos/foos/not_foo1/PLACEHOLDER +0 -0
  199. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar1/PLACEHOLDER +0 -0
  200. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar2/PLACEHOLDER +0 -0
  201. data/spec/fixtures/find_targets/nested/Buildfile +8 -0
  202. data/spec/fixtures/find_targets/nested/apps/app1/Buildfile +1 -0
  203. data/spec/fixtures/find_targets/nested/apps/app1/apps/nested_app/PLACEHOLDER +0 -0
  204. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework1/PLACEHOLDER +0 -0
  205. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework2/PLACEHOLDER +0 -0
  206. data/spec/fixtures/find_targets/standard/clients/client1/PLACEHOLDER +0 -0
  207. data/spec/fixtures/find_targets/standard/frameworks/framework1/frameworks/framework1/PLACEHOLDER +0 -0
  208. data/spec/fixtures/find_targets/standard/frameworks/framework2/PLACEHOLDER +0 -0
  209. data/spec/fixtures/find_targets/standard/themes/theme1/PLACEHOLDER +0 -0
  210. data/spec/fixtures/find_targets/standard/themes/theme2/PLACEHOLDER +0 -0
  211. data/spec/fixtures/languages/apps/caps_long_names/English.lproj/PLACEHOLDER +0 -0
  212. data/spec/fixtures/languages/apps/caps_long_names/FreNCH.lproj/PLACEHOLDER +0 -0
  213. data/spec/fixtures/languages/apps/caps_long_names/UnknOWN.lproj/PLACEHOLDER +0 -0
  214. data/spec/fixtures/languages/apps/long_names/english.lproj/PLACEHOLDER +0 -0
  215. data/spec/fixtures/languages/apps/long_names/french.lproj/PLACEHOLDER +0 -0
  216. data/spec/fixtures/languages/apps/long_names/german.lproj/PLACEHOLDER +0 -0
  217. data/spec/fixtures/languages/apps/long_names/italian.lproj/PLACEHOLDER +0 -0
  218. data/spec/fixtures/languages/apps/long_names/japanese.lproj/PLACEHOLDER +0 -0
  219. data/spec/fixtures/languages/apps/long_names/spanish.lproj/PLACEHOLDER +0 -0
  220. data/spec/fixtures/languages/apps/long_names/unknown.lproj/PLACEHOLDER +0 -0
  221. data/spec/fixtures/languages/apps/no_names/PLACEHOLDER +0 -0
  222. data/spec/fixtures/languages/apps/short_names/de.lproj/PLACEHOLDER +0 -0
  223. data/spec/fixtures/languages/apps/short_names/en-CA.lproj/PLACEHOLDER +0 -0
  224. data/spec/fixtures/languages/apps/short_names/en-GB.lproj/PLACEHOLDER +0 -0
  225. data/spec/fixtures/languages/apps/short_names/en-US.lproj/PLACEHOLDER +0 -0
  226. data/spec/fixtures/languages/apps/short_names/en.lproj/PLACEHOLDER +0 -0
  227. data/spec/fixtures/languages/apps/short_names/es.lproj/PLACEHOLDER +0 -0
  228. data/spec/fixtures/languages/apps/short_names/foo.lproj/PLACEHOLDER +0 -0
  229. data/spec/fixtures/languages/apps/short_names/fr.lproj/PLACEHOLDER +0 -0
  230. data/spec/fixtures/languages/apps/short_names/it.lproj/PLACEHOLDER +0 -0
  231. data/spec/fixtures/languages/apps/short_names/ja.lproj/PLACEHOLDER +0 -0
  232. data/spec/fixtures/ordered_entries/apps/no_requires/1.js +1 -0
  233. data/spec/fixtures/ordered_entries/apps/no_requires/B.js +1 -0
  234. data/spec/fixtures/ordered_entries/apps/no_requires/a.js +1 -0
  235. data/spec/fixtures/ordered_entries/apps/no_requires/a/a.js +1 -0
  236. data/spec/fixtures/ordered_entries/apps/no_requires/a/b.js +1 -0
  237. data/spec/fixtures/ordered_entries/apps/no_requires/b/a.js +1 -0
  238. data/spec/fixtures/ordered_entries/apps/no_requires/c.js +1 -0
  239. data/spec/fixtures/ordered_entries/apps/no_requires/core.js +1 -0
  240. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/B.css +0 -0
  241. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a.css +0 -0
  242. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/a.css +0 -0
  243. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/b.css +0 -0
  244. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/b/a.css +0 -0
  245. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/c.css +0 -0
  246. data/spec/fixtures/ordered_entries/apps/no_requires/lproj/strings.js +1 -0
  247. data/spec/fixtures/ordered_entries/apps/no_requires/utils.js +1 -0
  248. data/spec/fixtures/ordered_entries/apps/with_requires/a.js +2 -0
  249. data/spec/fixtures/ordered_entries/apps/with_requires/b.js +3 -0
  250. data/spec/fixtures/ordered_entries/apps/with_requires/c.js +2 -0
  251. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/a.css +2 -0
  252. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/b.css +2 -0
  253. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/c.css +2 -0
  254. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/d.js +1 -0
  255. data/spec/fixtures/real_world/Buildfile +12 -0
  256. data/spec/fixtures/real_world/apps/account/README +1 -0
  257. data/spec/fixtures/real_world/apps/calendar/README +1 -0
  258. data/spec/fixtures/real_world/apps/contacts/README_BEFORE_EDITING +1 -0
  259. data/spec/fixtures/real_world/apps/files/README +1 -0
  260. data/spec/fixtures/real_world/apps/mail/README +1 -0
  261. data/spec/fixtures/real_world/apps/mobile_photos/README +1 -0
  262. data/spec/fixtures/real_world/apps/photos/README +1 -0
  263. data/spec/fixtures/real_world/apps/uploader/README +1 -0
  264. data/spec/fixtures/real_world/frameworks/core_files/PLACEHOLDER +0 -0
  265. data/spec/fixtures/real_world/frameworks/core_photos/PLACEHOLDER +0 -0
  266. data/spec/fixtures/real_world/frameworks/shared/PLACEHOLDER +0 -0
  267. data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +26 -0
  268. data/spec/fixtures/real_world/frameworks/sproutcore/README +1 -0
  269. data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
  270. data/spec/fixtures/real_world/frameworks/sproutcore/apps/test_runner/PLACEHOLDER +0 -0
  271. data/spec/fixtures/real_world/frameworks/sproutcore/core.js +0 -0
  272. data/spec/fixtures/real_world/frameworks/sproutcore/debug/debug-resource.html +0 -0
  273. data/spec/fixtures/real_world/frameworks/sproutcore/debug/sample_debug.js +0 -0
  274. data/spec/fixtures/real_world/frameworks/sproutcore/demo2.js +0 -0
  275. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/debug/sample_debug-loc.js +0 -0
  276. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.css +4 -0
  277. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.html +1 -0
  278. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo2.sass +0 -0
  279. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.haml +0 -0
  280. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb +1 -0
  281. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.rhtml +0 -0
  282. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js +0 -0
  283. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/has_require.css +4 -0
  284. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_require.css +1 -0
  285. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_sc_resource.rhtml +1 -0
  286. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/protocols/sample-loc.js +0 -0
  287. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.css +6 -0
  288. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.rhtml +3 -0
  289. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/strings.js +1 -0
  290. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/tests/sample-loc.js +0 -0
  291. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample-json-fixture.json +1 -0
  292. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample_fixtures.js +0 -0
  293. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/application/PLACEHOLDER +0 -0
  294. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/costello/core.js +0 -0
  295. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/data_store/PLACEHOLDER +0 -0
  296. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/debug/PLACEHOLDER +0 -0
  297. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/desktop/PLACEHOLDER +0 -0
  298. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/empty_theme/PLACEHOLDER +0 -0
  299. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/foundation/PLACEHOLDER +0 -0
  300. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/mobile/PLACEHOLDER +0 -0
  301. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/qunit/PLACEHOLDER +0 -0
  302. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/uploader/PLACEHOLDER +0 -0
  303. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/french-resource.js +0 -0
  304. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/strings.js +1 -0
  305. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/german-resource.js +0 -0
  306. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/strings.js +0 -0
  307. data/spec/fixtures/real_world/frameworks/sproutcore/has_require.js +4 -0
  308. data/spec/fixtures/real_world/frameworks/sproutcore/lib/index.html +1 -0
  309. data/spec/fixtures/real_world/frameworks/sproutcore/no_require.js +1 -0
  310. data/spec/fixtures/real_world/frameworks/sproutcore/protocols/sample.js +0 -0
  311. data/spec/fixtures/real_world/frameworks/sproutcore/sc_resource.js +6 -0
  312. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample1.js +0 -0
  313. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample2.js +0 -0
  314. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.js +0 -0
  315. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.rhtml +1 -0
  316. data/spec/fixtures/real_world/frameworks/sproutcore/themes/standard_theme/README +0 -0
  317. data/spec/fixtures/real_world/frameworks/sproutcore/views/view.js +1 -0
  318. data/spec/fixtures/real_world/generators/sample_custom/Buildfile +0 -0
  319. data/spec/fixtures/real_world/generators/sample_custom/templates/{filename}.js +1 -0
  320. data/spec/fixtures/recursive_project/Buildfile +8 -0
  321. data/spec/fixtures/recursive_project/frameworks/sproutcore/frameworks/costello/PLACEHOLDER +0 -0
  322. data/spec/lib/builders/combine_spec.rb +67 -0
  323. data/spec/lib/builders/html_spec.rb +577 -0
  324. data/spec/lib/builders/javascript_spec.rb +81 -0
  325. data/spec/lib/builders/sass_spec.rb +43 -0
  326. data/spec/lib/builders/spec_helper.rb +30 -0
  327. data/spec/lib/builders/strings_spec.rb +52 -0
  328. data/spec/lib/builders/stylesheet_spec.rb +63 -0
  329. data/spec/lib/builders/test_index_spec.rb +44 -0
  330. data/spec/lib/builders/test_spec.rb +135 -0
  331. data/spec/lib/buildfile/config_for_spec.rb +81 -0
  332. data/spec/lib/buildfile/define_spec.rb +59 -0
  333. data/spec/lib/buildfile/dup_spec.rb +65 -0
  334. data/spec/lib/buildfile/invoke_spec.rb +130 -0
  335. data/spec/lib/buildfile/load_spec.rb +49 -0
  336. data/spec/lib/buildfile/task/dup_spec.rb +55 -0
  337. data/spec/lib/buildfile/task_defined_spec.rb +17 -0
  338. data/spec/lib/buildfile_commands/build_task_spec.rb +19 -0
  339. data/spec/lib/buildfile_commands/config_spec.rb +97 -0
  340. data/spec/lib/buildfile_commands/import_spec.rb +17 -0
  341. data/spec/lib/buildfile_commands/namespace_spec.rb +18 -0
  342. data/spec/lib/buildfile_commands/proxies_spec.rb +38 -0
  343. data/spec/lib/buildfile_commands/replace_task_spec.rb +29 -0
  344. data/spec/lib/buildfile_commands/task_spec.rb +36 -0
  345. data/spec/lib/helpers/packing_optimizer/optimize_spec.rb +26 -0
  346. data/spec/lib/models/hash_struct/deep_clone_spec.rb +27 -0
  347. data/spec/lib/models/hash_struct/has_options_spec.rb +32 -0
  348. data/spec/lib/models/hash_struct/hash_spec.rb +64 -0
  349. data/spec/lib/models/hash_struct/merge_spec.rb +26 -0
  350. data/spec/lib/models/hash_struct/method_missing.rb +41 -0
  351. data/spec/lib/models/manifest/add_entry_spec.rb +36 -0
  352. data/spec/lib/models/manifest/add_transform_spec.rb +90 -0
  353. data/spec/lib/models/manifest/build_spec.rb +78 -0
  354. data/spec/lib/models/manifest/entry_for_spec.rb +94 -0
  355. data/spec/lib/models/manifest/find_entry.rb +84 -0
  356. data/spec/lib/models/manifest/prepare_spec.rb +62 -0
  357. data/spec/lib/models/manifest_entry/cacheable_url_spec.rb +31 -0
  358. data/spec/lib/models/manifest_entry/prepare_spec.rb +54 -0
  359. data/spec/lib/models/project/add_target_spec.rb +44 -0
  360. data/spec/lib/models/project/buildfile_spec.rb +35 -0
  361. data/spec/lib/models/project/find_targets_for_spec.rb +77 -0
  362. data/spec/lib/models/project/load_nearest_project_spec.rb +23 -0
  363. data/spec/lib/models/project/target_for_spec.rb +33 -0
  364. data/spec/lib/models/project/targets_spec.rb +62 -0
  365. data/spec/lib/models/target/compute_build_number_spec.rb +125 -0
  366. data/spec/lib/models/target/config_spec.rb +30 -0
  367. data/spec/lib/models/target/expand_required_targets_spec.rb +48 -0
  368. data/spec/lib/models/target/installed_languages_spec.rb +47 -0
  369. data/spec/lib/models/target/lproj_for_spec.rb +38 -0
  370. data/spec/lib/models/target/manifest_for_spec.rb +42 -0
  371. data/spec/lib/models/target/parent_target_spec.rb +21 -0
  372. data/spec/lib/models/target/prepare_spec.rb +53 -0
  373. data/spec/lib/models/target/required_targets_spec.rb +119 -0
  374. data/spec/lib/models/target/target_for_spec.rb +56 -0
  375. data/spec/lib/tools/build_number_spec.rb +28 -0
  376. data/spec/lib/tools/gen_spec.rb +207 -0
  377. data/spec/lib/tools/tools_spec.rb +78 -0
  378. data/spec/spec_helper.rb +138 -0
  379. data/sproutcore.gemspec +47 -0
  380. data/vendor/github_gem_lint.rb +22 -0
  381. data/vendor/yui-compressor/yuicompressor-2.4.2.jar +0 -0
  382. metadata +1084 -0
@@ -0,0 +1,232 @@
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 'ostruct'
9
+
10
+ module SC
11
+
12
+ # A manifest entry describes a single item that can be built by the build
13
+ # system. A manifest entry can be assigned any properties you like during
14
+ # the manifest build process.
15
+ #
16
+ # A ManifestEntry must have at least the following properties to build:
17
+ #
18
+ # bundle:: owner bundle
19
+ # build_rule:: name of the task to invoke to build this entry
20
+ # build_path:: absolute path to place built files
21
+ # staging_path:: absolute path to place staging files
22
+ # source_path:: absolute path to source file
23
+ # source_paths:: arrays of source paths to use for build. alt to single
24
+ # is_hidden:: if true, entry is not included in build
25
+ #
26
+ class ManifestEntry < HashStruct
27
+
28
+ def initialize(manifest, opts={})
29
+ @manifest = manifest # store manifest has ivar
30
+ super(opts)
31
+ end
32
+
33
+ # invoked whenever the manifest entry is first created. This will invoke
34
+ # the entry:prepare task if defined.
35
+ def prepare!
36
+ if !@is_prepared
37
+ @is_prepared = true
38
+ buildfile = manifest.target.buildfile
39
+ if buildfile.task_defined? 'entry:prepare'
40
+ buildfile.invoke 'entry:prepare',
41
+ :entry => self,
42
+ :manifest => self.manifest,
43
+ :target => self.manifest.target,
44
+ :config => self.manifest.target.config,
45
+ :project => self.manifest.target.project
46
+ end
47
+ end
48
+ return self
49
+ end
50
+
51
+ def prepared?; @is_prepared || false; end
52
+
53
+ def inspect
54
+ "SC::ManifestEntry(#{filename}, build_task=>#{self.build_task}, entry_type=>#{self.entry_type}, is_hidden=>#{self.hidden?})"
55
+ end
56
+
57
+ def to_hash(opts={})
58
+ ret = super()
59
+ if ret[:source_entries]
60
+ ret[:source_entries] = ret[:source_entries].map { |e| e.to_hash(opts)}
61
+ end
62
+
63
+ if only_keys = opts[:only]
64
+ filtered = {}
65
+ ret.each do |key, value|
66
+ filtered[key] = value if only_keys.include?(key)
67
+ end
68
+ ret = filtered
69
+ end
70
+
71
+ if except_keys = opts[:except]
72
+ filtered = {}
73
+ ret.each do |key, value|
74
+ filtered[key] = value unless except_keys.include?(key)
75
+ end
76
+ ret = filtered
77
+ end
78
+
79
+ return ret
80
+ end
81
+
82
+ ######################################################
83
+ # CONVENIENCE METHODS
84
+ #
85
+
86
+ # true if the current manifest entry should not be included in the
87
+ # build. The entry may still be used as an input for other entries and
88
+ # it may still be referenced directly
89
+ def hidden?; self[:hidden] ||= false; end
90
+
91
+ # Sets the entry's hidden? property to true
92
+ def hide!; self[:hidden] = true; self; end
93
+
94
+ # true if the manifest entry represents a composite resource built from
95
+ # one or more source entries. Composite resources will have their
96
+ # source_entries staged before the entry itself is built to staged.
97
+ def composite?; self[:composite]; end
98
+
99
+ # Marks the entry as composite. Returns self
100
+ def composite!; self[:composite] = true; self; end
101
+
102
+ # The owner manifest
103
+ attr_accessor :manifest
104
+
105
+ # The owner target
106
+ def target; @target ||= manifest.target; end
107
+
108
+ # Returns a timestamp for when this file was last changed. This will
109
+ # reach back to the source entries, finding the latest original entry.
110
+ def timestamp
111
+ if composite?
112
+ source_entries.map { |e| e.timestamp }.max
113
+ else
114
+ File.exist?(source_path) ? File.mtime(source_path).to_i : 0
115
+ end
116
+ end
117
+
118
+ # Returns a URL with a possible timestamp token appended to the end of
119
+ # the entry if the target's timestamp_url config is set. Otherwise
120
+ # returns the URL itself.
121
+ def cacheable_url
122
+ ret = self.url
123
+ ret = [ret, self.timestamp].join('?') if target.config.timestamp_urls
124
+ return ret
125
+ end
126
+
127
+ # Scans the source paths (first staging any source entries) for the
128
+ # passed regex. Your block will be executed with each line that matched.
129
+ # Returns the results of each block
130
+ #
131
+ # === Example
132
+ #
133
+ # entry.extract_content(/require\((.+)\)/) { |line| $1 }
134
+ #
135
+ def scan_source(regexp, &block)
136
+ if entries = self.source_entries
137
+ entries.each { |entry| entry.stage! }
138
+ end
139
+
140
+ if paths = self.source_paths
141
+ paths.each do |path|
142
+ next unless File.exist?(path)
143
+ File.readlines(path).each do |line|
144
+ line.scan(regexp) { |result| yield(result) }
145
+ end
146
+ end
147
+ end
148
+ end
149
+
150
+ BUILD_DIRECTIVES_REGEX = /(sc_require|require|sc_resource)\(\s*(['"])(.+)['"]\s*\)/
151
+
152
+ # Scans the source paths for standard build directives and annotates the
153
+ # entry accordingly. You should only call this method on entries
154
+ # representing CSS or JavaScript resources. It will yield undefined
155
+ # results on all other file types.
156
+ #
157
+ def discover_build_directives!
158
+ self.required = []
159
+ entry = self.transform? ? self.source_entry : self
160
+ entry.scan_source(BUILD_DIRECTIVES_REGEX) do |matches|
161
+ # strip off any file ext
162
+ filename = matches[2].ext ''
163
+ case matches[0]
164
+ when 'sc_require':
165
+ self.required << filename
166
+ when 'require':
167
+ self.required << filename
168
+ when 'sc_resource'
169
+ self.resource = filename
170
+ end
171
+ end
172
+ end
173
+
174
+ ######################################################
175
+ # BUILDING
176
+ #
177
+
178
+ # Invokes the entry's build task to build to its build path. If the
179
+ # entry has source entries, they will be staged first.
180
+ def build!
181
+ build_to self.build_path
182
+ end
183
+
184
+ # Builds an entry into its staging path. This method can be invoked on
185
+ # any entry whose output is required by another entry to be built.
186
+ def stage!
187
+ build_to self.staging_path
188
+ end
189
+
190
+ # Removes the build and staging files for this entry so the next
191
+ # build will rebuild.
192
+ #
193
+ # === Returns
194
+ # self
195
+ def clean!
196
+ FileUtils.rm(self.build_path) if File.exist?(self.build_path)
197
+ FileUtils.rm(self.staging_path) if File.exist?(self.staging_path)
198
+ return self
199
+ end
200
+
201
+ private
202
+
203
+ def build_to(dst_path)
204
+ if self.build_task.nil?
205
+ raise "no build task defined for #{self.filename}"
206
+ end
207
+
208
+ # stage source entries if needed...
209
+ (self.source_entries || []).each { |e| e.stage! } if composite?
210
+
211
+ # get build task and build it
212
+ buildfile = manifest.target.buildfile
213
+ if !buildfile.task_defined?(self.build_task)
214
+ raise "Could not build entry #{self.filename} because build task '#{self.build_task}' is not defined"
215
+ end
216
+
217
+ buildfile.invoke self.build_task,
218
+ :entry => self,
219
+ :manifest => self.manifest,
220
+ :target => self.manifest.target,
221
+ :config => self.manifest.target.config,
222
+ :project => self.manifest.target.project,
223
+ :src_path => self.source_path,
224
+ :src_paths => self.source_paths,
225
+ :dst_path => dst_path
226
+
227
+ return self
228
+ end
229
+
230
+ end
231
+
232
+ end
@@ -0,0 +1,270 @@
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
+ # A project describes a collection of targets that you can build. Normally
11
+ # you instantiate a project by calling Project.load() method. You should
12
+ # pass in the path of the project and the project type. The project type
13
+ # will determine the namespace used in the buildfile to detect and load
14
+ # tasks.
15
+ #
16
+ # == Examples
17
+ #
18
+ # Load a SproutCore-style project:
19
+ #
20
+ # Project.load('myproject', :sproutcore)
21
+ #
22
+ # Load a standard gcc-build project:
23
+ #
24
+ # Project.load('myproject', :cc)
25
+ #
26
+ # == How a Project is Loaded
27
+ #
28
+ # When you load a project, here is what happens:
29
+ #
30
+ # 1. Kocate and load Buildfiles, if any are found
31
+ # 2. Run project_type:target:find for all targets defined for the project.
32
+ # this will locate and define the targets for the project
33
+ # 3. If you request a build of a particular resource, a manifest will be
34
+ # built for the target. This manifest contains a series of rules that
35
+ # can be invoked in order to build the named resource.
36
+ #
37
+ class Project
38
+
39
+ # the path of this project
40
+ attr_reader :project_root
41
+
42
+ # Parent project this project shoud inherit build rules and targets from
43
+ attr_reader :parent_project
44
+
45
+ def inspect
46
+ "SC::Project(#{File.basename(project_root || '')})"
47
+ end
48
+
49
+ # When a new project is created, you may optionally pass either a
50
+ # :parent option or a :paths options. If you pass the paths option, then
51
+ # this class will search the paths for projects and initialize them as
52
+ # parent projects to this one.
53
+ #
54
+ # If you pass a parent project, then this project will start out with a
55
+ # clone of the parent project's buildfile and targets.
56
+ #
57
+ def initialize(project_root, opts ={})
58
+ @project_root = project_root
59
+ @parent_project = opts[:parent]
60
+ @buildfile = @targets = nil
61
+ end
62
+
63
+ # Attempts to find the nearest project root
64
+ def self.load_nearest_project(path, opts={})
65
+ candidate = nil
66
+ while path
67
+ if Buildfile.has_buildfile?(path)
68
+ candidate = path
69
+
70
+ # If we find a buildfile and the buildfile explicitly states
71
+ # that it is a project, then just stop here..
72
+ break if Buildfile.load(path).project?
73
+ end
74
+
75
+ new_path = File.dirname(path)
76
+ path = (new_path == path) ? nil : new_path
77
+ end
78
+ (candidate) ? self.new(candidate, opts) : nil
79
+ end
80
+
81
+ # Returns a new project loaded from the specified path
82
+ def self.load(project_root, opts={})
83
+ new project_root, opts
84
+ end
85
+
86
+ def reload!
87
+ @buildfile = @targets = nil
88
+ end
89
+
90
+ # The current buildfile for the project. The buildfile is calculated by
91
+ # merging any parent project buildfile with the contents of any
92
+ # buildfiles found in the current project. Buildfiles include any file
93
+ # named "Buildfile", "sc-config", or "sc-config.rb". You can also
94
+ # specify your own buildfile names with the "buildfile_names" config in
95
+ # the SC.env.
96
+ #
97
+ # === Returns
98
+ # Buildfile instance
99
+ #
100
+ def buildfile
101
+ @buildfile ||= (parent_project.nil? ? Buildfile.new : parent_project.buildfile.dup).load!(project_root)
102
+ end
103
+
104
+ # The config for the current project. The config is computed by merging
105
+ # the config settings from the current buildfile and then the current
106
+ # environment in the following order:
107
+ #
108
+ # config for all modes, all targets +
109
+ # config for current mode, all targets +
110
+ # Current environment defined in SC.env
111
+ #
112
+ # This is the config hash you should access to determine general project
113
+ # wide settings that cannot be overridden by individual targets.
114
+ #
115
+ # === Returns
116
+ # merged HashStruct
117
+ #
118
+ def config
119
+ return @config ||= buildfile.config_for(:all, SC.build_mode).merge(SC.env)
120
+ end
121
+
122
+ ################################################
123
+ ## TARGETS
124
+ ##
125
+
126
+ # A hash of the known targets for this project, including any targets
127
+ # inherited from a parent project. Each target is stored in the hash
128
+ # by target_name.
129
+ #
130
+ # The first time this method is called, the project will automatically
131
+ # clone any targets from a parent project, and then calls
132
+ # find_targets_for() on itself to recursively discover any targets in
133
+ # the project.
134
+ #
135
+ # If you need to change the way the project discovers project, override
136
+ # find_targets_for() instead of this method.
137
+ #
138
+ # === Returns
139
+ # Hash of targets keyed by target_name
140
+ #
141
+ def targets
142
+ return @targets unless @targets.nil?
143
+
144
+ # Create an empty targets hash or clone from parent project
145
+ @targets = HashStruct.new
146
+ dup_targets(parent_project.targets) if parent_project
147
+
148
+ # find targets inside project.
149
+ find_targets_for(project_root, nil, self.config)
150
+
151
+ return @targets
152
+ end
153
+
154
+ # Returns the target with the specified target name. The target name
155
+ # may be absolute path or not, both will lookup from the top.
156
+ #
157
+ # === Params
158
+ # target_name:: the target to lookup
159
+ #
160
+ # === Returns
161
+ # a Target instance or nil if no matching target could be found
162
+ #
163
+ def target_for(target_name)
164
+ ret = (targets[target_name.to_s.sub(/^([^\/])/,'/\1')])
165
+ ret.nil? ? nil : ret
166
+ end
167
+
168
+ # Adds a new target to the project with the passed target name. Include
169
+ # the source_root for the target as well as any additional options you
170
+ # want copied onto the target. If a previous target was defined by the
171
+ # same name it will be replaced by this one.
172
+ #
173
+ # === Params
174
+ # target_name:: the name of the target.
175
+ # target_type:: the type of target
176
+ #
177
+ # === Options (any others allowed also)
178
+ # source_root:: the absolute path to the target source
179
+ #
180
+ # === Returns
181
+ # new target
182
+ #
183
+ def add_target(target_name, target_type, options={})
184
+ targets[target_name] = Target.new(target_name.to_sym,
185
+ target_type.to_sym, options.merge(:project => self))
186
+ end
187
+
188
+ # Called by project to discover any targets within the project itself.
189
+ # The default implementation will search the project root directory for
190
+ # any directories matching those named in the "target_types" config. (See
191
+ # Buildfile for documentation). It will then recursively descend into
192
+ # each target looking for further nested targets unless you've set the
193
+ # "allow_nested_targets" config to false.
194
+ #
195
+ # If you need to change the way the project autodiscovers its own targets
196
+ # you can either change the "target_types" and "allow_nested_targets"
197
+ # configs or you can override this method in your own ruby code to
198
+ # do whatever kind of changes you want.
199
+ #
200
+ # === Params
201
+ # root_path:: The path to search for targets.
202
+ # root_name:: The root target name
203
+ # config:: The config hash to use for this. Should come from target
204
+ #
205
+ # === Returns
206
+ # self
207
+ #
208
+ def find_targets_for(root_path, root_name, config)
209
+
210
+ # look for directories matching the target_types keys and create target
211
+ # with target_types value as type. -- normalize to lowercase string
212
+ target_types = {}
213
+ (config.target_types || {}).each do |key, value|
214
+ target_types[key.to_s.downcase] = value
215
+ end
216
+
217
+ # look for directories matching a target type
218
+ Dir.glob(File.join(root_path, '*')).each do |dir_name|
219
+ target_type = target_types[File.basename(dir_name).to_s.downcase]
220
+ next if target_type.nil?
221
+ next unless File.directory?(dir_name)
222
+
223
+ # loop through each item in the directory.
224
+ Dir.glob(File.join(dir_name,'*')).each do |source_root|
225
+ next unless File.directory?(source_root)
226
+
227
+ # compute target name and create target
228
+ target_name = [root_name, File.basename(source_root)] * '/'
229
+ target = self.add_target target_name, target_type,
230
+ :source_root => source_root
231
+
232
+ # if target's config allows nested targets, then call recursively
233
+ # asking the target's config allows the target's Buildfile to
234
+ # override the default.
235
+ if target.config.allow_nested_targets
236
+ find_targets_for(source_root, target_name, target.config)
237
+ end
238
+ end # Dir.glob
239
+ end # target_type.each
240
+ return self
241
+ end
242
+
243
+ ################################################
244
+ ## GENERATOR SUPPORT
245
+ ##
246
+
247
+ # Attempts to discover and load a generator with the specified name from
248
+ # the current project. If the generator cannot be found, this method will
249
+ # return nil.
250
+ def generator_for(generator_name, opts={})
251
+ opts[:target_project] = self
252
+ return SC::Generator.load(generator_name, opts)
253
+ end
254
+
255
+ private
256
+
257
+ # Loops through the hash of targets and adds them to the receiver. This
258
+ # is how we inherit inherit targets from a parent project.
259
+ def dup_targets(to_dup)
260
+ to_dup.each do | target_name, target |
261
+ add_target target_name, target.target_type, target.to_hash
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end
268
+
269
+
270
+