Project

guardrc

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Guardrc allows one to have custom Guardfile commands in a different file than the Guardfile. Useful for different developers with different Guardfile preferences to be able to customize without removing/ignoring the Guardfile from git entirely.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Guardrc

Update

I just googled "guardrc" and discovered this functionality exists in Guard at this time (perhaps it even did before I wrote this gem). Please see guard/guard#265 for more information. Basically you use a .guard.rb file in your home directory. I won't yank this from rubygems since it has so many downloads and does work.

Update again

I have just used the .guard.rb however as noted, .guard.rb loads at the END of your Guardfile. This gem lets you load your arbitrary code anywhere, so it actually turned out to be effective for me for defining methods used later in the Guardfile (e.g. cucumber tag configurations from environment variables)

Description

Guardrc allows one to have custom Guardfile commands in a different file than the Guardfile. Useful for different developers with different Guardfile preferences to be able to customize without removing/ignoring the Guardfile from git entirely.

Purpose

I generally commit and do not ignore the Guardfile. I don't like to see GNTP notifications, but my collaborator does. The solution? Use another file, call it whatever you want, gitignore it, and load it in the Guardfile

Usage

Create a file with more Guard::DSL commands somewhere. I like to create this file in my home folder, calling it .guardrc

I usually only do one thing in my .guardrc file:

  # ~/.guardrc
  notification :off

Add the gem with bundler

  # Gemfile
  gem 'guardrc'

Run bundle, bundle install, etc to get it installed.

Next, in your Guardfile, require guardrc and eval your external file with Guardrc's help

  # Guardfile
  require 'guardrc'
  eval Guardrc.at('~/.guardrc')

Now, when you execute bundle exec guard, your external file will be read and executed as though its contents were in the Guardfile to begin with.

Final Notes

Guard is awesome, and I think it should work this way (check and read ~/.guardrc by default); until then you can use this.