trackman 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +49 -0
- data/LICENSE +17 -0
- data/README.md +96 -0
- data/Rakefile +52 -0
- data/lib/tasks.rb +7 -0
- data/lib/trackman/assets/asset.rb +97 -0
- data/lib/trackman/assets/components/asset_factory.rb +41 -0
- data/lib/trackman/assets/components/asset_factory.rb.orig +54 -0
- data/lib/trackman/assets/components/composite_asset.rb +39 -0
- data/lib/trackman/assets/components/conventions.rb +23 -0
- data/lib/trackman/assets/components/diffable.rb +29 -0
- data/lib/trackman/assets/components/hashable.rb +30 -0
- data/lib/trackman/assets/components/path_resolver.rb +34 -0
- data/lib/trackman/assets/components/rails32_path_resolver.rb +49 -0
- data/lib/trackman/assets/components/rails_path_resolver.rb +34 -0
- data/lib/trackman/assets/components/shippable.rb +31 -0
- data/lib/trackman/assets/components.rb +11 -0
- data/lib/trackman/assets/css_asset.rb +11 -0
- data/lib/trackman/assets/errors/asset_not_found_error.rb +8 -0
- data/lib/trackman/assets/errors/config_not_found_error.rb +8 -0
- data/lib/trackman/assets/errors.rb +10 -0
- data/lib/trackman/assets/html_asset.rb +30 -0
- data/lib/trackman/assets/remote_asset.rb +72 -0
- data/lib/trackman/assets.rb +37 -0
- data/lib/trackman/rack_middleware.rb +12 -0
- data/lib/trackman/railtie.rb +7 -0
- data/lib/trackman/version.rb +3 -0
- data/lib/trackman.rb +34 -0
- data/rails_generators/trackman/templates/trackman.rake +59 -0
- data/rails_generators/trackman/trackman_generator.rb +8 -0
- data/spec/asset_all_spec.rb +136 -0
- data/spec/asset_factory_spec.rb +70 -0
- data/spec/asset_spec.rb +99 -0
- data/spec/composite_asset_spec.rb +12 -0
- data/spec/css_asset_spec.rb +39 -0
- data/spec/diffable_spec.rb +57 -0
- data/spec/fixtures/rails2311/fully-loaded/README +243 -0
- data/spec/fixtures/rails2311/fully-loaded/Rakefile +10 -0
- data/spec/fixtures/rails2311/fully-loaded/app/controllers/application_controller.rb +10 -0
- data/spec/fixtures/rails2311/fully-loaded/app/helpers/application_helper.rb +3 -0
- data/spec/fixtures/rails2311/fully-loaded/config/boot.rb +114 -0
- data/spec/fixtures/rails2311/fully-loaded/config/database.yml +22 -0
- data/spec/fixtures/rails2311/fully-loaded/config/environment.rb +41 -0
- data/spec/fixtures/rails2311/fully-loaded/config/environments/development.rb +17 -0
- data/spec/fixtures/rails2311/fully-loaded/config/environments/production.rb +28 -0
- data/spec/fixtures/rails2311/fully-loaded/config/environments/test.rb +28 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/cookie_verification_secret.rb +7 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/inflections.rb +10 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/new_rails_defaults.rb +21 -0
- data/spec/fixtures/rails2311/fully-loaded/config/initializers/session_store.rb +15 -0
- data/spec/fixtures/rails2311/fully-loaded/config/locales/en.yml +5 -0
- data/spec/fixtures/rails2311/fully-loaded/config/routes.rb +43 -0
- data/spec/fixtures/rails2311/fully-loaded/db/seeds.rb +7 -0
- data/spec/fixtures/rails2311/fully-loaded/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails2311/fully-loaded/log/development.log +0 -0
- data/spec/fixtures/rails2311/fully-loaded/log/production.log +0 -0
- data/spec/fixtures/rails2311/fully-loaded/log/server.log +0 -0
- data/spec/fixtures/rails2311/fully-loaded/log/test.log +0 -0
- data/spec/fixtures/rails2311/fully-loaded/public/404.html +30 -0
- data/spec/fixtures/rails2311/fully-loaded/public/422.html +30 -0
- data/spec/fixtures/rails2311/fully-loaded/public/500.html +30 -0
- data/spec/fixtures/rails2311/fully-loaded/public/503-error.html +24 -0
- data/spec/fixtures/rails2311/fully-loaded/public/503-error.html~ +24 -0
- data/spec/fixtures/rails2311/fully-loaded/public/503.html +275 -0
- data/spec/fixtures/rails2311/fully-loaded/public/503.html~ +275 -0
- data/spec/fixtures/rails2311/fully-loaded/public/favicon.ico +0 -0
- data/spec/fixtures/rails2311/fully-loaded/public/images/rails.png +0 -0
- data/spec/fixtures/rails2311/fully-loaded/public/index.html +275 -0
- data/spec/fixtures/rails2311/fully-loaded/public/javascripts/application.js +2 -0
- data/spec/fixtures/rails2311/fully-loaded/public/javascripts/controls.js +963 -0
- data/spec/fixtures/rails2311/fully-loaded/public/javascripts/dragdrop.js +973 -0
- data/spec/fixtures/rails2311/fully-loaded/public/javascripts/effects.js +1128 -0
- data/spec/fixtures/rails2311/fully-loaded/public/javascripts/prototype.js +4320 -0
- data/spec/fixtures/rails2311/fully-loaded/public/robots.txt +5 -0
- data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/application.css +13 -0
- data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/some-other-css.css +3 -0
- data/spec/fixtures/rails2311/fully-loaded/public/stylesheets/sub-css/sub-css.css +1 -0
- data/spec/fixtures/rails2311/fully-loaded/script/about +4 -0
- data/spec/fixtures/rails2311/fully-loaded/script/console +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/dbconsole +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/destroy +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/generate +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/performance/benchmarker +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/performance/profiler +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/plugin +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/runner +3 -0
- data/spec/fixtures/rails2311/fully-loaded/script/server +3 -0
- data/spec/fixtures/rails2311/fully-loaded/test/performance/browsing_test.rb +9 -0
- data/spec/fixtures/rails2311/fully-loaded/test/test_helper.rb +38 -0
- data/spec/fixtures/rails2311/template/README +243 -0
- data/spec/fixtures/rails2311/template/Rakefile +10 -0
- data/spec/fixtures/rails2311/template/app/controllers/application_controller.rb +10 -0
- data/spec/fixtures/rails2311/template/app/helpers/application_helper.rb +3 -0
- data/spec/fixtures/rails2311/template/config/boot.rb +114 -0
- data/spec/fixtures/rails2311/template/config/database.yml +22 -0
- data/spec/fixtures/rails2311/template/config/environment.rb +41 -0
- data/spec/fixtures/rails2311/template/config/environments/development.rb +17 -0
- data/spec/fixtures/rails2311/template/config/environments/production.rb +28 -0
- data/spec/fixtures/rails2311/template/config/environments/test.rb +28 -0
- data/spec/fixtures/rails2311/template/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails2311/template/config/initializers/cookie_verification_secret.rb +7 -0
- data/spec/fixtures/rails2311/template/config/initializers/inflections.rb +10 -0
- data/spec/fixtures/rails2311/template/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails2311/template/config/initializers/new_rails_defaults.rb +21 -0
- data/spec/fixtures/rails2311/template/config/initializers/session_store.rb +15 -0
- data/spec/fixtures/rails2311/template/config/locales/en.yml +5 -0
- data/spec/fixtures/rails2311/template/config/routes.rb +43 -0
- data/spec/fixtures/rails2311/template/db/seeds.rb +7 -0
- data/spec/fixtures/rails2311/template/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails2311/template/log/development.log +0 -0
- data/spec/fixtures/rails2311/template/log/production.log +0 -0
- data/spec/fixtures/rails2311/template/log/server.log +0 -0
- data/spec/fixtures/rails2311/template/log/test.log +0 -0
- data/spec/fixtures/rails2311/template/public/404.html +30 -0
- data/spec/fixtures/rails2311/template/public/422.html +30 -0
- data/spec/fixtures/rails2311/template/public/500.html +30 -0
- data/spec/fixtures/rails2311/template/public/favicon.ico +0 -0
- data/spec/fixtures/rails2311/template/public/images/rails.png +0 -0
- data/spec/fixtures/rails2311/template/public/index.html +275 -0
- data/spec/fixtures/rails2311/template/public/javascripts/application.js +2 -0
- data/spec/fixtures/rails2311/template/public/javascripts/controls.js +963 -0
- data/spec/fixtures/rails2311/template/public/javascripts/dragdrop.js +973 -0
- data/spec/fixtures/rails2311/template/public/javascripts/effects.js +1128 -0
- data/spec/fixtures/rails2311/template/public/javascripts/prototype.js +4320 -0
- data/spec/fixtures/rails2311/template/public/robots.txt +5 -0
- data/spec/fixtures/rails2311/template/script/about +4 -0
- data/spec/fixtures/rails2311/template/script/console +3 -0
- data/spec/fixtures/rails2311/template/script/dbconsole +3 -0
- data/spec/fixtures/rails2311/template/script/destroy +3 -0
- data/spec/fixtures/rails2311/template/script/generate +3 -0
- data/spec/fixtures/rails2311/template/script/performance/benchmarker +3 -0
- data/spec/fixtures/rails2311/template/script/performance/profiler +3 -0
- data/spec/fixtures/rails2311/template/script/plugin +3 -0
- data/spec/fixtures/rails2311/template/script/runner +3 -0
- data/spec/fixtures/rails2311/template/script/server +3 -0
- data/spec/fixtures/rails2311/template/test/performance/browsing_test.rb +9 -0
- data/spec/fixtures/rails2311/template/test/test_helper.rb +38 -0
- data/spec/fixtures/rails32/clean-install/.gitignore +15 -0
- data/spec/fixtures/rails32/clean-install/Gemfile +38 -0
- data/spec/fixtures/rails32/clean-install/README.rdoc +261 -0
- data/spec/fixtures/rails32/clean-install/Rakefile +7 -0
- data/spec/fixtures/rails32/clean-install/app/assets/images/rails.png +0 -0
- data/spec/fixtures/rails32/clean-install/app/assets/javascripts/application.js +15 -0
- data/spec/fixtures/rails32/clean-install/app/assets/stylesheets/application.css +13 -0
- data/spec/fixtures/rails32/clean-install/app/controllers/application_controller.rb +3 -0
- data/spec/fixtures/rails32/clean-install/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails32/clean-install/app/mailers/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/app/models/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/app/views/layouts/application.html.erb +14 -0
- data/spec/fixtures/rails32/clean-install/config/application.rb +59 -0
- data/spec/fixtures/rails32/clean-install/config/boot.rb +6 -0
- data/spec/fixtures/rails32/clean-install/config/database.yml +25 -0
- data/spec/fixtures/rails32/clean-install/config/environment.rb +5 -0
- data/spec/fixtures/rails32/clean-install/config/environments/development.rb +37 -0
- data/spec/fixtures/rails32/clean-install/config/environments/production.rb +67 -0
- data/spec/fixtures/rails32/clean-install/config/environments/test.rb +37 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/inflections.rb +15 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/secret_token.rb +7 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/session_store.rb +8 -0
- data/spec/fixtures/rails32/clean-install/config/initializers/wrap_parameters.rb +14 -0
- data/spec/fixtures/rails32/clean-install/config/locales/en.yml +5 -0
- data/spec/fixtures/rails32/clean-install/config/routes.rb +58 -0
- data/spec/fixtures/rails32/clean-install/config.ru +4 -0
- data/spec/fixtures/rails32/clean-install/db/seeds.rb +7 -0
- data/spec/fixtures/rails32/clean-install/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails32/clean-install/lib/assets/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/lib/tasks/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/log/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/public/404.html +26 -0
- data/spec/fixtures/rails32/clean-install/public/422.html +26 -0
- data/spec/fixtures/rails32/clean-install/public/500.html +25 -0
- data/spec/fixtures/rails32/clean-install/public/favicon.ico +0 -0
- data/spec/fixtures/rails32/clean-install/public/index.html +241 -0
- data/spec/fixtures/rails32/clean-install/public/robots.txt +5 -0
- data/spec/fixtures/rails32/clean-install/script/rails +6 -0
- data/spec/fixtures/rails32/clean-install/test/fixtures/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/test/functional/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/test/integration/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/test/performance/browsing_test.rb +12 -0
- data/spec/fixtures/rails32/clean-install/test/test_helper.rb +13 -0
- data/spec/fixtures/rails32/clean-install/test/unit/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/fixtures/rails32/clean-install/vendor/plugins/.gitkeep +0 -0
- data/spec/fixtures/rails32/fully-loaded/Gemfile +37 -0
- data/spec/fixtures/rails32/fully-loaded/README.rdoc +261 -0
- data/spec/fixtures/rails32/fully-loaded/Rakefile +7 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/images/rails.png +0 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/images/riding-you.jpg +0 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/javascripts/application.js +16 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/application.css +13 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/some-other-css.css +3 -0
- data/spec/fixtures/rails32/fully-loaded/app/assets/stylesheets/sub-css/sub-css.css +1 -0
- data/spec/fixtures/rails32/fully-loaded/app/controllers/application_controller.rb +3 -0
- data/spec/fixtures/rails32/fully-loaded/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails32/fully-loaded/app/views/layouts/application.html.erb +14 -0
- data/spec/fixtures/rails32/fully-loaded/config/application.rb +65 -0
- data/spec/fixtures/rails32/fully-loaded/config/boot.rb +6 -0
- data/spec/fixtures/rails32/fully-loaded/config/environment.rb +5 -0
- data/spec/fixtures/rails32/fully-loaded/config/environments/development.rb +31 -0
- data/spec/fixtures/rails32/fully-loaded/config/environments/production.rb +64 -0
- data/spec/fixtures/rails32/fully-loaded/config/environments/test.rb +35 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/inflections.rb +15 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/secret_token.rb +7 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/session_store.rb +8 -0
- data/spec/fixtures/rails32/fully-loaded/config/initializers/wrap_parameters.rb +10 -0
- data/spec/fixtures/rails32/fully-loaded/config/locales/en.yml +5 -0
- data/spec/fixtures/rails32/fully-loaded/config/routes.rb +58 -0
- data/spec/fixtures/rails32/fully-loaded/config.ru +4 -0
- data/spec/fixtures/rails32/fully-loaded/db/seeds.rb +7 -0
- data/spec/fixtures/rails32/fully-loaded/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails32/fully-loaded/public/404.html +26 -0
- data/spec/fixtures/rails32/fully-loaded/public/422.html +26 -0
- data/spec/fixtures/rails32/fully-loaded/public/500.html +25 -0
- data/spec/fixtures/rails32/fully-loaded/public/503-error.html +25 -0
- data/spec/fixtures/rails32/fully-loaded/public/503.html +13 -0
- data/spec/fixtures/rails32/fully-loaded/public/favicon.ico +0 -0
- data/spec/fixtures/rails32/fully-loaded/public/index.html +241 -0
- data/spec/fixtures/rails32/fully-loaded/public/robots.txt +5 -0
- data/spec/fixtures/rails32/fully-loaded/script/rails +6 -0
- data/spec/fixtures/rails32/happy-path/Gemfile +37 -0
- data/spec/fixtures/rails32/happy-path/README.rdoc +261 -0
- data/spec/fixtures/rails32/happy-path/Rakefile +7 -0
- data/spec/fixtures/rails32/happy-path/app/assets/images/rails.png +0 -0
- data/spec/fixtures/rails32/happy-path/app/assets/javascripts/application.js +15 -0
- data/spec/fixtures/rails32/happy-path/app/assets/stylesheets/application.css +13 -0
- data/spec/fixtures/rails32/happy-path/app/controllers/application_controller.rb +3 -0
- data/spec/fixtures/rails32/happy-path/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails32/happy-path/app/views/layouts/application.html.erb +14 -0
- data/spec/fixtures/rails32/happy-path/config/application.rb +65 -0
- data/spec/fixtures/rails32/happy-path/config/boot.rb +6 -0
- data/spec/fixtures/rails32/happy-path/config/environment.rb +5 -0
- data/spec/fixtures/rails32/happy-path/config/environments/development.rb +31 -0
- data/spec/fixtures/rails32/happy-path/config/environments/production.rb +64 -0
- data/spec/fixtures/rails32/happy-path/config/environments/test.rb +35 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/inflections.rb +15 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/mime_types.rb +5 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/secret_token.rb +7 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/session_store.rb +8 -0
- data/spec/fixtures/rails32/happy-path/config/initializers/wrap_parameters.rb +10 -0
- data/spec/fixtures/rails32/happy-path/config/locales/en.yml +5 -0
- data/spec/fixtures/rails32/happy-path/config/routes.rb +58 -0
- data/spec/fixtures/rails32/happy-path/config.ru +4 -0
- data/spec/fixtures/rails32/happy-path/db/seeds.rb +7 -0
- data/spec/fixtures/rails32/happy-path/doc/README_FOR_APP +2 -0
- data/spec/fixtures/rails32/happy-path/public/404.html +26 -0
- data/spec/fixtures/rails32/happy-path/public/422.html +26 -0
- data/spec/fixtures/rails32/happy-path/public/500.html +25 -0
- data/spec/fixtures/rails32/happy-path/public/503-error.html +12 -0
- data/spec/fixtures/rails32/happy-path/public/503.html +11 -0
- data/spec/fixtures/rails32/happy-path/public/favicon.ico +0 -0
- data/spec/fixtures/rails32/happy-path/public/index.html +241 -0
- data/spec/fixtures/rails32/happy-path/public/robots.txt +5 -0
- data/spec/fixtures/rails32/happy-path/script/rails +6 -0
- data/spec/helpers/app_creator.rb +28 -0
- data/spec/helpers/fakable_pathman_tester.rb +117 -0
- data/spec/html_asset_spec.rb +51 -0
- data/spec/path_spec.rb +6 -0
- data/spec/paths/fakable_pathman_tester_spec.rb +36 -0
- data/spec/paths/pathman_spec.rb +64 -0
- data/spec/paths/rails32_pathman_spec.rb +80 -0
- data/spec/rails2311/first_push_spec.rb +29 -0
- data/spec/rails32/first_push_spec.rb +76 -0
- data/spec/remote_asset_spec.rb +80 -0
- data/spec/shippable_spec.rb +79 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/sync_spec.rb +85 -0
- data/spec/test_data/a.js +3 -0
- data/spec/test_data/all/1.css +4 -0
- data/spec/test_data/all/2.gif +0 -0
- data/spec/test_data/all/3.js +3 -0
- data/spec/test_data/all/all.html +8 -0
- data/spec/test_data/all/all2.html +7 -0
- data/spec/test_data/all/all3.html +8 -0
- data/spec/test_data/b.js +1 -0
- data/spec/test_data/c.js +5 -0
- data/spec/test_data/css/image/riding-you.jpg +0 -0
- data/spec/test_data/css/image/with-image.css +24 -0
- data/spec/test_data/css/imported-loop1.css +25 -0
- data/spec/test_data/css/imported-loop2.css +25 -0
- data/spec/test_data/css/imported.css +13 -0
- data/spec/test_data/css/imported2.css +13 -0
- data/spec/test_data/css/recursive/html-with-css.html +40 -0
- data/spec/test_data/css/recursive/imported-lvl2.css +25 -0
- data/spec/test_data/css/recursive/imported-lvl3.css +24 -0
- data/spec/test_data/css/recursive/imported-recursive.css +25 -0
- data/spec/test_data/css/recursive/riding-you.jpg +0 -0
- data/spec/test_data/css/with-asset.css +25 -0
- data/spec/test_data/css/with-multiple-assets.css +26 -0
- data/spec/test_data/external_paths/1.css +4 -0
- data/spec/test_data/external_paths/1.html +9 -0
- data/spec/test_data/sample.html +15 -0
- data/spec/test_data/test1.jpeg +0 -0
- data/spec/test_data/test2.png +0 -0
- data/spec/test_data/test3.gif +0 -0
- data/spec/test_data/y.css +1 -0
- data/spec/test_data/z.css +3 -0
- data/trackman.gemspec +27 -0
- metadata +437 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
module Trackman
|
2
|
+
module Assets
|
3
|
+
module Components
|
4
|
+
module Shippable
|
5
|
+
def ship diff
|
6
|
+
to_ship = diff.inject([])do |memo, (k, v)|
|
7
|
+
memo + v.map{ |x| {:proc => build_proc(k, x), :value => x} }
|
8
|
+
end
|
9
|
+
|
10
|
+
to_ship.sort_by{ |x| x[:value] }.each do |x|
|
11
|
+
x[:proc].call
|
12
|
+
end
|
13
|
+
end
|
14
|
+
private
|
15
|
+
def build_proc symbol, instance
|
16
|
+
case symbol
|
17
|
+
when :update
|
18
|
+
proc = Proc.new { instance.update! }
|
19
|
+
when :create
|
20
|
+
proc = Proc.new { instance.create! }
|
21
|
+
when :delete
|
22
|
+
proc = Proc.new { instance.delete }
|
23
|
+
else
|
24
|
+
raise "something is wrong."
|
25
|
+
end
|
26
|
+
proc
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Trackman
|
2
|
+
module Assets
|
3
|
+
module Components
|
4
|
+
@@modules = [:Conventions, :Diffable, :Hashable, :Shippable, :CompositeAsset, :AssetFactory, :PathResolver, :Rails32PathResolver, :RailsPathResolver]
|
5
|
+
|
6
|
+
::Trackman::Assets.autoloads 'trackman/assets/components', @@modules do |s,p|
|
7
|
+
autoload s, p
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
module Trackman
|
3
|
+
module Assets
|
4
|
+
class HtmlAsset < Asset
|
5
|
+
include Components::CompositeAsset
|
6
|
+
|
7
|
+
def document
|
8
|
+
@doc ||= Nokogiri::HTML(data)
|
9
|
+
end
|
10
|
+
|
11
|
+
def img_paths
|
12
|
+
@images_paths ||= refine_path(document.css('img'), 'src')
|
13
|
+
end
|
14
|
+
def js_paths
|
15
|
+
@js_paths ||= refine_path(document.xpath('//script'), 'src')
|
16
|
+
end
|
17
|
+
def css_paths
|
18
|
+
@css_paths ||= refine_path(document.xpath('//link[@type="text/css"]'), 'href')
|
19
|
+
end
|
20
|
+
|
21
|
+
def children_paths
|
22
|
+
@children_paths ||= img_paths + js_paths + css_paths + inner_css_paths
|
23
|
+
end
|
24
|
+
|
25
|
+
def refine_path(paths, node)
|
26
|
+
paths.collect{|n| n[node].to_s }.select{|n|n && n =~/\w/ && n.internal_path? }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module Trackman
|
6
|
+
module Assets
|
7
|
+
class RemoteAsset < Asset
|
8
|
+
@@server_url = ENV['TRACKMAN_URL']
|
9
|
+
@@site = "#{@@server_url}/assets"
|
10
|
+
|
11
|
+
attr_reader :id
|
12
|
+
|
13
|
+
def initialize attributes = {}
|
14
|
+
ensure_config
|
15
|
+
super
|
16
|
+
|
17
|
+
@id = attributes[:id]
|
18
|
+
@file_hash = attributes[:file_hash]
|
19
|
+
end
|
20
|
+
|
21
|
+
def file_hash
|
22
|
+
@file_hash || super
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate_path?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find id
|
30
|
+
response = RestClient.get "#{@@site}/#{id}"
|
31
|
+
body = Hash[JSON.parse(response).map{ |k, v| [k.to_sym, v] }]
|
32
|
+
RemoteAsset.new(body)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.all
|
36
|
+
JSON.parse(RestClient.get @@site).map{|r| Hash[r.map{ |k, v| [k.to_sym, v] }] }.map { |r| RemoteAsset.new(r) }.sort
|
37
|
+
end
|
38
|
+
|
39
|
+
def create!
|
40
|
+
puts "server = #{@@server_url}"
|
41
|
+
puts "site = #{@@site}"
|
42
|
+
response = RestClient.post @@site, :asset => {:path => path.to_s, :file => File.open(path)}, :content_type => :json, :accept => :json
|
43
|
+
path = response.headers[:location]
|
44
|
+
@id = path[/\d+$/].to_i
|
45
|
+
end
|
46
|
+
|
47
|
+
def update!
|
48
|
+
RestClient.put "#{@@site}/#{id}", :asset => {:path => path, :file => File.open(path)}, :content_type => :json, :accept => :json
|
49
|
+
end
|
50
|
+
def delete
|
51
|
+
response = RestClient.delete "#{@@site}/#{id}"
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
def ==(other)
|
56
|
+
result = super
|
57
|
+
if result
|
58
|
+
if other.is_a? RemoteAsset
|
59
|
+
result = other.id == id && other.file_hash == file_hash
|
60
|
+
end
|
61
|
+
return result
|
62
|
+
end
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def ensure_config
|
68
|
+
raise Errors::ConfigNotFoundError, "The config TRACKMAN_URL is missing." if @@server_url.nil?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class String
|
2
|
+
def trackman_underscore
|
3
|
+
word = dup
|
4
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
5
|
+
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
6
|
+
word.tr!("-", "_")
|
7
|
+
word.downcase!
|
8
|
+
word
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Symbol
|
13
|
+
def trackman_underscore
|
14
|
+
to_s.trackman_underscore
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Trackman
|
19
|
+
module Assets
|
20
|
+
|
21
|
+
#TODO do something better than this to share the scope
|
22
|
+
def self.autoloads path, items
|
23
|
+
items.each do |s|
|
24
|
+
if block_given?
|
25
|
+
yield(s, "#{path}/#{s.trackman_underscore}" )
|
26
|
+
else
|
27
|
+
autoload s, "#{path}/#{s.trackman_underscore}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
@@classes = [:Asset, :HtmlAsset, :RemoteAsset, :CssAsset]
|
33
|
+
@@modules = [:Components, :Errors]
|
34
|
+
|
35
|
+
autoloads 'trackman/assets', @@classes.concat(@@modules)
|
36
|
+
end
|
37
|
+
end
|
data/lib/trackman.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
require 'tasks'
|
4
|
+
|
5
|
+
module Trackman
|
6
|
+
autoload :RackMiddleware, 'trackman/rack_middleware'
|
7
|
+
autoload :Assets, 'trackman/assets'
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined?(Rails)
|
11
|
+
if ::Rails::VERSION::STRING =~ /^2\.[1-9]/
|
12
|
+
Rails.configuration.middleware.use Trackman::RackMiddleware
|
13
|
+
elsif ::Rails::VERSION::STRING =~ /^[3-9]\.[1-9]/
|
14
|
+
require "trackman/railtie"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
#ruby 1.8.7 does not take blocks (this fixes it) -- used in Asset.all
|
20
|
+
if RUBY_VERSION !~ /^1\.9/
|
21
|
+
class Array
|
22
|
+
def uniq
|
23
|
+
ret, keys = [], []
|
24
|
+
each do |x|
|
25
|
+
key = block_given? ? yield(x) : x
|
26
|
+
unless keys.include? key
|
27
|
+
ret << x
|
28
|
+
keys << key
|
29
|
+
end
|
30
|
+
end
|
31
|
+
ret
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'trackman'
|
2
|
+
namespace :trackman do
|
3
|
+
ERROR = 'ERROR_PAGE_URL'
|
4
|
+
MAINTENANCE = 'MAINTENANCE_PAGE_URL'
|
5
|
+
TRACKMAN_ERROR = 'TRACKMAN_ERROR_PAGE_URL'
|
6
|
+
TRACKMAN_MAINTENANCE = 'TRACKMAN_MAINTENANCE_PAGE_URL'
|
7
|
+
|
8
|
+
desc "Syncs your assets with the server, this is what gets executed when you deploy to heroku."
|
9
|
+
task :sync do
|
10
|
+
Trackman::Assets::Asset.sync
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Sets up the heroku configs required by Trackman"
|
14
|
+
task :setup do
|
15
|
+
heroku_version = `heroku version`
|
16
|
+
if heroku_version !~ /^[2-9]\.[2-9]/
|
17
|
+
puts "your heroku version is too low, we recommend '~> 2.26' at least"
|
18
|
+
else
|
19
|
+
configs = `heroku config -s`
|
20
|
+
rename_configs configs
|
21
|
+
add_configs configs
|
22
|
+
puts "done! Thank you for using Trackman!"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def rename_configs configs
|
27
|
+
bkp = {}
|
28
|
+
|
29
|
+
[ERROR, MAINTENANCE].each do |c|
|
30
|
+
bkp[c] = extract_config_value(configs, c) if configs.include? c
|
31
|
+
end
|
32
|
+
|
33
|
+
add = Hash[bkp.map {|k, v| [k + ".bkp", v] }].map{|k,v| "#{k}=#{v}" }.join(' ')
|
34
|
+
|
35
|
+
`heroku config:add #{add}`
|
36
|
+
puts "backuping configs to heroku...\n running heroku config:add #{add}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_configs configs
|
40
|
+
puts "overriding the required heroku configs #{MAINTENANCE} and #{ERROR}"
|
41
|
+
|
42
|
+
if configs.include?(TRACKMAN_ERROR) && configs.include?(TRACKMAN_MAINTENANCE)
|
43
|
+
trackman_configs = {}
|
44
|
+
[[TRACKMAN_ERROR, ERROR], [TRACKMAN_MAINTENANCE, MAINTENANCE]].each do |old_c, new_c|
|
45
|
+
trackman_configs[new_c] = extract_config_value(configs, old_c)
|
46
|
+
end
|
47
|
+
|
48
|
+
add = trackman_configs.map{|k,v| "#{k}=#{v}" }.join(' ')
|
49
|
+
`heroku config:add #{add}`
|
50
|
+
puts "running heroku config:add #{add}"
|
51
|
+
else
|
52
|
+
puts "cannot find trackman configuration, make sure trackman addon is installed"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def extract_config_value configs, name
|
57
|
+
configs[/#{name}=.+$/][/[^=]+$/]
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Trackman::Assets::Asset do
|
4
|
+
class TestAsset < Asset
|
5
|
+
end
|
6
|
+
|
7
|
+
describe "#all" do
|
8
|
+
it "returns every asset for a given maintenance path" do
|
9
|
+
class TestAsset
|
10
|
+
def self.maintenance_page
|
11
|
+
Asset.create(:path => 'spec/test_data/all/all.html')
|
12
|
+
end
|
13
|
+
def self.maintenance_path
|
14
|
+
Pathname.new('spec/test_data/all/all.html')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
expected = [
|
19
|
+
TestAsset.create(:path => 'spec/test_data/all/1.css'),
|
20
|
+
TestAsset.create(:path => 'spec/test_data/all/2.gif'),
|
21
|
+
TestAsset.maintenance_page
|
22
|
+
]
|
23
|
+
|
24
|
+
actual = TestAsset.all
|
25
|
+
|
26
|
+
actual.should eq(expected)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
it "includes assets from error page if it is also specified" do
|
31
|
+
class TestAsset
|
32
|
+
def self.maintenance_page
|
33
|
+
TestAsset.create(:path => 'spec/test_data/all/all.html')
|
34
|
+
end
|
35
|
+
def self.error_page
|
36
|
+
TestAsset.create(:path => 'spec/test_data/all/all2.html')
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.maintenance_path
|
40
|
+
Pathname.new('spec/test_data/all/all.html')
|
41
|
+
end
|
42
|
+
def self.error_path
|
43
|
+
Pathname.new('spec/test_data/all/all2.html')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
expected = [
|
48
|
+
TestAsset.create(:path => 'spec/test_data/all/3.js'),
|
49
|
+
TestAsset.create(:path => 'spec/test_data/all/2.gif'),
|
50
|
+
TestAsset.create(:path => 'spec/test_data/all/1.css'),
|
51
|
+
TestAsset.maintenance_page,
|
52
|
+
TestAsset.error_page
|
53
|
+
]
|
54
|
+
actual = TestAsset.all
|
55
|
+
|
56
|
+
actual.map{|x| x.path}.should == expected.map{|x| x.path}
|
57
|
+
actual.should eq(expected)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "does not include the same asset twice" do
|
61
|
+
class TestAsset
|
62
|
+
def self.maintenance_page
|
63
|
+
TestAsset.create(:path => 'spec/test_data/all/all.html')
|
64
|
+
end
|
65
|
+
def self.error_page
|
66
|
+
TestAsset.create(:path => 'spec/test_data/all/all3.html')
|
67
|
+
end
|
68
|
+
def self.maintenance_path
|
69
|
+
Pathname.new('spec/test_data/all/all.html')
|
70
|
+
end
|
71
|
+
def self.error_path
|
72
|
+
Pathname.new('spec/test_data/all/all3.html')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
expected = [
|
77
|
+
TestAsset.create(:path => 'spec/test_data/all/1.css'),
|
78
|
+
TestAsset.create(:path => 'spec/test_data/all/2.gif'),
|
79
|
+
TestAsset.maintenance_page,
|
80
|
+
TestAsset.error_page
|
81
|
+
]
|
82
|
+
|
83
|
+
actual = TestAsset.all
|
84
|
+
|
85
|
+
actual.should eq(expected)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "testing equality of 2 assets" do
|
89
|
+
one = [TestAsset.create(:path => 'spec/test_data/all/all3.html'), TestAsset.create(:path => 'spec/test_data/all/all3.html')]
|
90
|
+
the_same = [TestAsset.create(:path => 'spec/test_data/all/all3.html'), TestAsset.create(:path => 'spec/test_data/all/all3.html')]
|
91
|
+
|
92
|
+
one.should eq(the_same)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "does not include external assets" do
|
96
|
+
class TestAsset
|
97
|
+
def self.maintenance_page
|
98
|
+
TestAsset.create(:path => 'spec/test_data/external_paths/1.html')
|
99
|
+
end
|
100
|
+
def self.error_page
|
101
|
+
TestAsset.create(:path => '/invalid/path')
|
102
|
+
end
|
103
|
+
def self.maintenance_path
|
104
|
+
Pathname.new('spec/test_data/external_paths/1.html')
|
105
|
+
end
|
106
|
+
def self.error_path
|
107
|
+
Pathname.new('/invalid/path')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
expected = [TestAsset.create(:path => 'spec/test_data/external_paths/1.css'), TestAsset.maintenance_page]
|
112
|
+
|
113
|
+
TestAsset.all.should eq(expected)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "return html assets always at the end" do
|
117
|
+
class TestAsset
|
118
|
+
def self.maintenance_page
|
119
|
+
TestAsset.create(:path => 'spec/test_data/external_paths/1.html')
|
120
|
+
end
|
121
|
+
def self.error_page
|
122
|
+
TestAsset.create(:path => 'spec/test_data/external_paths/1.html')
|
123
|
+
end
|
124
|
+
def self.maintenance_path
|
125
|
+
Pathname.new('spec/test_data/external_paths/1.html')
|
126
|
+
end
|
127
|
+
def self.error_path
|
128
|
+
Pathname.new('spec/test_data/external_paths/1.html')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
expected = [TestAsset.create(:path => 'spec/test_data/external_paths/1.css'), TestAsset.maintenance_page]
|
133
|
+
TestAsset.all.should eq(expected)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Trackman::Assets::Components::AssetFactory do
|
4
|
+
class TestFactory
|
5
|
+
extend Trackman::Assets::Components::AssetFactory
|
6
|
+
end
|
7
|
+
|
8
|
+
before :all do
|
9
|
+
class Trackman::Assets::Asset
|
10
|
+
def validate_path?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
after :each do
|
16
|
+
begin
|
17
|
+
Object.send(:remove_const, :Rails)
|
18
|
+
rescue
|
19
|
+
end
|
20
|
+
end
|
21
|
+
after :all do
|
22
|
+
class Trackman::Assets::Asset
|
23
|
+
def validate_path?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns an HtmlAsset" do
|
30
|
+
asset = TestFactory.create(:path => 'spec/test_data/sample.html')
|
31
|
+
|
32
|
+
asset.should be_a_kind_of HtmlAsset
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
it "returns a Rails32 when asset pipeline is configured to be used" do
|
37
|
+
module Rails
|
38
|
+
def self.application
|
39
|
+
Rails::App.new
|
40
|
+
end
|
41
|
+
|
42
|
+
class App
|
43
|
+
def config
|
44
|
+
Rails::Config.new
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Config
|
49
|
+
def assets
|
50
|
+
Rails::Assets.new
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class Assets
|
55
|
+
def enabled
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
TestFactory.asset_pipeline_enabled?.should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
it "returns a normal asset if asset pipepeline is not defined or not used" do
|
65
|
+
|
66
|
+
TestFactory.asset_pipeline_enabled?.should be_false
|
67
|
+
asset = TestFactory.create(:path => 'x.css')
|
68
|
+
asset.should_not be_a_kind_of Rails32PathResolver
|
69
|
+
end
|
70
|
+
end
|
data/spec/asset_spec.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'digest/md5'
|
3
|
+
|
4
|
+
describe Trackman::Assets::Asset do
|
5
|
+
it "should raise an exception if the path is not good" do
|
6
|
+
wrong_path = "./wrong_path.html"
|
7
|
+
lambda { Asset.new(:path => wrong_path) }.should raise_error Trackman::Assets::Errors::AssetNotFoundError
|
8
|
+
end
|
9
|
+
|
10
|
+
it "is equal if the path is the same" do
|
11
|
+
path = "./spec/spec_helper.rb"
|
12
|
+
|
13
|
+
asset1 = Asset.new(:path => path)
|
14
|
+
asset2 = Asset.new(:path => path)
|
15
|
+
|
16
|
+
asset1.should == asset2
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
it "is equal if the path points to the same place" do
|
21
|
+
path1 = "spec/spec_helper.rb"
|
22
|
+
path2 = "spec/../spec/spec_helper.rb"
|
23
|
+
|
24
|
+
asset1 = Asset.new(:path => path1)
|
25
|
+
asset2 = Asset.new(:path => path2)
|
26
|
+
|
27
|
+
asset1.should == asset2
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#data" do
|
31
|
+
it "returns content of the file specified by path" do
|
32
|
+
path = "./spec/spec_helper.rb"
|
33
|
+
asset = Asset.new(:path => path)
|
34
|
+
|
35
|
+
asset.data.should eq(File.open(path).read)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#hash" do
|
40
|
+
it "returns the fingerprint of data" do
|
41
|
+
path = "./spec/spec_helper.rb"
|
42
|
+
asset = Asset.new(:path => path)
|
43
|
+
|
44
|
+
file = File.open path
|
45
|
+
asset.file_hash.should eq(Digest::MD5.hexdigest(file.read))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#remote" do
|
50
|
+
|
51
|
+
class TestAsset < Asset
|
52
|
+
def self.maintenance_page
|
53
|
+
Asset.create(:path => 'spec/test_data/sample.html')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns a remote asset equal to the previous one" do
|
58
|
+
local = TestAsset.maintenance_page
|
59
|
+
|
60
|
+
AppCreator.create
|
61
|
+
remote = local.to_remote
|
62
|
+
AppCreator.reset
|
63
|
+
|
64
|
+
local.should eq(remote)
|
65
|
+
remote.is_a?(RemoteAsset).should be_true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "compares html higher than any other asset" do
|
70
|
+
asset1 = Asset.create(:path => 'spec/test_data/sample.html')
|
71
|
+
asset2 = Asset.create(:path => 'spec/test_data/test1.jpeg')
|
72
|
+
|
73
|
+
(asset1 <=> asset2).should == 1
|
74
|
+
(asset2 <=> asset1).should == -1
|
75
|
+
end
|
76
|
+
|
77
|
+
it "compares html equal to any other html asset" do
|
78
|
+
asset1 = Asset.create(:path => 'spec/test_data/sample.html')
|
79
|
+
asset2 = Asset.create(:path => 'spec/test_data/sample.html')
|
80
|
+
|
81
|
+
(asset1 <=> asset2).should == 0
|
82
|
+
end
|
83
|
+
|
84
|
+
it "compares two htmls by their path" do
|
85
|
+
asset1 = Asset.create(:path => 'spec/test_data/all/all.html')
|
86
|
+
asset2 = Asset.create(:path => 'spec/test_data/all/all2.html')
|
87
|
+
|
88
|
+
(asset1 <=> asset2).should == -1
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
it "compares a css asset higher than its dependencies" do
|
93
|
+
dependent = Asset.create(:path => 'spec/test_data/css/with-asset.css')
|
94
|
+
dependency = dependent.assets.first
|
95
|
+
|
96
|
+
(dependent <=> dependency).should == 1
|
97
|
+
(dependency <=> dependent).should == -1
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class FakeCompositeAsset
|
4
|
+
#include CompositeAsset
|
5
|
+
end
|
6
|
+
|
7
|
+
describe FakeCompositeAsset do
|
8
|
+
it "" do
|
9
|
+
asset = CssAsset.new(:path => 'spec/test_data/css/with-asset.css')
|
10
|
+
asset.assets.should == [CssAsset.new(:path => 'spec/test_data/css/imported.css')]
|
11
|
+
end
|
12
|
+
end
|