motyl

Opinionated blog-aware static site generator written in Ruby
Log | Files | Refs | README | LICENSE

commit 8cdd1c15635fe5be163e86ba11774a7995833696
parent f8f5f62ae3e5584f3b2b051a155198d34f798d89
Author: Frederic Cambus <fred@statdns.com>
Date:   Sun, 18 Mar 2018 22:11:32 +0100

Remove dependency on Make, copy theme and static assets directly in Ruby

Diffstat:
MREADME.md | 4++--
Dexamples/Makefile | 10----------
Msrc/motyl.rb | 7+++++++
3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md @@ -17,7 +17,7 @@ For the record, motyl means butterfly in Polish. ## Requirements -Motyl requires Ruby and Make. +Motyl requires Ruby. ### Ruby modules @@ -45,7 +45,7 @@ and place the files in the `themes` directory. ## Usage -Simply run `make` to build the site, it will generate posts and pages into +Simply run `motyl` to build the site, it will generate posts and pages into the `public` directory, and will also copy static assets. ## License diff --git a/examples/Makefile b/examples/Makefile @@ -1,10 +0,0 @@ -default: - @rm -rf public/ - @motyl - @echo [`date +"%T"`] Copying assets and static files - @cp -r themes/fonts themes/scripts themes/styles public/ - @cp -r static/* public/ - @echo [`date +"%T"`] Done - -clean: - @rm -rf public diff --git a/src/motyl.rb b/src/motyl.rb @@ -86,6 +86,7 @@ def render(directory, templates, data) end # Render posts +FileUtils.rm_rf('public') render('posts', templates, data) # Sort post archives @@ -114,3 +115,9 @@ data['categories'].keys.each do |category| File.write('public/categories/' + category_url + 'index.html', Mustache.render(templates['categories'], data)) status('Rendering ' + category_url) end + +# Copy static assets +status('Copying assets and static files') +FileUtils.cp_r('themes/fonts', 'public'); +FileUtils.cp_r('themes/styles', 'public'); +FileUtils.cp_r('static', 'public');