4

Is there a way to mount Yard (http://yardoc.org/guides/index.html) server on heroku ? I did not find anything in the doc that explains how to do it.

Thanks a lot

mathieurip
  • 547
  • 1
  • 6
  • 16

2 Answers2

3

This may have pitfalls I haven't uncovered yet (e.g. Yard caches its output files somewhere, given Heroku may often wipe the filesystem and re-slug it, you will lose the cache files and have to be regenerated), but it generally works and is very simple.

  1. Create a new folder on your hard drive somewhere (I used ~/Sites/yard-on-heroku)
  2. Create a new Gemfile in there, listing the gems you want to be available (if they aren't in the standard Heroku install). I used the following:

    source 'https://rubygems.org'
    gem 'sinatra'
    gem 'rails'
    gem 'yard'
    
  3. Run bundle install to install the gems.

  4. Create a file called Procfile and put the following in it:

    web: yard server -p $PORT -g
    
  5. Create a new git repository with git init

  6. Commit your files to it (Gemfile*, Procfile)
  7. Create a Heroku app with heroku create
  8. Push your repo to Heroku with git push heroku master

And that's it. If you go to the Heroku URL given when you created the site in step 7, you'll see Yard running with all the gems available too it. If you want to specifically only show the gems listed in the Gemfile rather than all the Gems available by default including the ones in your Gemfile, then you can use -G instead of -g in the Procfile.

(my first ever answer on StackOverflow, so hope it's OK - any advice on improvements, gratefully received).

Andy Jeffries
  • 392
  • 3
  • 15
2

I wrote a nice tutorial with my solution to this problem here: http://benradler.com/blog/2014/05/27/deploy-yard-documentation-server-to-heroku/

professormeowingtons
  • 3,504
  • 7
  • 36
  • 50