guard-jekyll-plus 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/lib/guard/jekyll-plus/version.rb +1 -1
- data/lib/guard/jekyllplus.rb +38 -30
- data/test/Gemfile.lock +1 -1
- data/test/_config.yml +2 -0
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/lib/guard/jekyllplus.rb
CHANGED
@@ -54,7 +54,6 @@ module Guard
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def start
|
57
|
-
|
58
57
|
if @options[:serve]
|
59
58
|
start_server
|
60
59
|
build
|
@@ -75,31 +74,48 @@ module Guard
|
|
75
74
|
stop_server
|
76
75
|
end
|
77
76
|
|
78
|
-
def run_all
|
79
|
-
build
|
80
|
-
end
|
81
|
-
|
82
77
|
def run_on_modifications(paths)
|
83
|
-
|
78
|
+
matched = jekyll_matches paths
|
79
|
+
unmatched = non_jekyll_matches paths
|
80
|
+
|
81
|
+
if matched.size > 0
|
82
|
+
build(matched, "Files changed: ", " ~ ".yellow)
|
83
|
+
elsif unmatched.size > 0
|
84
|
+
copy(unmatched)
|
85
|
+
end
|
84
86
|
end
|
85
87
|
|
86
88
|
def run_on_additions(paths)
|
87
|
-
|
89
|
+
matched = jekyll_matches paths
|
90
|
+
unmatched = non_jekyll_matches paths
|
91
|
+
|
92
|
+
if matched.size > 0
|
93
|
+
build(matched, "Files added: ", " + ".green)
|
94
|
+
elsif unmatched.size > 0
|
95
|
+
copy(unmatched)
|
96
|
+
end
|
88
97
|
end
|
89
98
|
|
90
99
|
def run_on_removals(paths)
|
91
|
-
|
100
|
+
matched = jekyll_matches paths
|
101
|
+
unmatched = non_jekyll_matches paths
|
102
|
+
|
103
|
+
if matched.size > 0
|
104
|
+
build(matched, "Files removed: ", " x ".red)
|
105
|
+
elsif unmatched.size > 0
|
106
|
+
remove(unmatched)
|
107
|
+
end
|
92
108
|
end
|
93
109
|
|
94
110
|
|
95
111
|
private
|
96
112
|
|
97
|
-
def build(
|
113
|
+
def build(files = nil, message = '', mark = nil)
|
98
114
|
begin
|
99
|
-
UI.info "#{@label} " + "building...".yellow unless @config[:silent]
|
100
|
-
if
|
115
|
+
UI.info "#{@label} #{message}" + "building...".yellow unless @config[:silent]
|
116
|
+
if files
|
101
117
|
puts '| ' # spacing
|
102
|
-
|
118
|
+
files.each { |file| puts '|' + mark + file }
|
103
119
|
puts '| ' # spacing
|
104
120
|
end
|
105
121
|
@site.process
|
@@ -170,25 +186,12 @@ module Guard
|
|
170
186
|
true
|
171
187
|
end
|
172
188
|
|
173
|
-
def
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
paths.each do |file|
|
178
|
-
if file =~ @extensions
|
179
|
-
matches.push file
|
180
|
-
else
|
181
|
-
copy_files.push file
|
182
|
-
end
|
183
|
-
end
|
189
|
+
def jekyll_matches(paths)
|
190
|
+
paths.select { |file| file =~ @extensions }
|
191
|
+
end
|
184
192
|
|
185
|
-
|
186
|
-
|
187
|
-
if matches.length > 0
|
188
|
-
build(matches)
|
189
|
-
else
|
190
|
-
copy(copy_files)
|
191
|
-
end
|
193
|
+
def non_jekyll_matches(paths)
|
194
|
+
paths.select { |file| !file.match(/^_/) and !file.match(@extensions) }
|
192
195
|
end
|
193
196
|
|
194
197
|
def jekyll_config(options)
|
@@ -221,6 +224,11 @@ module Guard
|
|
221
224
|
end
|
222
225
|
end
|
223
226
|
|
227
|
+
# Remove
|
228
|
+
def ignore_underscores(paths)
|
229
|
+
paths.select { |file| file =~ /^[^_]/ }
|
230
|
+
end
|
231
|
+
|
224
232
|
def server(config)
|
225
233
|
proc{ Process.fork { ::Jekyll::Commands::Serve.process(config) } }
|
226
234
|
end
|
data/test/Gemfile.lock
CHANGED
data/test/_config.yml
CHANGED