workon 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,6 +60,10 @@ module Workon
60
60
  Kernel.system command
61
61
  end
62
62
 
63
+ def has_command?(command)
64
+ !`command -v #{command}`.empty?
65
+ end
66
+
63
67
  def run(command)
64
68
  puts "Running #{command}"
65
69
  output = %x(#{command}) unless options[:dry_run]
@@ -67,9 +71,9 @@ module Workon
67
71
  end
68
72
 
69
73
  def screen(command)
70
- @has_tmux ||= `which tmux`.length > 0
74
+ $has_tmux ||= has_command? 'tmux'
71
75
 
72
- @has_tmux ? _tmux(command) : _screen(command)
76
+ $has_tmux ? _tmux(command) : _screen(command)
73
77
  end
74
78
 
75
79
  def _screen(command, scope = nil)
@@ -86,7 +90,7 @@ module Workon
86
90
  end
87
91
 
88
92
  def initialize_tmux
89
- @tmux_initialized ||= begin
93
+ $tmux_initialized ||= begin
90
94
  run "tmux new-session -s #{tmux_session} \\; set-option -t #{tmux_session} set-remain-on-exit on \\; detach-client"
91
95
  true
92
96
  end
@@ -8,7 +8,7 @@ module Workon
8
8
  end
9
9
 
10
10
  def passenger_standalone_available?
11
- !`which passenger`.empty?
11
+ has_command? 'passenger'
12
12
  end
13
13
 
14
14
  def commit
@@ -1,3 +1,3 @@
1
1
  module Workon
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: workon
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mike Wyatt
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-04 00:00:00 Z
13
+ date: 2011-04-05 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Runs actions based on directories