dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Turn down ruby support

Open myk002 opened this issue 2 years ago • 20 comments

If you intend to port a script, please make a comment on this bug to "claim" it so others don't start working on it too.

  • [x] ./devel/scanitemother.rb DFHack/scripts#533
  • [x] ./devel/spawn-unit-helper.rb DFHack/scripts#545
  • [x] ./devel/unforbidall.rb DFHack/scripts#382
  • [x] ./fix/loyaltycascade.rb DFHack/scripts#542
  • [x] ./fix/stuckdoors.rb DFHack/scripts#480
  • [x] ./adaptation.rb DFHack/scripts#479
  • [x] ./ban-cooking.rb DFHack/scripts#479
  • [x] ./create-items.rb DFHack/scripts#546
  • [x] ./deathcause.rb DFHack/scripts#488
  • [x] ./deteriorateclothes.rb DFHack/scripts#384
  • [x] ./deterioratecorpses.rb DFHack/scripts#384
  • [x] ./deterioratefood.rb DFHack/scripts#384
  • [x] ./digfort.rb [removed] DFHack/scripts#332
  • [x] ./exterminate.rb DFHack/scripts#541
  • [x] ./growcrops.rb DFHack/scripts#487
  • [x] ./lever.rb DFHack/scripts/pull/515
  • [x] ./locate-ore.rb DFHack/scripts#489
  • [x] ./masspit.rb DFHack/scripts#531
  • [x] ./modtools/spawn-liquid.rb DFHack/scripts#540
  • [x] ./multicmd.rb DFHack/scripts#383
  • [ ] ./show-unit-syndromes.rb DFHack/scripts#562
  • [x] ./source.rb DFHack/scripts#492
  • [x] ./startdwarf.rb DFHack/scripts#385
  • [x] ./starvingdead.rb DFHack/scripts#537
  • [x] ./stripcaged.rb DFHack/scripts#522
  • [x] ./superdwarf.rb DFHack/scripts#491
  • [x] ./unforbid.rb DFHack/scripts#382

myk002 avatar Apr 07 '22 17:04 myk002

has multiple external dependencies that users have to separately install on their systems

It's not supposed to. libruby is the only one I can think of - we try to provide a build that should work for everyone, but it isn't always possible. It doesn't work out of the box on some uncommon Linux situations and new versions of macOS: #1742, #1718

Edit: I see #2023 as well. Missed those replies. I guess this falls under "uncommon Linux situations"?

lethosor avatar Apr 07 '22 17:04 lethosor

We'll need a deprecation plan to inform users that ruby is going away and give them time to rewrite any personal ruby scripts. How about we do this in stages, one stage per release:

  1. port all in-repo ruby scripts to lua; print a deprecation notice to the dfhack console whenever a ruby script is run.
  2. require specific action by the user to load the ruby plugin. e.g. they have to manually move the file to the plugins directory or run a specific dfhack command
  3. remove the ruby plugin from the repo

myk002 avatar May 05 '22 05:05 myk002

Removed rbsandbox.rb from the list - that was a private script of mine.

I think multicmd should be a built-in - I may have expressed this before. I'm willing to take on some of these.

lethosor avatar May 10 '22 18:05 lethosor

I think multicmd should be a built-in - I may have expressed this before.

Ha, I should have read this before I did that last port. We can choose to merge that PR (or not) and make multicmd a builtin later.

myk002 avatar May 10 '22 18:05 myk002

I guess what I really should have decided on is "not Ruby". It's pretty safe to rely on Lua being available - much more so than Ruby. String manipulation is also a bit easier/safer in Lua, as I'm sure you've found with argument parsing. Really the only risk I see is that people can edit/delete multicmd.lua, but it's not essential enough in my book that we should rewrite it.

lethosor avatar May 10 '22 18:05 lethosor

I'm willing to take on some of these.

There are some that could certainly use your expertise:

  • startdwarf does some direct memory manipulation that I haven't tried before
  • ban-cooking comments are full of conjecture that might benefit from your knowledge
  • create-items needs a decision on whether it should be replaced by the existing modtools/create-item.lua script (or the plugin? see #1012)

myk002 avatar May 10 '22 18:05 myk002

Looking at startdwarf now. Not a one-to-one API change, apparently

lethosor avatar May 11 '22 03:05 lethosor

huh... i was sure that there was startdwarf in lua already...

Edit; seems that i failed to port it from an old many-in-one tool

warmist avatar May 11 '22 08:05 warmist

I'm looking at superdwarf next. It looks like most of the functionality is copied from the fastdwarf plugin. I think the best way forward for this one is to move the superdwarf command to the fastdwarf plugin and just have that plugin provide both commands.

myk002 avatar May 22 '22 15:05 myk002

edit [myk002]: checklist moved to initial comment since the volume of comments on this issue has hidden this comment until you expand the list

Moth-Tolias avatar Dec 09 '22 02:12 Moth-Tolias

Thank you for that list! it's beautiful!

myk002 avatar Dec 09 '22 06:12 myk002

Just saw a message in discord from myk002 about claiming scripts in this issue.

I have added a PR to port growcrops.rb to lua DFHack/Scripts#487

AridTag avatar Dec 18 '22 01:12 AridTag

I am also claiming the conversion of deathcause.rb PR to follow soonish

AridTag avatar Dec 18 '22 03:12 AridTag

updated the tracker.

Moth-Tolias avatar Dec 18 '22 07:12 Moth-Tolias

I guess I'll claim stripcaged.rb as I might be halfway finished now. If anyone else has started it as well or wants to, contact me in the discord and we can share notes.

arekatir avatar Jan 08 '23 01:01 arekatir

Claiming masspit.rb, I will take a crack at this week.

EDIT: https://github.com/DFHack/scripts/pull/531

vallode avatar Jan 08 '23 22:01 vallode

Lever is at https://github.com/DFHack/scripts/pull/515

hawkowl avatar Jan 09 '23 05:01 hawkowl

I took spawn-liquid.rb too, https://github.com/DFHack/scripts/pull/532

vallode avatar Jan 15 '23 21:01 vallode

scanitemother.rb is done over at https://github.com/DFHack/scripts/pull/533

vallode avatar Jan 15 '23 22:01 vallode

I will tackle starvingdead.rb and exterminate.rb this week.

starvingdead.rb ported over at https://github.com/DFHack/scripts/pull/537 exterminate.rb over at https://github.com/DFHack/scripts/pull/541

vallode avatar Jan 16 '23 09:01 vallode