Contributing
jekyll-import is entirely open-source, which means we need your help to make it better!
Ran into an Issue?
Found an issue with one of the importers? Sorry about that! In order to better assist you and make sure the problem never happens, again, we would love for you to do a few things:
- Collection information about your system: operating system and version, Ruby version, Jekyll version, jekyll-import version.
- Which importer are you using? Note this.
- Collect the relevant data. This may be data from your database or input file. This will help us diagnose where the issue occurred.
- Ensure the
--trace
option is specified if you’re runningjekyll-import
from the command-line. - Open a new issue describing the four above points, as well as what you expected the outcome of your incantation to be.
You should receive help soon. As always, check out our help repo if you just have a question.
Creating a New Importer
So you have a new system you want to be able to import from? Great! It’s pretty simple to add a new importer to jekyll-import
. In this example, we’ll be creating the Columbus
importer.
First thing’s first: create the file where the importer will go. In this case, that will be lib/jekyll-import/importers/columbus.rb
.
Inside this file, we’ll add this template:
Let’s go through this quickly.
self.require_deps
This function is called before you run your importer to make sure all the necessary gem dependencies are installed on the user’s system.
self.specify_options
The specify_options
function is passed c
, which is the Mercenary::Command
instance for this importer. It allows you to specify the right options for your importer to be used with the command-line interface for your importer. jekyll-import
sets up everything else – just specify these options and you’re golden.
self.process
Where the magic happens! This method should read from your Columbus source, then output a Jekyll site.
Optional: self.validate
This function is entirely optional, but allows for some validation of the options. This method allows you to validate the options in any way you wish. For example:
Once you have your importer working (test with script/console
), then you’re ready to add documentation. Add your new file:
./docs/_importers/columbus.md
. Take a look at one of the other importers as an example. You just add basic usage and you’re golden.
All set? Add everything to a branch on your fork of jekyll-import
and
submit a pull request.
Thank you!