titech-pubnet-auth 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,6 +12,8 @@ titech-pubnet の認証の仕様に依存しているため、仕様が変われ
12
12
  - 認証ページのloginscript.js
13
13
  - titech-pubnet の HTTPプロキシ
14
14
 
15
+ ![](https://raw.github.com/Altech/titech-pubnet-auth/master/capture.png)
16
+
15
17
  ## 使い方
16
18
 
17
19
  参考:Ruby1.9 のインストール(Mac OS Xの場合)。
@@ -8,6 +8,8 @@ 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
+
11
13
  opt = OptionParser.new
12
14
 
13
15
  interval = TitechPubnetAuth::INTERVAL
@@ -58,14 +60,9 @@ end
58
60
  pubnet_auth = TitechPubnetAuth.new
59
61
  loop do
60
62
  begin
61
- mputs_with_notify = ->(auth,is_success){
62
- mputs auth, is_success
63
- TerminalNotifier.notify(nil,:title => 'Titech Punet Auth',:subtitle => 'Connected!') if OS_X and is_success
64
- }
65
-
66
63
  mputs 'network_available?', pubnet_auth.network_available?
67
64
  mputs 'is_connected?', pubnet_auth.is_connected? if pubnet_auth.network_available?
68
- mputs_with_notify 'auth' if pubnet_auth.network_available? and not pubnet_auth.is_connected?
65
+ mputs 'auth', pubnet_auth.auth and notifier.call if pubnet_auth.network_available? and not pubnet_auth.is_connected?
69
66
  rescue => e
70
67
  p e
71
68
  ensure
@@ -9,5 +9,6 @@ module Kernel
9
9
  def mputs(tag,msg)
10
10
  s = Time.now.strftime("%Y-%m-%d %H:%M:%S").green + "\t" + caller.first[/([^:]*):/,1].split('/').last.blue + "\t" + tag + ":" + msg.to_s
11
11
  puts(s)
12
+ return msg
12
13
  end
13
14
  end
@@ -1,3 +1,3 @@
1
1
  class TitechPubnetAuth
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: