shawnrice / alfred-bundler

a utility / workflow to handle dependencies
MIT License
21 stars 3 forks source link

AppleScript Bundler Needs to be distributed uncompiled #73

Closed shawnrice closed 10 years ago

shawnrice commented 10 years ago

We need to distribute uncompiled versions, and, if possible, compile them after they're installed.

shawnrice commented 10 years ago

Actually, scratch that: the bundlet that the author uses can never be compiled because it will produce the same problems when they distribute their workflows.

fractaledmind commented 10 years ago

I believe that the issue was in setting a property that pointed to the user's home directory. I have replaced all such properties in all of the script in commit affc1a351fbec6a726295bebdeed8f41c50636b8. I tested this across my Yosemite and Mavericks disks, and this fixed the problem (initially, I did have the same problem). So, pull the newest versions and try again. This should obviate this issue.

shawnrice commented 10 years ago

I'm still getting the same error. While you got rid of the _home property, it's still encoded in all of the other paths (BUNDLER_DIR, CACHE_DIR, etc...), so I think that all of those need to be converted to variables since the property keeps the value (oh the quirks...).

fractaledmind commented 10 years ago

Ok. I'll try again tomorrow

shawnrice commented 10 years ago

Sounds good.

fractaledmind commented 10 years ago

I tried a solution this morning. As per Apple's AppleScript Language Guide:

If you don’t want the value associated with an identifier to persist after a script is run but you want to use the same identifier throughout a script, declare a global variable and use the set command to set its value each time the script is run.

So, I have changed all properties to global variables. This should make them available to all handlers within the script, but they will also be reset on each run.

I am not certain (we can try to test), but there is a chance that loading a script does not constitute "running" it, in which case, the variables would not be reset. This means we need to ensure that the bundler and bundlet in the main repo are simply compiled but not yet run. The new versions I have just pushed have not been run on my machine, so when you run them, we will get some sense of this issue. But it is important that we keep our eye on this (i.e., if we run tests, we will need to delete and recreate the bundler and bundlet before pushing back to the repo).

fractaledmind commented 10 years ago

Ok. Screw all of this. My small tests still had problems, so I have completely dropped all properties and global variables. Instead, I now have handlers that return the proper path. Commit 38a592e7e87a45af61c381b51847997cec355109 has AlfredBundler.scpt, alfred.bundler.scpt, and test.scpt in their new form. My tests are now working well. @shawnrice, please let me know if this now works for you.

shawnrice commented 10 years ago

Strangely, the first time I ran it, I got

test.applescript: execution error: mkdir: /Users/smargheim/Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-devel/data/logs/: Permission denied (1)

But, then, I deleted the already installed bundler and ran it again, and it installed and worked just fine. Then I deleted it again, ran the PHP tests, and then ran the AppleScript version again, and, well, there were no errors.

So, it seems to be working.

fractaledmind commented 10 years ago

Perfect. Tests run well on my machine as well.

shawnrice commented 10 years ago

Since the tests are working out, I'm closing this.