Connor Shea Connor Shea - 1 year ago 77
Ruby Question

Accessing Nanoc variables from Rakefile

I'm wondering how it may be possible to access Nanoc's variables (e.g.

, etc.) from a Rakefile.

I have a file called
that has data like this in it:

name: 'Community Edition'
name: 'Enterprise Edition'

I'd like to be able to access this in the Rakefile so I have a "single source of truth" that can be accessed from within the Nanoc site as well as the Rakefile which pulls down some documentation. In the Nanoc site you can access these with
, for example, but not in the Rakefile.

Do I need to
something from Nanoc in the Rakefile?

Answer Source

Caution: This answer deals with a private API!

You can create a site using the SiteLoader:

site =

The site has a config:

# => Community Edition

Again, this is part of a private API (for the time being, at least), so the code above might break in a future release.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download