1

I've built a site in Sinatra, and need to "compile" it into HTML so I can hand it off to the client (their site can't run Sinatra. Miscommunication on my part). Right now I'm just hitting the site locally and saving the source from my browser. Is there a command I can run, or a rake task I can write to just dump the compiled files to a folder?

Thanks!

7
  • 2
    is it a static site? If not how are you going to run it? If it is you can just run haml from the command line.
    – three
    May 31, 2013 at 20:43
  • From CLI I don't think so, but maybe you can use something like this: html2haml.heroku.com or work out an automated way to save the HTML using something like Nokogiri.
    – patm
    Jun 2, 2013 at 7:39
  • 1
    You may want to look into static site generators, some of which are based on Sinatra, if you're doing this regularly.
    – Arman H
    Jun 2, 2013 at 8:06
  • Maybe its ok for them to run jar file? You can compile it using warbler gem. Jun 2, 2013 at 8:27
  • Thanks for all the comments. They're on a shared hosting site, with access for php and straight HTML only (served via Apache). Jun 2, 2013 at 12:07

2 Answers 2

2

Not really a Ruby solution, but if you have wget, this will mirror the entire site, save all of the pages, re-create the directory structure from URLs, download the assets (images, css, js, etc) and rewrite their paths to be relative to HTML pages (suitable for local viewing):

$ wget --verbose --mirror --page-requisites --convert-links \
  --no-cache --adjust-extension --force-directories \
  http://localhost:4567
0
1

Take a look into Middleman:

http://middlemanapp.com

It is a static site generator based on Sinatra. It probably won't be much work to edit your existing site to make use of it, allowing to keep the Sinatra-based site on your end for development purpose, while allowing you to publish the static version for your customer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.