guard 0.1.0 → 0.1.1
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/README.rdoc +9 -9
- data/lib/guard.rb +4 -2
- data/lib/guard/cli.rb +2 -1
- data/lib/guard/interactor.rb +1 -1
- data/lib/guard/ui.rb +8 -3
- data/lib/guard/version.rb +1 -1
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -13,7 +13,7 @@ Guard is a command line tool to easly handle events on files modifications.
|
|
13
13
|
|
14
14
|
== Install
|
15
15
|
|
16
|
-
Only Mac OS X (10.5+) & Linux are supported. Tested on Ruby 1.8.7 & 1.9.
|
16
|
+
Only Mac OS X (10.5+) & Linux are supported. Tested on Ruby 1.8.7 & 1.9.2.
|
17
17
|
|
18
18
|
Install the gem:
|
19
19
|
|
@@ -75,12 +75,12 @@ You are good to go!
|
|
75
75
|
|
76
76
|
Create a new guard is very easy, just create a new gem with this basic structure:
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
lib/
|
79
|
+
guard/
|
80
|
+
guard-name/
|
81
|
+
templates/
|
82
|
+
Guardfile (needed for guard init <guard-name>)
|
83
|
+
guard-name.rb
|
84
84
|
|
85
85
|
lib/guard/guard-name.rb inherit from guard/guard and should overwrite at least one of the five guard methods. Example:
|
86
86
|
|
@@ -126,7 +126,7 @@ Looks at available guards code for more concrete example.
|
|
126
126
|
|
127
127
|
== Guardfile DSL
|
128
128
|
|
129
|
-
Guardfile DSL consists of just
|
129
|
+
Guardfile DSL consists of just two simple methods: guard & watch. Example:
|
130
130
|
|
131
131
|
guard 'rspec', :version => 2 do
|
132
132
|
watch('^spec/(.*)_spec.rb')
|
@@ -152,4 +152,4 @@ you make.
|
|
152
152
|
|
153
153
|
== Authors
|
154
154
|
|
155
|
-
{Thibaud Guillaume-Gentil}[http://github.com/thibaudgg]
|
155
|
+
{Thibaud Guillaume-Gentil}[http://github.com/thibaudgg]
|
data/lib/guard.rb
CHANGED
@@ -47,17 +47,19 @@ module Guard
|
|
47
47
|
require "guard/#{name.downcase}"
|
48
48
|
guard_class = ObjectSpace.each_object(Class).detect { |c| c.to_s.downcase.match "^guard::#{name.downcase}" }
|
49
49
|
rescue LoadError
|
50
|
-
UI.error "
|
50
|
+
UI.error "Could not find gem 'guard-#{name}' in the current Gemfile."
|
51
51
|
end
|
52
52
|
|
53
53
|
def locate_guard(name)
|
54
54
|
spec = Bundler.load.specs.find{|s| s.name == "guard-#{name}" }
|
55
|
-
UI.error "Could not find gem '#{name}' in the current Gemfile." unless spec
|
56
55
|
spec.full_gem_path
|
56
|
+
rescue
|
57
|
+
UI.error "Could not find gem 'guard-#{name}' in the current Gemfile."
|
57
58
|
end
|
58
59
|
|
59
60
|
def run
|
60
61
|
listener.stop
|
62
|
+
UI.clear if options[:clear]
|
61
63
|
yield
|
62
64
|
listener.start
|
63
65
|
end
|
data/lib/guard/cli.rb
CHANGED
@@ -6,7 +6,8 @@ module Guard
|
|
6
6
|
default_task :start
|
7
7
|
|
8
8
|
desc "start", "Starts guard"
|
9
|
-
method_option :clear, :type => :boolean, :default => false, :aliases => '-c', :banner => "Auto clear shell
|
9
|
+
method_option :clear, :type => :boolean, :default => false, :aliases => '-c', :banner => "Auto clear shell before each change/run_all/reload"
|
10
|
+
method_option :debug, :type => :boolean, :default => false, :aliases => '-d', :banner => "Print debug messages"
|
10
11
|
def start
|
11
12
|
::Guard.start(options)
|
12
13
|
end
|
data/lib/guard/interactor.rb
CHANGED
data/lib/guard/ui.rb
CHANGED
@@ -5,7 +5,6 @@ module Guard
|
|
5
5
|
def info(message, options = {})
|
6
6
|
unless ENV["GUARD_ENV"] == "test"
|
7
7
|
reset_line if options[:reset]
|
8
|
-
clear if options.key?(:clear) ? options[:clear] : (::Guard.options && ::Guard.options[:clear])
|
9
8
|
puts reset_color(message) if message != ''
|
10
9
|
end
|
11
10
|
end
|
@@ -14,16 +13,22 @@ module Guard
|
|
14
13
|
puts "ERROR: #{message}"
|
15
14
|
end
|
16
15
|
|
16
|
+
def debug(message)
|
17
|
+
unless ENV["GUARD_ENV"] == "test"
|
18
|
+
puts "DEBUG: #{message}" if ::Guard.options && ::Guard.options[:debug]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
17
22
|
def reset_line
|
18
23
|
print "\r\e "
|
19
24
|
end
|
20
25
|
|
21
|
-
private
|
22
|
-
|
23
26
|
def clear
|
24
27
|
system("clear;")
|
25
28
|
end
|
26
29
|
|
30
|
+
private
|
31
|
+
|
27
32
|
def reset_color(text)
|
28
33
|
color(text, "\e[0m")
|
29
34
|
end
|
data/lib/guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thibaud Guillaume-Gentil
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-10 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -147,7 +147,7 @@ dependencies:
|
|
147
147
|
version: 0.1.3
|
148
148
|
type: :runtime
|
149
149
|
version_requirements: *id008
|
150
|
-
description: Guard is a command line tool to
|
150
|
+
description: Guard is a command line tool to easily handle events on files modifications.
|
151
151
|
email:
|
152
152
|
- thibaud@thibaud.me
|
153
153
|
executables:
|