refresh the mounting point if the site gets updated
did
committed Jan 02, 2013
commit 9f56559b505929a6d5ef751be25473b17ec2e0e1
Showing 3
changed files with
24 additions
and 18 deletions
TODO
+7
-7
| @@ | @@ -2,20 +2,20 @@ |
| x templatized page | |
| x localized page | |
| + | - listen: |
| + | x content types and content entries / site |
| + | - make it work for other platforms (linux, windows) |
| + | - I18n keys |
| + | - liquid assigns: sessions (rack) |
| + | - post content entry |
| - nice error page (replace the default exception middleware) to display: | |
| - liquid errors | |
| - other exceptions | |
| - nice logs | |
| - params to launch the thin server (port, address ?) | |
| - | - sessions |
| - | - post content entry |
| - | - listen: |
| - | - make it work for external libs |
| - | - better installation for all the platforms |
| - | - content types and content entries / site ? |
| + | |
| - translations | |
| - | - I18n keys |
| - tests | |
locomotive/builder/cli.rb b/lib/locomotive/builder/cli.rb
+1
-1
| @@ | @@ -23,7 +23,7 @@ module Locomotive |
| reader.run!(path: path) | |
| server = Thin::Server.new('0.0.0.0', port, Locomotive::Builder::Server.new(reader)) | |
| - | # server.threaded = true |
| + | server.threaded = true |
| server.start | |
| end | |
| end | |
locomotive/builder/listen.rb b/lib/locomotive/builder/listen.rb
+16
-10
| @@ | @@ -12,30 +12,36 @@ module Locomotive::Builder |
| def start(reader) | |
| self.reader = reader | |
| - | self.build_liquid_listener |
| + | self.definitions.each do |definition| |
| + | self.apply(definition) |
| + | end |
| + | end |
| - | self.build_content_types_listener |
| + | def definitions |
| + | [ |
| + | ['config', /\.yml/, [:site, :content_types, :pages, :snippets, :content_entries]], |
| + | ['app/views', /\.liquid/, [:pages, :snippets]], |
| + | ['app/content_types', /\.yml/, [:content_types, :content_entries]], |
| + | ['data', /\.yml/, :content_entries] |
| + | ] |
| end | |
| protected | |
| - | def build_liquid_listener |
| + | def apply(definition) |
| reloader = Proc.new do |modified, added, removed| | |
| - | reader.reload(:pages, :snippets) |
| + | reader.reload(definition.last) |
| end | |
| - | path = File.join(self.reader.mounting_point.path, 'app/views') |
| + | filter = definition[1] |
| + | path = File.join(self.reader.mounting_point.path, definition.first) |
| - | listener = ::Listen.to(path).filter(/\.liquid/).change(&reloader) |
| + | listener = ::Listen.to(path).filter(filter).change(&reloader) |
| # non blocking listener | |
| listener.start(false) | |
| end | |
| - | def build_content_types_listener |
| - | # TODO |
| - | end |
| - | |
| end | |
| end | |
| \ No newline at end of file | |