guard-less 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -0
- data/lib/guard/less.rb +52 -0
- data/lib/guard/less/templates/Guardfile +3 -0
- metadata +113 -0
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Guard-Less
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
You will need to have [guard](http://github.com/guard/guard) first.
|
6
|
+
|
7
|
+
Install the gem with:
|
8
|
+
|
9
|
+
gem install guard-less
|
10
|
+
|
11
|
+
Add an initial setup to your Guardfile with:
|
12
|
+
|
13
|
+
guard init less
|
14
|
+
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
A guard extension that compiles `.less` files to `.css` files when changed.
|
19
|
+
|
20
|
+
guard 'less' do
|
21
|
+
watch('(.*\.less)$')
|
22
|
+
end
|
23
|
+
|
24
|
+
#License
|
25
|
+
|
26
|
+
**Copyright (c) 2011 Brendan Erwin**
|
27
|
+
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
29
|
+
a copy of this software and associated documentation files (the
|
30
|
+
"Software"), to deal in the Software without restriction, including
|
31
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
32
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
33
|
+
permit persons to whom the Software is furnished to do so, subject to
|
34
|
+
the following conditions:
|
35
|
+
|
36
|
+
The above copyright notice and this permission notice shall be
|
37
|
+
included in all copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
40
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
41
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
42
|
+
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
43
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
44
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
45
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/guard/less.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#-*- Mode: ruby; tab-width: 2; indent-tabs-mode: nil;
|
2
|
+
|
3
|
+
require 'guard'
|
4
|
+
require 'guard/guard'
|
5
|
+
|
6
|
+
require 'less'
|
7
|
+
|
8
|
+
module Guard
|
9
|
+
class Less < Guard
|
10
|
+
|
11
|
+
VERSION = '0.0.1'
|
12
|
+
|
13
|
+
def initialize(watchers = [], options = {})
|
14
|
+
super
|
15
|
+
|
16
|
+
@watchers = watchers
|
17
|
+
end
|
18
|
+
|
19
|
+
# ================
|
20
|
+
# = Guard method =
|
21
|
+
# ================
|
22
|
+
|
23
|
+
def start
|
24
|
+
puts "Guard::Less #{VERSION} is on the job!\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Call with Ctrl-/ signal
|
28
|
+
# This method should be principally used for long action like running all specs/tests/...
|
29
|
+
def run_all
|
30
|
+
patterns = @watchers.map {|w| w.pattern}
|
31
|
+
files = Dir.glob('**/*.*')
|
32
|
+
r = []
|
33
|
+
files.each do |file|
|
34
|
+
patterns.each do |pattern|
|
35
|
+
r << file if file.match(Regexp.new(pattern))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
run_on_change(r)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Call on file(s) modifications
|
42
|
+
def run_on_change(paths)
|
43
|
+
paths.each do |file|
|
44
|
+
unless File.basename(file)[0] == "_"
|
45
|
+
puts "lessc - #{file}\n"
|
46
|
+
`lessc #{file} --verbose`
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-less
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Brendan Erwin
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-04 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: guard
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 2
|
30
|
+
- 1
|
31
|
+
version: 0.2.1
|
32
|
+
type: :runtime
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: less
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 2
|
45
|
+
version: "1.2"
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 2
|
58
|
+
- 0
|
59
|
+
- 0
|
60
|
+
- rc
|
61
|
+
version: 2.0.0.rc
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: *id003
|
65
|
+
description: Guard::Less automatically compiles less (like lessc --watch)
|
66
|
+
email:
|
67
|
+
- brendanjerwin@gmail.com
|
68
|
+
executables: []
|
69
|
+
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
74
|
+
files:
|
75
|
+
- lib/guard/less/templates/Guardfile
|
76
|
+
- lib/guard/less.rb
|
77
|
+
- README.md
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://rubygems.org/gems/guard-less
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
segments:
|
101
|
+
- 1
|
102
|
+
- 3
|
103
|
+
- 6
|
104
|
+
version: 1.3.6
|
105
|
+
requirements: []
|
106
|
+
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 1.3.7
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: Guard gem for Less
|
112
|
+
test_files: []
|
113
|
+
|