lifepillar / ASMake

An AppleScript build library
10 stars 3 forks source link

OSA_LIBRARY_PATH #5

Open kraigparkinson opened 8 years ago

kraigparkinson commented 8 years ago

So I've been able to build and test without installing scripts by setting the osa_library_path environment variable in the shell. I don't want to set it for everything, so I was wondering if you have suggestions for a method to set it for a specific task.

lifepillar commented 8 years ago

Could you be more specific about the problem you are trying to solve? You should be able to pass environment variables by prepending them to the command, as usual:

OSA_LIBRARY_PATH='/some/path/' ./asmake mytask

Is that what you need?

kraigparkinson commented 8 years ago

I didn't know you could do that. :)

I'm trying to set up continuous integration and continuous delivery processes around my scripts, and this takes configuration for each job. I've built up a number of libraries, and I'd much prefer this in the makefile.applescript over the command line spec.

As handy as the method you provided is, I'm remembering the days I spent in Ant and being able to set an additional path within compile and run tasks, so I could localize all the build / environment configurations to the Ant file and not manage any (well, as many) environment variables outside of that.

Specifically, I'd like to see makeScriptBundle accept an additional path, say './build:./lib', so I can run a test/build task that uses script libraries built from the makefile or provided with the script without requiring me to install them in any of the Script Libraries folders first. Same for running the unit tests.

lifepillar commented 8 years ago

Ok, I could try to implement something like that. No ETA, though: unfortunately, I have no spare time for this project, currently (and probably for several weeks on).

kraigparkinson commented 8 years ago

No worries on the timing. For now, I've made a shell script (asmake.sh) to add my local build targets onto the OSA_LIBRARY_PATH before the script.

To save yourself some headache on this working, I found this: http://stackoverflow.com/questions/35389058/why-wont-osa-library-path-not-work-as-documented-for-jxa. The first answer is what I went with.

lifepillar commented 8 years ago

Thanks for the link! In general, the most (and probably the only) robust way to work with script libraries is to put them where they are supposed to be (e.g., ~/Library/Script Libraries), even for testing. Keeping them anywhere else is calling for trouble eventually: I remember a discussion on MacScripter discussing this very issue and coming to such conclusion, although the details have escaped my mind.