• Stars
    star
    128
  • Rank 272,397 (Top 6 %)
  • Language
    Haskell
  • License
    BSD 3-Clause "New...
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A file watcher and development tool.

Steel Overseer

A file watcher and development tool, similar to Ruby's Guard.

The main idea is that you have steeloverseer watch your files and then execute a series of shell commands in response. The first command to fail short circuits the series. The watched files can be selected using regular expressions and the commands may include capture groups.

Build Status Build status Build status

Installation

Download and install the stack build tool.

stack install steeloverseer

This will create a binary deep inside ~/.stack/, and symlink to it at ~/.local/bin/sos.

Usage

See sos --help to get started:

Steel Overseer 2.0.2

Usage: sos [TARGET] [--rcfile ARG] [-c|--command COMMAND] [-p|--pattern PATTERN]
           [-e|--exclude PATTERN]
  A file watcher and development tool.

Available options:
  -h,--help                Show this help text
  TARGET                   Optional file or directory to watch for
                           changes. (default: ".")
  --rcfile ARG             Optional rcfile to read patterns and commands
                           from. (default: ".sosrc")
  -c,--command COMMAND     Add command to run on file event.
  -p,--pattern PATTERN     Add pattern to match on file path. Only relevant if
                           the target is a directory. (default: .*)
  -e,--exclude PATTERN     Add pattern to exclude matches on file path. Only
                           relevant if the target is a directory.

Patterns and Commands

Capture groups can be created with ( ) and captured variables can be referred to with \1, \2, etc. (\0 contains the entire match).

For example, for each change to a .c file in src/ (excluding files containing "_test"), we may want to compile the file and run its corresponding unit test:

sos src/ -c "gcc -c \0 -o obj/\1.o" -c "make test --filter=test/\1_test.c" -p "src/(.*)\.c" -e "_test"

Commands are run left-to-right, and one failed command will halt the entire pipeline.

The RCFile

As a shortcut, we may want to write the above only once and save it in .sosrc, which is an alternative to the command-line interface (yaml syntax):

- pattern: src/(.*)\.c
  exclude: _test
  commands:
  - gcc -c \0 -o obj/\1.o
  - make test --filter=test/\1_test.c

Then, we only need to run:

sos

to start watching the current directory. If you'd like to use multiple rcfiles, or just don't like the name .sosrc you can specify the rcfile on the command line like so:

sos --rcfile my-rcfile

Grammar

sosrc            := [entry]
entry            := {
                      pattern_entry,
                      exclude_entry?, -- Note: optional!
                      command_entry
                    }
pattern_entry    := "pattern" | "patterns" : value | [value]
exclude_entry    := "exclude" | "excludes" | "excluding" : value | [value]
command_entry    := "command" | "commands" : value | [value]
value            := [segment]
segment          := text_segment | var_segment
text_segment     := string
var_segment      := '\' integer

The .sosrc grammar is somewhat flexible with respect to the command specifications. Both singular and plural keys are allowed, and both strings and lists of strings are allowed for values.

Pipelining Explaned

Pipelines of commands are immediately canceled and re-run if a subsequent filesystem event triggers the same list of commands. Otherwise, commands are are enqueued and run sequentially to keep the terminal output clean and readable.

For example, we may wish to run hlint on any modified .hs file:

- pattern: .*\.hs
  command: hlint \0

We can modify foo.hs and trigger hlint foo.hs to run. During its execution, modifying bar.hs will enqueue hlint bar.hs, while modifying foo.hs again will re-run hlint foo.hs.

Transient Files

Sometimes text editors and other programs create short lived files in the directories that sos is watching. These can trigger sos to run your pipeline. This can often be avoided by using precise include syntax, ie adding explicit matchers like an end-line match:

- pattern: .*\.tex$ 

Alternatively you may use exclude syntax to exclude any transient editor files (eg here's an sosrc used for editing Haskell doctests and ignoring emac's flycheck files):

# This is for testing documentation
- patterns:
  - .*/[^_]*\.l?hs$
  excludes:
  - \#
  - flycheck
  commands:
  - stack exec doctest -- \0

For more info, see #38

More Repositories

1

mogwai

The minimalist, obvious, graphical, web application interface
Rust
424
star
2

gelatin

A nice Haskell graphics API. There's always room for jello.
Haskell
40
star
3

apecs

An asyncronous and pleasant entity-component system for Rust
Rust
38
star
4

varying

Continuously varying values, made easy :)
Haskell
36
star
5

PureMVC-Plus-Plus

A MVC application architecture for C++, based off of the popular PureMVC
C++
35
star
6

renderling

๐Ÿ– A configurable real-time renderer, backed by wgpu
Rust
31
star
7

odin

High level 2d game engine written in Haskell.
Haskell
30
star
8

reflex-sdl2

A minimal host for sdl2 based reflex apps.
Haskell
26
star
9

typograffiti

Just let me draw nice text already!
Haskell
22
star
10

old-gods

Old Gods Engine
Rust
20
star
11

ixshader

A shallow embedding of the OpenGL Shading Language in Haskell
Haskell
15
star
12

dagga

DAG scheduler with nice constraint semantics
Rust
14
star
13

moongraph

Rust library for scheduling, managing resources, and running DAGs ๐ŸŒ™
Rust
11
star
14

editor

An experimental text editor using freetype2 and OpenGL. Written in Haskell.
Haskell
11
star
15

glucose

An API that wraps webgl and opengl
Haskell
11
star
16

aeson-tiled

Aeson instances for Tiled map editor types
Haskell
10
star
17

px-lang

