trackman 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. data/.gitignore +4 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock +49 -0
  5. data/LICENSE +17 -0
  6. data/README.md +96 -0
  7. data/Rakefile +52 -0
  8. data/lib/tasks.rb +7 -0
  9. data/lib/trackman/assets/asset.rb +97 -0
  10. data/lib/trackman/assets/components/asset_factory.rb +41 -0
  11. data/lib/trackman/assets/components/asset_factory.rb.orig +54 -0
  12. data/lib/trackman/assets/components/composite_asset.rb +39 -0
  13. data/lib/trackman/assets/components/conventions.rb +23 -0
  14. data/lib/trackman/assets/components/diffable.rb +29 -0
  15. data/lib/trackman/assets/components/hashable.rb +30 -0
  16. data/lib/trackman/assets/components/path_resolver.rb +34 -0
  17. data/lib/trackman/assets/components/rails32_path_resolver.rb +49 -0
  18. data/lib/trackman/assets/components/rails_path_resolver.rb +34 -0
  19. data/lib/trackman/assets/components/shippable.rb +31 -0
  20. data/lib/trackman/assets/components.rb +11 -0
  21. data/lib/trackman/assets/css_asset.rb +11 -0
  22. data/lib/trackman/assets/errors/asset_not_found_error.rb +8 -0
  23. data/lib/trackman/assets/errors/config_not_found_error.rb +8 -0
  24. data/lib/trackman/assets/errors.rb +10 -0
  25. data/lib/trackman/assets/html_asset.rb +30 -0
  26. data/lib/trackman/assets/remote_asset.rb +72 -0
  27. data/lib/trackman/assets.rb +37 -0
  28. data/lib/trackman/rack_middleware.rb +12 -0
  29. data/lib/trackman/railtie.rb +7 -0
  30. data/lib/trackman/version.rb +3 -0
  31. data/lib/trackman.rb +34 -0
  32. data/rails_generators/trackman/templates/trackman.rake +59 -0
  33. data/rails_generators/trackman/trackman_generator.rb +8 -0
  34. data/spec/asset_all_spec.rb +136 -0
  35. data/spec/asset_factory_spec.rb +70 -0
  36. data/spec/asset_spec.rb +99 -0
  37. data/spec/composite_asset_spec.rb +12 -0
  38. data/spec/css_asset_spec.rb +39 -0
  39. data/spec/diffable_spec.rb +57 -0
  40. data/spec/fixtures/rails2311/fully-loaded/README +243 -0
  41. data/spec/fixtures/rails2311/fully-loaded/Rakefile +10 -0
  42. data/spec/fixtures/rails2311/fully-loaded/app/controllers/application_controller.rb +10 -0
  43. data/spec/fixtures/rails2311/fully-loaded/app/helpers/application_helper.rb +3 -0
  44. data/spec/fixtures/rails2311/fully-loaded/config/boot.rb +114 -0
  45. data/spec/fixtures/rails2311/fully-loaded/config/database.yml +22 -0
  46. data/spec/fixtures/rails2311/fully-loaded/config/environment.rb +41 -0
  47. data/spec/fixtures/rails2311/fully-loaded/config/environments/development.rb +17 -0
  48. data/spec/fixtures/rails2311/fully-loaded/config/environments/production.rb +28 -0
  49. data/spec/fixtures/rails2311/fully-loaded/config/environments/test.rb +28 -0
  50. data/spec/fixtures/rails2311/fully-loaded/config/initializers/backtrace_silencers.rb +7 -0
  51. data/spec/fixtures/rails2311/fully-loaded/config/initializers/cookie_verification_secret.rb +7 -0
  52. data/spec/fixtures/rails2311/fully-loaded/config/initializers/inflections.rb +10 -0
  53. data/spec/fixtures/rails2311/fully-loaded/config/initializers/mime_types.rb +5 -0
  54. data/spec/fixtures/rails2311/fully-loaded/config/initializers/new_rails_defaults.rb +21 -0
  55. data/spec/fixtures/rails2311/fully-loaded/config/initializers/session_store.rb +15 -0
  56. data/spec/fixtures/rails2311/fully-loaded/config/locales/en.yml +5 -0
  57. data/spec/fixtures/rails2311/fully-loaded/config/routes.rb +43 -0
  58. data/spec/fixtures/rails2311/fully-loaded/db/seeds.rb +7 -0
  59. data/spec/fixtures/rails2311/fully-loaded/doc/README_FOR_APP +2 -0
  60. data/spec/fixtures/rails2311/fully-loaded/log/development.log +0 -0
  61. data/spec/fixtures/rails2311/fully-loaded/log/production.log +0 -0
  62. data/spec/fixtures/rails2311/fully-loaded/log/server.log +0 -0
  63. data/spec/fixtures/rails2311/fully-loaded/log/test.log +0 -0
  64. data/spec/fixtures/rails2311/fully-loaded/public/404.html +30 -0
  65. data/spec/fixtures/rails2311/fully-loaded/public/422.html +30 -0
  66. data/spec/fixtures/rails2311/fully-loaded/public/500.html +30 -0
  67. data/spec/fixtures/rails2311/fully-loaded/public/503-error.html +24 -0
  68. data/spec/fixtures/rails2311/fully-loaded/public/503-error.html~ +24 -0
  69. data/spec/fixtures/rails2311/fully-loaded/public/503.html +275 -0
  70. data/spec/fixtures/rails2311/fully-loaded/public/503.html~ +275 -0
  71. data/spec/fixtures/rails2311/fully-loaded/public/favicon.ico +0 -0
  72. data/spec/fixtures/rails2311/fully-loaded/public/images/rails.png +0 -0
  73. data/spec/fixtures/rails2311/fully-loaded/public/index.html +275 -0
  74. data/spec/fixtures/rails2311/fully-loaded/public/javascripts/application.js +2 -0
  75. data/spec/fixtures/rails2311/fully-loaded/public/javascripts/controls.js +963 -0
  76. data/spec/fixtures/rails2311/fully-loaded/public/javascripts/dragdrop.js +973 -0
  77. data/spec/fixtures/rails2311/fully-loaded/public/javascripts/effects.js +1128 -0
  78. data/spec/fixtures/rails2311/fully-loaded/public/javascripts/prototype.js +4320 -0
  79. data/spec/fixtures/rails2311/fully-loaded/public/robots.txt +5 -0
  80. data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/application.css +13 -0
  81. data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/some-other-css.css +3 -0
  82. data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/sub-css/sub-css.css +1 -0
  83. data/spec/fixtures/rails2311/fully-loaded/script/about +4 -0
  84. data/spec/fixtures/rails2311/fully-loaded/script/console +3 -0
  85. data/spec/fixtures/rails2311/fully-loaded/script/dbconsole +3 -0
  86. data/spec/fixtures/rails2311/fully-loaded/script/destroy +3 -0
  87. data/spec/fixtures/rails2311/fully-loaded/script/generate +3 -0
  88. data/spec/fixtures/rails2311/fully-loaded/script/performance/benchmarker +3 -0
  89. data/spec/fixtures/rails2311/fully-loaded/script/performance/profiler +3 -0
  90. data/spec/fixtures/rails2311/fully-loaded/script/plugin +3 -0
  91. data/spec/fixtures/rails2311/fully-loaded/script/runner +3 -0
  92. data/spec/fixtures/rails2311/fully-loaded/script/server +3 -0
  93. data/spec/fixtures/rails2311/fully-loaded/test/performance/browsing_test.rb +9 -0
  94. data/spec/fixtures/rails2311/fully-loaded/test/test_helper.rb +38 -0
  95. data/spec/fixtures/rails2311/template/README +243 -0
  96. data/spec/fixtures/rails2311/template/Rakefile +10 -0
  97. data/spec/fixtures/rails2311/template/app/controllers/application_controller.rb +10 -0
  98. data/spec/fixtures/rails2311/template/app/helpers/application_helper.rb +3 -0
  99. data/spec/fixtures/rails2311/template/config/boot.rb +114 -0
  100. data/spec/fixtures/rails2311/template/config/database.yml +22 -0
  101. data/spec/fixtures/rails2311/template/config/environment.rb +41 -0
  102. data/spec/fixtures/rails2311/template/config/environments/development.rb +17 -0
  103. data/spec/fixtures/rails2311/template/config/environments/production.rb +28 -0
  104. data/spec/fixtures/rails2311/template/config/environments/test.rb +28 -0
  105. data/spec/fixtures/rails2311/template/config/initializers/backtrace_silencers.rb +7 -0
  106. data/spec/fixtures/rails2311/template/config/initializers/cookie_verification_secret.rb +7 -0
  107. data/spec/fixtures/rails2311/template/config/initializers/inflections.rb +10 -0
  108. data/spec/fixtures/rails2311/template/config/initializers/mime_types.rb +5 -0
  109. data/spec/fixtures/rails2311/template/config/initializers/new_rails_defaults.rb +21 -0
  110. data/spec/fixtures/rails2311/template/config/initializers/session_store.rb +15 -0
  111. data/spec/fixtures/rails2311/template/config/locales/en.yml +5 -0
  112. data/spec/fixtures/rails2311/template/config/routes.rb +43 -0
  113. data/spec/fixtures/rails2311/template/db/seeds.rb +7 -0
  114. data/spec/fixtures/rails2311/template/doc/README_FOR_APP +2 -0
  115. data/spec/fixtures/rails2311/template/log/development.log +0 -0
  116. data/spec/fixtures/rails2311/template/log/production.log +0 -0
  117. data/spec/fixtures/rails2311/template/log/server.log +0 -0
  118. data/spec/fixtures/rails2311/template/log/test.log +0 -0
  119. data/spec/fixtures/rails2311/template/public/404.html +30 -0
  120. data/spec/fixtures/rails2311/template/public/422.html +30 -0
  121. data/spec/fixtures/rails2311/template/public/500.html +30 -0
  122. data/spec/fixtures/rails2311/template/public/favicon.ico +0 -0
  123. data/spec/fixtures/rails2311/template/public/images/rails.png +0 -0
  124. data/spec/fixtures/rails2311/template/public/index.html +275 -0
  125. data/spec/fixtures/rails2311/template/public/javascripts/application.js +2 -0
  126. data/spec/fixtures/rails2311/template/public/javascripts/controls.js +963 -0
  127. data/spec/fixtures/rails2311/template/public/javascripts/dragdrop.js +973 -0
  128. data/spec/fixtures/rails2311/template/public/javascripts/effects.js +1128 -0
  129. data/spec/fixtures/rails2311/template/public/javascripts/prototype.js +4320 -0
  130. data/spec/fixtures/rails2311/template/public/robots.txt +5 -0
  131. data/spec/fixtures/rails2311/template/script/about +4 -0
  132. data/spec/fixtures/rails2311/template/script/console +3 -0
  133. data/spec/fixtures/rails2311/template/script/dbconsole +3 -0
  134. data/spec/fixtures/rails2311/template/script/destroy +3 -0
  135. data/spec/fixtures/rails2311/template/script/generate +3 -0
  136. data/spec/fixtures/rails2311/template/script/performance/benchmarker +3 -0
  137. data/spec/fixtures/rails2311/template/script/performance/profiler +3 -0
  138. data/spec/fixtures/rails2311/template/script/plugin +3 -0
  139. data/spec/fixtures/rails2311/template/script/runner +3 -0
  140. data/spec/fixtures/rails2311/template/script/server +3 -0
  141. data/spec/fixtures/rails2311/template/test/performance/browsing_test.rb +9 -0
  142. data/spec/fixtures/rails2311/template/test/test_helper.rb +38 -0
  143. data/spec/fixtures/rails32/clean-install/.gitignore +15 -0
  144. data/spec/fixtures/rails32/clean-install/Gemfile +38 -0
  145. data/spec/fixtures/rails32/clean-install/README.rdoc +261 -0
  146. data/spec/fixtures/rails32/clean-install/Rakefile +7 -0
  147. data/spec/fixtures/rails32/clean-install/app/assets/images/rails.png +0 -0
  148. data/spec/fixtures/rails32/clean-install/app/assets/javascripts/application.js +15 -0
  149. data/spec/fixtures/rails32/clean-install/app/assets/stylesheets/application.css +13 -0
  150. data/spec/fixtures/rails32/clean-install/app/controllers/application_controller.rb +3 -0
  151. data/spec/fixtures/rails32/clean-install/app/helpers/application_helper.rb +2 -0
  152. data/spec/fixtures/rails32/clean-install/app/mailers/.gitkeep +0 -0
  153. data/spec/fixtures/rails32/clean-install/app/models/.gitkeep +0 -0
  154. data/spec/fixtures/rails32/clean-install/app/views/layouts/application.html.erb +14 -0
  155. data/spec/fixtures/rails32/clean-install/config/application.rb +59 -0
  156. data/spec/fixtures/rails32/clean-install/config/boot.rb +6 -0
  157. data/spec/fixtures/rails32/clean-install/config/database.yml +25 -0
  158. data/spec/fixtures/rails32/clean-install/config/environment.rb +5 -0
  159. data/spec/fixtures/rails32/clean-install/config/environments/development.rb +37 -0
  160. data/spec/fixtures/rails32/clean-install/config/environments/production.rb +67 -0
  161. data/spec/fixtures/rails32/clean-install/config/environments/test.rb +37 -0
  162. data/spec/fixtures/rails32/clean-install/config/initializers/backtrace_silencers.rb +7 -0
  163. data/spec/fixtures/rails32/clean-install/config/initializers/inflections.rb +15 -0
  164. data/spec/fixtures/rails32/clean-install/config/initializers/mime_types.rb +5 -0
  165. data/spec/fixtures/rails32/clean-install/config/initializers/secret_token.rb +7 -0
  166. data/spec/fixtures/rails32/clean-install/config/initializers/session_store.rb +8 -0
  167. data/spec/fixtures/rails32/clean-install/config/initializers/wrap_parameters.rb +14 -0
  168. data/spec/fixtures/rails32/clean-install/config/locales/en.yml +5 -0
  169. data/spec/fixtures/rails32/clean-install/config/routes.rb +58 -0
  170. data/spec/fixtures/rails32/clean-install/config.ru +4 -0
  171. data/spec/fixtures/rails32/clean-install/db/seeds.rb +7 -0
  172. data/spec/fixtures/rails32/clean-install/doc/README_FOR_APP +2 -0
  173. data/spec/fixtures/rails32/clean-install/lib/assets/.gitkeep +0 -0
  174. data/spec/fixtures/rails32/clean-install/lib/tasks/.gitkeep +0 -0
  175. data/spec/fixtures/rails32/clean-install/log/.gitkeep +0 -0
  176. data/spec/fixtures/rails32/clean-install/public/404.html +26 -0
  177. data/spec/fixtures/rails32/clean-install/public/422.html +26 -0
  178. data/spec/fixtures/rails32/clean-install/public/500.html +25 -0
  179. data/spec/fixtures/rails32/clean-install/public/favicon.ico +0 -0
  180. data/spec/fixtures/rails32/clean-install/public/index.html +241 -0
  181. data/spec/fixtures/rails32/clean-install/public/robots.txt +5 -0
  182. data/spec/fixtures/rails32/clean-install/script/rails +6 -0
  183. data/spec/fixtures/rails32/clean-install/test/fixtures/.gitkeep +0 -0
  184. data/spec/fixtures/rails32/clean-install/test/functional/.gitkeep +0 -0
  185. data/spec/fixtures/rails32/clean-install/test/integration/.gitkeep +0 -0
  186. data/spec/fixtures/rails32/clean-install/test/performance/browsing_test.rb +12 -0
  187. data/spec/fixtures/rails32/clean-install/test/test_helper.rb +13 -0
  188. data/spec/fixtures/rails32/clean-install/test/unit/.gitkeep +0 -0
  189. data/spec/fixtures/rails32/clean-install/vendor/assets/javascripts/.gitkeep +0 -0
  190. data/spec/fixtures/rails32/clean-install/vendor/assets/stylesheets/.gitkeep +0 -0
  191. data/spec/fixtures/rails32/clean-install/vendor/plugins/.gitkeep +0 -0
  192. data/spec/fixtures/rails32/fully-loaded/Gemfile +37 -0
  193. data/spec/fixtures/rails32/fully-loaded/README.rdoc +261 -0
  194. data/spec/fixtures/rails32/fully-loaded/Rakefile +7 -0
  195. data/spec/fixtures/rails32/fully-loaded/app/assets/images/rails.png +0 -0
  196. data/spec/fixtures/rails32/fully-loaded/app/assets/images/riding-you.jpg +0 -0
  197. data/spec/fixtures/rails32/fully-loaded/app/assets/javascripts/application.js +16 -0
  198. data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/application.css +13 -0
  199. data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/some-other-css.css +3 -0
  200. data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/sub-css/sub-css.css +1 -0
  201. data/spec/fixtures/rails32/fully-loaded/app/controllers/application_controller.rb +3 -0
  202. data/spec/fixtures/rails32/fully-loaded/app/helpers/application_helper.rb +2 -0
  203. data/spec/fixtures/rails32/fully-loaded/app/views/layouts/application.html.erb +14 -0
  204. data/spec/fixtures/rails32/fully-loaded/config/application.rb +65 -0
  205. data/spec/fixtures/rails32/fully-loaded/config/boot.rb +6 -0
  206. data/spec/fixtures/rails32/fully-loaded/config/environment.rb +5 -0
  207. data/spec/fixtures/rails32/fully-loaded/config/environments/development.rb +31 -0
  208. data/spec/fixtures/rails32/fully-loaded/config/environments/production.rb +64 -0
  209. data/spec/fixtures/rails32/fully-loaded/config/environments/test.rb +35 -0
  210. data/spec/fixtures/rails32/fully-loaded/config/initializers/backtrace_silencers.rb +7 -0
  211. data/spec/fixtures/rails32/fully-loaded/config/initializers/inflections.rb +15 -0
  212. data/spec/fixtures/rails32/fully-loaded/config/initializers/mime_types.rb +5 -0
  213. data/spec/fixtures/rails32/fully-loaded/config/initializers/secret_token.rb +7 -0
  214. data/spec/fixtures/rails32/fully-loaded/config/initializers/session_store.rb +8 -0
  215. data/spec/fixtures/rails32/fully-loaded/config/initializers/wrap_parameters.rb +10 -0
  216. data/spec/fixtures/rails32/fully-loaded/config/locales/en.yml +5 -0
  217. data/spec/fixtures/rails32/fully-loaded/config/routes.rb +58 -0
  218. data/spec/fixtures/rails32/fully-loaded/config.ru +4 -0
  219. data/spec/fixtures/rails32/fully-loaded/db/seeds.rb +7 -0
  220. data/spec/fixtures/rails32/fully-loaded/doc/README_FOR_APP +2 -0
  221. data/spec/fixtures/rails32/fully-loaded/public/404.html +26 -0
  222. data/spec/fixtures/rails32/fully-loaded/public/422.html +26 -0
  223. data/spec/fixtures/rails32/fully-loaded/public/500.html +25 -0
  224. data/spec/fixtures/rails32/fully-loaded/public/503-error.html +25 -0
  225. data/spec/fixtures/rails32/fully-loaded/public/503.html +13 -0
  226. data/spec/fixtures/rails32/fully-loaded/public/favicon.ico +0 -0
  227. data/spec/fixtures/rails32/fully-loaded/public/index.html +241 -0
  228. data/spec/fixtures/rails32/fully-loaded/public/robots.txt +5 -0
  229. data/spec/fixtures/rails32/fully-loaded/script/rails +6 -0
  230. data/spec/fixtures/rails32/happy-path/Gemfile +37 -0
  231. data/spec/fixtures/rails32/happy-path/README.rdoc +261 -0
  232. data/spec/fixtures/rails32/happy-path/Rakefile +7 -0
  233. data/spec/fixtures/rails32/happy-path/app/assets/images/rails.png +0 -0
  234. data/spec/fixtures/rails32/happy-path/app/assets/javascripts/application.js +15 -0
  235. data/spec/fixtures/rails32/happy-path/app/assets/stylesheets/application.css +13 -0
  236. data/spec/fixtures/rails32/happy-path/app/controllers/application_controller.rb +3 -0
  237. data/spec/fixtures/rails32/happy-path/app/helpers/application_helper.rb +2 -0
  238. data/spec/fixtures/rails32/happy-path/app/views/layouts/application.html.erb +14 -0
  239. data/spec/fixtures/rails32/happy-path/config/application.rb +65 -0
  240. data/spec/fixtures/rails32/happy-path/config/boot.rb +6 -0
  241. data/spec/fixtures/rails32/happy-path/config/environment.rb +5 -0
  242. data/spec/fixtures/rails32/happy-path/config/environments/development.rb +31 -0
  243. data/spec/fixtures/rails32/happy-path/config/environments/production.rb +64 -0
  244. data/spec/fixtures/rails32/happy-path/config/environments/test.rb +35 -0
  245. data/spec/fixtures/rails32/happy-path/config/initializers/backtrace_silencers.rb +7 -0
  246. data/spec/fixtures/rails32/happy-path/config/initializers/inflections.rb +15 -0
  247. data/spec/fixtures/rails32/happy-path/config/initializers/mime_types.rb +5 -0
  248. data/spec/fixtures/rails32/happy-path/config/initializers/secret_token.rb +7 -0
  249. data/spec/fixtures/rails32/happy-path/config/initializers/session_store.rb +8 -0
  250. data/spec/fixtures/rails32/happy-path/config/initializers/wrap_parameters.rb +10 -0
  251. data/spec/fixtures/rails32/happy-path/config/locales/en.yml +5 -0
  252. data/spec/fixtures/rails32/happy-path/config/routes.rb +58 -0
  253. data/spec/fixtures/rails32/happy-path/config.ru +4 -0
  254. data/spec/fixtures/rails32/happy-path/db/seeds.rb +7 -0
  255. data/spec/fixtures/rails32/happy-path/doc/README_FOR_APP +2 -0
  256. data/spec/fixtures/rails32/happy-path/public/404.html +26 -0
  257. data/spec/fixtures/rails32/happy-path/public/422.html +26 -0
  258. data/spec/fixtures/rails32/happy-path/public/500.html +25 -0
  259. data/spec/fixtures/rails32/happy-path/public/503-error.html +12 -0
  260. data/spec/fixtures/rails32/happy-path/public/503.html +11 -0
  261. data/spec/fixtures/rails32/happy-path/public/favicon.ico +0 -0
  262. data/spec/fixtures/rails32/happy-path/public/index.html +241 -0
  263. data/spec/fixtures/rails32/happy-path/public/robots.txt +5 -0
  264. data/spec/fixtures/rails32/happy-path/script/rails +6 -0
  265. data/spec/helpers/app_creator.rb +28 -0
  266. data/spec/helpers/fakable_pathman_tester.rb +117 -0
  267. data/spec/html_asset_spec.rb +51 -0
  268. data/spec/path_spec.rb +6 -0
  269. data/spec/paths/fakable_pathman_tester_spec.rb +36 -0
  270. data/spec/paths/pathman_spec.rb +64 -0
  271. data/spec/paths/rails32_pathman_spec.rb +80 -0
  272. data/spec/rails2311/first_push_spec.rb +29 -0
  273. data/spec/rails32/first_push_spec.rb +76 -0
  274. data/spec/remote_asset_spec.rb +80 -0
  275. data/spec/shippable_spec.rb +79 -0
  276. data/spec/spec_helper.rb +22 -0
  277. data/spec/sync_spec.rb +85 -0
  278. data/spec/test_data/a.js +3 -0
  279. data/spec/test_data/all/1.css +4 -0
  280. data/spec/test_data/all/2.gif +0 -0
  281. data/spec/test_data/all/3.js +3 -0
  282. data/spec/test_data/all/all.html +8 -0
  283. data/spec/test_data/all/all2.html +7 -0
  284. data/spec/test_data/all/all3.html +8 -0
  285. data/spec/test_data/b.js +1 -0
  286. data/spec/test_data/c.js +5 -0
  287. data/spec/test_data/css/image/riding-you.jpg +0 -0
  288. data/spec/test_data/css/image/with-image.css +24 -0
  289. data/spec/test_data/css/imported-loop1.css +25 -0
  290. data/spec/test_data/css/imported-loop2.css +25 -0
  291. data/spec/test_data/css/imported.css +13 -0
  292. data/spec/test_data/css/imported2.css +13 -0
  293. data/spec/test_data/css/recursive/html-with-css.html +40 -0
  294. data/spec/test_data/css/recursive/imported-lvl2.css +25 -0
  295. data/spec/test_data/css/recursive/imported-lvl3.css +24 -0
  296. data/spec/test_data/css/recursive/imported-recursive.css +25 -0
  297. data/spec/test_data/css/recursive/riding-you.jpg +0 -0
  298. data/spec/test_data/css/with-asset.css +25 -0
  299. data/spec/test_data/css/with-multiple-assets.css +26 -0
  300. data/spec/test_data/external_paths/1.css +4 -0
  301. data/spec/test_data/external_paths/1.html +9 -0
  302. data/spec/test_data/sample.html +15 -0
  303. data/spec/test_data/test1.jpeg +0 -0
  304. data/spec/test_data/test2.png +0 -0
  305. data/spec/test_data/test3.gif +0 -0
  306. data/spec/test_data/y.css +1 -0
  307. data/spec/test_data/z.css +3 -0
  308. data/trackman.gemspec +27 -0
  309. metadata +437 -0
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ class Rails32Tester
4
+ extend Rails32PathResolver
5
+ end
6
+
7
+
8
+ describe Rails32PathResolver do
9
+ it "serves an image linked by an html" do
10
+ parent_url = 'public/503.html'
11
+ url = '/assets/bombero.jpg'
12
+
13
+ actual = Rails32Tester.translate url, parent_url
14
+ expected = 'app/assets/images/bombero.jpg'
15
+
16
+ actual.should == expected
17
+ end
18
+
19
+ it "serves a css linked by an html" do
20
+ parent_url = 'public/503.html'
21
+ url = '/assets/bombero.css'
22
+
23
+ actual = Rails32Tester.translate url, parent_url
24
+ expected = 'app/assets/stylesheets/bombero.css'
25
+
26
+ actual.should == expected
27
+ end
28
+
29
+ it "serves an image linked in a css" do
30
+ parent_url = 'app/assets/stylesheets/bombero/tralala/trundle.css'
31
+ url = '/assets/image.jpg'
32
+
33
+ actual = Rails32Tester.translate url, parent_url
34
+ expected = 'app/assets/images/image.jpg'
35
+
36
+ actual.should == expected
37
+ end
38
+
39
+ it "serves a relative image" do
40
+ parent_url = 'app/assets/stylesheets/trundle.css'
41
+ url = 'image.jpg'
42
+
43
+ actual = Rails32Tester.translate url, parent_url
44
+ expected = 'app/assets/images/image.jpg'
45
+
46
+ actual.should == expected
47
+ end
48
+
49
+ it "serves a favicon" do
50
+ parent_url = 'public/503.html'
51
+ url = '/favicon.png'
52
+
53
+ actual = Rails32Tester.translate url, parent_url
54
+ expected = 'public/favicon.png'
55
+
56
+ actual.should == expected
57
+ end
58
+
59
+
60
+
61
+ it "works for nested paths" do
62
+ parent_url = 'app/assets/stylesheets/a/css.css'
63
+ url = '3/32/allo.png'
64
+
65
+ actual = Rails32Tester.translate url, parent_url
66
+ expected = 'app/assets/images/3/32/allo.png'
67
+
68
+ actual.should == expected
69
+ end
70
+
71
+ it "public is not buggy" do
72
+ parent_url = 'public/500.html'
73
+ url = 'assets/rails.png'
74
+
75
+ actual = Rails32Tester.translate url, parent_url
76
+ expected = 'public/assets/rails.png'
77
+
78
+ actual.should == expected
79
+ end
80
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'helpers/app_creator'
3
+ require 'helpers/fakable_pathman_tester'
4
+
5
+ describe 'full path' do
6
+ before :all do
7
+ FakablePathManTester.switch_on 'spec/fixtures/rails2311/fully-loaded/'
8
+ ActLikeRails2311.switch_on
9
+ end
10
+ before :each do
11
+ AppCreator.create
12
+ end
13
+
14
+ after :all do
15
+ AppCreator.reset
16
+ FakablePathManTester.switch_off
17
+ ActLikeRails2311.switch_off
18
+ end
19
+
20
+ it "replaces all images" do
21
+ expected = Asset.all
22
+
23
+ Asset.sync
24
+ actual = RemoteAsset.all
25
+
26
+ actual.count.should == 8
27
+ actual.should == expected
28
+ end
29
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+ require 'helpers/app_creator'
3
+ require 'helpers/fakable_pathman_tester'
4
+
5
+ describe 'first push' do
6
+ before :all do
7
+ FakablePathManTester.switch_on 'spec/fixtures/rails32/clean-install/'
8
+ end
9
+ before :each do
10
+ AppCreator.create
11
+ end
12
+
13
+ after :all do
14
+ AppCreator.reset
15
+ FakablePathManTester.switch_off
16
+ end
17
+
18
+ it "does not do anything on a clean install" do
19
+ expected = RemoteAsset.all
20
+
21
+ Asset.sync
22
+
23
+ actual = RemoteAsset.all
24
+
25
+ actual.should == expected
26
+ end
27
+ end
28
+
29
+ describe 'happy path' do
30
+ before :all do
31
+ FakablePathManTester.switch_on 'spec/fixtures/rails32/happy-path/'
32
+ end
33
+ before :each do
34
+ AppCreator.create
35
+ end
36
+
37
+ after :all do
38
+ AppCreator.reset
39
+ FakablePathManTester.switch_off
40
+ end
41
+
42
+ it "replaces the default templates by the assets" do
43
+ expected = Asset.all
44
+ Asset.sync
45
+
46
+ actual = RemoteAsset.all
47
+
48
+ actual.should == expected
49
+ end
50
+ end
51
+
52
+ describe 'full path' do
53
+ before :all do
54
+ FakablePathManTester.switch_on 'spec/fixtures/rails32/fully-loaded/'
55
+ ActLikeRails32.switch_on
56
+ end
57
+ before :each do
58
+ AppCreator.create
59
+ end
60
+
61
+ after :all do
62
+ AppCreator.reset
63
+ FakablePathManTester.switch_off
64
+ ActLikeRails32.switch_off
65
+ end
66
+
67
+ it "replaces all images" do
68
+ expected = Asset.all
69
+
70
+ Asset.sync
71
+ actual = RemoteAsset.all
72
+
73
+ actual.count.should == 7
74
+ actual.should == expected
75
+ end
76
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe Trackman::Assets::RemoteAsset do
4
+ before :all do
5
+ user = ENV['HEROKU_USERNAME']
6
+ pass = ENV['HEROKU_PASSWORD']
7
+ server = ENV['TRACKMAN_SERVER_URL']
8
+
9
+ response = RestClient.post "http://#{user}:#{pass}@#{server}/heroku/resources", :plan => 'test', :heroku_id => 123
10
+ json = JSON.parse response
11
+ @trackman_url = json['config']['TRACKMAN_URL'].gsub(/https/, 'http')
12
+
13
+ @config = [[:@@server_url, @trackman_url], [:@@site, "#{@trackman_url}/assets"]]
14
+ @config.each do |s, v|
15
+ RemoteAsset.send(:class_variable_set, s, v)
16
+ end
17
+ end
18
+
19
+ after :each do
20
+ RemoteAsset.all.each do |a|
21
+ a.delete
22
+ end
23
+
24
+ File.open('spec/test_data/y.css', 'w') {|f| f.write @old_file } unless @old_file.nil?
25
+ end
26
+
27
+ it "creates assets on the server" do
28
+ puts "b4 call#{RemoteAsset.send(:class_variable_get, :@@server_url)}"
29
+ expected = RemoteAsset.new(:path => 'spec/test_data/test2.png')
30
+ expected.create!
31
+
32
+ actual = RemoteAsset.find expected.id
33
+
34
+ actual.should eq(expected)
35
+ end
36
+
37
+ it "deletes assets on the server" do
38
+ expected = RemoteAsset.new(:path => 'spec/test_data/y.css')
39
+ expected.create!
40
+
41
+ expected.delete
42
+
43
+ lambda { RemoteAsset.find expected.id }.should raise_error(RestClient::ResourceNotFound)
44
+ end
45
+
46
+ it "returns all assets on the server" do
47
+ expected = ['spec/test_data/y.css', 'spec/test_data/a.js', '/public/503-error.html', '/public/503.html', 'spec/test_data/sample.html']
48
+
49
+ assets = ['spec/test_data/y.css', 'spec/test_data/a.js', 'spec/test_data/sample.html'].map { |f| RemoteAsset.new(:path => f) }
50
+
51
+ assets.each{|f| f.create! }
52
+
53
+ RemoteAsset.all.map{|a| a.path.to_s }.should eq(expected)
54
+ end
55
+
56
+ it "updates assets on the server" do
57
+ expected = RemoteAsset.new(:path => 'spec/test_data/y.css')
58
+
59
+ expected.create!
60
+
61
+ @old_file = File.open(expected.path) { |f| f.read }
62
+ File.open(expected.path, 'w') { |f| f.write "wassup cutie pie?" }
63
+
64
+ expected.update!
65
+ actual = RemoteAsset.find(expected.id)
66
+
67
+ actual.should eq(expected)
68
+ end
69
+
70
+ it "throws if a config is missing" do
71
+ begin
72
+ @config.each {|k,v| RemoteAsset.send(:class_variable_set, k, nil) }
73
+ @config.each do |k,v|
74
+ lambda { RemoteAsset.new(:path => 'spec/test_data/a.js') }.should raise_error(Trackman::Assets::Errors::ConfigNotFoundError)
75
+ end
76
+ ensure
77
+ @config.each {|k,v| RemoteAsset.send(:class_variable_set, k, v) }
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe Trackman::Assets::Components::Shippable do
4
+ class Test
5
+ extend Trackman::Assets::Components::Shippable
6
+
7
+ @@events = []
8
+ def self.events
9
+ @@events
10
+ end
11
+ def self.created?
12
+ @@events.any?{|h| h.has_key? :create }
13
+ end
14
+ def self.updated?
15
+ @@events.any?{|h| h.has_key? :update }
16
+ end
17
+ def self.deleted?
18
+ @@events.any?{|h| h.has_key? :delete }
19
+ end
20
+
21
+ def self.created(value)
22
+ @@events << { :create => value }
23
+ end
24
+
25
+ def self.updated(value)
26
+ @@events << { :update => value }
27
+ end
28
+
29
+ def self.deleted(value)
30
+ @@events << { :delete => value }
31
+ end
32
+
33
+ def Test.build_proc symbol, instance
34
+ case symbol
35
+ when :update
36
+ proc = Proc.new { self.updated instance }
37
+ when :create
38
+ proc = Proc.new { self.created instance }
39
+ when :delete
40
+ proc = Proc.new { self.deleted instance }
41
+ else
42
+ raise 'zomg'
43
+ end
44
+ proc
45
+ end
46
+ end
47
+
48
+ before :each do
49
+ Test.events.clear
50
+ end
51
+
52
+ it "ships the create" do
53
+ diff = {:create => ["test"], :update => [], :delete => []}
54
+
55
+ Test.ship diff
56
+
57
+ Test.created?.should be_true
58
+ Test.deleted?.should be_false
59
+ Test.updated?.should be_false
60
+ end
61
+
62
+ it "ships all of them" do
63
+ diff = {:create => ["test"], :update => ["wassup"], :delete => ["dododo"]}
64
+
65
+ Test.ship diff
66
+
67
+ Test.created?.should be_true
68
+ Test.deleted?.should be_true
69
+ Test.updated?.should be_true
70
+ end
71
+
72
+ it "sorts them before execution" do
73
+ diff = {:create => [3], :update => [2], :delete => [1]}
74
+
75
+ Test.ship diff
76
+
77
+ Test.events.map{|x| x.values.first }.should eq([1,2,3])
78
+ end
79
+ end
@@ -0,0 +1,22 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'trackman'
8
+ RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run :focus
12
+ end
13
+
14
+
15
+ Asset = Trackman::Assets::Asset unless defined?(Asset)
16
+ CssAsset = Trackman::Assets::CssAsset unless defined?(CssAsset)
17
+ HtmlAsset = Trackman::Assets::HtmlAsset unless defined?(HtmlAsset)
18
+ RemoteAsset = Trackman::Assets::RemoteAsset unless defined?(RemoteAsset)
19
+
20
+ PathResolver = Trackman::Assets::Components::PathResolver unless defined?(PathResolver)
21
+ Rails32PathResolver = Trackman::Assets::Components::Rails32PathResolver unless defined?(Rails32PathResolver)
22
+ RailsPathResolver = Trackman::Assets::Components::RailsPathResolver unless defined?(RailsPathResolver)
data/spec/sync_spec.rb ADDED
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe Trackman::Assets::Asset do
4
+ before :all do
5
+ class Asset
6
+ class << self
7
+ alias :old_sync :sync
8
+ end
9
+ end
10
+
11
+ def Asset.sync
12
+ @@called = true
13
+ end
14
+ end
15
+
16
+ after :all do
17
+ def Asset.sync
18
+ old_sync
19
+ end
20
+ end
21
+
22
+ before :each do
23
+ @@called = false
24
+
25
+ class Env
26
+ def production?
27
+ true
28
+ end
29
+ end
30
+ end
31
+
32
+ after :each do
33
+ ENV['TRACKMAN_AUTOSYNC'] = nil
34
+ begin
35
+ Object.send(:remove_const, :Rails)
36
+ rescue
37
+ end
38
+ end
39
+
40
+ it "syncs without any special config" do
41
+ Asset.autosync
42
+
43
+ @@called.should be_true
44
+ end
45
+
46
+ it "doesnt autosync if ENV is set to false/0/FALSE" do
47
+ ['false', '0', 'FALSE'].each do |v|
48
+ ENV['TRACKMAN_AUTOSYNC'] = v
49
+ Asset.autosync
50
+ end
51
+
52
+ @@called.should be_false
53
+ end
54
+
55
+ it "doesn't autosync if the env is not in production" do
56
+ class Rails
57
+ def self.env
58
+ Env.new
59
+ end
60
+ end
61
+
62
+ class Env
63
+ def production?
64
+ false
65
+ end
66
+ end
67
+
68
+ Asset.autosync
69
+
70
+ @@called.should be_false
71
+ end
72
+
73
+ it "doesn't blow up when I autosync even though something is broken" do
74
+ def Asset.sync
75
+ @@called = true
76
+ raise "something is wrong"
77
+ end
78
+ result = true
79
+
80
+ lambda { result = Asset.autosync }.should_not raise_error
81
+
82
+ result.should be_false
83
+ @@called.should be_true
84
+ end
85
+ end
@@ -0,0 +1,3 @@
1
+ function a{
2
+
3
+ }
@@ -0,0 +1,4 @@
1
+ img{
2
+ img{
3
+ width:100%;
4
+ }
Binary file
@@ -0,0 +1,3 @@
1
+ function a{
2
+
3
+ }
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" type="text/css" href="1.css" />
4
+ </head>
5
+ <body>
6
+ <img title="this is test3" src="2.gif" />
7
+ </body>
8
+ </html>
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <head>
3
+ <script src="3.js"></script>
4
+ </head>
5
+ <body>
6
+ </body>
7
+ </html>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" type="text/css" href="1.css" />
4
+ </head>
5
+ <body>
6
+ <img title="this is test3" src="2.gif" />
7
+ </body>
8
+ </html>
@@ -0,0 +1 @@
1
+ var b = 123;
@@ -0,0 +1,5 @@
1
+ var myvar = {
2
+ c : function() {
3
+ return 5 - 4;
4
+ }
5
+ };
@@ -0,0 +1,24 @@
1
+ body {
2
+ font-family: arial;
3
+ }
4
+ h1 {
5
+ background-color:#CCC;
6
+ border: 1px solid;
7
+ color:#39F;
8
+ text-align: center;
9
+ }
10
+
11
+ table {
12
+ background-color: #F60;
13
+ border: 1px solid #39F;
14
+ width: 100%;
15
+ }
16
+ td {
17
+ border: 0px;
18
+ text-align: center;
19
+ }
20
+ p {
21
+ color:#09F;
22
+ text-indent: 20px;
23
+ background:url('riding-you.jpg');
24
+ }
@@ -0,0 +1,25 @@
1
+ body {
2
+ font-family: arial;
3
+ }
4
+ h1 {
5
+ background-color:#CCC;
6
+ border: 1px solid;
7
+ color:#39F;
8
+ text-align: center;
9
+ }
10
+
11
+ table {
12
+ background-color: #F60;
13
+ border: 1px solid #39F;
14
+ width: 100%;
15
+ }
16
+ td {
17
+ border: 0px;
18
+ text-align: center;
19
+ }
20
+ p {
21
+ color:#09F;
22
+ text-indent: 20px;
23
+ }
24
+
25
+ @import url('imported-loop2.css');
@@ -0,0 +1,25 @@
1
+ body {
2
+ font-family: arial;
3
+ }
4
+ h1 {
5
+ background-color:#CCC;
6
+ border: 1px solid;
7
+ color:#39F;
8
+ text-align: center;
9
+ }
10
+
11
+ table {
12
+ background-color: #F60;
13
+ border: 1px solid #39F;
14
+ width: 100%;
15
+ }
16
+ td {
17
+ border: 0px;
18
+ text-align: center;
19
+ }
20
+ p {
21
+ color:#09F;
22
+ text-indent: 20px;
23
+ }
24
+
25
+ @import url('imported-loop1.css');
@@ -0,0 +1,13 @@
1
+ table {
2
+ background-color: black;
3
+ border: 1px solid #39F;
4
+ width: 100%;
5
+ }
6
+ td {
7
+ border: 0px;
8
+ text-align: center;
9
+ }
10
+ p {
11
+ color:#09F;
12
+ text-indent: 20px;
13
+ }
@@ -0,0 +1,13 @@
1
+ table {
2
+ background-color: white;
3
+ border: 1px solid #39F;
4
+ width: 100%;
5
+ }
6
+ td {
7
+ border: 0px;
8
+ text-align: center;
9
+ }
10
+ p {
11
+ color:#09F;
12
+ text-indent: 20px;
13
+ }
@@ -0,0 +1,40 @@
1
+
2
+
3
+
4
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
5
+ <html>
6
+ <head>
7
+ <title>My first styled page</title>
8
+ <style type="text/css">
9
+ body {
10
+ font-family: arial;
11
+ }
12
+ h1 {
13
+ background-color:#CCC;
14
+ border: 1px solid;
15
+ color:#39F;
16
+ text-align: center;
17
+ }
18
+
19
+ table {
20
+ background-color: #F60;
21
+ border: 1px solid #39F;
22
+ width: 100%;
23
+ }
24
+ td {
25
+ border: 0px;
26
+ text-align: center;
27
+ }
28
+
29
+ p {
30
+ color:#09F;
31
+ text-indent: 20px;
32
+ }
33
+ @import url('imported-lvl2.css');
34
+ </style>
35
+ </head>
36
+
37
+ <body>
38
+
39
+ </body>
40
+ </html>
@@ -0,0 +1,25 @@
1
+ body {
2
+ font-family: arial;
3
+ }
4
+ h1 {
5
+ background-color:#CCC;
6
+ border: 1px solid;
7
+ color:#39F;
8
+ text-align: center;
9
+ }
10
+
11
+ table {
12
+ background-color: #F60;
13
+ border: 1px solid #39F;
14
+ width: 100%;
15
+ }
16
+ td {
17
+ border: 0px;
18
+ text-align: center;
19
+ }
20
+ p {
21
+ color:#09F;
22
+ text-indent: 20px;
23
+ }
24
+
25
+ @import url('imported-lvl3.css');