www

My personal website(s)
Log | Files | Refs

2012-05-13-jekyll-foreman-guard-bundler.html (4445B)


      1 <!DOCTYPE html>
      2 <html lang="en">
      3 <head>
      4 <!-- Sep 03, 2024 -->
      5 <meta charset="utf-8" />
      6 <meta name="viewport" content="width=device-width, initial-scale=1" />
      7 <title>Jekyll Forman Guard Bundler</title>
      8 <meta name="author" content="Vincent Demeester" />
      9 <meta name="generator" content="Org Mode" />
     10 <link rel='icon' type='image/x-icon' href='/images/favicon.ico'/>
     11 <meta name='viewport' content='width=device-width, initial-scale=1'>
     12 <link rel='stylesheet' href='/css/new.css' type='text/css'/>
     13 <link rel='stylesheet' href='/css/syntax.css' type='text/css'/>
     14 <link href='/index.xml' rel='alternate' type='application/rss+xml' title='Vincent Demeester' />
     15 </head>
     16 <body>
     17 <main id="content" class="content">
     18 <header>
     19 <h1 class="title">Jekyll Forman Guard Bundler</h1>
     20 </header><section id="outline-container-Introduction" class="outline-2">
     21 <h2 id="Introduction">Introduction</h2>
     22 <div class="outline-text-2" id="text-Introduction">
     23 <p>
     24 This post is a quick &ldquo;How did I setup my Jekyll environnement ?&rdquo;. We are
     25 going all the tools that are quite awesome in Ruby.
     26 </p>
     27 </div>
     28 </section>
     29 <section id="outline-container-goal" class="outline-2">
     30 <h2 id="goal">Goal</h2>
     31 <div class="outline-text-2" id="text-goal">
     32 <p>
     33 The goal is simple :
     34 </p>
     35 
     36 <ol class="org-ol">
     37 <li>I want to be able to install any dependent
     38 <a href="http://rubygems.org">Gem</a> with a <i>on-liner</i> command</li>
     39 <li>I want to be able to run a <i>Jekyll server</i> that auto updates.</li>
     40 </ol>
     41 
     42 <p>
     43 We are going to play with : <a href="http://gembundler.com/">Bundler</a>,
     44 <a href="https://github.com/guard/guard">Guard</a> and
     45 <a href="https://github.com/ddollar/foreman">foreman</a>.
     46 </p>
     47 </div>
     48 </section>
     49 <section id="outline-container-bundler" class="outline-2">
     50 <h2 id="bundler">Bundler</h2>
     51 <div class="outline-text-2" id="text-bundler">
     52 <p>
     53 Bundler let us run <code>bundle install</code> to get all Ruby Gems we will need ;
     54 It use a file name <code>Gemfile</code>. The gems we need are simple : <code>jekyll</code>,
     55 <code>guard</code> and some Guard extensions.
     56 </p>
     57 
     58 <div class="org-src-container">
     59 <pre class="src src-ruby">source "http://rubygems.org"
     60 
     61 gem 'jekyll'
     62 gem 'guard'
     63 gem 'guard-jekyll2'
     64 gem 'guard-shell'
     65 gem 'guard-bundler'
     66 </pre>
     67 </div>
     68 </div>
     69 </section>
     70 <section id="outline-container-guard" class="outline-2">
     71 <h2 id="guard">Guard</h2>
     72 <div class="outline-text-2" id="text-guard">
     73 <blockquote>
     74 <p>
     75 Guard is a command line tool to easily handle events on file system
     76 modifications.
     77 </p>
     78 </blockquote>
     79 
     80 <p>
     81 Guard will be watching file we told him and run action in consequence ;
     82 The file is name <code>Guardfile</code>.
     83 </p>
     84 
     85 <div class="org-src-container">
     86 <pre class="src src-ruby">guard 'jekyll2' do
     87   watch %r{.*}
     88 end
     89 
     90 guard :bundler do
     91   watch('Gemfile')
     92 end
     93 # vim:filetype=ruby
     94 </pre>
     95 </div>
     96 </div>
     97 </section>
     98 <section id="outline-container-foreman" class="outline-2">
     99 <h2 id="foreman">Foreman</h2>
    100 <div class="outline-text-2" id="text-foreman">
    101 <p>
    102 Finally, foreman will let us declare our processes and will handle the
    103 start, forward the output and handle the shutdown. It can then export
    104 its configuration into more <i>production-ready</i> file (<code>init</code>, <code>upstard</code>,
    105 &#x2026;) ; It uses a file named <code>Procfile</code>.
    106 </p>
    107 
    108 <p>
    109 We will tell foreman to run :
    110 </p>
    111 
    112 <ul class="org-ul">
    113 <li>The jekyll build-in server : <code>jekyll --server</code></li>
    114 <li>Guard, to handle file changes <i>in background</i>.</li>
    115 </ul>
    116 
    117 <div class="org-src-container">
    118 <pre class="src src-bash">web: bundle exec jekyll --server
    119 guard: bundle exec guard
    120 </pre>
    121 </div>
    122 
    123 <p>
    124 And that&rsquo;s all folk. Now, you just need to run foreman in the
    125 Jekyll-powered directory and edit your files.
    126 </p>
    127 </div>
    128 </section>
    129 </main>
    130 <footer id="postamble" class="status">
    131 <footer>
    132      <small><a href="/" rel="history">Index</a> • <a href="/sitemap.html">Sitemap</a> • <a href="https://dl.sbr.pm/">Files</a></small><br/>
    133      <small class='questions'>Questions, comments ? Please use my <a href="https://lists.sr.ht/~vdemeester/public-inbox">public inbox</a> by sending a plain-text email to <a href="mailto:~vdemeester/public-inbox@lists.sr.ht">~vdemeester/public-inbox@lists.sr.ht</a>.</small><br/>
    134      <small class='copyright'>
    135       Content and design by Vincent Demeester
    136       (<a rel='licence' href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Some rights reserved</a>)
    137     </small><br />
    138 </footer>
    139 </footer>
    140 </body>
    141 </html>