• Stars
    star
    556
  • Rank 80,098 (Top 2 %)
  • Language
    Ruby
  • License
    Other
  • Created over 15 years ago
  • Updated almost 6 years ago

Reviews

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

Repository Details

A lean, agnostic, flexible file-change watcher, using OS X FSEvents.

Kicker

<img src=“https://travis-ci.org/alloy/kicker.svg?branch=master” alt=“Build Status” />

A lean, agnostic, flexible file-change watcher.

Installation

$ gem install kicker -s http://gemcutter.org

The short version

Usage: ./bin/kicker [options] [paths to watch]

  Available recipes: ignore, jstest, rails, ruby.

    -s, --silent                     Keep output to a minimum.
    -q, --quiet                      Quiet output. Don't print timestamps when logging.
    -c, --clear                      Clear console before each run.
    -l, --latency [FLOAT]            The time to collect file change events before acting on them. Defaults to 1 second.
    -r, --recipe [NAME]              A named recipe to load.
    -e, --execute [COMMAND]          The command to execute.
    -b, --ruby [PATH]                Use an alternate Ruby binary for spawned test runners. (Default is `ruby')

The long version

Execute a shell command

Show all files, whenever a change occurs in the current work directory:

$ kicker -e "ls -l" .

Show all files, whenever a change occurs to a specific file:

$ kicker -e "ls -l" foo.txt

Or use it as a ghetto-autotest, running tests whenever files change:

$ kicker -e "ruby test/test_case.rb" test/test_case.rb lib/file.rb

Et cetera.

Using recipes

A recipe is a predefined handler. You can use as many as you like, by specifying them with the --recipe (-r) option.

For instance, when in the root of a typical Ruby on Rails application, using the rails recipe will map models, concerns, controllers, helpers, and views to their respective test files. These will then all be ran with Ruby.

A few recipes come shipped with Kicker:

  • Typical Ruby library.

  • Ruby on Rails, as aforementioned.

  • JavaScript tests, to run it needs HeadlessSquirrel.

  • Ignore, ignores logs, tmp, and svn and git files.

Add your own shared recipes to ~/.kick folder or current working directory .kick.

Project specific handlers

Most of the time, you’ll want to create handlers specific to the project at hand. This can be done by adding your handlers to a .kick file and running Kicker from the directory containing it.

This file is reloaded once saved. No need to stop Kicker.

Writing handlers

Whenever file-change events occur, Kicker will go through a chain of handlers until that the files list is empty, or the end of the chain is reached.

Handlers are objects that respond to #call. These are typically Proc objects. (If you know Rack, you’re familiar with this concept.) Every handler gets passed a list of changed files and can decide whether or not to act on them. Normally when handling a file, you should remove it from the files list, unless you want to let the file fall through to another handler. In the same way, one can add files to handler to the files list.

Time for a simple example

process do |files|
  execute("rake docs:generate && open -a Safari html/index.html") if files.delete("README.rdoc")
end

A handler is defined by passing a block to process. Which is one of three possible callback chains to add your handlers to, the others being: pre_process and post_process. See Kernel for more info.

Then README.rdoc is deleted from the files array. If it did exist in the array and was deleted, a shell command is executed which runs a rake task to generate rdoc and open the docs with Safari.

Something more elaborate.

Consider a Rails application with a mailer. Since the naming convention of mailer views tend to be fairly application specific, a specific handler has to be added:

process do |files|
  test_files = files.take_and_map do |file|
    if path =~ %r{^app/views/mailer/\w+\.erb$}
      'test/unit/mailer_test.rb'

    # elsif ... handle more app specific stuff
    end
  end

  Ruby.run_tests test_files
end

The files list is iterated over with the Array#take_and_map method, which both removes and maps the results. This is an easy way to do a common thing in recipes. See Kicker::ArrayExt for details.

The handler then checks if the file is a mailer view and if so runs the mailers test case. Ruby.run_tests runs them with something like the following command:

execute "ruby -r #{test_files.join(' -r ')} -e ''" unless test_files.empty?

See Kernel for more info on the utility methods.

To load recipes from your ~/.kick file:

recipe :ignore
ignore(/^data\//)

That’s basically it, just remember that the order of specifying handlers can be important in your decision on where to specify handlers.

Notifiers

For platform specific notifications we use the notify gem. For supported backends see: github.com/jugyo/notify#feature.

You select the notify backend by setting the NOTIFY environment variable.

gem install terminal-notifier
env NOTIFY=terminal-notifier kicker

Contributors

  • Manfred Stienstra (@manfred)

  • Cristi Balan (@evilchelu)

  • Damir Zekic (@sidonath)

  • Adam Keys (@therealadam)

More Repositories

1

MotionData

An experiment in using Core Data in a Ruby-ish way with RubyMotion
Objective-C
145
star
2

LLDB-Is-It-Not

Xcode plugin to load project specific .lldbinit
Objective-C
136
star
3

lowdown

A Ruby client for the HTTP/2 version of the Apple Push Notification Service.
Ruby
120
star
4

UitzendingGemist-ATV2

A simple Apple TV 2 application that shows content from UitzendingGemist.nl without having to use AirPlay.
Objective-C
94
star
5

AxeMode

🐒🔧 for Xcode
Objective-C
62
star
6

dietrb

IRB on a diet, for MacRuby / Ruby 1.9
Ruby
62
star
7

git-svn-mirror

A command-line tool that automates the task of creating a GIT mirror for a SVN repo, and keeping it up-to-date.
Ruby
60
star
8

MacRubyWebKitPlugInExample

A WebKit plugin written in MacRuby, adding ruby power to the web kid!
Objective-C
53
star
9

RealNative

React Native C Example – WHEN PERFORMANCE TRULY MATTERS!
C
50
star
10

watch-sim

A command-line WatchKit application launcher.
Objective-C
42
star
11

rucola

A Framework for rapidly building RubyCocoa applications
Ruby
34
star
12

clang-compilation-database-tool

Tool that can be used to generate Clang Compilation DBs from Xcode.
Objective-C
29
star
13

ruby-nzb

A simple Ruby NZB download/post-process library, with a very naive command line client. When done, a separate OSX GUI client will use this library.
Ruby
23
star
14

no-slacking-on-pull-requests-bot

A Slack bot that keeps track of open PRs.
JavaScript
19
star
15

adding-more-native-to-your-react-native-app

Objective-C
18
star
16

interactive-macruby

A MacRuby Cocoa REPL
Ruby
17
star
17

relational-theory

A prototype of server-side React+Relay rendering.
TypeScript
17
star
18

mocha-on-bacon

Because it's yummy!
Ruby
16
star
19

ForceOrientationTest

Experimenting with forcing orientation changes on iOS 6.
Objective-C
16
star
20

paper-cups

A small cozy web chat app, like paper cups and a string back in the days. Usually surrounded by lots of French chatter…
JavaScript
14
star
21

flight-seeker

Find flights and calculate level/award mileage.
Ruby
14
star
22

time_zone_scheduler

A Ruby library that assists in scheduling events whilst taking time zones into account.
Ruby
14
star
23

ObjectiveBacon

A small RSpec clone, with NSRunLoop powers. The core of MacBacon & NuBacon.
C
13
star
24

ruby-trace

Prototype of a call trace visualizer.
JavaScript
12
star
25

webapp-app

A SSB OSX application, which at some point will be able to create a new application which wraps a specific web application, (Think Campfire, Twitter etc) and allows the user to use Ruby to create event handlers to be able support things like Growl or whatever you would like.
Ruby
12
star
26

Opinions

These opinions are mine and you should make them yours too.
11
star
27

instruments

Ruby
11
star
28

vscode-relay

TypeScript
10
star
29

dotvim

Just my weak attempt at moving to VIM
Vim Script
10
star
30

NuBacon

A small RSpec clone for the Nu and Objective-C programming languages
C
10
star
31

mr-experimental

This is my private git mirror of the experimental branch (0.5), it might not always be up-to-date so keep that in mind.
Ruby
10
star
32

relay2ts

Generate TypeScript interfaces for your Relay GraphQL query fragments.
TypeScript
8
star
33

UISpec

fork of UISpec for iPhone
Objective-C
8
star
34

microgem

Toying with a clean room implementation of the rubygems ‘install’ command. Focus is on naivety for portability, MacRuby for instance.
Ruby
8
star
35

art.c

Artsy Salon 2019 art exhibition entry.
C
7
star
36

relay-only-local-state

TypeScript
7
star
37

react-native-macos

C++
7
star
38

graphqless-js

Statically compiled resolvers for entire queries based on a graphql-js schema.
TypeScript
7
star
39

react-native-eu

Slides from my talk at React Native EU 2017
6
star
40

dotfiles

My config files.
Shell
5
star
41

KISStribution

C
5
star
42

anthology

Where stories are chronicled.
Ruby
5
star
43

ios-sim-test

Ruby
4
star
44

macruby-asl-logger

A MacRuby wrapper of the Apple System Log facility
4
star
45

undercover

Undercover: CIA Ruby agent for GitHub
Ruby
4
star
46

feel-good

A simple task and time-tracker to make you feel good about yourself.
TypeScript
4
star
47

passengerpane

[REPO MOVED!] A Mac OS X preference pane for easily configuring Rails applications with Passenger.
4
star
48

rubycocoa-prefs

A ruby abstraction for read/write access to the NSUserDefaults of a Cocoa application.
Ruby
3
star
49

juse

A Jest script transformer backed FUSE implementation
TypeScript
3
star
50

railsgirls-polymorphic-associations-and-single-table-inheritance

Ruby
3
star
51

ControlTower-mirror-test

C
3
star
52

flow2dts

3
star
53

rubyenrails09

Ruby
3
star
54

MacOnRack

A sample MacRuby application demonstrating how to connect Rack to a WebView.
Ruby
3
star
55

eloyendionnetrouwen.nl

Ruby
3
star
56

libedit-merge

C
3
star
57

ssalleyware

SSL (cert verification for Ruby) Anywhere!
Ruby
3
star
58

TremoloAudioUnitTutorial

C++
3
star
59

SBTR

SHOOT BY THE RULES
3
star
60

repo_page_san_test

TODO
Ruby
2
star
61

pasternakredux

Ruby
2
star
62

alloy.github.com

Ruby
2
star
63

CPGuides

2
star
64

life

2
star
65

rails-ticket-sample-bin

A Rails application used to try out examples given in Rails tickets.
Ruby
2
star
66

MacRubyWebsite-mirror-test

Ruby
2
star
67

slides

Conf slides
2
star
68

The-Jag

Our Jaguar X-Type
2
star
69

limechat-plugin

Some random collected thoughts on a LimeChat plugin API
Ruby
2
star
70

piccsy-fetcher

Fetches low-res versions of the images you’ve ‘picked’ on piccsy.com
Ruby
2
star
71

create_github_project

From the hackpits, a setup script which creates a new project on github, adds users and enable services.
2
star
72

cocoa_gist

A simple lib which uses RubyCocoa to create a Gist. This is made for LimeChat, but is fairly general.
Ruby
2
star
73

todomvc-apollo-client-with-subscriptions

JavaScript
2
star
74

rucola-xcode

Classes to assist with XCode project related tasks
Ruby
2
star
75

mrdate

Ruby
2
star
76

microspec

A very simple test/spec like clone used for MacRuby, without the rspec assertion syntax. Especially for mon ami Laurent ;)
2
star
77

todo

2
star
78

MacRuby-mirror-test

Ruby
2
star
79

draft-issues

2
star
80

superalloy.nl

Where I write…
2
star
81

relay-rerender-example

Created with CodeSandbox
JavaScript
2
star
82

merge-schemas-enum-repro

JavaScript
1
star
83

tsc-exclude-types-repro

JavaScript
1
star
84

graphql-augment-poc

TypeScript
1
star
85

TestRNW

JavaScript
1
star
86

the-tesla

Model X 75D
1
star
87

NiNoKuni

Walkthrough version diffs.
1
star
88

homebridge-linak

TypeScript
1
star
89

TestPLCrashReporter

A RubyMotion app that I use to easily test PLCrashReporter on both iOS and OS X
Ruby
1
star
90

graphql-finland

1
star
91

rn2dts

TypeScript
1
star
92

NSHipster-ContactTracingManager

Swift
1
star
93

houseboat

🏠⛵
1
star
94

HockeySDK-CocoaPods

Objective-C
1
star
95

ReactNativeExperiments

Objective-C
1
star
96

henkenmarieketrouwen.nl

Ruby
1
star