px is an experimental, typed lambda calculus for _
Haskell
9
star
18

gristle

Like ixshader but ergonomic
Haskell
9
star
19

renderable

Drop-in rendering resource management
Haskell
7
star
20

blocks

A game where blocks...are a part of the game.
Haskell
7
star
21

fe_web_dev_in_rust

Intro to Rust and frontend web development - the book!
Shell
7
star
22

crabslab

Slabcraft for crabs
Rust
7
star
23

mogwai-realworld

RealWorld mogwai impl
Rust
6
star
24

kabukitheatre.bourtange

A fort defense game written in lisp in 30 days.
Common Lisp
5
star
25

mod

JS modules to aid in code separation and organization.
JavaScript
4
star
26

bang

A display list and event system for creating 2D HTML5 canvas apps.
JavaScript
4
star
27

mossy

A STLC generating GLSL
Haskell
4
star
28

todo-mvc-bench

A benchmarking suite for TodoMVC implementations
JavaScript
4
star
29

blocks-ios

Haskell iPhone Tetris Clone
Objective-C
4
star
30

Sublime-AS3

I've moved on to vim, so this project most likely will not be updated...A project building package for Sublime Text 2
Python
4
star
31

berry

Constraint based GUI for Rust
Rust
3
star
32

smugmugjsgallery

A smugmug javascript gallery
JavaScript
3
star
33

the-mutant

Don't fear the Mutant
Haskell
3
star
34

blenderScripts

my custom blender scripts
Python
3
star
35

broomdog

๐Ÿงน๐Ÿ• Rust library providing a map of type-erased values with indefinite loanership semantics
Rust
3
star
36

haskellgames

haskellgames.com
Haskell
3
star
37

urzas-toolbox

A Haskell package for the game artificer.
Haskell
3
star
38

milkshake

Website CMS built with โค๏ธ and Haskell.
HTML
3
star
39

beginners-guide-msg-passing

A Beginner's Guide to Message Passing in Rust
JavaScript
2
star
40

varying-tetris

Tetris implemented with varying and gelatin
Haskell
2
star
41

mogwai-todo

MOVED TO
Rust
2
star
42

schells.tmbundle

my textmate bundle (has a bunch of stuff in it)
C
2
star
43

arborgeddon

Jake witnessed his family murdered by savage trees. Now's he's back for treevenge!
Haskell
2
star
44

pusher

A server for pushing things to s3.
Haskell
2
star
45

scottys-crew

Adds user sessions to scotty.
Haskell
2
star
46

gooey

User interfaces that are renderable, varying and eventually produce a value
Haskell
2
star
47

event-transformer

An ephemeral continuation monad in the form of an effectful Moore machine. Wut?
Haskell
2
star
48

mogwai-template

cargo generate template for mogwai
Rust
2
star
49

officialgingerandscott.com

Ginger Berglund and Scott Whitfield
Haskell
1
star
50

image-mapper

Image Mapping Tool
Haskell
1
star
51

mars

My terraform modules
HCL
1
star
52

ld31

Ludum Dare 31
Haskell
1
star
53

meshterial

Vulkan based 2d and 3d rendering system that supports some meshes
Rust
1
star
54

aagol

another automaton game of life
JavaScript
1
star
55

elxa

The BTC based bounty service.
Haskell
1
star
56

modmash.it

modmash.it website
1
star
57

drawn-quartered

A roguelike.
Haskell
1
star
58

shortygoldsteins

Shorty Goldstein's
Haskell
1
star
59

Mod-2

mod 2
Objective-C
1
star
60

todo_finder

Finds TODOs in your filesystem
Rust
1
star
61

deckprinter

Magic deck printer
1
star
62

glapp

My experimental editor.
Haskell
1
star
63

schell.github.com

Various things of mine
HTML
1
star
64

bindings-objc

Low level Haskell bindings to the Objective-C runtime.
Haskell
1
star
65

MachineMash

C++
1
star
66

xybish

A simple UDP driven, in memory, key value store.
Haskell
1
star
67

self-pong

Pong by yourself! But really this is another sandbox for me.
Haskell
1
star
68

slaughterballoon.com

slaughter balloon software company
PHP
1
star
69

orion

Personal data tracking.
Haskell
1
star
70

illegal-text-reloc

Haskell
1
star
71

audaxian-toolbox

Gimme build web things!
Haskell
1
star
72

germs

A kind of block cellular automata.
Haskell
1
star
73

voxy

Foxy voxy.
Haskell
1
star
74

caltrops

Haskell
1
star
75

dotfiles

My dot files.
Emacs Lisp
1
star
76

wikifire

Contentinating the countryside
Haskell
1
star
77

dropdox

Use Fuse to manage Amazon S3 as a mounted filesystem
Haskell
1
star
78

ludum-helpers

A sandbox of helpful patterns for writing my Ludum Dare games in Haskell.
Haskell
1
star
79

esthree

A REPL for working with Amazon S3
Haskell
1
star
80

nshaskell

High level library for building Mac and iOS applications in Haskell
Haskell
1
star
81

Mod-1

iOS modular synthesizer
Objective-C
1
star
82

gelatin-tutorial

WIP tutorial for the 2d rendering library gelatin and friends
Haskell
1
star
83

htmlbin

a bucket of html
1
star
84

exchange

My BTC exchange.
Haskell
1
star
85

Slice-Machine

The Slice Machine
Objective-C
1
star
86

rust-gpu-expo

Attempt to find exponential filesize / compile times in rust-gpu
Rust
1
star
87

pretzel

2D rendering library based on renderling and rust-gpu
Rust
1
star