0.0
No commit activity in last 3 years
No release in over 3 years
Provides mock content for your Jekyll prototypes when building a site, through the Faker gem, with all the fun stuff included, at no cost to you, this Sunday Sunday Sunday only.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Code Climate Code Climate Travis CI Gem Version Gem DL

Jekyll Faker

Jekyll Faker is a Jekyll/Liquid wrapper around the Faker gem, it allows you to do anything that Faker allows you to do, as long as it's an acceptable format. It is disaware of it's surroundings, and is extensible by automatic upgrade, meaning... if faker adds new methods, or even new classes, you can continue to use it without needing to upgrade Jekyll Faker.

Installing

gem "jekyll-faker"
gem "jekyll-faker", {
  git: "https://github.com/anomaly/jekyll-faker.git"
}

Usage

Given faker has a class called Lorem, and that class Lorem accepts messages to the method sentences, you can then do the following to extract the data from Faker:

{% faker lorem sentences=8 %}
  <p>{{ faker.val }}</p>
{% endfaker %}

w/ the result

<p>Sentence 1</p>
<p>Sentence 2</p>
<p>Sentence 3</p>
<p>Sentence 4</p>
<p>Sentence 5</p>
<p>Sentence 6</p>
<p>Sentence 7</p>
<p>Sentence 8</p>

Multiple Arguments

If a class and method you wish to use takes multiple arguments, you can replicate the name of the method multiple times to create an array that will be expanded, and messaged to the method. For example:

{% faker number between=1 between=10 %}
  <small>
    {{ faker.val }}
  </small>
{% endfaker %}

CamelCase classes

If a Faker is a CamelCased class, for example "DrWho" (even though technically it's supposed to be DoctorWho, it's Doctor, not Dr, who even does that?) You can do the following:

{% faker dr-who catch_phrase %}
  <p>{{ faker.val }}</p>
{% endfaker %}

or

{% faker id-number valid %}
  <p>{{ faker.val }}</p>
{% endfaker %}

We will attempt to determine the class name automatically, first, efficiently by assuming the dash is a literal for uppercase, and then by doing a simple regexp search, this should often result in the class being found.*