teamocil 1.3.1 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/lib/teamocil.rb +1 -0
- data/lib/teamocil/command/set_window_option.rb +9 -0
- data/lib/teamocil/tmux/window.rb +8 -1
- data/lib/teamocil/version.rb +1 -1
- data/spec/teamocil/tmux/window_spec.rb +25 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e796389d4b59a72b6642f344e17ced9c0cb23c74
|
4
|
+
data.tar.gz: 06955132e6bb74b8a7aaf0d7d6d0d50223386143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a060e6b0799fd16adf75dad62064ba7ec794c4fffba5188e1314705c9fdf16a5928033a9fbcf4eb223846bbd452bb8a10cb0e523f51538ce69653a194c8a0e1
|
7
|
+
data.tar.gz: bb07d7f9fcfddd7828bc155ab0dedff75264f57c69e60955d5b2ca2be699880ea4a44b0b523a338aa30b87d0818585415730d5659bbf9369e0bc4306511caba7
|
data/README.md
CHANGED
@@ -77,13 +77,14 @@ The [`0.4-stable` branch](https://github.com/remiprev/teamocil/tree/0.4-stable)
|
|
77
77
|
|
78
78
|
### Windows
|
79
79
|
|
80
|
-
| Key
|
81
|
-
|
82
|
-
| `name`
|
83
|
-
| `root`
|
84
|
-
| `layout`
|
85
|
-
| `panes`
|
86
|
-
| `focus`
|
80
|
+
| Key | Description
|
81
|
+
|-----------|----------------------------
|
82
|
+
| `name` | The tmux window name
|
83
|
+
| `root` | The path where all panes in the window will be started
|
84
|
+
| `layout` | The layout that will be set after all panes are created by Teamocil
|
85
|
+
| `panes` | An `Array` of panes
|
86
|
+
| `focus` | If set to `true`, the window will be selected after the layout has been executed
|
87
|
+
| `options` | A `Hash` of options that will be set with the `set-window-option` command
|
87
88
|
|
88
89
|
### Panes
|
89
90
|
|
data/lib/teamocil.rb
CHANGED
@@ -27,6 +27,7 @@ require 'teamocil/command/select_pane'
|
|
27
27
|
require 'teamocil/command/select_window'
|
28
28
|
require 'teamocil/command/send_keys'
|
29
29
|
require 'teamocil/command/send_keys_to_pane'
|
30
|
+
require 'teamocil/command/set_window_option'
|
30
31
|
require 'teamocil/command/show_options'
|
31
32
|
require 'teamocil/command/show_window_options'
|
32
33
|
require 'teamocil/command/split_window'
|
data/lib/teamocil/tmux/window.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Teamocil
|
2
2
|
module Tmux
|
3
|
-
class Window < ClosedStruct.new(:index, :root, :focus, :layout, :name, :panes)
|
3
|
+
class Window < ClosedStruct.new(:index, :root, :focus, :layout, :name, :panes, :options)
|
4
4
|
def initialize(object)
|
5
5
|
super
|
6
6
|
|
@@ -43,6 +43,13 @@ module Teamocil
|
|
43
43
|
tmux << Teamocil::Command::NewWindow.new(name: name, root: root)
|
44
44
|
end
|
45
45
|
|
46
|
+
# Set window options
|
47
|
+
if options
|
48
|
+
tmux << options.map do |(option, value)|
|
49
|
+
Teamocil::Command::SetWindowOption.new(name: name, option: option, value: value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
46
53
|
# Execute all panes commands
|
47
54
|
tmux << panes.map(&:as_tmux).flatten
|
48
55
|
|
data/lib/teamocil/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Teamocil::Tmux::Window do
|
4
|
-
let(:window) { Teamocil::Tmux::Window.new(index: index, root: root, layout: layout, name: name, panes: panes) }
|
4
|
+
let(:window) { Teamocil::Tmux::Window.new(index: index, root: root, layout: layout, name: name, panes: panes, options: window_options) }
|
5
5
|
let(:as_tmux) { window.as_tmux }
|
6
6
|
|
7
7
|
before do
|
@@ -13,9 +13,10 @@ RSpec.describe Teamocil::Tmux::Window do
|
|
13
13
|
# Tmux options
|
14
14
|
let(:pane_base_index) { Random.rand(0..100) }
|
15
15
|
let(:window_base_index) { Random.rand(0..100) }
|
16
|
+
let(:options) { {} }
|
16
17
|
|
17
18
|
# Window attributes
|
18
|
-
let(:
|
19
|
+
let(:window_options) { {} }
|
19
20
|
let(:index) { 0 }
|
20
21
|
let(:name) { 'foo' }
|
21
22
|
let(:layout) { nil }
|
@@ -84,6 +85,28 @@ RSpec.describe Teamocil::Tmux::Window do
|
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
88
|
+
context 'with options attribute' do
|
89
|
+
let(:layout) { 'main-vertical' }
|
90
|
+
let(:window_options) do
|
91
|
+
{ 'main-pane-width' => '100' }
|
92
|
+
end
|
93
|
+
|
94
|
+
it do
|
95
|
+
expect(as_tmux).to eql [
|
96
|
+
Teamocil::Command::NewWindow.new(name: name),
|
97
|
+
Teamocil::Command::SetWindowOption.new(name: name, option: 'main-pane-width', value: '100'),
|
98
|
+
Teamocil::Command::SendKeysToPane.new(index: "#{name}.#{pane_base_index}", keys: 'foo; omg'),
|
99
|
+
Teamocil::Command::SendKeysToPane.new(index: "#{name}.#{pane_base_index}", keys: 'Enter'),
|
100
|
+
Teamocil::Command::SelectLayout.new(layout: layout, name: name),
|
101
|
+
Teamocil::Command::SplitWindow.new(name: name),
|
102
|
+
Teamocil::Command::SendKeysToPane.new(index: "#{name}.#{pane_base_index + 1}", keys: 'bar'),
|
103
|
+
Teamocil::Command::SendKeysToPane.new(index: "#{name}.#{pane_base_index + 1}", keys: 'Enter'),
|
104
|
+
Teamocil::Command::SelectLayout.new(layout: layout, name: name),
|
105
|
+
Teamocil::Command::SelectPane.new(index: "#{name}.#{pane_base_index + 1}")
|
106
|
+
]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
87
110
|
context 'with --here option' do
|
88
111
|
context 'without root' do
|
89
112
|
let(:options) { { here: true } }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamocil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémi Prévost
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/teamocil/command/select_window.rb
|
96
96
|
- lib/teamocil/command/send_keys.rb
|
97
97
|
- lib/teamocil/command/send_keys_to_pane.rb
|
98
|
+
- lib/teamocil/command/set_window_option.rb
|
98
99
|
- lib/teamocil/command/show_options.rb
|
99
100
|
- lib/teamocil/command/show_window_options.rb
|
100
101
|
- lib/teamocil/command/split_window.rb
|