lostapathy / scad_bundler

A package manager for OpenSCAD powered by RubyGems
MIT License
15 stars 1 forks source link

Windows support #3

Open keeeal opened 3 months ago

keeeal commented 3 months ago

Hi!

I love this idea! I would love to use it and contribute OpenSCAD packages. However, there are two things stopping me.

  1. The latest versions of ruby and bundler at the time of writing are incompatible with this tool.

    • The first error arises when running scad_bundle init. When checking if Scadfile is present, the function exists? has been renamed to exist? as of ruby 3.2.0. (easy fix - just rename)
    • The second error arises when running scad_bundle install. I get an error message about requiring bundler >=2.0.0 to parse the Scadfile. (maybe an easy fix - just bump the bundler version? maybe it will just work? not sure)

    Ultimately I solved both of these issues by installing a version of Ruby that is >4 years old so it is just an inconvenience,

  2. More importantly (and I am not sure how easy/difficult it would be to implement) is windows support.

    The biggest issue here is that scad_bundle exec openscad assumes that there is an OPENSCADPATH env var and that OpenSCAD can be started from the terminal. Neither of these things are necessarily true on windows.

    I have some thoughts on patterns that could be used to get around this need to start OpenSCAD using scad_bundler, hopefully making this tool platform independent in the process. Reply to this issue if the repo is currently being maintained and this is worth discussing/making a PR for.

lostapathy commented 3 months ago

I'll be honest - I don't use this much anymore. I still love the concept but struggled to find a way to get broader adoption.

I'm interested in PRs, though, and knowing somebody wants to use it makes me want to take a stab at updating it. I don't think it should be too terrible to update this to work on a newer bundler, but I guess I'm not certain. We aren't really using ruby or bundler for much other than the simplest case of resolving dependencies and installing them.

keeeal commented 3 months ago

No worries! I might split item 1 into some smaller issues and chuck a PR or two your way.

Regarding item 2, can I run a more significant change idea past you?

As it currently stands, gems installs the packages into a gems-specific (and ruby-version specific) directory. scad_bundler exec ... is then used to run OpenSCAD with some env vars set.

I think that scad_bundle install should ultimately copy/symlink installed packages into a directory of the user's choice. This could be the default OpenSCAD library location or somewhere else. The path could be an argument of the install subcommand or something that needs configuring. Upon changing project and running scad bundle install again, packages found in the install directory should be nuked before the installation of new packages. Then OpenSCAD can be started in the usual way,

While this is less elegant than the way ruby installs packages, I think it is more aligned with the way OpenSCAD is typically used. I.E. Users will have just one version of OpenSCAD or any package installed at a given time, with backwards compatibility of any package with any version of OpenSCAD being a reasonable assumption. It would also make this tool more platform-independent.

Do you think this idea is worth pursuing?