Fix some typos, better wording and formatting.

This commit is contained in:
Michael Kessler 2011-09-21 01:30:35 +02:00
parent 78448631ab
commit 507abce5b6
12 changed files with 66 additions and 57 deletions

View File

@ -4,7 +4,7 @@ require 'guard/version'
module Guard
# Guard command line interface managed by [Thor](https://github.com/wycats/thor).
# This is the main interface to Guard that is called by the Guard binary at `bin/guard`.
# This is the main interface to Guard that is called by the Guard binary `bin/guard`.
#
class CLI < Thor
@ -60,7 +60,7 @@ module Guard
# List the Guards that are available for use in your system and marks
# those that are currently used in your `Guardfile`.
#
# @example guard list output
# @example Guard list output
#
# Available guards:
# bundler *
@ -107,7 +107,7 @@ module Guard
desc 'init [GUARD]', 'Generates a Guardfile at the current working directory, or insert the given GUARD to an existing Guardfile'
# Appends the Guard template to the `Guardfile`, or creates an initial
# `Guardfile` when no Guard name is passed,
# `Guardfile` when no Guard name is passed.
#
# @param [String] guard_name the name of the Guard to initialize
#

View File

@ -3,15 +3,15 @@ module Guard
# The DSL class provides the methods that are used in each `Guardfile` to describe
# the behaviour of Guard.
#
# The main keywords of the DSL are `guard` and `watch`, which are necessary to define
# which Guards are used a what file changes they are watching.
# The main keywords of the DSL are `guard` and `watch`. These are necessary to define
# the used Guards and the file changes they are watching.
#
# Optionally you can group the Guards with the `group` keyword and ignore certain paths
# You can optionally group the Guards with the `group` keyword and ignore certain paths
# with the `ignore_paths` keyword.
#
# A more advanced DSL use is the `callback` keyword, that allows you to execute arbitrary
# A more advanced DSL use is the `callback` keyword that allows you to execute arbitrary
# code before or after any of the `start`, `stop`, `reload`, `run_all` and `run_on_change`
# guards' method. You can even insert more hooks inside these methods.
# Guards' method. You can even insert more hooks inside these methods.
# Please [checkout the Wiki page](https://github.com/guard/guard/wiki/Hooks-and-callbacks) for more details.
#
# The DSL will also evaluate normal Ruby code.
@ -24,6 +24,7 @@ module Guard
# be appended to the current project `Guardfile`.
#
# @example A sample of a complex Guardfile
#
# group 'frontend' do
# guard 'passenger', :ping => true do
# watch('config/application.rb')
@ -97,8 +98,7 @@ module Guard
UI.error 'No guards found in Guardfile, please add at least one.' if !::Guard.guards.nil? && ::Guard.guards.empty?
end
# Reevaluate the Guardfile to update the current Guard configuration
# when the `Guardfile` has been changed after Guard is started.
# Re-evaluate the `Guardfile` to update the current Guard configuration.
#
def reevaluate_guardfile
::Guard.guards.clear
@ -206,12 +206,12 @@ module Guard
# @return [Boolean] if the Guardfile is usable
#
def guardfile_contents_usable?
guardfile_contents && guardfile_contents.size >= 'guard :a'.size # smallest guard-definition
guardfile_contents && guardfile_contents.size >= 'guard :a'.size # Smallest Guard definition
end
# Gets the default path of the `Guardfile`.
# This returns the `Guardfile` from the current directory when existing,
# or the global `Guardfile` at the home directory.
# Gets the default path of the `Guardfile`. This returns the `Guardfile`
# from the current directory when existing, or the global `Guardfile`
# at the home directory.
#
# @return [String] the path to the Guardfile
#
@ -222,7 +222,7 @@ module Guard
private
# The path to the `Guardfile` that is located at
# the directory where Guard has been started from.
# the directory, where Guard has been started from.
#
# @param [String] the path to the local Guardfile
#
@ -253,6 +253,7 @@ module Guard
# Declares a group of guards to be run with `guard start --group group_name`.
#
# @example Declare two groups of Guards
#
# group 'backend' do
# guard 'spork'
# guard 'rspec'
@ -290,6 +291,7 @@ module Guard
# The available options are different for each Guard implementation.
#
# @example Declare a Guard
#
# guard 'rspec' do
# end
#
@ -313,6 +315,7 @@ module Guard
# Define a pattern to be watched in order to run actions on file modification.
#
# @example Declare watchers for a Guard
#
# guard 'rspec' do
# watch('spec/spec_helper.rb')
# watch(%r{^.+_spec.rb})
@ -328,7 +331,7 @@ module Guard
@watchers << ::Guard::Watcher.new(pattern, action)
end
# Define a callback to execute arbitary code before or after any of
# Define a callback to execute arbitrary code before or after any of
# the `start`, `stop`, `reload`, `run_all` and `run_on_change` guards' method.
#
# @param [Array] args the callback arguments
@ -350,5 +353,6 @@ module Guard
UI.info "Ignoring paths: #{ paths.join(', ') }"
::Guard.listener.ignore_paths.push(*paths)
end
end
end

