Shellfire – A repository of namespaced, composable shell function libraries
github.com
github.com
> "And lastly, because we're fed up with having to install half-an-universe's worth of Ruby, Python and Perl to bootstrap our servers or run CI jobs"
If this takes off, some will use it some won't, and we'll be stuck installing a "half-an-universe's worth of Ruby, Python, Perl, and Shellfire scripts to bootstrap our servers or run CI jobs"
The proof in the pudding will be trying to make libertine linux use it - a not even started project of mine to build a minimal, net-bootable linux with an immutable file system (upgrade == reboot a new image).
We've long been at the point where you can expect Perl and Python to be installed (Perl is required by the Debian's base tools, and Python by Redhat's).
You may not have the libraries you need at the version you need, and it's a shame that neither system has a convenient way to address that (Python virtualenv remains a hacky solution IMHO).
I was initially enthused by Shellfire's offering but, come to think of it, all it's doing is bringing SH scripting to some level with Perl or Python... but, as you point out, we have those already.
If the job requires one page of code or less, use shell. If it requires more than one page of code, use Python or whatever. Simple as that.
I still hate Perl anyway - source code obfuscation by design is a terrible thing to do to your brain.
The problem with this simple guideline is that tools grow, so what was well less than a page becomes much more—and each small increment is too small to justify a complete re-write, so eventually you wind up with a huge shell-script monster.
Python has a upgrade problem. We're still running a bunch of CentOS 5.5 machines which depend on Python 2.4. In my org, we still have scripts littered around that expect a later version of python, but are executed from just "#!/usr/bin/python" instead of "python2.7". which fails on those old CentOS machines, on which you can't just set a newer version of Python as default because that'll break many system utilities.
Also, Perl's syntactic sugar for regular expressions turns out to be very useful (and I say this after years of grumbling against it).
Of course, since they have many geniuses working on their codebase, I assume the problem must actually be pretty fundamental and tricky.... right?
I also don't like the "framework" approach. I actually thought this would be actual "shell functions" to do all kinds of common shell tasks; a copy-paste library of sorts. I was actually pretty excited about that as it is something I see myself using on a regular basis.
But don't let my negativity bring anybody down, I'm sure it can be useful; and if it's useful for you, just use it and be happy.
The shell needs to be understood. There's no doubt it's an old looking-language to most people, but that's why we should treat it with the same discipline as anything else. I'd agree that the shell can be obscure. Wherever possible, shellfire tries to make things explicit, not obscure through good naming; hence the reams of functions on core/variable to do simple things, eg core_variable_startsWith rather than having to figure the weird looking ${var?/:} syntax.
Because missing something is only one way that something can suck. Not everything can be fixed through additive processes.
I think posix shell is quite a beautiful language, and I enjoy hacking together a medium size application with it just because it's fun, but it has a lot of disadvantages relative to a more modern scripting language. If you use perl/python/ruby/javascript/lua/lisp instead, your application will perform better, be easier to maintain and be able to run on windows without cygwin.
I get the impression that this project is trying to advertise itself for making real applications, but I don't think that's realistic. As a toy, though, it's really cool and I'll probably play around with it at least a little.
It's obviously not so great for distributing around to random places where it probably won't be installed.
Edit: Right in the README is this:
> fatten[1], to make standalone shell scripts
This project is far from a toy; there's a complete MQTT client written in it, bish-bosh[1], and swaddle (see comment below). I wouldn't build a webserver in it, but I would build command line wrappers of all those REST APIs out there so I don't have to install gems and eggs and whatever else to just get stuff done. shellfire is minimally dependent.
shellfire exists because installing Ruby and Python and all their dependencies is simply not an option for minimal bare metal servers and routers. Because there are far too many 'toy' shell scripts out there that aren't robust. Because the shell is the glue we need for out big ticket applications. Because I really loathe having to depend a VM configured and setup and snapshotted.
Performance is not a goal, not should it be for any scripting language. If you need performance, write in C or perhaps Java, although V8 is getting closer all the time.
And there is not dependency. shellfire deliberately discourages the model of 'install framework in /usr/lib'. It just doesn't work. But it does support working nicely with git-based dependencies as you develop; you can even deploy as nothing more than a git export, if you so choose.
This makes development completely independent of the `/usr`, etc of the machine your own. If you clone your repo from your laptop to someone else's desktop, no need to to install deps, no need even for a working network env - valuable if you're in one of those places that breaks Ruby because they uses a Windows proxy (eg most UK Gov setups).
You don't have to fatten; you can just deploy by exporting your git repo. That sort of route would be perfectly acceptable for most enterprise work. Still no need to install deps, as everything is relatively-pathed.
Good work (as far as I can see)!
Everyone has a different learning style - perhaps the tutorial will help? Or just looking at a real use case - try bish-bosh at https://github.com/raphaelcohn/bish-bosh. Let me know if there's a better way of explaining it.
If there's enough folks interested, maybe we could run an interactive tutorial or IRC session?