Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets disappearing #19

Closed
6 of 10 tasks
danielpclark opened this issue Jun 14, 2016 · 4 comments
Closed
6 of 10 tasks

Assets disappearing #19

danielpclark opened this issue Jun 14, 2016 · 4 comments
Labels

Comments

@danielpclark
Copy link
Owner

danielpclark commented Jun 14, 2016

This is embarrassing but at the moment my assets are disappearing. This thread will be for me to track down what methods are having issues.

Adding tests for outer methods that call on this method would be wise.

Pathname#chop_basename is directly called by:

  • Pathname#plus
  • Pathname#relative?
  • Pathname#cleanpath_aggressive

Those are most called by:

  • Pathname#absolute?
  • Pathname#+
  • normalize_element from Hike::Paths

And those methods are called by:

  • Pathname#join
  • block in normalize_elements from Hike::NormalizedArray

Check boxes will be for ones where all tests have been implemented and pass.

Sprockets asset helpers issue

I've narrowed it down to my Sprockets not prepending the /assets to the asset helper paths.

  • Track down where /assets side effect happened
  • Remedy the situation
@danielpclark
Copy link
Owner Author

danielpclark commented Jun 14, 2016

I've tracked it down to ActionView::Helpers::AssetUrlHelper

Time to use pry

This is what is happening:

When it works without the gem: ActionView::Helpers::AssetUrlHelper's method asset_path src calls the method compute_asset_path which is currently overwritten by Sprockets::Rails::Helper#compute_asset_path src where this code File.join(assets_prefix || "/", path) prepends /assets. The assets_prefix is instantiated on inclusion or extending by some sort of Voodoo I'm sure.

After the gem is included this line if digest_path = asset_digest_path(path) here returns nil and the code block for prepending the assets directory is not executed. So it looks like the Sprockets digest isn't building. Time to dig in some more.

@danielpclark
Copy link
Owner Author

danielpclark commented Jun 14, 2016

My new ripple_effect tests have found some discrepancies when monkey-patching is used.

1) Failure:
  CleanpathAggressiveTest#test_clean_aggresive_defaults [/home/travis/build/danielpclark/faster_path/test/ripple_effects/plus_test.rb:27]:
Expected: "."
Actual: "a"

2) Failure:
  CleanpathAggressiveTest#test_clean_aggressive_dosish_stuff [/home/travis/build/danielpclark/faster_path/test/ripple_effects/cleanpath_aggressive_test.rb:55]:
--- expected
+++ actual
@@ -1,2 +1 @@
-# encoding: ASCII-8BIT
-"/a/"
+"/"

3) Failure:
  JoinTest#test_join [/home/travis/build/danielpclark/faster_path/test/ripple_effects/join_test.rb:17]:
Expected: #<Pathname:/a/b/c>
Actual: #<Pathname://a/b/c>

@danielpclark danielpclark changed the title Assets disappearing Assets disappearing / new chop_basename not handling parent directory /../ Jun 14, 2016
@danielpclark danielpclark changed the title Assets disappearing / new chop_basename not handling parent directory /../ Assets disappearing, new chop_basename not handling parent directory /. Jun 14, 2016
@danielpclark danielpclark changed the title Assets disappearing, new chop_basename not handling parent directory /. Assets disappearing, new chop_basename not handling parent directory /../ Jun 14, 2016
@danielpclark
Copy link
Owner Author

danielpclark commented Jun 14, 2016

Here's Rust implementation's decisions on leaving parent directory path alone on .. rust-lang/rust#14028

@danielpclark danielpclark changed the title Assets disappearing, new chop_basename not handling parent directory /../ Assets disappearing Jun 14, 2016
@danielpclark
Copy link
Owner Author

#31 should fix this issue. Testing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant