jmacdotorg / plerd

Ultralight Dropbox-friendly Markdown-based blogging.
MIT License
112 stars 21 forks source link

plerdall --init fails if there is no plerd.conf already present #37

Closed ghost closed 5 years ago

ghost commented 5 years ago

The configuration section of the README reads:

Run plerdall --init to create a new directory called plerd/ in your current working directory, populated with all the special files and directories that Plerd requires. This includes a sample config file in plerd/plerd.conf.

plerdall documentation also reads:

Run plerdall --init to create a new directory called plerd/ in your current working directory, populated with all the special files and directories that Plerd requires. This includes a sample config file in plerd/plerd.conf.

However, on a brand new deployment of Plerd, (installed with cpanm) when running plerdall --init or plerdall --init="path/to/some-dir" I get:

Can't start bin/plerdall: I can't find a Plerd config file in /home/user/plerd/plerd.conf, /home/user/plerd/conf/plerd.conf, /home/user/.plerd, or in /home/user/plerd/bin/../conf/plerd.conf, and no other location was specified as a command-line argument. at /home/user/plerd/bin/../lib/Plerd/Util.pm line 38.

(Sorry editing this as I'm troubleshooting to not clutter up the thread)

This fails only if there is no plerd.conf in the directory plerdall --init is being run. Even touching an empty plerd.conf in the directory makes it work. :woman_shrugging:

Furthermore, the message that prints after plerd is deployed in a user-defined directory is:

I have created and populated a new Plerd working directory at /home/b/blog. Your next step involves updating the configuration file at /home/b/blog/plerd.conf. For full documentation, links to mailing lists, and other stuff, please visit http://plerd.jmac.org/. Enjoy!

even though plerd.conf is located in and read from conf/plerd.conf

I would submit a pull request to fix this but I am using this project as a way to learn Perl myself!

taskboy3000 commented 5 years ago

It might be nice if plerdall, on detecting no existing conf file, offered to walk the user through 3 or 4 essential questions to create a minimally functional configuration.

jmacdotorg commented 5 years ago

Thanks for this! (And I'm very happy you're using my humble project to learn Perl!) I'll aim to take a closer look within the next few days.

jmacdotorg commented 5 years ago

Had an opportunity to observe this firsthand when I had reason to instance a new Plerd blog on a fresh machine. Oh dear, how embarrassing! I'll see if I can't address it presently.

tyrosinase commented 5 years ago

Not sure what, if any, adoption of this spec is but someone brought it up on another project so here's a link for your consideration: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

jmacdotorg commented 5 years ago

This should be fixed with 7fa1e70f1c4a42427e914f8358e83498ad04a80b, now on the master branch. @e-krup, please confirm at your own convenience?

jmacdotorg commented 5 years ago

@tyrosinase I've put that into my reading list. Thank you!

jmacdotorg commented 5 years ago

Plerd was overdue for a new release anyway, so I went ahead and shipped it and baked this fix into it. Thanks again for alerting me to it!