From e3bbdbfa4204848d0be4edacfb8422ab5b25fab8 Mon Sep 17 00:00:00 2001 From: Doug Renn Date: Fri, 22 Jul 2011 15:27:03 -0600 Subject: [PATCH] Add a command line option to specify the guardfile --- lib/core_ext/hash_with_indifferent_access.rb | 9 +++++++++ lib/guard.rb | 2 ++ lib/guard/cli.rb | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 lib/core_ext/hash_with_indifferent_access.rb diff --git a/lib/core_ext/hash_with_indifferent_access.rb b/lib/core_ext/hash_with_indifferent_access.rb new file mode 100644 index 0000000..cfb83e7 --- /dev/null +++ b/lib/core_ext/hash_with_indifferent_access.rb @@ -0,0 +1,9 @@ +class Thor + module CoreExt #:nodoc: + class HashWithIndifferentAccess < ::Hash #:nodoc: + def has_key?(key) + super(convert_key(key)) + end + end + end +end diff --git a/lib/guard.rb b/lib/guard.rb index 8923320..607e759 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -1,3 +1,5 @@ +require 'core_ext/hash_with_indifferent_access' + module Guard autoload :UI, 'guard/ui' diff --git a/lib/guard/cli.rb b/lib/guard/cli.rb index 9bf323a..98c4fc8 100644 --- a/lib/guard/cli.rb +++ b/lib/guard/cli.rb @@ -10,6 +10,8 @@ module Guard 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 :guardfile, :type => :string, :default => './Guardfile', :aliases => '-C', :banner => "Specify a Guardfile" + desc "start", "Starts Guard" def start ::Guard.start(options)