Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch #71

Closed
wants to merge 5 commits into from
Closed

Watch #71

wants to merge 5 commits into from

Conversation

jondkoon
Copy link

watch command for landslide. solves issue #66.

Adds new dependency: watchdog

Tested on mac osx.

It works by first writing the presentation. As it is being written it creates an array of sources that gets parsed. It simply watches any of the files that were parsed and if they change then it regenerates the presentation.

Use Ctrl-C to exit watch mode.

@jondkoon
Copy link
Author

jondkoon commented Aug 3, 2011

I have been using this to prepare a presentation and just uncovered some bugs.

  • The table of contents doesn't get reset on every run
  • The slide count doesn't get reset on every run

This results in really high slide numbers and a repetitive table of contents

I will look into these, so I don't recommend merging this in quite yet.

@jondkoon
Copy link
Author

jondkoon commented Aug 6, 2011

I have fixed the table of contents and slide numbers bugs.

Do you have any feedback on this adamzap?

thanks.

@adamzap
Copy link
Owner

adamzap commented Aug 6, 2011

I'm trying to decide whether we should require watchdog or make it optional.

Maybe if they try the -w flag, it would try to import watchdog and upon a failure, tell them to install it.

What do you think? I guess I'm hesitant to add watchdog as a dependency (along with its many dependencies). Maybe I'm wrong.

@adamzap
Copy link
Owner

adamzap commented Aug 6, 2011

Whenever I save my .md file in vim, I immediately get this from the watch process:

○ ./main.py -w ~/Desktop/landslide_test/test.md
Adding   /Users/adam/Desktop/landslide_test/test.md (markdown)
Generated file: presentation.html

Watching /Users/adam/Desktop/landslide_test/test.md

Adding   /Users/adam/Desktop/landslide_test/test.md (markdown)Generated file: presentation.html

Watching /Users/adam/Desktop/landslide_test/test.md

Exception in thread Thread-2:Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/watchdog/observers/api.py", line 192, in run
    self.queue_events(self.timeout)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/watchdog/observers/kqueue.py", line 686, in queue_events
    self.watch.is_recursive)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/watchdog/utils/dirsnapshot.py", line 227, in __init__
    stat_info = os.stat(self._path)
OSError: [Errno 2] No such file or directory: '/Users/adam/Desktop/landslide_test/test.md'

Any ideas? Maybe it's me.

@jondkoon
Copy link
Author

jondkoon commented Aug 6, 2011

Just simulated a run using a near identical command ./main.py -w ~/Desktop/test.md

And it worked. I am on python 2.7.1 . I would hate for that to be the reason. I'll test with a virtual environment.

@jondkoon
Copy link
Author

jondkoon commented Aug 6, 2011

I think it would be fine to tell them just to install watchdog.
It is a nice to have feature rather than a requirement.

FYI:
You'll notice that I set recursive to "true" when I schedule the observer in watcher.py. This is because of this issue:
gorakhargosh/pathtools#1

That is a little concerning that he hasn't touched that project since February.

Watchdog itself looks pretty active though:
https://github.com/gorakhargosh/watchdog

@adamzap
Copy link
Owner

adamzap commented Aug 6, 2011

I tried smultron, and it's not seeing the changes...weird.

Which editor are you using?

I'll play with this more tonight. I'm probably missing something.

@jondkoon
Copy link
Author

jondkoon commented Aug 6, 2011

I use vim too.

@jondkoon
Copy link
Author

jondkoon commented Aug 7, 2011

Just tested on python 2.7.2 and it works fine for me.

@adamzap adamzap closed this in 8b93e85 Nov 11, 2012
@adamzap
Copy link
Owner

adamzap commented Nov 11, 2012

I used your code as starting point and finally implemented this...a year later.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants