just-tmux 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/lib/just-tmux.rb +57 -0
- metadata +81 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c64942d5b414654232636551529fc45087f1eccb
|
4
|
+
data.tar.gz: 90618d489a480d8451f504413a6c55a3d68fcf3b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 412f1bcae281b8fef6d6275ddb7cdcd16f79475d77ab15acd39df8a79a63e7b5208f7537be944205b47b7c60090ae066f1612ae4b79fdd6329f577b7e7052598
|
7
|
+
data.tar.gz: d9565c7be64901b5f189fcc852614d6e3b164b464e0ef91b8cc52ed70a6a872970ea8d5806536a1ea1df8b9d08abf44510ebf8fab7d5feca88ab5da5915e8816
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
data/lib/just-tmux.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: just-tmux.rb
|
4
|
+
|
5
|
+
require 'dynarex'
|
6
|
+
|
7
|
+
class JustTmux
|
8
|
+
|
9
|
+
attr_reader :to_s
|
10
|
+
|
11
|
+
|
12
|
+
# example raw dynarex file:
|
13
|
+
#
|
14
|
+
# config=<<EOF
|
15
|
+
# <?dynarex schema="tmux[session, shell, default_dir]/window(command, name, dir)"?>
|
16
|
+
# session: fun
|
17
|
+
# shell: bash
|
18
|
+
# default_dir: ~
|
19
|
+
#
|
20
|
+
# lis
|
21
|
+
# pwd home /home/james/ruby
|
22
|
+
#EOF
|
23
|
+
#
|
24
|
+
def intialize(dynarex_file)
|
25
|
+
|
26
|
+
dynarex = Dynarex.new dynarex_file
|
27
|
+
|
28
|
+
shell = dynarex.summary['shell']
|
29
|
+
default_dir = File.expand_path dynarex.summary['default_dir']
|
30
|
+
session_name = dynarex.summary['session']
|
31
|
+
|
32
|
+
h = dynarex.to_h.map do |x|
|
33
|
+
x[:name] = shell if x[:name].empty?
|
34
|
+
x[:dir] = default_dir if x[:dir].empty?
|
35
|
+
x
|
36
|
+
end
|
37
|
+
|
38
|
+
@to_s = new_session(session_name, h[0][:name], shell, h[0][:dir],
|
39
|
+
h[0][:command]) + h[1..-1].map {|x| new_window(x[:name],
|
40
|
+
shell, x[:command]) }.join
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def new_window(window_name, shell, command)
|
47
|
+
"tmux new-window -n %s %s\ntmux send-keys '%s' Enter\n" %
|
48
|
+
[window_name, shell, command]
|
49
|
+
end
|
50
|
+
|
51
|
+
def new_session(session_name, window_name, shell, dir, command)
|
52
|
+
r = "tmux new-session -d -s %s -n %s '%s'\n" %
|
53
|
+
[session_name, shell, window_name]
|
54
|
+
r + "tmux send-keys 'cd %s && %s' Enter\n" % [dir, command]
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: just-tmux
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTEzMTAyMTIxMDg1NVoXDTE0MTAyMTIx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7pRK4fMNj7DLdJwBafBtUguULQ2
|
31
|
+
GZxKVyIb70J4/2nG3zo8UMkUNLZb4ndNQ+FEsYq5injt0qnyorF9kpslWaSMv2Y0
|
32
|
+
BEbFg33dhjzHhQ==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dynarex
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
description:
|
51
|
+
email: james@r0bertson.co.uk
|
52
|
+
executables: []
|
53
|
+
extensions: []
|
54
|
+
extra_rdoc_files: []
|
55
|
+
files:
|
56
|
+
- lib/just-tmux.rb
|
57
|
+
homepage: https://github.com/jrobertson/just-tmux
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.0.0.rc.2
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: just-tmux
|
81
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|