Permalink
Browse files

Merge pull request #416 from Nerian/project_guardrc

Support .guardrc file on the folder from which Guard is executed as well
  • Loading branch information...
2 parents ae9b9de + e8758d5 commit 3a32b8918d94a0aa76732d4b3f67aa18376b5013 Thibaud Guillaume-Gentil committed Apr 8, 2013
Showing with 7 additions and 0 deletions.
  1. +6 −0 lib/guard/interactor.rb
  2. +1 −0 spec/spec_helper.rb
View
6 lib/guard/interactor.rb
@@ -103,6 +103,7 @@ def initialize
# Add Pry hooks:
#
# * Load `~/.guardrc` within each new Pry session.
+ # * Load project's `.guardrc` within each new Pry session.
# * Restore prompt after each evaluation.
#
def add_hooks
@@ -112,6 +113,11 @@ def add_hooks
end
end
+ Pry.config.hooks.add_hook :when_started, :load_project_guard_rc do
+ project_guard_rc = Dir.pwd + '/.guardrc'
+ load project_guard_rc if File.exist?(project_guard_rc)
+ end
+
if stty_exists?
Pry.config.hooks.add_hook :after_eval, :restore_visibility do
system('stty echo 2>/dev/null')
View
1 spec/spec_helper.rb
@@ -43,6 +43,7 @@
config.after(:each) do
Pry.config.hooks.delete_hook(:when_started, :load_guard_rc)
+ Pry.config.hooks.delete_hook(:when_started, :load_project_guard_rc)
if ::Guard.options
::Guard.options[:debug] = false

0 comments on commit 3a32b89

Please sign in to comment.