iNecas / hammer-cli-eval

0 stars 1 forks source link

"With your powers combined..." #1

Open komidore64 opened 9 years ago

komidore64 commented 9 years ago

Hey Ivan!

It's really cool to see that we had some similar ideas on a hammer debugging tool. I started on hammer-cli-console a few weeks ago to do a similar thing as hammer-cli-eval plus a couple other command-checking commands. What would you say to combining our two plugins into one?

komidore64 commented 9 years ago

how does hammer-cli-eval's eval command differ from hammer-cli-console's console command in what it does?

iNecas commented 9 years ago

Hey! Glad to see this. I was not aware of the hammer-cli-console before and they themselves are really very similar and I'm more than happy with making it one.

The real added value is in combination with the active_support like style of bindings, that I've started adding into https://github.com/iNecas/apipie-bindings/tree/model. With this, I can imagine thins not being only a tool for debugging, but also for scripting in Ruby, as you can pass a --file argument to it.

Here are some examples of what's already possible https://github.com/iNecas/hammer-cli-eval/blob/master/examples/content_management.rb. Altough, the code is a bit prototypish now, I'm quite happy about the recognition of the associations, as well as handling async commands https://github.com/iNecas/hammer-cli-eval/blob/master/examples/content_management.rb#L39 where you just call wait and it polls for the task until it finishes.

The motivation came from me trying to script some of my deployments by calling the hammer commands directly, but it has downsides of needed to parse the output and then passing it again as arguments. There are also performance benefits, as the runtime is loaded only once.