Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

kfatehi/guardrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Eval some code in your guardfile so you can customize guard without dirtying the stream.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages