sul-dlss/DeveloperPlaybook

Recommend writing rake tasks over shell scripts

Closed this issue ยท 24 comments

Add:
Recommend rake task over shell script, with reasoning.

๐Ÿ‘

๐Ÿ‘

@tcramer to provide example rake task ;)

๐Ÿ‘ on both the issue and @tcramer providing the example

๐Ÿ‘

๐Ÿ‘ it's weird voting without seeing the "with reasoning" part. Makes me uncomfy.

@ndushay Agree regarding the "with reasoning" comment. Happy to work with +1ers to come up with good text for that part in the PR.

atz commented

Reasoning:

  • modular, reusable (not copy/paste reusable, actually reusable)
  • has access to all app/gem models, config and underlying structure
  • testable

I would also submit that rails console (i.e. rails command line) code can hit all those points while supporting fuller options/argument handling and depth. Rake task arguments exist and should be used, but they are nothing compared to real command line expressivity.

So, prefer rake tasks to shell, yes. But not prefer only rake tasks.

@atz ... that sounds like a +1 but want to be sure?

atz commented

Yes, rake tasks are preferable to shell scripts, generally speaking. ๐Ÿ‘

I would also add that shell scripts aren't cross platform - this is a big reason to prefer rake tasks.

And it's not that I can't come up with the "reasoning" -- it's more that it feels a bit like approving this issue is approving a PR with unknown content. But that's for a different discussion. So I remain ๐Ÿ‘ on this issue and retain some concerns about the efficiency of our process -- but am giving it a try, so no flames.

๐Ÿ‘

๐Ÿ‘

๐Ÿ‘Œ

Big ๐Ÿ‘ on this.

Now that multiple folks have added rationales and agreement, can this be merged?

Is there anything to merge? (This is an issue.)

Ah, this issue was looking to find consensus. Now we have that, but there is still work to be done. OK, leaving this issue open. Thx, @darrenleeweber.

Perhaps the contribution from @atz is a starting point for a PR? Also see the discussion in sul-dlss-deprecated/annotations2triannon#10. Note that distinctions between apps and gems may be useful. I'm generally in agreement that rake tasks are preferable. My objection is based on gem projects where I am using dotenv gem to configure a gem that can be installed (i.e. outside the repo where rake is not available and rake handling/modification of env with dotenv is problematic). So, while I generally agree rake is preferable, it doesn't cover all cases.

@sul-dlss/infrastructure-team @sul-dlss/access-team @sul-dlss/libsys is this issue still useful or should we dump it?

๐Ÿ”ฅ

๐Ÿ—‘

Closing. Re-open if anyone feels strongly about it.