ig3client 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ig3client/generic_client.rb +45 -8
- metadata +2 -2
@@ -16,17 +16,36 @@ module Ig3tool
|
|
16
16
|
@host = host
|
17
17
|
@port = port
|
18
18
|
@timeout = timeout # 0 = no timeout.
|
19
|
-
|
19
|
+
|
20
20
|
begin
|
21
|
-
|
21
|
+
begin
|
22
|
+
@token = File.read(File.expand_path("~/.ig3token")).strip
|
23
|
+
rescue Exception => e
|
24
|
+
userdir = File.join(ENV['userprofile'].to_s, "ig3tool")
|
25
|
+
tokenpath = File.join(userdir, "ig3token")
|
26
|
+
Dir.mkdir(userdir) unless File.exists?(userdir)
|
27
|
+
@token = File.read(tokenpath)
|
28
|
+
end
|
22
29
|
rescue Exception => e
|
23
30
|
@token = nil
|
24
31
|
end
|
25
32
|
|
26
33
|
begin
|
27
|
-
|
34
|
+
begin
|
35
|
+
begin
|
36
|
+
@username = File.read(File.expand_path("~/.ig3user")).strip
|
37
|
+
rescue Exception => e
|
38
|
+
@username = ENV["USER"] || \
|
39
|
+
Etc.getpwuid(Process::Sys.geteuid).name
|
40
|
+
end
|
41
|
+
rescue Exception => e
|
42
|
+
userdir = File.join(ENV['userprofile'].to_s, "ig3tool")
|
43
|
+
Dir.mkdir(userdir) unless File.exists?(userdir)
|
44
|
+
usernamepath = File.join(userdir, "ig3user")
|
45
|
+
@username = File.read(usernamepath)
|
46
|
+
end
|
28
47
|
rescue Exception => e
|
29
|
-
@username =
|
48
|
+
@username = nil
|
30
49
|
end
|
31
50
|
end
|
32
51
|
|
@@ -52,12 +71,30 @@ module Ig3tool
|
|
52
71
|
# else => throw exception
|
53
72
|
@token = method_missing("wannabe!", {"username" => username,"password" => passwd})
|
54
73
|
|
55
|
-
|
56
|
-
|
74
|
+
begin
|
75
|
+
File.open(File.expand_path("~/.ig3token"), "wb") do |f|
|
76
|
+
f.write @token
|
77
|
+
end
|
78
|
+
rescue Exception => e
|
79
|
+
userdir = File.join(ENV['userprofile'].to_s, "ig3tool")
|
80
|
+
tokenpath = File.join(userdir, "ig3token")
|
81
|
+
Dir.mkdir(userdir) unless File.exists?(userdir)
|
82
|
+
File.open(tokenpath, "wb") do |f|
|
83
|
+
f.write @token
|
84
|
+
end
|
57
85
|
end
|
58
86
|
|
59
|
-
|
60
|
-
|
87
|
+
begin
|
88
|
+
File.open(File.expand_path("~/.ig3user"), "wb") do |f|
|
89
|
+
f.write @username
|
90
|
+
end
|
91
|
+
rescue Exception => e
|
92
|
+
userdir = File.join(ENV['userprofile'].to_s, "ig3tool")
|
93
|
+
usernamepath = File.join(userdir, "ig3user")
|
94
|
+
Dir.mkdir(userdir) unless File.exists?(userdir)
|
95
|
+
File.open(usernamepath, "wb") do |f|
|
96
|
+
f.write @username
|
97
|
+
end
|
61
98
|
end
|
62
99
|
#rescue Token => t
|
63
100
|
# raise PermissionDenied
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ig3client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pinte
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-05-08 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|