New CLI options: watchdir and guardfile thanks to @nestegg!

This commit is contained in:
Rémy Coutable 2011-07-28 23:59:31 +02:00
parent a366e0f8dd
commit 48057cb6c8
4 changed files with 11 additions and 20 deletions

View File

@ -6,6 +6,9 @@
## Improvements ## Improvements
- New CLI options: ([@nestegg][])
- `watchdir`/`-w` to specify the directory in which Guard should watch for changes,
- `guardfile`/`-G` to specify an alternate location for the Guardfile to use.
- Pull request [#90](https://github.com/guard/guard/pull/90): Refactoring of color handling in the `Guard::UI`. ([@stereobooster][]) - Pull request [#90](https://github.com/guard/guard/pull/90): Refactoring of color handling in the `Guard::UI`. ([@stereobooster][])
## 0.5.1 - July 2, 2011 ## 0.5.1 - July 2, 2011
@ -195,6 +198,7 @@
[@koshigoe]: https://github.com/koshigoe [@koshigoe]: https://github.com/koshigoe
[@mcmire]: https://github.com/mcmire [@mcmire]: https://github.com/mcmire
[@mislav]: https://github.com/mislav [@mislav]: https://github.com/mislav
[@nestegg]: https://github.com/nestegg
[@netzpirat]: https://github.com/netzpirat [@netzpirat]: https://github.com/netzpirat
[@nicksieger]: https://github.com/nicksieger [@nicksieger]: https://github.com/nicksieger
[@niklas]: https://github.com/niklas [@niklas]: https://github.com/niklas

View File

@ -1,9 +0,0 @@
class Thor
module CoreExt #:nodoc:
class HashWithIndifferentAccess < ::Hash #:nodoc:
def has_key?(key)
super(convert_key(key))
end
end
end
end

View File

@ -1,6 +1,3 @@
require 'core_ext/hash_with_indifferent_access'
#require 'pry'
module Guard module Guard
autoload :UI, 'guard/ui' autoload :UI, 'guard/ui'
@ -17,7 +14,7 @@ module Guard
# initialize this singleton # initialize this singleton
def setup(options = {}) def setup(options = {})
@options = options @options = options
@listener = Listener.select_and_init((options[:watchdir]) ? File.expand_path(options[:watchdir]) : Dir.pwd) @listener = Listener.select_and_init(@options[:watchdir] ? File.expand_path(@options[:watchdir]) : Dir.pwd)
@guards = [] @guards = []
@options[:notify] && ENV["GUARD_NOTIFY"] != 'false' ? Notifier.turn_on : Notifier.turn_off @options[:notify] && ENV["GUARD_NOTIFY"] != 'false' ? Notifier.turn_on : Notifier.turn_off

View File

@ -5,13 +5,12 @@ module Guard
class CLI < Thor class CLI < Thor
default_task :start default_task :start
method_option :clear, :type => :boolean, :default => false, :aliases => '-c', :banner => "Auto clear shell before each change/run_all/reload" method_option :clear, :type => :boolean, :default => false, :aliases => '-c', :banner => "Auto clear shell before each change/run_all/reload"
method_option :notify, :type => :boolean, :default => true, :aliases => '-n', :banner => "Notifications feature (growl/libnotify)" method_option :notify, :type => :boolean, :default => true, :aliases => '-n', :banner => "Notifications feature (growl/libnotify)"
method_option :debug, :type => :boolean, :default => false, :aliases => '-d', :banner => "Print debug messages" method_option :debug, :type => :boolean, :default => false, :aliases => '-d', :banner => "Print debug messages"
method_option :group, :type => :array, :default => [], :aliases => '-g', :banner => "Run only the passed groups" method_option :group, :type => :array, :default => [], :aliases => '-g', :banner => "Run only the passed groups"
method_option :watchdir, :type => :string, :aliases => '-w', :banner => "Specify the directory to watch"
method_option :guardfile, :type => :string, :aliases => '-C', :banner => "Specify a Guardfile" method_option :guardfile, :type => :string, :aliases => '-G', :banner => "Specify a Guardfile"
method_option :watchdir, :type => :string, :default => '.', :aliases => '-w', :banner => "Specify the directory to watch"
desc "start", "Starts Guard" desc "start", "Starts Guard"
def start def start