teamocil 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.mkd CHANGED
@@ -23,11 +23,12 @@ Teamocil is a tool used to automatically create sessions, windows and splits in
23
23
  name: sample-session
24
24
  windows:
25
25
  - name: sample-window
26
+ root: ~/Code/sample/www
26
27
  splits:
27
- - cmd: cd ~/Code/sample/www
28
28
  - cmd:
29
- - cd ~/Code/sample/www
30
- - rails s
29
+ - ls -la
30
+ - git status
31
+ - cmd: rails server --port 3000
31
32
  width: 50
32
33
  - cmd: memcached -p 11211 -vv
33
34
  height: 25
data/lib/teamocil.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Teamocil
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  autoload :Layout, "teamocil/layout"
4
4
  end
@@ -26,10 +26,11 @@ module Teamocil
26
26
  windows.each_with_index do |window, window_index|
27
27
 
28
28
  if options.include?(:here) and window_index == 0
29
- output << "tmux rename-window #{window["name"]}"
29
+ output << "tmux rename-window \"#{window["name"]}\""
30
30
  else
31
- output << "tmux new-window -n #{window["name"]}"
31
+ output << "tmux new-window -n \"#{window["name"]}\""
32
32
  end
33
+
33
34
  window["splits"].each_with_index do |split, index|
34
35
  unless index == 0
35
36
  if split.include?("width")
@@ -43,7 +44,13 @@ module Teamocil
43
44
  end
44
45
  end
45
46
 
47
+ # Support single command splits, but treat it as an array nevertheless
46
48
  split["cmd"] = [split["cmd"]] unless split["cmd"].is_a? Array
49
+
50
+ # If a `root` key exist, start each split in this directory
51
+ split["cmd"] = ["cd \"#{window["root"]}\""] + split["cmd"] if window.include?("root")
52
+
53
+ # Execute each split command
47
54
  split["cmd"].each do |command|
48
55
  output << "tmux send-keys -t #{index} \"#{command}\""
49
56
  output << "tmux send-keys -t #{index} Enter"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamocil
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - "R\xC3\xA9mi Pr\xC3\xA9vost"