Idea: S9y CLI tool
Idea: S9y CLI tool
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?
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
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 …?mattsches wrote:Do you think a CLI tool would make sense for S9y?
YL
Re: Idea: S9y CLI tool
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:
I guess this console tool will start its life as a simple diagnosis and info helper
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.
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
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.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Idea: S9y CLI tool
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
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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Idea: S9y CLI tool
I thought about it, and you're probably right
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!
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
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 .
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
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.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 .
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
http://de.wikipedia.org/wiki/Unterwelt_ ... Mythologiemattsches 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?
How about Styx, in Orpheus and Eurydice...?
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Re: Idea: S9y CLI tool
Given the origin of Serendipity, how about Rufus?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?
YL
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Idea: S9y CLI tool
Guys, we need to have some tool or platform called "Metatron".
Just sayin'.
Just sayin'.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Idea: S9y CLI tool
Oh, take Metatron! (I hereby reserve at least Bartleby, Loki and Azrael for new templates.)
YL
YL
Re: Idea: S9y CLI tool
I must admit that I was also toying with the idea of calling it "Metatron" (after looking for inspiration here)
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?
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
With the current naming scheme, we'll run out of code names very quickly.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?
YL
Re: Idea: S9y CLI tool
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"...
This is far more Serendipity than a film can ever be...!
This is far more Serendipity than a film can ever be...!
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Re: Idea: S9y CLI tool
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.
YL
YL