guard 0.1.0.beta.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,3 +1,155 @@
1
1
  = Guard
2
2
 
3
- Documentation is coming.
3
+ Guard is a command line tool to easly handle events on files modifications.
4
+
5
+ == Features
6
+
7
+ - FSEvent support on Mac OS X (without RubyCocoa!)
8
+ - Inotify support on Linux (beta)
9
+ - Super fast change detection
10
+ - Automatic files modifications detection (even new files are detected)
11
+ - Growl notification (please install {growlnotify}[http://growl.info/documentation/growlnotify.php])
12
+ - Libnotify notification
13
+
14
+ == Install
15
+
16
+ Only Mac OS X (10.5+) & Linux are supported. Tested on Ruby 1.8.7 & 1.9.2dev.
17
+
18
+ Install the gem:
19
+
20
+ gem install guard
21
+
22
+ Add it to your Gemfile (inside test group):
23
+
24
+ gem 'guard'
25
+
26
+ Generate an empty Guardfile with:
27
+
28
+ guard init
29
+
30
+ Add guard(s) you need (see available guards below)
31
+
32
+ == Usage
33
+
34
+ Just launch Guard inside your ruby/rails project with:
35
+
36
+ guard
37
+
38
+ Options list is available with:
39
+
40
+ guard help
41
+
42
+ Signal handlers are used to interact with Guard:
43
+
44
+ - Ctrl-C - Quit Guard (call stop guard(s) method before)
45
+ - Ctrl-\ - Call run_all guard(s) method
46
+ - Ctrl-Z - Call reload guard(s) method
47
+
48
+ == Available Guards
49
+
50
+ - {guard-rspec}[http://github.com/guard/guard-rspec]
51
+
52
+ guard ideas:
53
+
54
+ - guard-spork
55
+ - guard-livereload
56
+ - guard-cucumber
57
+ - guard-test
58
+ - guard-sass
59
+ - guard-bundler
60
+ - others ideas?
61
+
62
+ === Add a guard to your Guardfile
63
+
64
+ Add it to your Gemfile (inside test group):
65
+
66
+ gem '<guard-name>'
67
+
68
+ Add guard definition to your Guardfile with:
69
+
70
+ guard init <guard-name>
71
+
72
+ You are good to go!
73
+
74
+ == Create a guard
75
+
76
+ Create a new guard is very easy, just create a new gem with this basic structure:
77
+
78
+ - lib/
79
+ - guard/
80
+ - guard-name/
81
+ - templates/
82
+ - Guardfile (needed for guard init <guard-name>)
83
+ - guard-name.rb
84
+
85
+ lib/guard/guard-name.rb inherit from guard/guard and should overwrite at least one of the five guard methods. Example:
86
+
87
+ require 'guard'
88
+ require 'guard/guard'
89
+
90
+ module Guard
91
+ class GuardName < Guard
92
+
93
+ # ================
94
+ # = Guard method =
95
+ # ================
96
+
97
+ # Call once when guard starts
98
+ def start
99
+ true
100
+ end
101
+
102
+ # Call with Ctrl-C signal (when Guard quit)
103
+ def stop
104
+ true
105
+ end
106
+
107
+ # Call with Ctrl-Z signal
108
+ def reload
109
+ true
110
+ end
111
+
112
+ # Call with Ctrl-/ signal
113
+ def run_all
114
+ true
115
+ end
116
+
117
+ # Call on file(s) modifications
118
+ def run_on_change(paths)
119
+ true
120
+ end
121
+
122
+ end
123
+ end
124
+
125
+ Looks at available guards code for more concrete example.
126
+
127
+ == Guardfile DSL
128
+
129
+ Guardfile DSL consists of just 2 simple methods: guard & watch. Example:
130
+
131
+ guard 'rspec', :version => 2 do
132
+ watch('^spec/(.*)_spec.rb')
133
+ watch('^lib/(.*)\.rb') { |m| "spec/lib/#{m[1]}_spec.rb" }
134
+ watch('^spec/spec_helper.rb') { "spec" }
135
+ watch('^spec/spec_helper.rb') { `say hello` }
136
+ end
137
+
138
+ - "guard" method allow to add a guard with an optional options hash
139
+ - "watch" method allow to define which files are supervised per this guard. A optional block can be added to overwrite path sending to run_on_change guard method or launch simple command.
140
+
141
+ == TODO
142
+
143
+ - Add more specs, help are welcome because I'm not sure about how to test stuff like this :-)
144
+
145
+ == Development
146
+
147
+ - Source hosted at {GitHub}[http://github.com/guard/guard]
148
+ - Report issues/Questions/Feature requests on {GitHub Issues}[http://github.com/guard/guard/issues]
149
+
150
+ Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
151
+ you make.
152
+
153
+ == Authors
154
+
155
+ {Thibaud Guillaume-Gentil}[http://github.com/thibaudgg].
data/lib/guard.rb CHANGED
@@ -19,7 +19,7 @@ module Guard
19
19
 
20
20
  Dsl.evaluate_guardfile
21
21
  if guards.empty?
22
- UI.error "No guards found in Guardfile, too bad."
22
+ UI.error "No guards found in Guardfile, please add it at least one."
23
23
  else
24
24
  Interactor.init_signal_traps
25
25
 
data/lib/guard/cli.rb CHANGED
@@ -8,12 +8,12 @@ module Guard
8
8
  desc "start", "Starts guard"
9
9
  method_option :clear, :type => :boolean, :default => false, :aliases => '-c', :banner => "Auto clear shell after each change"
10
10
  def start
11
- Guard.start(options)
11
+ ::Guard.start(options)
12
12
  end
13
13
 
14
14
  desc "version", "Prints the guard's version information"
15
15
  def version
16
- Guard::UI.info "Guard version #{Guard::VERSION}"
16
+ ::Guard::UI.info "Guard version #{Guard::VERSION}"
17
17
  end
18
18
  map %w(-v --version) => :version
19
19
 
@@ -23,12 +23,12 @@ module Guard
23
23
  puts "Writing new Guardfile to #{Dir.pwd}/Guardfile"
24
24
  FileUtils.cp(File.expand_path('../templates/Guardfile', __FILE__), 'Guardfile')
25
25
  elsif guard_name.nil?
26
- Guard::UI.error "Guardfile already exists at #{Dir.pwd}/Guardfile"
26
+ ::Guard::UI.error "Guardfile already exists at #{Dir.pwd}/Guardfile"
27
27
  exit 1
28
28
  end
29
29
 
30
30
  if guard_name
31
- guard_class = Guard.get_guard_class(guard_name)
31
+ guard_class = ::Guard.get_guard_class(guard_name)
32
32
  guard_class.init(guard_name)
33
33
  end
34
34
  end
data/lib/guard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- VERSION = "0.1.0.beta.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196407
5
- prerelease: true
4
+ hash: 27
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
9
  - 0
10
- - beta
11
- - 2
12
- version: 0.1.0.beta.2
10
+ version: 0.1.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Thibaud Guillaume-Gentil
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2010-10-07 00:00:00 +02:00
18
+ date: 2010-10-08 00:00:00 +02:00
21
19
  default_executable:
22
20
  dependencies:
23
21
  - !ruby/object:Gem::Dependency
@@ -45,14 +43,12 @@ dependencies:
45
43
  requirements:
46
44
  - - ~>
47
45
  - !ruby/object:Gem::Version
48
- hash: 62196407
46
+ hash: 27
49
47
  segments:
50
48
  - 0
51
49
  - 1
52
50
  - 0
53
- - beta
54
- - 2
55
- version: 0.1.0.beta.2
51
+ version: 0.1.0
56
52
  type: :development
57
53
  version_requirements: *id002
58
54
  - !ruby/object:Gem::Dependency
@@ -151,7 +147,7 @@ dependencies:
151
147
  version: 0.1.3
152
148
  type: :runtime
153
149
  version_requirements: *id008
154
- description: Guard is a command line tool to easly manage script launch when your files change
150
+ description: Guard is a command line tool to easly handle events on files modifications.
155
151
  email:
156
152
  - thibaud@thibaud.me
157
153
  executables:
@@ -216,6 +212,6 @@ rubyforge_project: guard
216
212
  rubygems_version: 1.3.7
217
213
  signing_key:
218
214
  specification_version: 3
219
- summary: Guard keep an eye on your files event
215
+ summary: Guard keep an eye on your files modifications.
220
216
  test_files: []
221
217