guardrc 0.1 → 0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  .DS_Store
2
+ *.gem
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 the file `.guardrc.rb` in your project (you can name it anything, .guardrc.rb is an example)
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('.guardrc.rb')
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.
@@ -1,10 +1,14 @@
1
1
  module Guardrc
2
+ @cache = ''
2
3
  def Guardrc.at(path)
3
- @path = path
4
- if File.exists?(path)
5
- File.open(@path, 'r') { |f| f.read }
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
- "puts 'Guardrc not found: #{path} not loaded'"
10
+ puts "Guardrc did not find any file at #{@path}"
8
11
  end
12
+ return @cache
9
13
  end
10
14
  end
@@ -1,3 +1,3 @@
1
1
  module Guardrc
2
- VERSION = "0.1"
2
+ VERSION = "0.3"
3
3
  end
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.1'
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-06-24 00:00:00.000000000 Z
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