guard-ejs 0.0.1 → 0.0.2
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.
- checksums.yaml +7 -0
- data/lib/guard/ejs.rb +30 -19
- data/lib/guard/ejs/version.rb +1 -1
- metadata +14 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b33dd25ce24abe0db1d7da5e6a9b33c45d8887ec
|
4
|
+
data.tar.gz: dfe1585ce8a68cdfd47fa663c68fb791fd800495
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62ff8f7fa9534d90c5442aa8afc3b655ba4ca961492c65ad7d6779dff71dd6664a0af1af294b065511dec920f6d491b1c68d153803217d2a0adb15e55762d497
|
7
|
+
data.tar.gz: bd8ba1af86d1ae78bde4525f620219217d00928450890b578203bd14b19b9ad1abec293a2a0bd3227756eced0f7ce2296214c59ff68ac2d3395bcd0409b3e0df
|
data/lib/guard/ejs.rb
CHANGED
@@ -1,21 +1,30 @@
|
|
1
1
|
require 'guard'
|
2
2
|
require 'guard/guard'
|
3
|
+
require 'guard/watcher'
|
3
4
|
require 'ejs'
|
4
5
|
|
5
6
|
module Guard
|
6
7
|
class EJS < Guard
|
8
|
+
DEFAULT_OPTIONS = {
|
9
|
+
run_on_start: true,
|
10
|
+
namespace: 'app',
|
11
|
+
input: 'public/templates',
|
12
|
+
output: 'public/js/templates.js'
|
13
|
+
}
|
14
|
+
|
7
15
|
def initialize(watchers = [], options = {})
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
input
|
13
|
-
|
14
|
-
|
16
|
+
defaults = DEFAULT_OPTIONS.clone
|
17
|
+
|
18
|
+
if options[:input]
|
19
|
+
defaults.merge!(output: options[:input])
|
20
|
+
watchers << ::Guard::Watcher.new(%r{^#{options[:input]}/.+$})
|
21
|
+
end
|
22
|
+
|
23
|
+
super(watchers, defaults.merge(options))
|
15
24
|
end
|
16
25
|
|
17
26
|
def start
|
18
|
-
UI.info 'Guard::EJS is now watching
|
27
|
+
UI.info 'Guard::EJS is now watching for changes.'
|
19
28
|
|
20
29
|
# Run all if the option is true.
|
21
30
|
run_all() if @options[:run_on_start]
|
@@ -23,32 +32,33 @@ module Guard
|
|
23
32
|
|
24
33
|
# Compile all templates.
|
25
34
|
def run_all
|
26
|
-
|
27
|
-
files = Dir.glob("#{@options[:input]}/**/*").select do |path|
|
28
|
-
not File.directory? path
|
29
|
-
end
|
30
|
-
|
31
|
-
run_on_modifications files
|
35
|
+
run_on_modifications()
|
32
36
|
end
|
33
37
|
|
34
38
|
# Run when the guardfile changes.
|
35
39
|
def run_on_changes(paths)
|
36
|
-
|
40
|
+
run_all()
|
37
41
|
end
|
38
42
|
|
39
43
|
def run_on_additions(paths)
|
40
|
-
|
44
|
+
run_all()
|
41
45
|
end
|
42
46
|
|
43
47
|
# Compile each template at the passed in paths.
|
44
|
-
def run_on_modifications(paths)
|
48
|
+
def run_on_modifications(paths = [])
|
45
49
|
hash = {}
|
46
50
|
|
47
|
-
|
51
|
+
# Get all files.
|
52
|
+
paths = Dir.glob("#{@options[:input]}/**/*").select do |path|
|
53
|
+
not File.directory? path
|
54
|
+
end
|
55
|
+
|
48
56
|
paths.each do |path|
|
49
57
|
file = File.read path
|
50
58
|
compiled = ::EJS.compile file
|
51
59
|
hash[path] = compiled
|
60
|
+
|
61
|
+
UI.info "[Guard::EJS] Compiled #{path}."
|
52
62
|
end
|
53
63
|
|
54
64
|
# Just overwrite the whole thing for now.
|
@@ -67,7 +77,8 @@ module Guard
|
|
67
77
|
end
|
68
78
|
|
69
79
|
def run_on_removals(paths)
|
70
|
-
|
80
|
+
UI.info "Recompiling templates without #{paths}"
|
81
|
+
run_all()
|
71
82
|
end
|
72
83
|
end
|
73
84
|
end
|
data/lib/guard/ejs/version.rb
CHANGED
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-ejs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Wm. McAllister
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: guard
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.8.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.8.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: ejs
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.1.1
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.1.1
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: bundler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Guard gem for EJS
|
@@ -66,31 +59,30 @@ executables: []
|
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
62
|
+
- lib/guard/ejs.rb
|
69
63
|
- lib/guard/ejs/templates/Guardfile
|
70
64
|
- lib/guard/ejs/version.rb
|
71
|
-
- lib/guard/ejs.rb
|
72
65
|
homepage: ''
|
73
66
|
licenses: []
|
67
|
+
metadata: {}
|
74
68
|
post_install_message:
|
75
69
|
rdoc_options: []
|
76
70
|
require_paths:
|
77
71
|
- lib
|
78
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
73
|
requirements:
|
81
|
-
- -
|
74
|
+
- - ">="
|
82
75
|
- !ruby/object:Gem::Version
|
83
76
|
version: '0'
|
84
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
78
|
requirements:
|
87
|
-
- -
|
79
|
+
- - ">="
|
88
80
|
- !ruby/object:Gem::Version
|
89
81
|
version: '0'
|
90
82
|
requirements: []
|
91
83
|
rubyforge_project:
|
92
|
-
rubygems_version:
|
84
|
+
rubygems_version: 2.2.2
|
93
85
|
signing_key:
|
94
|
-
specification_version:
|
86
|
+
specification_version: 4
|
95
87
|
summary: guard-ejs will automatically precompile your ejs templates when they change.
|
96
88
|
test_files: []
|