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,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
|
data/spec/spec_helper.rb
ADDED
@@ -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
|
data/spec/test_data/a.js
ADDED
Binary file
|
data/spec/test_data/b.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
var b = 123;
|
data/spec/test_data/c.js
ADDED
Binary file
|
@@ -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,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');
|