softcover 0.6.6 → 0.6.7
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 +4 -4
- data/lib/softcover/commands/server.rb +17 -6
- data/lib/softcover/server/app.rb +1 -1
- data/lib/softcover/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e10cc07c83b7d50616aa5a8a627b434ed437de
|
4
|
+
data.tar.gz: 9579bb03abbf836ed83e86aef3a2ecb996183f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e0e95ed9a948cce46ebb8c282345af60d3befbb578cce6d7ea1b674e43a7ff575d41f86cd527ebc4dc1dcfa22f075d9af8a78baf463e3d554f89223ee6d0ff
|
7
|
+
data.tar.gz: 9c7d2c428d7c4856f1a97cb70e1a9538982372b869e08a920773cb457c13a4ff5ecf117da1c19339ba328cf0e22ad5ff322312861850daf6b7a79e8be2b44e6d
|
@@ -10,18 +10,29 @@ module Softcover::Commands::Server
|
|
10
10
|
def listen_for_changes
|
11
11
|
return if defined?(@no_listener) && @no_listener
|
12
12
|
server_pid = Process.pid
|
13
|
-
|
14
|
-
@listener = Listen.to(
|
15
|
-
|
16
|
-
@listener.filter(/(#{file_pattern}|custom\.sty)$/)
|
13
|
+
filter_regex = /(\.md|\.tex|custom\.sty|Book\.txt)$/
|
14
|
+
@listener = Listen.to('.')
|
15
|
+
@listener.filter(filter_regex)
|
17
16
|
|
18
17
|
@listener.change do |modified|
|
19
|
-
|
20
|
-
|
18
|
+
first_modified = modified.try(:first)
|
19
|
+
unless first_modified =~ ignore_regex
|
20
|
+
rebuild first_modified
|
21
|
+
Process.kill("HUP", server_pid)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
@listener.start
|
23
25
|
end
|
24
26
|
|
27
|
+
# Returns a regex for files to be ignored by the listener.
|
28
|
+
def ignore_regex
|
29
|
+
ignores = ['generated_polytex', '\.tmp\.tex']
|
30
|
+
# Ignore <book>.tex, which gets overwritten each time PolyTeXnic runs,
|
31
|
+
# unless there's no Book.txt, which means the author is using raw LaTeX.
|
32
|
+
ignores << Regexp.escape(Dir.glob('*.tex').first) if File.exist?('Book.txt')
|
33
|
+
/(#{ignores.join('|')})/
|
34
|
+
end
|
35
|
+
|
25
36
|
def markdown?
|
26
37
|
!Dir.glob(path('chapters/*.md')).empty?
|
27
38
|
end
|
data/lib/softcover/server/app.rb
CHANGED
@@ -14,7 +14,7 @@ class Softcover::App < Sinatra::Base
|
|
14
14
|
|
15
15
|
before do
|
16
16
|
origin = Dir.glob('chapters/*.md').empty? ? :polytex : :markdown
|
17
|
-
@manifest = Softcover::BookManifest.new(
|
17
|
+
@manifest = Softcover::BookManifest.new(origin: origin)
|
18
18
|
end
|
19
19
|
|
20
20
|
get '/' do
|
data/lib/softcover/version.rb
CHANGED