module Clayoven::Toplevel::Util

Miscellanous utilities

Public Class Methods

fork_exec(command) click to toggle source

Execute a process so that its output is displayed synchronously, but wait until it finishes

# File lib/clayoven/util.rb, line 10
def self.fork_exec(command)
  fork { exec command }
lex_sort(files) click to toggle source

Sorts a list of filenames lexicographically, but for 'index.clay'

# File lib/clayoven/util.rb, line 4
def self.lex_sort(files) (files.reject { |f| f == 'index.clay' }).sort end
ls_files() click to toggle source

Fetch all .clay files, ∞ directories deep

# File lib/clayoven/util.rb, line 7
def self.ls_files; Dir.glob('**/*.clay').reject { |entry| entry } end
minify_design() click to toggle source

Minify css and js files, by forking out to npm

# File lib/clayoven/util.rb, line 16
def self.minify_design
  puts "[#{'NPM'.green} ]: Minifying js and css"
  fork_exec 'npm run --silent minify'
render_math(htmlfiles) click to toggle source

Fork out to npm to render math, via MathJaX and XyJaX; very expensive if you have a lot of math on your site.

# File lib/clayoven/util.rb, line 22
def self.render_math(htmlfiles)
  fork_exec "npm run --silent jax -- #{htmlfiles}"