Closed frdmn closed 8 years ago
@mattly you might find this bit of code useful for resolving the true file: https://github.com/diffsky/bolt/blob/master/bin/bolt#L3-L10
My plan was to actually have bork compile itself with some markers so it knew which parts to pull out for compiling, but this is probably easier. :) And it'll work with homebrew too. :)
So I had a hit list for a proper release but eh, I can throw that out the window and at least get something up. I'm guessing we need version number tags or something for homebrew?
Fixed by fd49cab22c2c0b49f1652771d2f0ee4687212a2e ...I hope.
Thanks @frdmn for bringing the problem to my attention and @diffsky for providing a pointer to a solution.
I went ahead and tagged the fixed version as "v0.9". There's a release up on the releases tab.
@mattly Perfect! Filed the PR including the new formula: https://github.com/Homebrew/homebrew/pull/50382
@mattly Just noticed a little issue when trying to exectute the following:
❯ ~ bork satisfy /Users/jonas/.dotfiles/borkfiles/atom.bork
/usr/local/bin/bork: line 28: cd: /Users/jonas//Users/jonas/.dotfiles/borkfiles/..: No such file or directory
ok: directory /Users/jonas/.atom
ok: symlink /Users/jonas/.atom/config.cson /Users/jonas/.dotfiles/opt/config.cson
ok: apm atom-beautify
ok: apm autocomplete-paths
ok: apm color-picker
ok: apm docblockr
ok: apm file-icons
ok: apm file-types
ok: apm hashrocket
ok: apm hex
ok: apm highlight-line
ok: apm jquery-snippets
ok: apm linter
ok: apm linter-htmlhint
ok: apm linter-jshint
ok: apm linter-jsonlint
ok: apm linter-php
ok: apm linter-shellcheck
ok: apm minimap
ok: apm minimap-git-diff
ok: apm pigments
ok: apm quantum-syntax
ok: apm quantum-ui
ok: apm script
ok: apm sort-lines
ok: apm tasks
ok: apm the-closer
ok: apm valign
I assume that's because of the change which happened in fd49cab22c2c0b49f1652771d2f0ee4687212a2e
Edit: this output might be helpful as well:
++ cat
+ BORK_SETUP_FUNCTION='getDir () {
fname=$1
while [ -h "$fname" ]; do
dir=$(cd -P "$(dirname "$fname")" && pwd)
fname=$(readlink $fname)
[[ $fname != /* ]] && fname="$dir/$fname"
done
echo "$(cd "$(dirname $fname)/.." && pwd)"
}
# used by loader to find core/ and stdlib/
BORK_SOURCE_DIR="$(getDir ${BASH_SOURCE[0]})"'
+ eval 'getDir () {
fname=$1
while [ -h "$fname" ]; do
dir=$(cd -P "$(dirname "$fname")" && pwd)
fname=$(readlink $fname)
[[ $fname != /* ]] && fname="$dir/$fname"
done
echo "$(cd "$(dirname $fname)/.." && pwd)"
}
# used by loader to find core/ and stdlib/
BORK_SOURCE_DIR="$(getDir ${BASH_SOURCE[0]})"'
+++ getDir /usr/local/bin/bork
+++ fname=/usr/local/bin/bork
+++ '[' -h /usr/local/bin/bork ']'
+++++ dirname /usr/local/bin/bork
++++ cd -P /usr/local/bin
++++ pwd
+++ dir=/usr/local/bin
++++ readlink /usr/local/bin/bork
+++ fname=../Cellar/bork/0.9/bin/bork
+++ [[ ../Cellar/bork/0.9/bin/bork != /* ]]
+++ fname=/usr/local/bin/../Cellar/bork/0.9/bin/bork
+++ '[' -h /usr/local/bin/../Cellar/bork/0.9/bin/bork ']'
+++++ dirname /usr/local/bin/../Cellar/bork/0.9/bin/bork
++++ cd /usr/local/bin/../Cellar/bork/0.9/bin/..
++++ pwd
+++ echo /usr/local/Cellar/bork/0.9
++ BORK_SOURCE_DIR=/usr/local/Cellar/bork/0.9
+ operation=satisfy
+ shift
+ BORK_SCRIPT_DIR=/Users/jonas
+ '[' -n /Users/jonas/.dotfiles/borkfiles/sublime3.bork ']'
+++ pwd -P
++ getDir /Users/jonas//Users/jonas/.dotfiles/borkfiles/sublime3.bork
++ fname=/Users/jonas//Users/jonas/.dotfiles/borkfiles/sublime3.bork
++ '[' -h /Users/jonas//Users/jonas/.dotfiles/borkfiles/sublime3.bork ']'
++++ dirname /Users/jonas//Users/jonas/.dotfiles/borkfiles/sublime3.bork
+++ cd /Users/jonas//Users/jonas/.dotfiles/borkfiles/..
/usr/local/bin/bork: line 28: cd: /Users/jonas//Users/jonas/.dotfiles/borkfiles/..: No such file or directory
++ echo ''
+ BORK_SCRIPT_DIR=
+ BORK_WORKING_DIR=/Users/jonas
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/arguments.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/bag.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/bake.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/http.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/md5cmd.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/operations.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/permission_cmd.sh
+ for file in '$BORK_SOURCE_DIR/lib/helpers/*.sh' '$BORK_SOURCE_DIR/lib/declarations/*.sh'
+ . /usr/local/Cellar/bork/0.9/lib/helpers/status_codes.sh
harumph. I'll see what I can figure out. Also, you wrote an APM type?
ok, I think I've got it now. I've never passed in an absolute path on the command line before, it assumed a relative path. I cut a new release as well.
Just woke up and giving it a spin in some minutes. Regarding the apm
type: It's not really a bork compatible type yet, more of a script that's executed by my dotfile wrapper: https://github.com/frdmn/dotfiles/blob/master/borkfiles/atom.bork
I've planned to turn this into a proper bork type at some point but I switched (onec again) from Atom to Sublime Text so It's not that much incentive for me at the moment.
ok, great. let me know how this works for you and I'll close the issue. Or close it yourself.
Fixing this actually helped me find a problem with the destination
utility and how it works with ok
. I wanted to get rid of destination
anyway, now it looks like I've got an excuse.
Problem fixed, thanks @mattly!
I'm trying to create a Homebrew formula for bork, but at the moment I'm stuck since bork, doesnt like to be executed when symlinked:
Perhaps you could adjust it so it returns the actual location instead of location of the symlink.
While testing around a bit, I've found out that
$(realpath $0)
returns the expected path, but that binary doesn't come with OS X by default. (coreutils
brew package).Any ideas how to solve this?