teamocil 1.4 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e796389d4b59a72b6642f344e17ced9c0cb23c74
4
- data.tar.gz: 06955132e6bb74b8a7aaf0d7d6d0d50223386143
3
+ metadata.gz: fbc2a7a64a9c84296d75836e76bde8167f824f6b
4
+ data.tar.gz: 0e60909ca4da8bca1f843f8ce505a0c85789954a
5
5
  SHA512:
6
- metadata.gz: 7a060e6b0799fd16adf75dad62064ba7ec794c4fffba5188e1314705c9fdf16a5928033a9fbcf4eb223846bbd452bb8a10cb0e523f51538ce69653a194c8a0e1
7
- data.tar.gz: bb07d7f9fcfddd7828bc155ab0dedff75264f57c69e60955d5b2ca2be699880ea4a44b0b523a338aa30b87d0818585415730d5659bbf9369e0bc4306511caba7
6
+ metadata.gz: b0711544e6cd410e1fe5a92e17d10028be600b23469bc26aed3ac89bae78f0533f2629de278dc25049c8bafb6fc12710b95ffd84a23cfda04882342e1ec5e64e
7
+ data.tar.gz: 21fc9ccf1157485e005a0267aa2a1ea15b8a3c133a5c0ee4bf4cbbcd3df06096a8654d4959c603d638e3ad7d9bd81304a4b527ba460ff891a2b90cb7a47d36c5
@@ -1,6 +1,9 @@
1
+ sudo: false
2
+
1
3
  rvm:
2
- - 2.0.0
3
- - 2.1.2
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
4
7
 
5
8
  script:
6
9
  - 'echo "Checking code style" && bundle exec phare'
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2015 Rémi Prévost
1
+ Copyright (c) 2011-2016 Rémi Prévost
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -79,7 +79,7 @@ The [`0.4-stable` branch](https://github.com/remiprev/teamocil/tree/0.4-stable)
79
79
 
80
80
  | Key | Description
81
81
  |-----------|----------------------------
82
- | `name` | The tmux window name
82
+ | `name` | The tmux window name _(required)_
83
83
  | `root` | The path where all panes in the window will be started
84
84
  | `layout` | The layout that will be set after all panes are created by Teamocil
85
85
  | `panes` | An `Array` of panes
@@ -230,6 +230,16 @@ To get autocompletion when typing `teamocil <Tab>` in a bash session, add this l
230
230
  complete -W "$(teamocil --list)" teamocil
231
231
  ```
232
232
 
233
+ ### Fish autocompletion
234
+
235
+ To get autocompletion when typing `teamocil <Tab>` in a fish session,
236
+ add the following file `~/.config/fish/completions/teamocil.fish` with
237
+ the following content:
238
+
239
+ ```fish
240
+ complete -x -c teamocil -a '(teamocil --list)'
241
+ ```
242
+
233
243
  ## Contributors
234
244
 
235
245
  Feel free to contribute and submit issues/pull requests
@@ -244,6 +254,6 @@ folks did:
244
254
 
245
255
  ## License
246
256
 
247
- Teamocil is © 2011-2015 [Rémi Prévost](http://exomel.com) and may be freely
257
+ Teamocil is © 2011-2016 [Rémi Prévost](http://exomel.com) and may be freely
248
258
  distributed under the [MIT license](https://github.com/remiprev/teamocil/blob/master/LICENSE.md).
249
259
  See the `LICENSE.md` file for more information.
@@ -7,6 +7,7 @@ module Teamocil
7
7
  # Make sure paths like `~/foo/bar` work
8
8
  self.root = File.expand_path(root) if root
9
9
 
10
+ self.options ||= {}
10
11
  self.panes ||= []
11
12
  self.panes = panes.each_with_index.map do |pane, index|
12
13
  # Support single command instead of `commands` key in Hash
@@ -30,33 +31,18 @@ module Teamocil
30
31
 
31
32
  def as_tmux
32
33
  [].tap do |tmux|
33
- # Rename the current window or create a new one
34
- if Teamocil.options[:here] && first?
35
- if root
36
- first_pane_index = panes.first.internal_index
37
- tmux << Teamocil::Command::SendKeysToPane.new(index: first_pane_index, keys: %(cd "#{root}"))
38
- tmux << Teamocil::Command::SendKeysToPane.new(index: first_pane_index, keys: 'Enter')
39
- end
40
-
41
- tmux << Teamocil::Command::RenameWindow.new(name: name)
42
- else
43
- tmux << Teamocil::Command::NewWindow.new(name: name, root: root)
44
- end
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
34
+ # Create a new window or use the current one
35
+ tmux << spawn_window_commands
36
+
37
+ # Set specific window options
38
+ tmux << set_window_options_commands
52
39
 
53
40
  # Execute all panes commands
54
41
  tmux << panes.map(&:as_tmux).flatten
55
42
 
56
43
  # Set the focus on the right pane or the first one
57
- focused_pane = panes.find(&:focus)
58
- focused_index = focused_pane ? focused_pane.internal_index : "#{name}.#{Teamocil::Tmux::Pane.pane_base_index}"
59
- tmux << Teamocil::Command::SelectPane.new(index: focused_index)
44
+ tmux << focus_pane_commands
45
+
60
46
  end.flatten
61
47
  end
62
48
 
@@ -78,6 +64,36 @@ module Teamocil
78
64
 
79
65
  protected
80
66
 
67
+ def spawn_window_commands
68
+ if Teamocil.options[:here] && first?
69
+ change_working_directory_commands << Teamocil::Command::RenameWindow.new(name: name)
70
+ else
71
+ Teamocil::Command::NewWindow.new(name: name, root: root)
72
+ end
73
+ end
74
+
75
+ def set_window_options_commands
76
+ options.map do |(option, value)|
77
+ Teamocil::Command::SetWindowOption.new(name: name, option: option, value: value)
78
+ end
79
+ end
80
+
81
+ def focus_pane_commands
82
+ focused_pane = panes.find(&:focus)
83
+ focused_index = focused_pane ? focused_pane.internal_index : "#{name}.#{Teamocil::Tmux::Pane.pane_base_index}"
84
+
85
+ Teamocil::Command::SelectPane.new(index: focused_index)
86
+ end
87
+
88
+ def change_working_directory_commands
89
+ return [] unless root
90
+ pane_index = panes.any? ? panes.first.internal_index : Teamocil::Tmux::Pane.pane_base_index
91
+
92
+ [%(cd "#{root}"), 'Enter'].map do |keys|
93
+ Teamocil::Command::SendKeysToPane.new(index: pane_index, keys: keys)
94
+ end
95
+ end
96
+
81
97
  def first?
82
98
  index.zero?
83
99
  end
@@ -1,3 +1,3 @@
1
1
  module Teamocil
2
- VERSION = '1.4'
2
+ VERSION = '1.4.1'
3
3
  end
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'
4
+ version: 1.4.1
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-15 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.4.5
139
+ rubygems_version: 2.5.1
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Teamocil is a simple tool used to automatically create windows and panes