guard-less 0.0.2 → 0.0.4
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.md +8 -3
- data/lib/guard/less.rb +17 -5
- data/lib/guard/less/templates/Guardfile +2 -2
- data/lib/guard/less/version.rb +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -21,15 +21,20 @@ Please read [Guard usage doc](https://github.com/guard/guard#readme).
|
|
21
21
|
|
22
22
|
## Guardfile
|
23
23
|
|
24
|
-
guard 'less' do
|
24
|
+
guard 'less', :all_on_start => true, :all_after_change => true do
|
25
25
|
watch(/.*\.less$/)
|
26
26
|
end
|
27
27
|
|
28
28
|
Please read [Guard doc](https://github.com/guard/guard#readme) for more info about Guardfile DSL.
|
29
29
|
|
30
|
+
## Options
|
31
|
+
|
32
|
+
:all_after_change => [true|false] # run on all files after any changed files, default: true
|
33
|
+
:all_on_start => [true|false] # run on all the files at startup, default: true
|
34
|
+
|
30
35
|
# License
|
31
36
|
|
32
|
-
**Copyright (c) 2011 Brendan Erwin**
|
37
|
+
**Copyright (c) 2011 Brendan Erwin and contributors**
|
33
38
|
|
34
39
|
Permission is hereby granted, free of charge, to any person obtaining
|
35
40
|
a copy of this software and associated documentation files (the
|
@@ -48,4 +53,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
48
53
|
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
49
54
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
50
55
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
51
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/guard/less.rb
CHANGED
@@ -10,9 +10,15 @@ module Guard
|
|
10
10
|
# ================
|
11
11
|
# = Guard method =
|
12
12
|
# ================
|
13
|
+
def initialize(watchers=[], options={})
|
14
|
+
super
|
15
|
+
@all_after_change = options.delete(:all_after_change)
|
16
|
+
@all_on_start = options.delete(:all_on_start)
|
17
|
+
end
|
13
18
|
|
14
19
|
def start
|
15
20
|
UI.info "Guard::Less #{LessVersion::VERSION} is on the job!"
|
21
|
+
run_all unless @all_on_start == false
|
16
22
|
end
|
17
23
|
|
18
24
|
# Call with Ctrl-/ signal
|
@@ -20,24 +26,30 @@ module Guard
|
|
20
26
|
def run_all
|
21
27
|
patterns = @watchers.map { |w| w.pattern }
|
22
28
|
files = Dir.glob('**/*.*')
|
23
|
-
|
29
|
+
paths = []
|
24
30
|
files.each do |file|
|
25
31
|
patterns.each do |pattern|
|
26
|
-
|
32
|
+
paths << file if file.match(Regexp.new(pattern))
|
27
33
|
end
|
28
34
|
end
|
29
|
-
|
35
|
+
run(paths)
|
30
36
|
end
|
31
37
|
|
32
38
|
# Call on file(s) modifications
|
33
39
|
def run_on_change(paths)
|
40
|
+
run_all if run(paths) && (@all_after_change != false)
|
41
|
+
end
|
42
|
+
|
43
|
+
def run(paths)
|
44
|
+
last_passed = false
|
34
45
|
paths.each do |file|
|
35
46
|
unless File.basename(file)[0] == "_"
|
36
47
|
UI.info "lessc - #{file}\n"
|
37
|
-
|
48
|
+
last_passed = system("lessc #{file} --verbose")
|
38
49
|
end
|
39
50
|
end
|
51
|
+
last_passed
|
40
52
|
end
|
41
53
|
|
42
54
|
end
|
43
|
-
end
|
55
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
guard 'less' do
|
1
|
+
guard 'less', :all_on_start => true, :all_after_pass => true do
|
2
2
|
watch(/.*\.less$/)
|
3
|
-
end
|
3
|
+
end
|
data/lib/guard/less/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brendan Erwin
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-04-23 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|