titech-pubnet-auth 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,8 +8,6 @@ require 'titech_pubnet_auth'
8
8
  require 'optparse'
9
9
  require 'terminal-notifier' if OS_X
10
10
 
11
- notifier = ->{TerminalNotifier.notify(nil,:title => 'Titech Punet Auth',:subtitle => 'Connected!') if OS_X}
12
-
13
11
  opt = OptionParser.new
14
12
 
15
13
  interval = TitechPubnetAuth::INTERVAL
@@ -57,14 +55,23 @@ if daemon
57
55
  Process.daemon
58
56
  end
59
57
 
58
+
59
+ notifier = ->{TerminalNotifier.notify(nil,:title => 'Titech Punet Auth', :subtitle => 'Connected!') if OS_X}
60
+ error_notifier = ->(e){TerminalNotifier.notify(e.inspect,:title => 'Titech Punet Auth',:subtitle => 'Caught an unexpected error!') if OS_X}
61
+
60
62
  pubnet_auth = TitechPubnetAuth.new
61
63
  loop do
62
64
  begin
65
+ no_such_method
63
66
  mputs 'network_available?', pubnet_auth.network_available?
64
67
  mputs 'is_connected?', pubnet_auth.is_connected? if pubnet_auth.network_available?
65
68
  mputs 'auth', pubnet_auth.auth and notifier.call if pubnet_auth.network_available? and not pubnet_auth.is_connected?
66
69
  rescue => e
67
- p e
70
+ mputs 'unexpected error', e.class and error_notifier.call(e)
71
+ puts " == Message =="
72
+ puts " #{e.message}"
73
+ puts " == Stack Trace =="
74
+ puts e.backtrace.map{|l| " #{l}"}.join("\n")
68
75
  ensure
69
76
  print "\n"
70
77
  $stdout.flush
@@ -1,3 +1,3 @@
1
1
  class TitechPubnetAuth
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titech-pubnet-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: