workon 0.0.9 → 0.0.10
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.
- data/lib/workon/actor/base.rb +29 -2
- data/lib/workon/version.rb +1 -1
- data/lib/workon.rb +1 -1
- metadata +3 -5
data/lib/workon/actor/base.rb
CHANGED
@@ -66,17 +66,44 @@ module Workon
|
|
66
66
|
return output
|
67
67
|
end
|
68
68
|
|
69
|
-
def screen(command
|
69
|
+
def screen(command)
|
70
|
+
@has_tmux ||= `which tmux`.length > 0
|
71
|
+
|
72
|
+
@has_tmux ? _tmux(command) : _screen(command)
|
73
|
+
end
|
74
|
+
|
75
|
+
def _screen(command, scope = nil)
|
70
76
|
identifier = screen_scope scope
|
71
77
|
|
72
78
|
run %(screen -dmS #{identifier} #{command})
|
73
79
|
puts %(Reconnect with `screen -r #{identifier}')
|
74
80
|
end
|
75
81
|
|
82
|
+
def _tmux(command)
|
83
|
+
initialize_tmux
|
84
|
+
|
85
|
+
run "tmux attach-session -t #{tmux_session} \\; new-window -d -n #{tmux_window} '#{command}' \\; detach-client"
|
86
|
+
end
|
87
|
+
|
88
|
+
def initialize_tmux
|
89
|
+
@tmux_initialized ||= begin
|
90
|
+
run "tmux new-session -s #{tmux_session} \\; set-option -t #{tmux_session} set-remain-on-exit on \\; detach-client"
|
91
|
+
true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
76
95
|
def screen_scope(scope = nil)
|
77
|
-
scope ||= self.class.
|
96
|
+
scope ||= self.class.actor_name
|
78
97
|
"#{project}.#{scope}".downcase
|
79
98
|
end
|
99
|
+
|
100
|
+
def tmux_session
|
101
|
+
project
|
102
|
+
end
|
103
|
+
|
104
|
+
def tmux_window
|
105
|
+
self.class.actor_name.downcase
|
106
|
+
end
|
80
107
|
end
|
81
108
|
end
|
82
109
|
end
|
data/lib/workon/version.rb
CHANGED
data/lib/workon.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: workon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.10
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Wyatt
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-04-04 00:00:00 Z
|
15
14
|
dependencies: []
|
16
15
|
|
17
16
|
description: Runs actions based on directories
|
@@ -44,7 +43,6 @@ files:
|
|
44
43
|
- lib/workon/configuration.rb
|
45
44
|
- lib/workon/version.rb
|
46
45
|
- workon.gemspec
|
47
|
-
has_rdoc: true
|
48
46
|
homepage: ""
|
49
47
|
licenses: []
|
50
48
|
|
@@ -68,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
66
|
requirements: []
|
69
67
|
|
70
68
|
rubyforge_project: workon
|
71
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.7.1
|
72
70
|
signing_key:
|
73
71
|
specification_version: 3
|
74
72
|
summary: Runs actions based on directories
|