Skip to content

Serve locally uploaded crates from a different folder #951

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

Merged
merged 7 commits into from
Aug 26, 2017
Merged

Serve locally uploaded crates from a different folder #951

merged 7 commits into from
Aug 26, 2017

Conversation

vignesh-sankaran
Copy link
Contributor

Fix #934, serve locally uploaded crates from a different location since dist/ gets recreated each time the front end restarts.

src/lib.rs Outdated
if env != Env::Test {
m.around(dist::Middleware::default());
m.around(local_uploads::Middleware::default());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this break prod ?
It seems that the dist::Middleware is used to serve the Ember application, styles & other assets. Does it still work after this change ?

@vignesh-sankaran
Copy link
Contributor Author

Argh yes you're right it doesn't work :(. I'll find another way to get this to work, maybe by adding another bit of middleware specifically for the uploader.

@vignesh-sankaran vignesh-sankaran changed the title Serve locally uploaded crates from local_uploads/ [WIP] Serve locally uploaded crates from a different folder Aug 12, 2017
@vignesh-sankaran vignesh-sankaran changed the title [WIP] Serve locally uploaded crates from a different folder Serve locally uploaded crates from a different folder Aug 13, 2017
@vignesh-sankaran
Copy link
Contributor Author

Bear with me for a few mins, I'm updating a previous PR and I would like to add notes about local_uploads/ in docs/ :)

@vignesh-sankaran
Copy link
Contributor Author

Ok, I've updated the docs too :)

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few little comment fixes, and I'm having trouble getting this to work-- will elaborate in the next comment.

the frontend. If you try to install a crate from your local crates.io and
`cargo` can't find the crate files, that's probably why.
will be stored in `local_uploads/` and served from there when a crate is
downloaded. This directory gets cleared out if you stop and restart the frontend.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the point of this change was to make it so that the local uploads wouldn't get cleared out if you stop and restart the frontend? So that should mean this sentence should go away, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should, I'll make the change :)

src/dist.rs Outdated
@@ -1,3 +1,5 @@
//! This module implements middleware to host the compiled emberjs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say "serve" rather than "host".

@@ -0,0 +1,41 @@
//! This module implements middleware to host crates from the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here-- please replace "host" with "serve" :)

@carols10cents
Copy link
Member

Nevermind what I said about it not working, it's totally working now.. I don't know what my issue was.

However, since the README rendering has been merged in, and since I merged upstream into this branch for you, could you get README rendering to work as well? The HTML for readmes is getting saved in `/local_uploads/readmes/crate/crate-version.html, but the frontend is requesting http://localhost:4200/local_uploads/readmes/crate/crate-version.html which 404s.

@vignesh-sankaran
Copy link
Contributor Author

I've made the requested changes @carols10cents, this should now work locally with readme files too :)

@carols10cents
Copy link
Member

bors: r+

bors-voyager bot added a commit that referenced this pull request Aug 25, 2017
951: Serve locally uploaded crates from a different folder r=carols10cents

Fix #934, serve locally uploaded crates from a different location since `dist/` gets recreated each time the front end restarts.
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Aug 25, 2017

Build failed

@carols10cents
Copy link
Member

bors: retry

@carols10cents
Copy link
Member

bors: r+

bors-voyager bot added a commit that referenced this pull request Aug 26, 2017
951: Serve locally uploaded crates from a different folder r=carols10cents

Fix #934, serve locally uploaded crates from a different location since `dist/` gets recreated each time the front end restarts.
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Aug 26, 2017

Build failed

@carols10cents
Copy link
Member

bors: r+

bors-voyager bot added a commit that referenced this pull request Aug 26, 2017
951: Serve locally uploaded crates from a different folder r=carols10cents

Fix #934, serve locally uploaded crates from a different location since `dist/` gets recreated each time the front end restarts.
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Aug 26, 2017

Build succeeded

@bors-voyager bors-voyager bot merged commit d3671b7 into rust-lang:master Aug 26, 2017
@vignesh-sankaran vignesh-sankaran deleted the local-upload-fix branch August 27, 2017 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants