teamocil 0.4.5 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -4
- data/.rubocop.yml +48 -0
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.md +124 -166
- data/Rakefile +12 -27
- data/bin/teamocil +3 -4
- data/lib/teamocil.rb +51 -4
- data/lib/teamocil/cli.rb +23 -90
- data/lib/teamocil/command/new_window.rb +16 -0
- data/lib/teamocil/command/rename_session.rb +9 -0
- data/lib/teamocil/command/rename_window.rb +9 -0
- data/lib/teamocil/command/select_layout.rb +9 -0
- data/lib/teamocil/command/select_pane.rb +9 -0
- data/lib/teamocil/command/select_window.rb +9 -0
- data/lib/teamocil/command/send_keys.rb +9 -0
- data/lib/teamocil/command/send_keys_to_pane.rb +9 -0
- data/lib/teamocil/command/split_window.rb +15 -0
- data/lib/teamocil/layout.rb +58 -36
- data/lib/teamocil/tmux/pane.rb +15 -0
- data/lib/teamocil/tmux/session.rb +28 -0
- data/lib/teamocil/tmux/window.rb +47 -0
- data/lib/teamocil/utils/closed_struct.rb +16 -0
- data/lib/teamocil/utils/option_parser.rb +56 -0
- data/lib/teamocil/version.rb +1 -1
- data/teamocil.gemspec +15 -16
- metadata +27 -54
- data/examples/four-splits.yml +0 -8
- data/examples/one-and-three-splits.yml +0 -8
- data/examples/six-splits.yml +0 -10
- data/examples/two-horizontal-splits.yml +0 -6
- data/examples/two-vertical-splits.yml +0 -6
- data/lib/teamocil/error.rb +0 -6
- data/lib/teamocil/layout/pane.rb +0 -66
- data/lib/teamocil/layout/session.rb +0 -30
- data/lib/teamocil/layout/window.rb +0 -77
- data/spec/cli_spec.rb +0 -79
- data/spec/fixtures/.my-fancy-layouts-directory/sample-3.yml +0 -10
- data/spec/fixtures/.teamocil/sample-2.yml +0 -10
- data/spec/fixtures/.teamocil/sample.yml +0 -10
- data/spec/fixtures/layouts.yml +0 -76
- data/spec/layout_spec.rb +0 -229
- data/spec/mock/cli.rb +0 -35
- data/spec/mock/layout.rb +0 -16
- data/spec/spec_helper.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec181d7aedf97f5a86ff36a951f9e6778871d715
|
4
|
+
data.tar.gz: 898335772480c6026daa85a96ad83c083b553dba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b7e11004f212c832c72f4bc6e14690294dd7526c9fb820bbaac3c62c16a7bb5ecdc83f72f42e0b3c4ad9551d27986390b0539c799fcf3d61d86046fbee61e5
|
7
|
+
data.tar.gz: 066d82e108560b8633c6d79dd5d4ff1b57ec1596286c0738d81ecfc2110eacd6d212cda02c1cd713fc624eaa1a21e3c04c8053b218f45b56175f94233040fc82
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- Rakefile
|
4
|
+
- teamocil.gemspec
|
5
|
+
|
6
|
+
Documentation:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Encoding:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
LineLength:
|
13
|
+
Max: 200
|
14
|
+
|
15
|
+
AccessModifierIndentation:
|
16
|
+
EnforcedStyle: outdent
|
17
|
+
|
18
|
+
IfUnlessModifier:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
CaseIndentation:
|
22
|
+
IndentWhenRelativeTo: case
|
23
|
+
IndentOneStep: true
|
24
|
+
|
25
|
+
MethodLength:
|
26
|
+
CountComments: false
|
27
|
+
Max: 20
|
28
|
+
|
29
|
+
SignalException:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
ColonMethodCall:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
AsciiComments:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Lambda:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
RegexpLiteral:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
RedundantBegin:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
AssignmentInCondition:
|
48
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
rvm: 1.
|
2
|
-
script:
|
1
|
+
rvm: 2.1.2
|
2
|
+
script: bundle exec phare
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
gemspec
|
data/{LICENSE → LICENSE.md}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,199 +1,172 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://github.com/remiprev/teamocil">
|
3
|
+
<img src="http://i.imgur.com/NX2eV2X.png" alt="Teamocil" />
|
4
|
+
</a>
|
5
|
+
<br />
|
6
|
+
Teamocil is a simple tool used to automatically create sessions,<br /> windows and panes in <a href="http://tmux.sourceforge.net">tmux</a> with YAML files.
|
7
|
+
<br /><br />
|
8
|
+
<a href="https://rubygems.org/gems/teamocil"><img src="http://img.shields.io/gem/v/teamocil.svg" /></a>
|
9
|
+
<a href="https://travis-ci.org/remiprev/teamocil"><img src="http://img.shields.io/travis/remiprev/teamocil.svg" /></a>
|
10
|
+
</p>
|
2
11
|
|
3
|
-
|
4
|
-
<a href="https://travis-ci.org/remiprev/teamocil"><img src="http://img.shields.io/travis/remiprev/teamocil.svg" /></a>
|
12
|
+
---
|
5
13
|
|
6
|
-
|
7
|
-
|
8
|
-
## Usage
|
14
|
+
## Installation
|
9
15
|
|
10
16
|
```bash
|
17
|
+
# Install the `teamocil` Ruby gem
|
11
18
|
$ gem install teamocil
|
19
|
+
|
20
|
+
# Create your layout directory
|
12
21
|
$ mkdir ~/.teamocil
|
22
|
+
|
23
|
+
# Edit ~/.teamocil/sample.yml (look for sample layouts in this very `README.md`)
|
13
24
|
$ teamocil --edit sample
|
25
|
+
|
26
|
+
# Launch tmux
|
14
27
|
$ tmux
|
28
|
+
|
29
|
+
# Run your newly-created sample layout
|
15
30
|
$ teamocil sample
|
16
31
|
```
|
17
32
|
|
18
|
-
##
|
19
|
-
|
20
|
-
* `--here` opens the session in the current window, do not create an empty first window.
|
21
|
-
* `--layout` takes a custom file path to a YAML layout file.
|
22
|
-
* `--edit` opens the layout file (whether or not `--layout` is used) with `$EDITOR`.
|
23
|
-
* `--list` lists all available layouts in `./.teamocil` or `$TEAMOCIL_PATH`.
|
24
|
-
* `--show` show the layout content instead of executing it.
|
25
|
-
|
26
|
-
## Layout file structure
|
27
|
-
|
28
|
-
A layout file is a single YAML file located in `~/.teamocil` or `$TEAMOCIL_PATH` (eg. `~/.teamocil/my-project.yml`).
|
29
|
-
|
30
|
-
### Session
|
31
|
-
|
32
|
-
You can wrap your entire layout file in a `session` and Teamocil will rename the current session (so that you can find it more easily when running `tmux list-sessions`) before creating your windows.
|
33
|
-
|
34
|
-
#### Keys
|
35
|
-
|
36
|
-
* `name` (the name of the session)
|
37
|
-
|
38
|
-
#### Example
|
33
|
+
## Usage
|
39
34
|
|
40
|
-
```
|
41
|
-
|
42
|
-
name: "my-awesome-session"
|
43
|
-
windows:
|
44
|
-
[windows list]
|
35
|
+
```bash
|
36
|
+
$ teamocil [options] [layout-name]
|
45
37
|
```
|
46
38
|
|
47
|
-
###
|
39
|
+
### Global options
|
48
40
|
|
49
|
-
|
41
|
+
| Option | Description
|
42
|
+
|-------------|----------------------------
|
43
|
+
| `--list` | Lists all available layouts in `~/.teamocil`
|
50
44
|
|
51
|
-
|
45
|
+
### Layout options
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
* `options` (a hash of `tmux` options, see `man tmux` for a list)
|
47
|
+
| Option | Description
|
48
|
+
|-------------|----------------------------
|
49
|
+
| `--layout` | Takes a custom file path to a YAML layout file instead of `[layout-name]`
|
50
|
+
| `--here` | Uses the current window as the layout’s first window
|
51
|
+
| `--edit` | Opens the layout file with `$EDITOR` instead of executing it
|
52
|
+
| `--show` | Shows the layout content instead of executing it
|
60
53
|
|
61
|
-
|
54
|
+
## Upgrading
|
62
55
|
|
63
|
-
|
56
|
+
Teamocil 1.0 is a complete rewrite (from scratch!) of Teamocil. The code is now
|
57
|
+
very much simpler, cleaner and easier to maintain.
|
64
58
|
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
The downside of that is that several features were dropped during the rewrite
|
60
|
+
process, mostly because I didn’t actually use/need them and I got tired of
|
61
|
+
maintaining features I don’t think are useful.
|
68
62
|
|
69
|
-
|
63
|
+
But hey, that’s just my opinion. Feel free to fork the repository and add as
|
64
|
+
many features as you want :smile:.
|
70
65
|
|
71
|
-
|
72
|
-
- name: "a-window-with-weird-layout"
|
73
|
-
layout: "4d71,204x51,0,0{101x51,0,0,114,102x51,102,0[102x10,102,0,118,102x40,102,11,115]}"
|
74
|
-
panes: …
|
75
|
-
```
|
66
|
+
## Configuration
|
76
67
|
|
77
|
-
|
68
|
+
### Windows
|
78
69
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
filters:
|
87
|
-
before:
|
88
|
-
- "echo 'Let’s use ruby-1.9.3 for each pane in this window.'"
|
89
|
-
- "rbenv local 1.9.3-p374"
|
90
|
-
panes:
|
91
|
-
[panes list]
|
92
|
-
- name: "my-second-window"
|
93
|
-
layout: tiled
|
94
|
-
root: "~/Projects/foo-api"
|
95
|
-
panes:
|
96
|
-
[panes list]
|
97
|
-
- name: "my-third-window"
|
98
|
-
layout: main-vertical
|
99
|
-
root: "~/Projects/foo-daemons"
|
100
|
-
panes:
|
101
|
-
[panes list]
|
102
|
-
```
|
70
|
+
| Key | Description
|
71
|
+
|----------|----------------------------
|
72
|
+
| `name` | The tmux window name
|
73
|
+
| `root` | The path where all panes in the window will be started
|
74
|
+
| `layout` | The layout that will be set after all panes are created by Teamocil
|
75
|
+
| `panes` | An `Array` of panes
|
76
|
+
| `focus` | If set to `true`, the window will be selected after the layout has been executed
|
103
77
|
|
104
78
|
### Panes
|
105
79
|
|
106
|
-
|
80
|
+
A pane can either be a `String` or a `Hash`. If it’s a `String`, Teamocil will
|
81
|
+
treat it as a single-command pane.
|
107
82
|
|
108
|
-
|
83
|
+
| Key | Description
|
84
|
+
|------------|----------------------------
|
85
|
+
| `commands` | An `Array` of commands that will be ran when the pane is created
|
86
|
+
| `focus` | If set to `true`, the pane will be selected after the layout has been executed
|
109
87
|
|
110
|
-
|
111
|
-
* `width` (the pane width, in percentage)
|
112
|
-
* `height` (the pane width, in percentage)
|
113
|
-
* `target` (the pane to set focus on before creating the current one)
|
114
|
-
* `focus` (the pane to set focus on after initializing all the panes for a window)
|
88
|
+
## Examples
|
115
89
|
|
116
|
-
|
90
|
+
### Simple two pane window
|
117
91
|
|
118
92
|
```yaml
|
119
93
|
windows:
|
120
|
-
- name:
|
121
|
-
root:
|
122
|
-
layout: even-
|
123
|
-
filters:
|
124
|
-
before: "rbenv local 2.0.0-p0"
|
125
|
-
after: "echo 'I am done initializing this pane.'"
|
94
|
+
- name: sample-two-panes
|
95
|
+
root: ~/Code/sample/www
|
96
|
+
layout: even-horizontal
|
126
97
|
panes:
|
127
|
-
-
|
128
|
-
-
|
129
|
-
focus: true
|
130
|
-
- cmd:
|
131
|
-
- "sudo service memcached start"
|
132
|
-
- "sudo service mongodb start"
|
98
|
+
- git status
|
99
|
+
- rails server
|
133
100
|
```
|
134
101
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
102
|
+
```
|
103
|
+
.------------------.------------------.
|
104
|
+
| (0) | (1) |
|
105
|
+
| | |
|
106
|
+
| | |
|
107
|
+
| | |
|
108
|
+
| | |
|
109
|
+
| | |
|
110
|
+
| | |
|
111
|
+
| | |
|
112
|
+
| | |
|
113
|
+
'------------------'------------------'
|
114
|
+
```
|
140
115
|
|
141
|
-
|
116
|
+
### Simple three pane window
|
142
117
|
|
143
118
|
```yaml
|
144
119
|
windows:
|
145
|
-
- name:
|
146
|
-
root:
|
147
|
-
layout:
|
120
|
+
- name: sample-three-panes
|
121
|
+
root: ~/Code/sample/www
|
122
|
+
layout: main-vertical
|
148
123
|
panes:
|
149
|
-
-
|
150
|
-
-
|
124
|
+
- vim
|
125
|
+
- rails server
|
126
|
+
- git status
|
151
127
|
```
|
152
|
-
|
153
|
-
|
154
|
-
#### Result of `$ teamocil sample-1`
|
155
128
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
129
|
+
```
|
130
|
+
.------------------.------------------.
|
131
|
+
| (0) | (1) |
|
132
|
+
| | |
|
133
|
+
| | |
|
134
|
+
| | |
|
135
|
+
| |------------------|
|
136
|
+
| | (2) |
|
137
|
+
| | |
|
138
|
+
| | |
|
139
|
+
| | |
|
140
|
+
'------------------'------------------'
|
141
|
+
```
|
169
142
|
|
170
|
-
|
143
|
+
### Simple four pane window
|
171
144
|
|
172
145
|
```yaml
|
173
146
|
windows:
|
174
|
-
- name:
|
175
|
-
root:
|
147
|
+
- name: sample-two-panes
|
148
|
+
root: ~/Code/sample/www
|
176
149
|
layout: tiled
|
177
150
|
panes:
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
151
|
+
- vim
|
152
|
+
- foreman start web
|
153
|
+
- git status
|
154
|
+
- foreman start worker
|
182
155
|
```
|
183
156
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
157
|
+
```
|
158
|
+
.------------------.------------------.
|
159
|
+
| (0) | (1) |
|
160
|
+
| | |
|
161
|
+
| | |
|
162
|
+
| | |
|
163
|
+
|------------------|------------------|
|
164
|
+
| (2) | (3) |
|
165
|
+
| | |
|
166
|
+
| | |
|
167
|
+
| | |
|
168
|
+
'------------------'------------------'
|
169
|
+
```
|
197
170
|
|
198
171
|
## Extras
|
199
172
|
|
@@ -213,26 +186,11 @@ To get autocompletion when typing `teamocil <Tab>` in a bash session, add this l
|
|
213
186
|
complete -W "$(teamocil --list)" teamocil
|
214
187
|
```
|
215
188
|
|
216
|
-
### ERB support
|
217
|
-
|
218
|
-
You can use ERB in your layouts. For example, you can use an environment variable in a layout like so:
|
219
|
-
|
220
|
-
```yaml
|
221
|
-
windows:
|
222
|
-
- name: "erb-example"
|
223
|
-
root: <%= ENV['MY_PROJECT_ROOT'] %>
|
224
|
-
panes:
|
225
|
-
- cmd: "pwd"
|
226
|
-
```
|
227
|
-
|
228
|
-
## Todo list
|
229
|
-
|
230
|
-
* Making sure the layout is valid before executing it (ie. throw exceptions).
|
231
|
-
* Add more specs.
|
232
|
-
|
233
189
|
## Contributors
|
234
190
|
|
235
|
-
Feel free to contribute and submit issues/pull requests
|
191
|
+
Feel free to contribute and submit issues/pull requests
|
192
|
+
[on GitHub](https://github.com/remiprev/teamocil/issues), just like these fine
|
193
|
+
folks did:
|
236
194
|
|
237
195
|
* [@garno](https://github.com/garno)
|
238
196
|
* [@jbourassa](https://github.com/jbourassa)
|
@@ -240,8 +198,8 @@ Feel free to contribute and submit issues/pull requests [on GitHub](https://gith
|
|
240
198
|
* [@jscheel](https://github.com/jscheel)
|
241
199
|
* [@mklappstuhl](https://github.com/mklappstuhl)
|
242
200
|
|
243
|
-
Take a look at the `spec` folder before you do, and make sure `bundle exec rake spec` passes after your modifications :)
|
244
|
-
|
245
201
|
## License
|
246
202
|
|
247
|
-
Teamocil is © 2011-2014 [Rémi Prévost](http://exomel.com) and may be freely
|
203
|
+
Teamocil is © 2011-2014 [Rémi Prévost](http://exomel.com) and may be freely
|
204
|
+
distributed under the [MIT license](https://github.com/remiprev/teamocil/blob/master/LICENSE.md).
|
205
|
+
See the `LICENSE.md` file for more information.
|