guardrc 0.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +22 -3
- data/lib/guardrc/guardrc.rb +8 -4
- data/lib/guardrc/version.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -9,10 +9,29 @@ I don't like to see GNTP notifications, but my collaborator does.
|
|
9
9
|
The solution? Use another file, call it whatever you want, gitignore it, and load it in the Guardfile
|
10
10
|
|
11
11
|
## Usage
|
12
|
-
Create
|
12
|
+
Create a file with more Guard::DSL commands somewhere.
|
13
|
+
I like to create this file in my home folder, calling it `.guardrc`
|
14
|
+
|
15
|
+
I usually only do one thing in my .guardrc file:
|
16
|
+
```ruby
|
17
|
+
# ~/.guardrc
|
18
|
+
notification :off
|
19
|
+
```
|
20
|
+
|
13
21
|
Add the gem with bundler
|
22
|
+
```ruby
|
23
|
+
# Gemfile
|
24
|
+
gem 'guardrc'
|
25
|
+
```
|
26
|
+
|
14
27
|
Next, in your Guardfile, require guardrc and eval your external file with Guardrc's help
|
15
28
|
```ruby
|
29
|
+
# Guardfile
|
16
30
|
require 'guardrc'
|
17
|
-
eval Guardrc.at('
|
18
|
-
```
|
31
|
+
eval Guardrc.at('~/.guardrc')
|
32
|
+
```
|
33
|
+
|
34
|
+
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.
|
35
|
+
|
36
|
+
## Final Notes
|
37
|
+
Guard is awesome, and I think it should work this way (check and read ~/.guardrc by default); until then you can use this.
|
data/lib/guardrc/guardrc.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
module Guardrc
|
2
|
+
@cache = ''
|
2
3
|
def Guardrc.at(path)
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
puts "Guardrc is looking for extra commands at #{path}" if path
|
5
|
+
@path = File.expand_path(path)
|
6
|
+
if File.exists?(@path)
|
7
|
+
File.open(@path, 'r') { |f| @cache = f.read }
|
8
|
+
puts "Guardrc has loaded your auxiliary commands!"
|
6
9
|
else
|
7
|
-
|
10
|
+
puts "Guardrc did not find any file at #{@path}"
|
8
11
|
end
|
12
|
+
return @cache
|
9
13
|
end
|
10
14
|
end
|
data/lib/guardrc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guardrc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Guardrc allows one to have custom Guardfile commands in a different file
|
15
15
|
than the Guardfile. Useful for different developers with different Guardfile preferences
|