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

serve export overwrites html files without warning #36

Open
rmetzler opened this issue Jun 28, 2011 · 10 comments
Open

serve export overwrites html files without warning #36

rmetzler opened this issue Jun 28, 2011 · 10 comments

Comments

@rmetzler
Copy link
Contributor

I had a Compass project that I converted into a Serve project. This procedure left an index.html file inside the public folder.

When I start serve export it seems like it first renders everything to the target folder and then copies the public folder into target overwriting existing files inside the target folder.

I think there are several methods how to deal with this.

  1. the most simple approach would be to change the order of these two tasks
  2. there should be a warning whenever an existing file is overwritten
  3. there should be an interactive query for the user: "Overwrite? [Yn]"

I guess there are several other methods more for handling this problem. I would vote for 1 and could provide a patch if needed. Please tell me what you think.

@jlong
Copy link
Owner

jlong commented Jul 7, 2011

I think this is the expected behavior. On a web server this would fail silently too because files in public would be served instead of files from the app. Or am I missing something?

@rmetzler
Copy link
Contributor Author

rmetzler commented Jul 7, 2011

When I go to http://localhost:4000/ serve shows views/index.html.erb and not public/index.html
After exporting export/index.html is the same as public/index.html. It's just a little bit inconsistent and it fails silently.

@jlong
Copy link
Owner

jlong commented Jul 8, 2011

Good point. :)

I think I can switch this around for Serve. Let me look into it.

@jlong
Copy link
Owner

jlong commented Jul 12, 2011

There's not an easy way to do this. I'd have to rewrite the Rack directory indexing stuff... Hrmmm...

@rmetzler
Copy link
Contributor Author

I didn't test it, but I would expect if you move line 21 of https://github.com/jlong/serve/blob/master/lib/serve/export.rb to the start
of the method it should work.

@jlong
Copy link
Owner

jlong commented Jul 13, 2011

That's true, but I want it to work that way. What I would like to do is get Serve to function the other way so that it mimics the functionality of both export and a normal Ruby deployment.

@ntalbott
Copy link
Contributor

ntalbott commented Apr 6, 2012

So the way you want it to work is that serve first renders the .html file, and only processes the template if the .html file doesn't exist?

@jlong
Copy link
Owner

jlong commented Apr 6, 2012

Right, just like a regular Rack app.

@jlong
Copy link
Owner

jlong commented Apr 6, 2012

Files in public should be served first, then if those URLs don't exist Serve should check the views directory.

@ntalbott
Copy link
Contributor

ntalbott commented Apr 6, 2012

Got it - will see what I can do about that.

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 a pull request may close this issue.

3 participants