How to upload gems to server?

21 views
Skip to first unread message

Human

unread,
Jul 15, 2019, 11:44:50 AM7/15/19
to YARD
Hello YARD community. 

I have been using YARD for a bit now, and I really enjoy the documentation interface it provides as well as the website it builds for the documentation. 
I have recently found out about 
yard server
command, and I would like to utilize it for my local gem store. It works fine on its own, but I would like to be able to upload documentation to it remotely (for example, geminabox supplies something like
gem inabox gem_name --host rubygems.home.local
command for uploading a new gem to a gem server). This is because I am trying to set up CI/CD that will automatically upload the documentation to the server upon release, and I would like to avoid connecting to the documentation server and performing 
gem install gem_name
systemctl restart docsserver
.service

My first thought was to create another gem that will manage the uploading interface - provide some function like
yard upload gem_name
on one side, and listen for upload requests server-side, installing provided gem and restarting the yardoc server. 

Maybe I am overthinking it, and I missed some functionality that YARD already provides. Please let me know if there is a better way.

Regards,
Human

Loren Segal

unread,
Jul 15, 2019, 4:28:31 PM7/15/19
to yar...@googlegroups.com

Hello,

You can look at the way this works for rubydoc.info, which is an open sourced project to manage serving docs for arbitrary gems: https://github.com/docmeta/rubydoc.info

The TLDR of it is that gems are pulled by the service (the service being an extended YARD server) itself rather than uploaded to rubydoc.info. I suppose you can build some kind of .gem upload queue, but if your gem is published and publicly accessible, you can just link to that gem, download, unpack, and process the source as is done with this YARD server extension code:

https://github.com/docmeta/rubydoc.info/blob/master/lib/extensions.rb#L30

The `load_yardoc_from_XXXX` methods provided by the above extension allow YARD to load documentation from extra sources, one of which being "remote_gem", which can download and unpack for processing. The implementation for expanding the gem is in that file as well. This extension API is documented in https://rubydoc.info/gems/yard/YARD/Server/LibraryVersion and can be used to avoid pushing data to your server (instead have the server pull).

Hope that helps!

Loren

--

---
You received this message because you are subscribed to the Google Groups "YARD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yardoc+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/yardoc/a44e4c5e-d50d-4e5e-b08c-4c42fbafea27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages