Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
Latest commit
76 lines (67 loc) · 1.88 KB
/
Copy pathRakefile
File metadata and controls
76 lines (67 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require"bundler/gem_tasks"
require"jekyll"
require"listen"
deflisten_ignore_paths(base,options)
[
/_config\.ya?ml/,
/_site/,
/\.jekyll-metadata/
]
end
deflisten_handler(base,options)
site=Jekyll::Site.new(options)
Jekyll::Command.process_site(site)
procdo |modified,added,removed|
t=Time.now
c=modified + added + removed
n=c.length
relative_paths=c.map{ |p| Pathname.new(p).relative_path_from(base).to_s}
printJekyll.logger.message("Regenerating:","#{relative_paths.join(", ")} changed... ")
begin
Jekyll::Command.process_site(site)
puts"regenerated in #{Time.now - t} seconds."
rescue=>e
puts"error:"
Jekyll.logger.warn"Error:",e.message
Jekyll.logger.warn"Error:","Run jekyll build --trace for more information."
end
end
end
task:previewdo
base=Pathname.new('.').expand_path
options={
"source"=>base.join('test').to_s,
"destination"=>base.join('test/_site').to_s,
"force_polling"=>false,
"serving"=>true,
"theme"=>"minimal-mistakes-jekyll"
}
options=Jekyll.configuration(options)
ENV["LISTEN_GEM_DEBUGGING"]="1"
listener=Listen.to(
base.join("_data"),
base.join("_includes"),
base.join("_layouts"),
base.join("_sass"),
base.join("assets"),
options["source"],
:ignore=>listen_ignore_paths(base,options),
:force_polling=>options['force_polling'],
&(listen_handler(base,options))
)
begin
listener.start
Jekyll.logger.info"Auto-regeneration:","enabled for '#{options["source"]}'"
unlessoptions['serving']
trap("INT")do
listener.stop
puts" Halting auto-regeneration."
exit0
end
loop{sleep1000}
end
rescueThreadError
# You pressed Ctrl-C, oh my!
end
Jekyll::Commands::Serve.process(options)
end