lab42_tmux2 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -9
- data/lib/lab42/tmux/config.rb +2 -1
- data/lib/lab42/tmux/session/commands.rb +5 -0
- data/lib/lab42/tmux/session.rb +1 -0
- data/lib/lab42/tmux/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4abd846c0ceffd96881a405fe172b5f4c1aca28e
|
4
|
+
data.tar.gz: 7f9214fcf575a8c4b375cd45adae78025d07656d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b703dd7c02e5cf7c121cf56578fd17a38fb2d082b969f0d2f7666427cb36557e2412ab9cee18442eab5287eb79d02e07b7189ce8d0dbc387b035a1576f8569e
|
7
|
+
data.tar.gz: 7036211a92294745df4317b40f7b2efe365e96730ab7f4ee638fb9609ed658c33c7fc78ae5ed569ff9d1282e9b04ae7771f123bfb4ab6c92f823c99aed21d50d
|
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
|
2
|
-
# Lab42
|
2
|
+
# Lab42 Programmer's Best Friend In Ruby2
|
3
3
|
|
4
4
|
## Tmux2
|
5
5
|
|
6
6
|
**N.B.** This is a complete rewrite of tmux and it is **not** compatible, IOW do not
|
7
|
-
install both gems.
|
7
|
+
install both gems, they even occupy the same namespace.
|
8
8
|
|
9
9
|
These are the differences
|
10
10
|
|
11
11
|
* Everything has changed.
|
12
12
|
|
13
|
-
* Furthermore, nothing has remained the same
|
13
|
+
* Furthermore, nothing has remained the same.
|
14
14
|
|
15
15
|
* There are no predefined scripts, but have a look at the examples.
|
16
16
|
|
@@ -26,8 +26,6 @@ A simple API for launching tmux sessions from Ruby scripts
|
|
26
26
|
session "vi_session" do
|
27
27
|
new_window 'vi' do
|
28
28
|
send_keys 'vi .'
|
29
|
-
wait_for '.. (up a dir)' # NERDTree pane has loaded (not yet implemented)
|
30
|
-
send_keys_raw 'C-w', 'l'
|
31
29
|
end
|
32
30
|
new_window 'pry' do
|
33
31
|
send_keys 'pry -Ilib'
|
@@ -53,7 +51,7 @@ A simple API for launching tmux sessions from Ruby scripts
|
|
53
51
|
|
54
52
|
### Hooks
|
55
53
|
|
56
|
-
Add
|
54
|
+
Add an `after_new_window` hook for tmux commands to be executed after the creation of a new
|
57
55
|
window.
|
58
56
|
|
59
57
|
```ruby
|
@@ -77,9 +75,9 @@ and only then switch to the right hand side split pane (of vi, not tmux).
|
|
77
75
|
|
78
76
|
config
|
79
77
|
# options for wait_for
|
80
|
-
pre_wait_interval 0.1 # Before checking for text
|
81
|
-
post_wait_interval 0.1 # After text has shown up in pane
|
82
|
-
wait_timeout 4 # Do not wait longer than that
|
78
|
+
pre_wait_interval 0.1 # Before checking for text in s, defaults to nil
|
79
|
+
post_wait_interval 0.1 # After text has shown up in pane, defaults to nil
|
80
|
+
wait_timeout 4 # Do not wait longer than that, defaults to 2s
|
83
81
|
|
84
82
|
verbose true # Talk to stdout for post mortem analyse
|
85
83
|
end
|
data/lib/lab42/tmux/config.rb
CHANGED
@@ -16,13 +16,14 @@ module Lab42
|
|
16
16
|
end
|
17
17
|
|
18
18
|
define_setter_getters :pre_wait_interval, :post_wait_interval, :wait_interval, :wait_timeout
|
19
|
-
define_setter_getters :session_name, :window_automatic_rename
|
19
|
+
define_setter_getters :project_home, :session_name, :window_automatic_rename
|
20
20
|
define_setter_getters :verbose
|
21
21
|
|
22
22
|
private
|
23
23
|
def initialize
|
24
24
|
@wait_interval = 0.5
|
25
25
|
@wait_timeout = 2
|
26
|
+
@project_home = File.dirname $0
|
26
27
|
end
|
27
28
|
end # module Config
|
28
29
|
end # module Tmux
|
@@ -4,9 +4,14 @@ module Lab42
|
|
4
4
|
module Tmux
|
5
5
|
class Session
|
6
6
|
module Commands
|
7
|
+
def goto dest
|
8
|
+
return unless dest
|
9
|
+
send_keys "cd #{dest}"
|
10
|
+
end
|
7
11
|
def new_window window_name, &block
|
8
12
|
@window_number += 1
|
9
13
|
command 'new-window', '-t', session_name, '-n', window_name
|
14
|
+
goto configuration.project_home
|
10
15
|
instance_exec( &@after_new_window_hook ) if @after_new_window_hook
|
11
16
|
instance_exec( &block ) if block
|
12
17
|
end
|
data/lib/lab42/tmux/session.rb
CHANGED
@@ -44,6 +44,7 @@ module Lab42
|
|
44
44
|
# TODO: replace 'sh' with a configuration value
|
45
45
|
command 'new-session', '-d', '-s', session_name, '-n', 'sh'
|
46
46
|
command 'set-window-option', '-g', 'automatic-rename', 'off' unless configuration.window_automatic_rename
|
47
|
+
goto configuration.project_home
|
47
48
|
end
|
48
49
|
|
49
50
|
def running?
|
data/lib/lab42/tmux/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lab42_tmux2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Dober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forwarder2
|