Skip to content
This repository
Browse code

If there is a .guardrc file on the folder from which Guard is execute…

…d, then load it too.
  • Loading branch information...
commit e8758d53a0c8698976c042c43e6055dd6aea1fb2 1 parent 2aed4bd
Gonzalo Rodríguez-Baltanás Díaz Nerian authored

Showing 2 changed files with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +6 0 lib/guard/interactor.rb
  2. +1 0  spec/spec_helper.rb
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 comments on commit e8758d5

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