View File

@ -13,7 +13,7 @@ module Guard
attr_accessor :watchers, :options, :group
# initialize a Guard.
# Initialize a Guard.
#
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
# @param [Hash] options the custom Guard options.
@ -43,7 +43,7 @@ module Guard
end
end
# Call once when guard starts. Please override initialize method to init stuff.
# Call once when Guard starts. Please override initialize method to init stuff.
#
# @return [Boolean] Whether the start action was successful or not
#
@ -51,7 +51,7 @@ module Guard
true
end
# Call once when guard quit.
# Call once when Guard quit.
#
# @return [Boolean] Whether the stop action was successful or not
#

View File

@ -2,8 +2,8 @@ module Guard
# Guard has a hook mechanism that allows you to insert callbacks for individual Guards.
# By default, each of the Guard instance methods has a "_begin" and an "_end" hook.
# For example, the Guard::Guard#start method has a :start_begin hook that is run immediately
# before Guard::Guard#start and a :start_end hook that is run immediately after Guard::Guard#start.
# For example, the Guard::Guard#start method has a :start_begin hook that is runs immediately
# before Guard::Guard#start, and a :start_end hook that runs immediately after Guard::Guard#start.
#
# Read more about [hooks and callbacks on the wiki](https://github.com/guard/guard/wiki/Hooks-and-callbacks).
#
@ -21,11 +21,12 @@ module Guard
#
module InstanceMethods
# When +event+ is a Symbol, {#hook} will generate a hook name
# When event is a Symbol, {#hook} will generate a hook name
# by concatenating the method name from where {#hook} is called
# with the given Symbol.
#
# @example Add a hook with a Symbol
#
# def run_all
# hook :foo
# end
@ -33,10 +34,11 @@ module Guard
# Here, when {Guard::Guard#run_all} is called, {#hook} will notify callbacks
# registered for the "run_all_foo" event.
#
# When +event+ is a String, {#hook} will directly turn the String
# When event is a String, {#hook} will directly turn the String
# into a Symbol.
#
# @example Add a hook with a String
#
# def run_all
# hook "foo_bar"
# end
@ -63,7 +65,7 @@ module Guard
class << self
# Get all callbacks
# Get all callbacks.
#
def callbacks
@callbacks ||= Hash.new { |hash, key| hash[key] = [] }
@ -104,7 +106,7 @@ module Guard
end
end
# Reset all callbacks
# Reset all callbacks.
#
def reset_callbacks!
@callbacks = nil

View File

@ -162,7 +162,7 @@ module Guard
end
end
# Use relative paths?
# Use paths relative to the current directory.
#
# @return [Boolean] whether to use relative or absolute paths
#
@ -170,7 +170,7 @@ module Guard
!!@relativize_paths
end
# Removes ignored paths from the directory list.
# Removes the ignored paths from the directory list.
#
# @param [Array<String>] dirs the directory to listen to
# @param [Array<String>] ignore_paths the paths to ignore
@ -184,7 +184,7 @@ module Guard
private
# Gets a list of files that are in the modified firectories.
# Gets a list of files that are in the modified directories.
#
# @param [Array<String>] dirs the list of directories
# @param [Hash] options the options

