Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable for root does not work #119

Open
spinningarrow opened this issue Feb 22, 2017 · 1 comment · May be fixed by #134
Open

Environment variable for root does not work #119

spinningarrow opened this issue Feb 22, 2017 · 1 comment · May be fixed by #134

Comments

@spinningarrow
Copy link

I'm trying to use teamocil with the root setting in my config. I have something like this:

windows:
  - name: some-name
    root: $WORKSPACE
    layout: even-horizontal
    panes:
      - commands:
        - cd my-project
        - git fetch

I have $WORKSPACE set to ~/dev/workspace and exported in my shell config (I'm using fish) but this is not working.

Running with the debug flag I see

tmux new-window -n 'some-name' -c '/Users/sahil/dev/$WORKSPACE'

Instead of resolving the variable to a path, it's instead appending it to my current directory and creating an invalid path.

Is this something that can be fixed?

@SidOfc
Copy link

SidOfc commented Jun 14, 2017

This happens because the file is not 'parsed' by the shell, when you use commands on the terminal, the shell can look up the variable SAMPLE in your environment when you echo $SAMPLE. However, this file simply gets loaded into Teamocil as a string and no further parsing is done, except from YAML to a ruby hash, not even a shell nearby :)

I've created a pull request here: #121 but the tests aren't running and I'm not really sure why but the commits add a grand total of ~3 lines (including documentation note) enabling ERB support in the YAML config files. This allows you to do something like this instead:

windows:
  - name: some-name
     root: <%= ENV['WORKSPACE'] %>
     layout: even-horizontal
     ... snipped...

I'm unsure if it'll make it in the actual project, for now - I've created a fork which is at the time of writing on version 1.4.2.

To install the fork, one should first git clone my fork locally, then uninstall the teamocil gem with gem uninstall teamocil then cd into the fork directory and run rake install:local to build and install the forked version, you should be able to use the teamocil command like normal with the key difference being enabled ERB support :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants