Fix some typos, better wording and formatting.
This commit is contained in:
parent
78448631ab
commit
507abce5b6
@ -4,7 +4,7 @@ require 'guard/version'
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# Guard command line interface managed by [Thor](https://github.com/wycats/thor).
|
# 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
|
class CLI < Thor
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ module Guard
|
|||||||
# List the Guards that are available for use in your system and marks
|
# List the Guards that are available for use in your system and marks
|
||||||
# those that are currently used in your `Guardfile`.
|
# those that are currently used in your `Guardfile`.
|
||||||
#
|
#
|
||||||
# @example guard list output
|
# @example Guard list output
|
||||||
#
|
#
|
||||||
# Available guards:
|
# Available guards:
|
||||||
# bundler *
|
# 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'
|
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
|
# 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
|
# @param [String] guard_name the name of the Guard to initialize
|
||||||
#
|
#
|
||||||
|
@ -3,15 +3,15 @@ module Guard
|
|||||||
# The DSL class provides the methods that are used in each `Guardfile` to describe
|
# The DSL class provides the methods that are used in each `Guardfile` to describe
|
||||||
# the behaviour of Guard.
|
# the behaviour of Guard.
|
||||||
#
|
#
|
||||||
# The main keywords of the DSL are `guard` and `watch`, which are necessary to define
|
# The main keywords of the DSL are `guard` and `watch`. These are necessary to define
|
||||||
# which Guards are used a what file changes they are watching.
|
# 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.
|
# 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`
|
# 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.
|
# 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.
|
# The DSL will also evaluate normal Ruby code.
|
||||||
@ -24,6 +24,7 @@ module Guard
|
|||||||
# be appended to the current project `Guardfile`.
|
# be appended to the current project `Guardfile`.
|
||||||
#
|
#
|
||||||
# @example A sample of a complex Guardfile
|
# @example A sample of a complex Guardfile
|
||||||
|
#
|
||||||
# group 'frontend' do
|
# group 'frontend' do
|
||||||
# guard 'passenger', :ping => true do
|
# guard 'passenger', :ping => true do
|
||||||
# watch('config/application.rb')
|
# 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?
|
UI.error 'No guards found in Guardfile, please add at least one.' if !::Guard.guards.nil? && ::Guard.guards.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reevaluate the Guardfile to update the current Guard configuration
|
# Re-evaluate the `Guardfile` to update the current Guard configuration.
|
||||||
# when the `Guardfile` has been changed after Guard is started.
|
|
||||||
#
|
#
|
||||||
def reevaluate_guardfile
|
def reevaluate_guardfile
|
||||||
::Guard.guards.clear
|
::Guard.guards.clear
|
||||||
@ -206,12 +206,12 @@ module Guard
|
|||||||
# @return [Boolean] if the Guardfile is usable
|
# @return [Boolean] if the Guardfile is usable
|
||||||
#
|
#
|
||||||
def guardfile_contents_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
|
end
|
||||||
|
|
||||||
# Gets the default path of the `Guardfile`.
|
# Gets the default path of the `Guardfile`. This returns the `Guardfile`
|
||||||
# This returns the `Guardfile` from the current directory when existing,
|
# from the current directory when existing, or the global `Guardfile`
|
||||||
# or the global `Guardfile` at the home directory.
|
# at the home directory.
|
||||||
#
|
#
|
||||||
# @return [String] the path to the Guardfile
|
# @return [String] the path to the Guardfile
|
||||||
#
|
#
|
||||||
@ -222,7 +222,7 @@ module Guard
|
|||||||
private
|
private
|
||||||
|
|
||||||
# The path to the `Guardfile` that is located at
|
# 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
|
# @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`.
|
# Declares a group of guards to be run with `guard start --group group_name`.
|
||||||
#
|
#
|
||||||
# @example Declare two groups of Guards
|
# @example Declare two groups of Guards
|
||||||
|
#
|
||||||
# group 'backend' do
|
# group 'backend' do
|
||||||
# guard 'spork'
|
# guard 'spork'
|
||||||
# guard 'rspec'
|
# guard 'rspec'
|
||||||
@ -290,6 +291,7 @@ module Guard
|
|||||||
# The available options are different for each Guard implementation.
|
# The available options are different for each Guard implementation.
|
||||||
#
|
#
|
||||||
# @example Declare a Guard
|
# @example Declare a Guard
|
||||||
|
#
|
||||||
# guard 'rspec' do
|
# guard 'rspec' do
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
@ -313,6 +315,7 @@ module Guard
|
|||||||
# Define a pattern to be watched in order to run actions on file modification.
|
# Define a pattern to be watched in order to run actions on file modification.
|
||||||
#
|
#
|
||||||
# @example Declare watchers for a Guard
|
# @example Declare watchers for a Guard
|
||||||
|
#
|
||||||
# guard 'rspec' do
|
# guard 'rspec' do
|
||||||
# watch('spec/spec_helper.rb')
|
# watch('spec/spec_helper.rb')
|
||||||
# watch(%r{^.+_spec.rb})
|
# watch(%r{^.+_spec.rb})
|
||||||
@ -328,7 +331,7 @@ module Guard
|
|||||||
@watchers << ::Guard::Watcher.new(pattern, action)
|
@watchers << ::Guard::Watcher.new(pattern, action)
|
||||||
end
|
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.
|
# the `start`, `stop`, `reload`, `run_all` and `run_on_change` guards' method.
|
||||||
#
|
#
|
||||||
# @param [Array] args the callback arguments
|
# @param [Array] args the callback arguments
|
||||||
@ -350,5 +353,6 @@ module Guard
|
|||||||
UI.info "Ignoring paths: #{ paths.join(', ') }"
|
UI.info "Ignoring paths: #{ paths.join(', ') }"
|
||||||
::Guard.listener.ignore_paths.push(*paths)
|
::Guard.listener.ignore_paths.push(*paths)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@ module Guard
|
|||||||
|
|
||||||
attr_accessor :watchers, :options, :group
|
attr_accessor :watchers, :options, :group
|
||||||
|
|
||||||
# initialize a Guard.
|
# Initialize a Guard.
|
||||||
#
|
#
|
||||||
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
||||||
# @param [Hash] options the custom Guard options.
|
# @param [Hash] options the custom Guard options.
|
||||||
@ -43,7 +43,7 @@ module Guard
|
|||||||
end
|
end
|
||||||
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
|
# @return [Boolean] Whether the start action was successful or not
|
||||||
#
|
#
|
||||||
@ -51,7 +51,7 @@ module Guard
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Call once when guard quit.
|
# Call once when Guard quit.
|
||||||
#
|
#
|
||||||
# @return [Boolean] Whether the stop action was successful or not
|
# @return [Boolean] Whether the stop action was successful or not
|
||||||
#
|
#
|
||||||
@ -67,7 +67,7 @@ module Guard
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Should be used for long action like running all specs/tests/...
|
# Should be used for long action like running all specs/tests/...
|
||||||
#
|
#
|
||||||
# @return [Boolean] Whether the run_all action was successful or not
|
# @return [Boolean] Whether the run_all action was successful or not
|
||||||
#
|
#
|
||||||
|
@ -2,8 +2,8 @@ module Guard
|
|||||||
|
|
||||||
# Guard has a hook mechanism that allows you to insert callbacks for individual Guards.
|
# 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.
|
# 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
|
# 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 is run immediately after Guard::Guard#start.
|
# 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).
|
# 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
|
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
|
# by concatenating the method name from where {#hook} is called
|
||||||
# with the given Symbol.
|
# with the given Symbol.
|
||||||
#
|
#
|
||||||
# @example Add a hook with a Symbol
|
# @example Add a hook with a Symbol
|
||||||
|
#
|
||||||
# def run_all
|
# def run_all
|
||||||
# hook :foo
|
# hook :foo
|
||||||
# end
|
# end
|
||||||
@ -33,10 +34,11 @@ module Guard
|
|||||||
# Here, when {Guard::Guard#run_all} is called, {#hook} will notify callbacks
|
# Here, when {Guard::Guard#run_all} is called, {#hook} will notify callbacks
|
||||||
# registered for the "run_all_foo" event.
|
# 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.
|
# into a Symbol.
|
||||||
#
|
#
|
||||||
# @example Add a hook with a String
|
# @example Add a hook with a String
|
||||||
|
#
|
||||||
# def run_all
|
# def run_all
|
||||||
# hook "foo_bar"
|
# hook "foo_bar"
|
||||||
# end
|
# end
|
||||||
@ -63,7 +65,7 @@ module Guard
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
# Get all callbacks
|
# Get all callbacks.
|
||||||
#
|
#
|
||||||
def callbacks
|
def callbacks
|
||||||
@callbacks ||= Hash.new { |hash, key| hash[key] = [] }
|
@callbacks ||= Hash.new { |hash, key| hash[key] = [] }
|
||||||
@ -104,7 +106,7 @@ module Guard
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reset all callbacks
|
# Reset all callbacks.
|
||||||
#
|
#
|
||||||
def reset_callbacks!
|
def reset_callbacks!
|
||||||
@callbacks = nil
|
@callbacks = nil
|
||||||
|
@ -162,7 +162,7 @@ module Guard
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use relative paths?
|
# Use paths relative to the current directory.
|
||||||
#
|
#
|
||||||
# @return [Boolean] whether to use relative or absolute paths
|
# @return [Boolean] whether to use relative or absolute paths
|
||||||
#
|
#
|
||||||
@ -170,7 +170,7 @@ module Guard
|
|||||||
!!@relativize_paths
|
!!@relativize_paths
|
||||||
end
|
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>] dirs the directory to listen to
|
||||||
# @param [Array<String>] ignore_paths the paths to ignore
|
# @param [Array<String>] ignore_paths the paths to ignore
|
||||||
@ -184,7 +184,7 @@ module Guard
|
|||||||
|
|
||||||
private
|
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 [Array<String>] dirs the list of directories
|
||||||
# @param [Hash] options the options
|
# @param [Hash] options the options
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# Listener implementation for Mac OS X FSEvents.
|
# Listener implementation for Mac OS X `FSEvents`.
|
||||||
#
|
#
|
||||||
class Darwin < Listener
|
class Darwin < Listener
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# Listener implementation for Linux inotify.
|
# Listener implementation for Linux `inotify`.
|
||||||
#
|
#
|
||||||
class Linux < Listener
|
class Linux < Listener
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# Polling listener that works cross-plattform and
|
# Polling listener that works cross-platform and
|
||||||
# has no dependencies. This is the listener that
|
# has no dependencies. This is the listener that
|
||||||
# uses the most CPU processing power and has higher
|
# uses the most CPU processing power and has higher
|
||||||
# File IO that the other implementations.
|
# file IO that the other implementations.
|
||||||
#
|
#
|
||||||
class Polling < Listener
|
class Polling < Listener
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# Listener implementation for Windows fchange.
|
# Listener implementation for Windows `fchange`.
|
||||||
#
|
#
|
||||||
class Windows < Listener
|
class Windows < Listener
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ require 'guard/ui'
|
|||||||
module Guard
|
module Guard
|
||||||
|
|
||||||
# The notifier class handles cross-platform system notifications that supports:
|
# The notifier class handles cross-platform system notifications that supports:
|
||||||
|
#
|
||||||
# - Growl on Mac OS X
|
# - Growl on Mac OS X
|
||||||
# - Libnotify on Linux
|
# - Libnotify on Linux
|
||||||
# - Notifu on Windows
|
# - Notifu on Windows
|
||||||
@ -14,7 +15,7 @@ module Guard
|
|||||||
# Application name as shown in the specific notification settings
|
# Application name as shown in the specific notification settings
|
||||||
APPLICATION_NAME = "Guard"
|
APPLICATION_NAME = "Guard"
|
||||||
|
|
||||||
# Turn notifications of.
|
# Turn notifications off.
|
||||||
#
|
#
|
||||||
def self.turn_off
|
def self.turn_off
|
||||||
ENV["GUARD_NOTIFY"] = 'false'
|
ENV["GUARD_NOTIFY"] = 'false'
|
||||||
@ -72,7 +73,7 @@ module Guard
|
|||||||
|
|
||||||
private
|
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] title the notification title
|
||||||
# @param [String] message the message to show
|
# @param [String] message the message to show
|
||||||
@ -125,6 +126,7 @@ module Guard
|
|||||||
# Get the image path for an image symbol.
|
# Get the image path for an image symbol.
|
||||||
#
|
#
|
||||||
# Known symbols are:
|
# Known symbols are:
|
||||||
|
#
|
||||||
# - failed
|
# - failed
|
||||||
# - pending
|
# - pending
|
||||||
# - success
|
# - success
|
||||||
|
@ -110,11 +110,12 @@ module Guard
|
|||||||
@color_enabled
|
@color_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
# Colorizes a text message. See the constant below for possible
|
# Colorizes a text message. See the constant in the UI class for possible
|
||||||
# color_options parameters. You can pass :bright, a foreground
|
# color_options parameters. You can pass optionally :bright, a foreground
|
||||||
# and a background color.
|
# color and a background color.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
|
#
|
||||||
# color('Hello World', :red, :bright)
|
# color('Hello World', :red, :bright)
|
||||||
#
|
#
|
||||||
# @param [String] the text to colorize
|
# @param [String] the text to colorize
|
||||||
@ -136,55 +137,55 @@ module Guard
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# bright color
|
# Brighten the color
|
||||||
ANSI_ESCAPE_BRIGHT = '1'
|
ANSI_ESCAPE_BRIGHT = '1'
|
||||||
|
|
||||||
# black foreground color
|
# Black foreground color
|
||||||
ANSI_ESCAPE_BLACK = '30'
|
ANSI_ESCAPE_BLACK = '30'
|
||||||
|
|
||||||
# red foreground color
|
# Red foreground color
|
||||||
ANSI_ESCAPE_RED = '31'
|
ANSI_ESCAPE_RED = '31'
|
||||||
|
|
||||||
# green foreground color
|
# Green foreground color
|
||||||
ANSI_ESCAPE_GREEN = '32'
|
ANSI_ESCAPE_GREEN = '32'
|
||||||
|
|
||||||
# yellow foreground color
|
# Yellow foreground color
|
||||||
ANSI_ESCAPE_YELLOW = '33'
|
ANSI_ESCAPE_YELLOW = '33'
|
||||||
|
|
||||||
# blue foreground color
|
# Blue foreground color
|
||||||
ANSI_ESCAPE_BLUE = '34'
|
ANSI_ESCAPE_BLUE = '34'
|
||||||
|
|
||||||
# magenta foreground color
|
# Magenta foreground color
|
||||||
ANSI_ESCAPE_MAGENTA = '35'
|
ANSI_ESCAPE_MAGENTA = '35'
|
||||||
|
|
||||||
# cyan foreground color
|
# Cyan foreground color
|
||||||
ANSI_ESCAPE_CYAN = '36'
|
ANSI_ESCAPE_CYAN = '36'
|
||||||
|
|
||||||
# white foreground color
|
# White foreground color
|
||||||
ANSI_ESCAPE_WHITE = '37'
|
ANSI_ESCAPE_WHITE = '37'
|
||||||
|
|
||||||
# black background color
|
# Black background color
|
||||||
ANSI_ESCAPE_BGBLACK = '40'
|
ANSI_ESCAPE_BGBLACK = '40'
|
||||||
|
|
||||||
# red background color
|
# Red background color
|
||||||
ANSI_ESCAPE_BGRED = '41'
|
ANSI_ESCAPE_BGRED = '41'
|
||||||
|
|
||||||
# green background color
|
# Green background color
|
||||||
ANSI_ESCAPE_BGGREEN = '42'
|
ANSI_ESCAPE_BGGREEN = '42'
|
||||||
|
|
||||||
# yellow background color
|
# Yellow background color
|
||||||
ANSI_ESCAPE_BGYELLOW = '43'
|
ANSI_ESCAPE_BGYELLOW = '43'
|
||||||
|
|
||||||
# blue background color
|
# Blue background color
|
||||||
ANSI_ESCAPE_BGBLUE = '44'
|
ANSI_ESCAPE_BGBLUE = '44'
|
||||||
|
|
||||||
# magenta background color
|
# Magenta background color
|
||||||
ANSI_ESCAPE_BGMAGENTA = '45'
|
ANSI_ESCAPE_BGMAGENTA = '45'
|
||||||
|
|
||||||
# cyan background color
|
# Cyan background color
|
||||||
ANSI_ESCAPE_BGCYAN = '46'
|
ANSI_ESCAPE_BGCYAN = '46'
|
||||||
|
|
||||||
# white background color
|
# White background color
|
||||||
ANSI_ESCAPE_BGWHITE = '47'
|
ANSI_ESCAPE_BGWHITE = '47'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Guard
|
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
|
# When a watcher matches a change, an optional action block is executed to enable
|
||||||
# processing the file system change result.
|
# processing the file system change result.
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user