playgroundbooks / playgroundbook

Tool for Swift Playground books
https://ashfurrow.com/blog/swift-playground-books/
MIT License
259 stars 17 forks source link

Failed to open and parse playground chapter. #54

Open ag opened 7 years ago

ag commented 7 years ago

For some reason I am not able to render the book.yaml file

Output

Rendering book.yaml...
Failed to open and parse playground chapter.
/Library/Ruby/Gems/2.0.0/gems/playgroundbook-1.1.0/lib/renderer/playgroundbook_renderer.rb:68:in `block in render': Missing valid playground for Chapter 1. (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/playgroundbook-1.1.0/lib/renderer/playgroundbook_renderer.rb:46:in `map'
    from /Library/Ruby/Gems/2.0.0/gems/playgroundbook-1.1.0/lib/renderer/playgroundbook_renderer.rb:46:in `render'
    from /Library/Ruby/Gems/2.0.0/gems/playgroundbook-1.1.0/bin/playgroundbook:17:in `<top (required)>'
    from /usr/local/bin/playgroundbook:22:in `load'
    from /usr/local/bin/playgroundbook:22:in `<main>'

Note: I wasn't able to install playgroundbook as described in the readme. When I tried to run

sudo gem install playgroundbook

I got this error

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/playgroundbook

So I had to install it like this

sudo gem install -n /usr/local/bin playgroundbook

Output

Successfully installed playgroundbook-1.1.0
Parsing documentation for playgroundbook-1.1.0
1 gem installed
ashfurrow commented 7 years ago

Sorry you're having that issue. It looks like the tool is looking for Chapter 1.xcplayground but can't find it. Would you be able to zip + upload the directory containing your playgrounds and yaml file so we can take a look?

ag commented 7 years ago

Sure! play.zip

ashfurrow commented 7 years ago

Gotcha, yup. The chapter names defined in book.yaml have to match up to playgrounds that are in the same directory. Here's a directory with the modifications:

play 2.zip

I removed "Chapter 2" and renamed the playground to "Chapter 1".

We really need better documentation and examples around this, because you're not the first person to run into this problem. We're tracking that issue here and would appreciate input or help you could offer (but no pressure!). Hope that works, let us know 👍

ag commented 7 years ago

Oh yeah obviously ;)

Sure I would love to contribute to this project!

Thanks for the great & fast help!

ashfurrow commented 7 years ago

No problem! You caught me at just the right time :smile: Ideally, we would have a pull request submitted against this repository that adds an example book.yaml, a few chapter playgrounds, and a readme explaining how to render them into a playground book. But if you could do even some of that, it'd be a big help to us.