module Kernel
Public Instance Methods
Executes the command
, logs the output, and optionally sends user notifications on Mac OS X (10.8 or higher).
# File lib/kicker/utils.rb, line 124 def execute(command, &block) Kicker::Utils.execute(command, &block) end
Adds regexp_or_string
as an ignore rule.
require 'ignore' ignore /^data\// ignore 'Rakefile'
Only available if the `ignore' recipe is required.
# File lib/kicker/recipes/ignore.rb, line 29 def ignore(regexp_or_string) Ignore.ignore(regexp_or_string) end
Prints a message
with timestamp to stdout.
# File lib/kicker/utils.rb, line 111 def log(message) Kicker::Utils.log(message) end
Returns the global OptionParser instance that recipes can use to add options.
# File lib/kicker/options.rb, line 93 def options Kicker::Options.parser end
When you perform some work (like shelling out a command to run without using execute
) you need to call this method, with a block in which you perform your work, which will take care of logging the work appropriately.
# File lib/kicker/utils.rb, line 118 def perform_work(command, &block) Kicker::Utils.perform_work(command, &block) end
Adds a handler to the post_process
chain. This chain is ran after the process chain and is processed from last to first.
Takes a callback
object that responds to #call
, or a block.
# File lib/kicker/callback_chain.rb, line 92 def post_process(callback = nil, &block) Kicker.post_process_chain.prepend_callback(block ? block : callback) end
Adds a handler to the pre_process
chain. This chain is ran before the process chain and is processed from first to last.
Takes a callback
object that responds to #call
, or a block.
# File lib/kicker/callback_chain.rb, line 76 def pre_process(callback = nil, &block) Kicker.pre_process_chain.append_callback(block ? block : callback) end
Adds a handler to the process chain. This chain is ran in between the pre_process
and post_process
chains. It is processed from first to last.
Takes a callback
object that responds to #call
, or a block.
# File lib/kicker/callback_chain.rb, line 84 def process(callback = nil, &block) Kicker.process_chain.append_callback(block ? block : callback) end
If only given a name
, the specified recipe will be loaded. For instance, the following, in a .kick
file, will load the Rails recipe:
recipe :rails
However, this same method is used to define a callback that is called if the recipe is loaded. For instance, the following, in a recipe file, will be called if the recipe is actually used:
recipe :rails do # Load anything needed for the recipe. process do # ... end end
# File lib/kicker/recipes.rb, line 18 def recipe(name, &block) Kicker::Recipes.recipe(name, &block) end
Adds a handler to the startup chain. This chain is ran once Kicker
is done loading before starting the normal operations. Note that an empty files array is given to the callback.
Takes a callback
object that responds to #call
, or a block.
# File lib/kicker/callback_chain.rb, line 68 def startup(callback = nil, &block) Kicker.startup_chain.append_callback(block ? block : callback) end