3 ms·
It’s lighter-weight. Not as cryptic. Can also hook it up to your makefile targets, make them easier to access. The only additional “weight” in the Makefile wou
by sorbits 6y ago
It’s lighter-weight. Not as cryptic. Can also hook it up to your makefile targets, make them easier to access.
The only additional “weight” in the Makefile would be the name of the target, where you leave it out and have it default to 1, 2, … n, which I would argue is more cryptic, as “make build” or “make deploy” is always doing that action, whereas “ok 2” could be deploy in one folder, and push in another.
As for easy access, most shells should offer you tab completion for the Makefile’s targets, and your development environment may also pick up the existence of the Makefile and offer a way to run the targets.
Additionally Makefiles allow to setup dependencies, for example in your ok file example you have ./build.sh and ./deploy.sh as two actions: Clearly build should be a dependency of deploy, so “make deploy” implies building, rather than having to always do “ok 1 && ok 2”.
Lastly there is the ability to do dry-runs with Makefiles, once you start to setup dependencies…
- LeonB 6y agoYou haven’t used or experienced .ok files and are seeing them as a competitor to makefiles and being very defensive. They’re not a competitor to makefiles. With ok you can also name the commands. It’s optional. I would suggest using both, in a project that involves building, if you are already comfortable with makefiles. You may also have npm scripts, again I’d suggest both. You’ll probably find it quite comfortable and fun. Makefiles have more features but bring with them more complexity and nuance, for example the dependency features, which are useful for making but a hindrance for a lot of other project tasks. When I show a “getting started with makefiles” guide to my documentation friend they look at me like I’m insane. It is truly cryptic to the uninitiated. But you already understand makefiles, so try using both.
- heavenlyblue 6y ago> When I show a “getting started with makefiles” guide to my documentation friend they look at me like I’m insane. I am still not going to add another tool that makes my project even more spaghetti than it already is.
- LeonB 6y agoI use it and it does not make my project more spaghetti. Be sure to let me know when you put something out in the world. You’ll find that i come around and act in an encouraging manner and do not take pot shots at it without trying it out. Please do not be unkind.
- Kaze404 6y agoWhile this is a fair thing to say, your original response to my comment wasn't exactly inviting of a positive discussion. It sounded pretty dismissive to me.
- LeonB 6y agoHi Kaze404. I think I see what you mean and I’m sorry for that. The “lol” wasn’t called for. That comes from my own personal frustration. Thanks for coming back and saying that now. I understand.
- sorbits 6y agoBut you already understand makefiles, so try using both What is it that ok files can do that Makefiles don’t? I don’t buy your complexity argument, a Makefile can be as simple as: 1: ./build.sh Now you can run “make 1” and you have the same as “ok 1”. Although most people would name this “build” rather than “1”, so you “make build”. And the equivalent ok file would be: build: ./build.sh So the only syntactical difference is that make require a newline after the colon.
- LeonB 6y agoI modify “cd” so that every time I change directory it calls “ok” and thus I get a pretty print of the most useful 1-line commands for that folder. I have .ok in all my projects. Some of those have makefiles, some have cake, some have grunt, some have npm scripts. Many are pure documentation folders (books etc). ok isn’t primarily a build system or a task runner, it’s a folder profile. Asking “what can x do that y cannot do?” invokes the Turing tarpit. A better question is “why is it more pleasant to use x with or instead of y?” ...particularly since they can be used together.
- doekezanstra 6y agoThe thing ok can do what make can't, is work on the current shell. With ok, you can: * navigate to another folder/directory * set an environment variable I use both make and ok. For me, if I want to "make" stuff, I use make (compile, sign, zip, deploy etc.). The ok-files, I use for ad-hoc stuff, like viewing log files). It's also a good command's I can't seem to remember. A bit less structured. So I guess it's not only a technical difference, but also a slightly conceptual difference. I must say I do have a lot of (rather) small git-repo's I work on. And not every day. So when I switch to some kind of project, it helps me work faster. But your situation might differ...