multiterm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/multiterm +12 -0
- data/lib/multiterm.rb +2 -4
- data/lib/multiterm/terminal.rb +6 -1
- data/lib/multiterm/version.rb +1 -1
- data/tasks/gem.rake +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ea07352fc603aea65964367f1641e14448ed93
|
4
|
+
data.tar.gz: 8e341a7a7b20a3122764ea56dd8e36468dfe0bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05be027eaf1a1f2f6025c5dc689045d76c456d4466b8be826aa48afb269da3ba004b504b3adb63c3d4c1ed667057dc6fb589000d7e0661385472839abe44429
|
7
|
+
data.tar.gz: aa09971aba2845fcb3f8fb0bf26dfd22585af5a3c5d4de78a004fad4ef1138295d04766f7e901407b0a8a25249ea75132a0364f24089d547592445aec10e47b5
|
data/bin/multiterm
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
bin_dir = File.expand_path(File.dirname(__FILE__))
|
3
|
+
lib_dir = File.expand_path(File.join(bin_dir, '../lib'))
|
4
|
+
$:.unshift(lib_dir)
|
5
|
+
$:.uniq!
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'osaka'
|
9
|
+
require 'yaml'
|
10
|
+
require 'multiterm'
|
11
|
+
|
12
|
+
MultiTerm.execute
|
data/lib/multiterm.rb
CHANGED
@@ -37,6 +37,7 @@ module MultiTerm
|
|
37
37
|
while search_path != '/' && search_path != home_path
|
38
38
|
if File.exists?(File.join(search_path, '.multiterm.yml'))
|
39
39
|
settings = YAML.load(File.read(File.join(search_path, '.multiterm.yml')))
|
40
|
+
settings[:root] = File.expand_path(search_path)
|
40
41
|
return settings if settings
|
41
42
|
end
|
42
43
|
search_path = File.expand_path(File.join(search_path, '..'))
|
@@ -49,10 +50,7 @@ module MultiTerm
|
|
49
50
|
app = Osaka::Terminal.new
|
50
51
|
app.activate
|
51
52
|
for tab_config in configuration[:tabs]
|
52
|
-
app.new_tab(
|
53
|
-
script: tab_config[:script],
|
54
|
-
name: tab_config[:name]
|
55
|
-
)
|
53
|
+
app.new_tab({:directory => configuration[:root]}.merge(tab_config))
|
56
54
|
end
|
57
55
|
else
|
58
56
|
puts "Missing '.multiterm.yml' configuration."
|
data/lib/multiterm/terminal.rb
CHANGED
@@ -9,7 +9,11 @@ module Osaka
|
|
9
9
|
def new_tab(options={})
|
10
10
|
tab_name = options[:name]
|
11
11
|
script = options[:script]
|
12
|
+
directory = options[:directory]
|
12
13
|
control.keystroke('t', :command)
|
14
|
+
if directory != nil
|
15
|
+
control.tell('do script "cd \'' + directory + '\'" in front window')
|
16
|
+
end
|
13
17
|
if tab_name != nil
|
14
18
|
tab_name.gsub!(/[^a-zA-Z0-9 \_\-\.]/, '')
|
15
19
|
|
@@ -17,13 +21,14 @@ module Osaka
|
|
17
21
|
# on ';' character, which we need to use mid-script.
|
18
22
|
script_commands = [
|
19
23
|
'tell application "Terminal"',
|
20
|
-
'do script "printf \'\\\\\e]1;' + tab_name.to_s + '\\\\\a\'
|
24
|
+
'do script "printf \'\\\\\e]1;' + tab_name.to_s + '\\\\\a\'" in front window',
|
21
25
|
'end tell'
|
22
26
|
].map { |c| c.gsub("\"", "\\\"") }
|
23
27
|
escaped_commands = ""
|
24
28
|
script_commands.each { |l| escaped_commands += " -e \"#{l.strip}\"" }
|
25
29
|
new_tab_output = `osascript#{escaped_commands} 2>&1`
|
26
30
|
end
|
31
|
+
control.tell('do script "clear" in front window')
|
27
32
|
if script != nil
|
28
33
|
# LOL, yes, we need to triple-escape for double quotes.
|
29
34
|
# Single quotes should Just Work.
|
data/lib/multiterm/version.rb
CHANGED
data/tasks/gem.rake
CHANGED
@@ -23,6 +23,7 @@ namespace :gem do
|
|
23
23
|
s.add_development_dependency("launchy", ">= 0.3.2")
|
24
24
|
|
25
25
|
s.require_path = "lib"
|
26
|
+
s.executables << 'multiterm'
|
26
27
|
|
27
28
|
s.author = "Bob Aman"
|
28
29
|
s.email = "bob@sporkmonger.com"
|
@@ -58,7 +59,7 @@ namespace :gem do
|
|
58
59
|
|
59
60
|
desc "Install the gem"
|
60
61
|
task :install => ["clobber", "gem:package"] do
|
61
|
-
sh "
|
62
|
+
sh "gem install pkg/#{GEM_SPEC.full_name}.gem"
|
62
63
|
end
|
63
64
|
|
64
65
|
desc "Uninstall the gem"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiterm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
description: |
|
56
56
|
MultiTerm is a rudimentary terminal multiplexer for OS X that uses the built-in Terminal.app tabs.
|
57
57
|
email: bob@sporkmonger.com
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- multiterm
|
59
60
|
extensions: []
|
60
61
|
extra_rdoc_files:
|
61
62
|
- README.md
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- LICENSE
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
69
|
+
- bin/multiterm
|
68
70
|
- lib/multiterm.rb
|
69
71
|
- lib/multiterm/terminal.rb
|
70
72
|
- lib/multiterm/version.rb
|