sts10 / radiation

A simple blog CMS for totallynuclear.club pages.
MIT License
16 stars 3 forks source link

App fails when editing empty and/or nonexistent post (0.3.7) #10

Closed cena closed 9 years ago

cena commented 9 years ago

So, here's what happened. I created a post with title only. I'm unfamiliar with Vim so was unsure whether it actually saved (it did), but I was given the option to publish it and chose no. I then tried to edit with the following results:

Enter the number of the post you wish to edit (enter q to return to main menu):
/home/straylight/radiation/lib/blog.rb:185:in `readline': end of file reached (EOFError)
    from /home/straylight/radiation/lib/blog.rb:185:in `open'
    from /home/straylight/radiation/lib/blog.rb:185:in `block in present_menu_of_posts'
    from /home/straylight/radiation/lib/blog.rb:184:in `glob'
    from /home/straylight/radiation/lib/blog.rb:184:in `present_menu_of_posts'
    from /home/straylight/radiation/lib/blog.rb:119:in `present_edit_menu'
    from bin/runner.rb:98:in `<main>'

I then learned enough about Vim to save and exit, so created a new post, and published it. Upon selecting the edit option:

Enter the number of the post you wish to edit (enter q to return to main menu):
1 - ../radiation_posts/2014-12-03T15+29+26-my-first-post.html
/home/straylight/radiation/lib/blog.rb:185:in `readline': end of file reached (EOFError)
    from /home/straylight/radiation/lib/blog.rb:185:in `open'
    from /home/straylight/radiation/lib/blog.rb:185:in `block in present_menu_of_posts'
    from /home/straylight/radiation/lib/blog.rb:184:in `glob'
    from /home/straylight/radiation/lib/blog.rb:184:in `present_menu_of_posts'
    from /home/straylight/radiation/lib/blog.rb:119:in `present_edit_menu'
    from bin/runner.rb:98:in `<main>'

So 2 things. First, it's not giving me the option to choose the post number -- it just immediately goes to the error message. Also, if you look at my site here: http://totallynuclear.club/~straylight/blog.html it looks like it actually did save and publish BOTH posts, even though I didn't publish the first.

sts10 commented 9 years ago

Hi cena. So sorry that happened! I admit I haven't been testing much for what happens when you save an empty posts, but I TOTALLY get how that can happen when you're new to vim.

I just pushed v 0.3.8 which should solve this problem going forward. If you're still having problems you may have to manually go into your radiation posts directory (run cd ~/radiation_posts) and manually delete the blank post with the rm command.

Also, note that when you use Radiation's publish command, it publishes all posts that are not marked as a draft. There's no such thing as publishing a single post, one at a time. It's pushes all (except drafts).

I'm glad you found that emacs works. Let me know how else I can help!