lib/softcover/commands/server.rb in softcover-0.6.10 vs lib/softcover/commands/server.rb in softcover-0.7.0
- old
+ new
@@ -27,11 +27,13 @@
# Returns a regex for files to be ignored by the listener.
def ignore_regex
ignores = ['generated_polytex', '\.tmp\.tex']
# Ignore <book>.tex, which gets overwritten each time PolyTeXnic runs,
# unless there's no Book.txt, which means the author is using raw LaTeX.
- ignores << Regexp.escape(Dir.glob('*.tex').first) if File.exist?('Book.txt')
+ if File.exist?(Softcover::BookManifest::TXT_PATH)
+ ignores << Regexp.escape(Dir.glob('*.tex').first)
+ end
/(#{ignores.join('|')})/
end
def markdown?
!Dir.glob(path('chapters/*.md')).empty?
@@ -49,16 +51,16 @@
puts e.message
end
def start_server(port)
require 'softcover/server/app'
- rebuild
puts "Running Softcover server on http://localhost:#{port}"
Softcover::App.set :port, port
Softcover::App.run!
end
def run(port)
+ rebuild
listen_for_changes
start_server port
end
end