Skip to content

Setting up Jekyll locally

pwmvx1289 edited this page Jan 5, 2015 · 14 revisions

Preparation:

Get a local copy of fossasia.github.io (fork and clone). There is a file called 'Gemfile' in the root, this is for bundler that bundle install will install every gem in the gemfile.

Install node.js and Ruby.

node.js: http://nodejs.org/

Ruby: https://www.ruby-lang.org/en/downloads/

Steps:

Once you get everything ready, it's time to start. In your command line, run gem install bundler

Next, navigate to the fossasia.github.io directory, where the Gemfile is located. Run bundle install in the command line. It install dependencies for the github-pages gem. The full list of dependencies can be found here.

When you succeed, you should see at the end of your command lines
Using bundler 1.7.11
Your bundle is complete!
Use 'bundle show [gemname]' to see where a bundled gem is installed.
Run bundle exec jekyll serve and the repo will be compiled and run just like Github would do. Visit localhost:4000 to see your page.

Linting

Inside the project folder, run npm install. Then install Gulp http://gulpjs.com/

After that, run gulp. Now you are linting using the configuration inside gulpfile.js (and .jscsrc) exactly the way travis does it.

Note: In Windows, if you create .jscsrc directly you will be prompted that it does not contain a filename. To create .jscsrc, you can run touch .jscsrc in git bash. Alternatively, you can find the solution in this question.

Common errors

If you encounter SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed , you can change source 'https://rubygems.org' into source 'https://rubygems.org' in Gemfile. If the problem still exists, you can take a look at this stakeoverflow question about Certificate Verify Failed

During bundle install, if you encounter Gem::InstallError: The 'RedCloth' native gem requires installed build tools. As told by the insructions, you can download DevKit from http://rubyinstaller.org/downloads and follow the instructions at http://github.com/oneclick/rubyinstaller/wiki/Development-Kit. There're few things to note:

  • Under step 3. Extract Files, make sure the files are extracted in a permanent directory which is not directly under C:, otherwise some files will be missing and the installation would fail.
  • Under Installation Instructions 4. Run Installation Scripts, not including any extra Rubies, i.e. not editing the generated config.yml file would still work.

If you see Gem::Ext::BuildError: ERROR: Failed to build gem native extension. and
An error occurred while installing rdiscount (2.1.7), and Bundler cannot continue.
Make sure that 'gem install rdiscount -v '2.1.7'' succeeds before bundling.
You should try to run gem install rdiscount -v, sometimes it would succeed and bundling could continue successfully.

Clone this wiki locally