threeman 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.threeman +3 -0
- data/CHANGELOG.md +5 -1
- data/Procfile +3 -0
- data/lib/threeman/cli.rb +13 -10
- data/lib/threeman/frontend.rb +15 -1
- data/lib/threeman/frontends/iterm3.rb +6 -2
- data/lib/threeman/frontends/mac_terminal.rb +1 -1
- data/lib/threeman/frontends/tmux.rb +15 -6
- data/lib/threeman/procfile.rb +1 -1
- data/lib/threeman/version.rb +1 -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: 69d8685bd916a582798ff25ff645c0cc0d1b2349
|
4
|
+
data.tar.gz: 09caa15bd71c1c46aae565d13ae450ee1c064019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdd20f5247ee87ec37f52cf27169c6f6b409940410e9238f92c88e9ee758476dfb0c34ac6c66fdd7dba6f47021a46776fcd1341e71cb213bbdcabfb28ff60527
|
7
|
+
data.tar.gz: ad118a7c53bb3b6aacf54e6285708dc2af36216e34e1fe895dbdf940e761ff5918a79c2700ee37e2e54c7afca54fba4629d2fefb3483061cbb4ae2049bf586e1
|
data/.gitignore
CHANGED
data/.threeman
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.5.0 - May 31, 2017
|
2
|
+
|
3
|
+
* Adds `--panes=command_name command_two` to run certain commands in panes
|
4
|
+
|
1
5
|
# 0.4.0 - March 18, 2017
|
2
6
|
|
3
7
|
* Support reading .threeman or .foreman files to get the default options
|
@@ -28,4 +32,4 @@
|
|
28
32
|
|
29
33
|
# 0.1.0 - March 28, 2016
|
30
34
|
|
31
|
-
* First release
|
35
|
+
* First release
|
data/Procfile
ADDED
data/lib/threeman/cli.rb
CHANGED
@@ -4,17 +4,17 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Threeman
|
6
6
|
FRONTENDS = {
|
7
|
-
:iterm3 => lambda {
|
7
|
+
:iterm3 => lambda { |options|
|
8
8
|
require 'threeman/frontends/iterm3'
|
9
|
-
Threeman::Frontends::Iterm3.new
|
9
|
+
Threeman::Frontends::Iterm3.new(options)
|
10
10
|
},
|
11
|
-
:mac_terminal => lambda {
|
11
|
+
:mac_terminal => lambda { |options|
|
12
12
|
require 'threeman/frontends/mac_terminal'
|
13
|
-
Threeman::Frontends::MacTerminal.new
|
13
|
+
Threeman::Frontends::MacTerminal.new(options)
|
14
14
|
},
|
15
|
-
:tmux => lambda {
|
15
|
+
:tmux => lambda { |options|
|
16
16
|
require 'threeman/frontends/tmux'
|
17
|
-
Threeman::Frontends::Tmux.new
|
17
|
+
Threeman::Frontends::Tmux.new(options)
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
@@ -23,7 +23,10 @@ module Threeman
|
|
23
23
|
|
24
24
|
desc "start", "Start the application"
|
25
25
|
option :frontend, desc: "Which frontend to use. One of: #{FRONTENDS.keys.sort.join(', ')}"
|
26
|
+
option :panes, desc: "Runs each command in a pane, if supported by the frontend. (Currently supported in iterm3 and tmux.)", type: :array
|
26
27
|
option :port, desc: "The port to run the application on. This will set the PORT environment variable.", type: :numeric
|
28
|
+
option :layout_name, desc: "If using tmux, the layout name to use for paned commands", type: :string
|
29
|
+
|
27
30
|
def start
|
28
31
|
pwd = Dir.pwd
|
29
32
|
procfile = Threeman::Procfile.new(File.expand_path("Procfile", pwd))
|
@@ -36,11 +39,11 @@ module Threeman
|
|
36
39
|
exit! 1
|
37
40
|
end
|
38
41
|
|
39
|
-
frontend(frontend_name).run_commands(commands)
|
42
|
+
frontend(frontend_name, options).run_commands(commands)
|
40
43
|
end
|
41
44
|
|
42
45
|
private
|
43
|
-
def frontend(name)
|
46
|
+
def frontend(name, options = {})
|
44
47
|
frontend_lambda = FRONTENDS[name.to_sym]
|
45
48
|
unless frontend_lambda
|
46
49
|
puts "No frontend named #{name}!"
|
@@ -48,7 +51,7 @@ module Threeman
|
|
48
51
|
exit! 1
|
49
52
|
end
|
50
53
|
|
51
|
-
frontend_lambda.call
|
54
|
+
frontend_lambda.call(options)
|
52
55
|
end
|
53
56
|
|
54
57
|
def auto_frontend
|
@@ -83,4 +86,4 @@ module Threeman
|
|
83
86
|
@dotfile ||= ['.threeman', '.foreman'].find { |filename| File.file?(filename) }
|
84
87
|
end
|
85
88
|
end
|
86
|
-
end
|
89
|
+
end
|
data/lib/threeman/frontend.rb
CHANGED
@@ -2,6 +2,12 @@ require 'shellwords'
|
|
2
2
|
|
3
3
|
module Threeman
|
4
4
|
class Frontend
|
5
|
+
attr_reader :options
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
5
11
|
def run_commands(commands)
|
6
12
|
raise "Subclasses must implement #run_commands"
|
7
13
|
end
|
@@ -12,5 +18,13 @@ module Threeman
|
|
12
18
|
command.bash_script
|
13
19
|
].join(" ; ")
|
14
20
|
end
|
21
|
+
|
22
|
+
def sort_commands(commands)
|
23
|
+
commands.sort_by { |c| paned_command_names.include?(c.name) ? 0 : 1 }
|
24
|
+
end
|
25
|
+
|
26
|
+
def paned_command_names
|
27
|
+
options[:panes] || []
|
28
|
+
end
|
15
29
|
end
|
16
|
-
end
|
30
|
+
end
|
@@ -14,9 +14,13 @@ module Threeman
|
|
14
14
|
iterm.activate
|
15
15
|
window = iterm.create_window_with_default_profile
|
16
16
|
|
17
|
-
commands.each_with_index do |command, index|
|
17
|
+
sort_commands(commands).each_with_index do |command, index|
|
18
18
|
current_tab = if index == 0
|
19
19
|
window
|
20
|
+
elsif paned_command_names.include?(command.name)
|
21
|
+
tab = window.current_session.split_horizontally_with_same_profile
|
22
|
+
tab.select
|
23
|
+
window
|
20
24
|
else
|
21
25
|
window.create_tab_with_default_profile
|
22
26
|
end
|
@@ -33,4 +37,4 @@ module Threeman
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
36
|
-
end
|
40
|
+
end
|
@@ -5,12 +5,13 @@ module Threeman
|
|
5
5
|
class Tmux < Threeman::Frontend
|
6
6
|
attr_reader :session
|
7
7
|
|
8
|
-
def initialize
|
8
|
+
def initialize(options)
|
9
9
|
@session = "threeman_#{Time.now.to_i}"
|
10
|
+
super
|
10
11
|
end
|
11
12
|
|
12
13
|
def run_commands(commands)
|
13
|
-
commands.each_with_index do |command, index|
|
14
|
+
sort_commands(commands).each_with_index do |command, index|
|
14
15
|
run_command(command, index)
|
15
16
|
end
|
16
17
|
|
@@ -21,13 +22,21 @@ module Threeman
|
|
21
22
|
def run_command(command, index)
|
22
23
|
bash_cmd = "bash -c #{Shellwords.escape bash_script(command)}"
|
23
24
|
|
24
|
-
|
25
|
+
name_opt = "-n #{Shellwords.escape command.name}"
|
26
|
+
common_opts = "-c #{Shellwords.escape command.workdir} #{Shellwords.escape bash_cmd}"
|
25
27
|
if index == 0
|
26
|
-
system "tmux new-session -d -s #{session} #{common_opts}"
|
28
|
+
system "tmux new-session -d -s #{session} #{name_opt} #{common_opts}"
|
29
|
+
elsif paned_command_names.include?(command.name)
|
30
|
+
system "tmux split-window -v -d -f -t #{session}:0.#{index - 1} #{common_opts}"
|
31
|
+
system "tmux select-layout -t #{session}:0 #{layout_name}"
|
27
32
|
else
|
28
|
-
system "tmux -v new-window -t #{session}:#{index} #{common_opts}"
|
33
|
+
system "tmux -v new-window -t #{session}:#{index} #{name_opt} #{common_opts}"
|
29
34
|
end
|
30
35
|
end
|
36
|
+
|
37
|
+
def layout_name
|
38
|
+
options[:layout_name] || 'tiled'
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
|
-
end
|
42
|
+
end
|
data/lib/threeman/procfile.rb
CHANGED
data/lib/threeman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: threeman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman
|
@@ -104,11 +104,13 @@ extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
106
|
- ".gitignore"
|
107
|
+
- ".threeman"
|
107
108
|
- ".travis.yml"
|
108
109
|
- CHANGELOG.md
|
109
110
|
- CODE_OF_CONDUCT.md
|
110
111
|
- Gemfile
|
111
112
|
- LICENSE
|
113
|
+
- Procfile
|
112
114
|
- README.md
|
113
115
|
- Rakefile
|
114
116
|
- bin/console
|