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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3c3f7ec1c29b0d9916d06aaab5a587d197d2a5a
4
- data.tar.gz: db1916e845252bcd7816dc6dbfd68ae71b1c3f8d
3
+ metadata.gz: 18e10cc07c83b7d50616aa5a8a627b434ed437de
4
+ data.tar.gz: 9579bb03abbf836ed83e86aef3a2ecb996183f5f
5
5
  SHA512:
6
- metadata.gz: 6621e690252b6d378e5b2d5850b705ad6ac5464cbf2065e228148488eae1c885a827198033de49ca76bc238f537962e432d3d290c4e8fbdd235a257a92c569ad
7
- data.tar.gz: b109970ac67eac9ff43c696c9da122bb3adce718cce79bd7c6dcb407c302c8dc6fb1d4db56cab5e91251ed01bed1e7a1f61d4df65301b24b01a20653eeb3213c
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
- directories = ['.', 'chapters']
14
- @listener = Listen.to(*directories)
15
- file_pattern = markdown? ? '\.md|\.txt' : '\.tex'
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
- rebuild modified.try(:first)
20
- Process.kill("HUP", server_pid)
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
@@ -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(foo: "bar", origin: origin)
17
+ @manifest = Softcover::BookManifest.new(origin: origin)
18
18
  end
19
19
 
20
20
  get '/' do
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softcover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl