What is the best practice to publish online the /doc folder - ruby-on-rails

I am using Rails (4.1.5) and I have generated a full documentation which has been put in /doc as by default. My app is publish online but internally. I would like to expose this documentation through an URL part of my actual (e.g. http://myapp.com/doc). I want to find a way to automate this as the "generate the doc" action will be done on my side to refresh the documentation.
Somebody have any idea what should be the trick for this? Route (if so, how), should I create a controller for that specifically?
Thank you in advance for any help on this.

I've done this using Dropbox. I run my documentation generator command and have it output to a location in my Dropbox folder. Then, my colleagues can simply open the index.html file at the shared location to view the documentation. But, in your case I suppose you could have your myapp.com/doc url redirect to the dropbox location? The advantage of all this being that you don't have to redeploy to have updated documentation -- just regenerate the docs since Dropbox does the uploading and hosting for you.

Related

Accessing OneDrive file - the easiest way

My android app needs to access (read only) .txt file located on OneDrive. Which is the simplest way to achieve that? All tutorial I read are a bit complicated for me (I'm new in this android stuff).
The simplest way is to share the file read only using “anyone anonymous with the link”. So basically no log in is required to access the file, just the link generated by onedrive. Using that link you should be able to access the file directly like any http web link.
Cheers
Christian

Why does my asciidoc relative link doesn't work outside of my microservice?

I'm starting to create documentation using asciidoc on my project which is following a microservices architecture.
We have a microservice for documentation. In its files I want to link to another document in another microservice.
I can do a relative link inside my own component but when I try to go higher with ../ it does not work and the link does nothing.
Does anyone may know why ?
Could it be because asciidoc is installed in the jenkins file of my component but not the others ?
Or is it because I do not use the link correctly ?
I use it as it is describe in the doc :
link:../other_microservice/other-document.asciidoc[]
I also tried the xref with no more success.
Thanks a lot for anyone who can help me
The link: macro is supposed to be used with a URL, not a file path. Generally, it does what you mean. However, Asciidoctor's safe mode prevents access to files which reside outside of the folder containing the source file specified for transformation.
So, if the documentation for your other microservices is going to be hosted separately (e.g. one URL per microservice), then you should update your link: macro usage to specify URLs instead.
If all of your microservice documentation is to be hosted under one URL, specify --safe when you invoke Asciidoctor. For more details, see:: https://asciidoctor.org/docs/user-manual/#running-asciidoctor-securely

How do I link to a PDF file in Silex?

I've looked around a bit and can't seem to figure out how to link to a static file while using Silex. I've seen some similar questions/answers in regards to Symfony, but they involved YML routing files, which I don't use with Silex.
My Situation
I have some files in a /docs folder. Logged in users can upload new pdf files (so, I don't know ahead of time what all of the filenames will be; they're constantly changing).
My Intent
I need to be able to link to these PDF files, so that a click on a link somewhere will open www.myurl.com/docs/myfile.pdf.
The Problem
Due to the routing system in silex, it treats the url as a route (obviously) and throws a Page Not Found error.
Thanks in advance for any feedback!
You need to configure your web server in a way that it does not forward existing files to the front controller. The web servers section of the silex documentation has examples of such configurations for the most popular web servers.
As for the link itself, just link to the file directly, something along these lines:
{{ filename }}

How to show only the link of an uploaded file, not its location

I have used paperclip to allow me to upload files to a rails application. Everything works and the file is uploaded, but instead of seeing a link to the actual file itself I see the location of it within the systems folder of the rails project.
I'm guessing its either a routing issue or I need to create a link to the file in question. However, I would like to hide the location of the file itself, and only see the link displayed.
I would be very grateful if someone could point me in the right direction here.
You want to hide the actual path of the file in the server, right?
You can achieve that using send_file (http://api.rubyonrails.org/classes/ActionController/DataStreaming.html#method-i-send_file) in a normal controller.
You will still need to do something to protect the download using the real path.

(Rails) Uploading Directories

I need to upload multiple files on my website.
But I need not just a form for uploading multiple files, I need to upload whole directories.
How's this possible for the minimalist?
Yours, Joern.
According to my somewhat limited knowledge this is not possible, only file transfer is possible, not directories.
Here are some workarounds, based on discussion on Velocity Reviews and another discussion:
upload a zip, which you unzip at the server side
upload directories over ftp (web page can be a front end to this)
upload files one by one
I would go either for zip or ftp. Note: someone might have produced a gem that enables uploading directories (I know nothing of such thing, but I will be happy to find out, if there is).
Adding another option to the list provided by Sorrow:
upload via REST/JSON
OK, this is a partial solution, but it does give you the opportunity to write a script that reads your directory and POSTS to your website.

Resources