Skip to content
This repository
Browse code

Merge pull request #416 from Nerian/project_guardrc

Support .guardrc file on the folder from which Guard is executed as well
  • Loading branch information...
commit 3a32b8918d94a0aa76732d4b3f67aa18376b5013 2 parents ae9b9de + e8758d5
Thibaud Guillaume-Gentil authored April 08, 2013
6  lib/guard/interactor.rb
@@ -103,6 +103,7 @@ def initialize
103 103
     # Add Pry hooks:
104 104
     #
105 105
     # * Load `~/.guardrc` within each new Pry session.
  106
+    # * Load project's `.guardrc` within each new Pry session.
106 107
     # * Restore prompt after each evaluation.
107 108
     #
108 109
     def add_hooks
@@ -112,6 +113,11 @@ def add_hooks
112 113
         end
113 114
       end
114 115
 
  116
+      Pry.config.hooks.add_hook :when_started, :load_project_guard_rc do
  117
+        project_guard_rc = Dir.pwd + '/.guardrc'
  118
+        load project_guard_rc if File.exist?(project_guard_rc)
  119
+      end
  120
+
115 121
       if stty_exists?
116 122
         Pry.config.hooks.add_hook :after_eval, :restore_visibility do
117 123
           system('stty echo 2>/dev/null')
1  spec/spec_helper.rb
@@ -43,6 +43,7 @@
43 43
 
44 44
   config.after(:each) do
45 45
     Pry.config.hooks.delete_hook(:when_started, :load_guard_rc)
  46
+    Pry.config.hooks.delete_hook(:when_started, :load_project_guard_rc)
46 47
 
47 48
     if ::Guard.options
48 49
       ::Guard.options[:debug] = false

0 notes on commit 3a32b89

Please sign in to comment.
Something went wrong with that request. Please try again.