View File

@ -1,6 +1,6 @@
module Guard
# Listener implementation for Mac OS X FSEvents.
# Listener implementation for Mac OS X `FSEvents`.
#
class Darwin < Listener

View File

@ -1,6 +1,6 @@
module Guard
# Listener implementation for Linux inotify.
# Listener implementation for Linux `inotify`.
#
class Linux < Listener

View File

@ -1,9 +1,9 @@
module Guard
# Polling listener that works cross-plattform and
# Polling listener that works cross-platform and
# has no dependencies. This is the listener that
# uses the most CPU processing power and has higher
# File IO that the other implementations.
# file IO that the other implementations.
#
class Polling < Listener

View File

@ -1,6 +1,6 @@
module Guard
# Listener implementation for Windows fchange.
# Listener implementation for Windows `fchange`.
#
class Windows < Listener

View File

@ -5,6 +5,7 @@ require 'guard/ui'
module Guard
# The notifier class handles cross-platform system notifications that supports:
#
# - Growl on Mac OS X
# - Libnotify on Linux
# - Notifu on Windows
@ -14,7 +15,7 @@ module Guard
# Application name as shown in the specific notification settings
APPLICATION_NAME = "Guard"
# Turn notifications of.
# Turn notifications off.
#
def self.turn_off
ENV["GUARD_NOTIFY"] = 'false'
@ -72,7 +73,7 @@ module Guard
private
# Send a message to Growl either with the growl gem or the growl_notify gem.
# Send a message to Growl either with the `growl` gem or the `growl_notify` gem.
#
# @param [String] title the notification title
# @param [String] message the message to show
@ -125,6 +126,7 @@ module Guard
# Get the image path for an image symbol.
#
# Known symbols are:
#
# - failed
# - pending
# - success

View File

@ -110,11 +110,12 @@ module Guard
@color_enabled
end
# Colorizes a text message. See the constant below for possible
# color_options parameters. You can pass :bright, a foreground
# and a background color.
# Colorizes a text message. See the constant in the UI class for possible
# color_options parameters. You can pass optionally :bright, a foreground
# color and a background color.
#
# @example
#
# color('Hello World', :red, :bright)
#
# @param [String] the text to colorize
@ -136,55 +137,55 @@ module Guard
end
# bright color
# Brighten the color
ANSI_ESCAPE_BRIGHT = '1'
# black foreground color
# Black foreground color
ANSI_ESCAPE_BLACK = '30'
# red foreground color
# Red foreground color
ANSI_ESCAPE_RED = '31'
# green foreground color
# Green foreground color
ANSI_ESCAPE_GREEN = '32'
# yellow foreground color
# Yellow foreground color
ANSI_ESCAPE_YELLOW = '33'
# blue foreground color
# Blue foreground color
ANSI_ESCAPE_BLUE = '34'
# magenta foreground color
# Magenta foreground color
ANSI_ESCAPE_MAGENTA = '35'
# cyan foreground color
# Cyan foreground color
ANSI_ESCAPE_CYAN = '36'
# white foreground color
# White foreground color
ANSI_ESCAPE_WHITE = '37'
# black background color
# Black background color
ANSI_ESCAPE_BGBLACK = '40'
# red background color
# Red background color
ANSI_ESCAPE_BGRED = '41'
# green background color
# Green background color
ANSI_ESCAPE_BGGREEN = '42'
# yellow background color
# Yellow background color
ANSI_ESCAPE_BGYELLOW = '43'
# blue background color
# Blue background color
ANSI_ESCAPE_BGBLUE = '44'
# magenta background color
# Magenta background color
ANSI_ESCAPE_BGMAGENTA = '45'
# cyan background color
# Cyan background color
ANSI_ESCAPE_BGCYAN = '46'
# white background color
# White background color
ANSI_ESCAPE_BGWHITE = '47'
end

View File

@ -1,6 +1,6 @@
module Guard
# The watcher defines a RegEx that will be matched against file system modifications.
# The watcher defines a RegExp that will be matched against file system modifications.
# When a watcher matches a change, an optional action block is executed to enable
# processing the file system change result.
#