Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jun 29, 2012
@bdimcheff bdimcheff Layout yaml is now passed through ERB
All yaml files will be passed through ERB before being parsed.  This
will allow you to use environmental variables (or any other ruby
snippets) to make your config more generic.
9203362
@bdimcheff bdimcheff readme for ERB support f4e2620
@remiprev Version bump to 0.3.7 5ac39d4
View
12 README.md
@@ -185,6 +185,18 @@ To get autocompletion when typing `teamocil <Tab>` in a zsh session, add this li
compctl -g '~/.teamocil/*(:t:r)' teamocil
```
+### ERB Support
+
+You can use ERB in your config files. For example, you can use an environment variable in your config like so:
+
+```yaml
+windows:
+ - name: "erb-example"
+ root: <%= ENV['MY_PROJECT_ROOT'] %>
+ splits:
+ - cmd: "pwd"
+```
+
## Todo list
* Making sure the layout is valid before executing it (ie. throw exceptions).
View
2  lib/teamocil.rb
@@ -1,5 +1,5 @@
module Teamocil
- VERSION = "0.3.6"
+ VERSION = "0.3.7"
autoload :Layout, "teamocil/layout"
autoload :CLI, "teamocil/cli"
end
View
5 lib/teamocil/cli.rb
@@ -1,5 +1,6 @@
require 'optparse'
require 'fileutils'
+require 'erb'
module Teamocil
# This class handles interaction with the `tmux` utility.
@@ -32,7 +33,9 @@ def initialize(argv, env) # {{{
bail "There is no file \"#{file}\"" unless File.exists?(file)
bail "You must be in a tmux session to use teamocil" unless env["TMUX"]
- @layout = Teamocil::Layout.new(YAML.load_file(file), @options)
+ yaml = ERB.new(File.read(file)).result
+
+ @layout = Teamocil::Layout.new(YAML.load(yaml), @options)
@layout.compile!
@layout.execute_commands(@layout.generate_commands)
end
View
2  spec/fixtures/.teamocil/sample.yml
@@ -2,7 +2,7 @@ session:
name: sample
root: ~
windows:
- - name: "foo"
+ - name: <%= "foo" %>
splits:
- cmd: "pwd"
- name: "bar"

No commit comments for this range

Something went wrong with that request. Please try again.