sheepsafe 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 0.2.2
2
+
3
+ - Make Ruby wrapper around socks daemon that keeps trying to run ssh
4
+ even if it exits due to bad or no connection
5
+ - Add `sheepsafe proxy up/down` to manually up/down the proxy
6
+
1
7
  === 0.2.1
2
8
 
3
9
  - Fix regression if config.last_network.nil?
@@ -1,5 +1,5 @@
1
1
  module Sheepsafe
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
4
4
 
5
5
  require 'sheepsafe/config'
@@ -19,6 +19,11 @@ module Sheepsafe
19
19
  end
20
20
 
21
21
  def run
22
+ if ARGV.first == 'proxy' # 'sheepsafe proxy up/down'
23
+ bring_socks_proxy ARGV[1]
24
+ return
25
+ end
26
+
22
27
  log("Sheepsafe starting")
23
28
  if network_up?
24
29
  if network_changed?
@@ -58,8 +63,18 @@ module Sheepsafe
58
63
 
59
64
  def bring_socks_proxy(direction)
60
65
  Daemons.run_proc '.sheepsafe.proxy', :ARGV => [direction == 'up' ? 'start' : 'stop'], :dir_mode => :normal, :dir => ENV['HOME'] do
61
- log("Starting ssh -ND #{@config.socks_port} #{@config.ssh_host}")
62
- exec("ssh -ND #{@config.socks_port} #{@config.ssh_host}")
66
+ pid = nil
67
+ trap("TERM") do
68
+ Process.kill("TERM", pid)
69
+ exit 0
70
+ end
71
+ loop do
72
+ pid = fork do
73
+ exec("ssh -ND #{@config.socks_port} #{@config.ssh_host}")
74
+ end
75
+ Process.waitpid(pid, 0)
76
+ sleep 1
77
+ end
63
78
  end
64
79
  end
65
80
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sheepsafe'
5
- s.version = '0.2.1'
6
- s.date = '2010-10-27'
5
+ s.version = '0.2.2'
6
+ s.date = '2010-11-02'
7
7
 
8
8
  s.rubyforge_project = %q{caldersphere}
9
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheepsafe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nick Sieger
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-27 00:00:00 -05:00
18
+ date: 2010-11-02 00:00:00 -05:00
19
19
  default_executable: sheepsafe
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency