Page 1 of 2

Idea: S9y CLI tool

Posted: Sun Jul 14, 2013 10:15 pm
by mattsches
I find myself writing CLI tools for many of my projects lately. People write them for popular OSS projects, too, for example: And the list could go on ...

Usually, these tools start with a basic set of commands: printing out the currently installed version number; installing an instance of the project (with interaction on the shell); running tests; creating a new user; etc. Later, some of them turn into fully featured administration tools.

Personally, I'm pretty happy with the Symfony2 Console component that makes writing CLI commands really easy. But other options exist, e.g. Laravel's Artisan.

Actually, I wanted to write a simple tool first, so I could show it to you before posting here, but I was busy with other things. A project like this could (start to) exist outside of S9y, no problem with that. So:

Do you think a CLI tool would make sense for S9y?

Re: Idea: S9y CLI tool

Posted: Sun Jul 14, 2013 11:16 pm
by yellowled
mattsches wrote:Do you think a CLI tool would make sense for S9y?
I'm pretty sure at least the Uberspace users among us would love that. Also, we seem to have a rather high percentage of users with shell access, so why not? I also don't see why this should not be an official s9y project right from the start …?

YL

Re: Idea: S9y CLI tool

Posted: Sun Jul 21, 2013 12:18 am
by mattsches
Ok, I just tried to write a very basic console command based on the Symfony2 Console component. I wanted to print out the currently installed S9y version and the title of the blog.

It's pretty impossible to bootstrap the blog application from the command line because it expects server and request globals and tons of other stuff. Would have been nice to simply require_once('serendipity_config.inc.php') and read all the info from there, but this won't work, of course.

But I could parse the file and find the version number with the help of some regexes. However, the actual version number is stored in serendipity_config_local.inc.php, and because this file is readable only for the web server user (www-data in my case), it cannot be read from the shell command. Bummer.

Database connection, on the other hand, was straightforward using the Doctrine2 DBAL, so I can now read the blog title and a lot of other info directly from the DB and print it out on the console:

Code: Select all

$ php console.php version
Version: 2.0-alpha1
Blog title: Serendipity 2.0 Dev Blog
I guess this console tool will start its life as a simple diagnosis and info helper :wink:

It's really not more than a proof of concept now, but I will go ahead and push it to GitHub once it has some basic functionality.

Re: Idea: S9y CLI tool

Posted: Mon Jul 22, 2013 10:38 am
by garvinhicking
Hi!

Really? Usually 'include serendipity_config.inc.php' should actually work, what errors do you get?! (Of course this requires you to be a user that has read access to serendipity_config_local.inc.php...

Regards,
Garvin

Re: Idea: S9y CLI tool

Posted: Tue Jul 23, 2013 11:42 pm
by mattsches
I thought about it, and you're probably right :wink:

Whoever is using the CLI tool must be root or at least must have read rights to serendipity_config_local.inc.php. Otherwise it just doesn't make sense.

Thanks for the heads up, Garvin.

PS: Yup, works!

Re: Idea: S9y CLI tool

Posted: Sun Jul 28, 2013 8:12 pm
by artodeto
Hi, is there already something available on an open source and forkable plattform?

Currently, i don't know what the tool could be good for, but since i like to work with symfony 2 console component, i would love to have a look on the current state and get influenced by ;-).

Re: Idea: S9y CLI tool

Posted: Sun Jul 28, 2013 11:31 pm
by mattsches
artodeto wrote:Hi, is there already something available on an open source and forkable plattform?

Currently, i don't know what the tool could be good for, but since i like to work with symfony 2 console component, i would love to have a look on the current state and get influenced by ;-).
Great, you're welcome to look at it and also to contribute once it's released! We're currently in a kind of closed alpha testing phase, but I would very much like to release it next weekend or so. Keep an eye on the S9y Github account.

The tool won't have a lot of functionality right from the start, but it should be easy to add more and meaningful commands quickly. I'm looking forward to ideas, proposals, or even pull requests. In a way, it's learning project for me, too.

I would also love to give it a clever/catchy name, right now it's called "s9ytool", but that's a bit boring imho. Suggestions anyone?

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 9:22 am
by Timbalu
mattsches wrote:I would also love to give it a clever/catchy name, right now it's called "s9ytool", but that's a bit boring imho. Suggestions anyone?
http://de.wikipedia.org/wiki/Unterwelt_ ... Mythologie
How about Styx, in Orpheus and Eurydice...? :)

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 11:19 am
by yellowled
mattsches wrote:I would also love to give it a clever/catchy name, right now it's called "s9ytool", but that's a bit boring imho. Suggestions anyone?
Given the origin of Serendipity, how about Rufus?

YL

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 11:54 am
by garvinhicking
Guys, we need to have some tool or platform called "Metatron".

Just sayin'.

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 11:56 am
by yellowled
Oh, take Metatron! (I hereby reserve at least Bartleby, Loki and Azrael for new templates.) :)

YL

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 2:16 pm
by mattsches
I must admit that I was also toying with the idea of calling it "Metatron" (after looking for inspiration here) :lol:

The more I think about it the more I actually like it!

PS: Concerning "Bartleby" - look who mentioned it first ;) We could also use it as a code name for the 2.0 release ... do we have code names for releases? Shouldn't we?

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 2:19 pm
by yellowled
mattsches wrote:We could also use it as a code name for the 2.0 release ... do we have code names for releases? Shouldn't we?
With the current naming scheme, we'll run out of code names very quickly. :)

YL

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 2:34 pm
by Timbalu
Though I really like all these code name suggestions here, I have to admit I NEVER took inspiration for Serendipity from a comedy film...., since I seem to be some kind out of time..., linking this far more into the history, back to Horace Walpole and him inspired by the "The Three Princes of Serendip"... :wink:
This is far more Serendipity than a film can ever be...!

Re: Idea: S9y CLI tool

Posted: Mon Jul 29, 2013 2:40 pm
by yellowled
While we're at it, I have to admit that Dogma is actually one of the very few flicks by Kevin Smith which I don't like. :mrgreen:

YL