RubyTaban 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/RubyTaban.rb +35 -35
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ee75161ab38bc90531b0cf36da91baea2a42182d63a1d46a141d064d143ad2e
|
4
|
+
data.tar.gz: 11e984ae06d8eaf2f02477b61d743dcd1938de010b61fdaae0b14d0191068084
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83600feb897358747ffd808ded78d428034d8a5afd6c5b93d0a166c6b6926556407fc61f1e9d99c1510b067881ba67272bb052ce71cdf63091c45661d9aa59bc
|
7
|
+
data.tar.gz: e32ce60b73eb9fea063cbaa619d5c5800c341e8be08f4febc5448757d96ee4e889fa45e669e2afd6feeb78fcef518b0e1fe9a4f12c263a98917cb5f9fd7df996
|
data/lib/RubyTaban.rb
CHANGED
@@ -6,69 +6,69 @@ require 'json'
|
|
6
6
|
using RubyFiglet
|
7
7
|
|
8
8
|
class RubyTaban
|
9
|
-
attr_accessor :banner,:
|
9
|
+
attr_accessor :banner,:tabs
|
10
10
|
|
11
|
-
def initialize(banner,
|
11
|
+
def initialize(banner, tabs = 1)
|
12
12
|
@banner = banner
|
13
|
-
@
|
14
|
-
|
15
|
-
|
13
|
+
@tabs = tabs
|
14
|
+
logo
|
15
|
+
information
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
20
|
-
puts ((" " * @
|
18
|
+
def logo
|
19
|
+
clear
|
20
|
+
puts ((" " * @tabs).to_s + @banner + "\n\n").art!.green
|
21
21
|
puts "\n\n"
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def information
|
25
25
|
time = Time.new
|
26
26
|
|
27
|
-
|
28
|
-
ip
|
29
|
-
|
30
|
-
|
27
|
+
session = (ENV['USERNAME'].to_s + "@" + ENV["COMPUTERNAME"].to_s).cyan.center(44)
|
28
|
+
ip = global_ip.yellow.center(44)
|
29
|
+
pc = ENV["OS"].red.center(44)
|
30
|
+
time_format = ((time.strftime("%d-%m-%Y")).to_s + " | " + (time.strftime("%k:%M")).to_s).center(30)
|
31
31
|
|
32
|
-
|
33
|
-
puts
|
32
|
+
information_text = "\t\t#{pc}\n\t\t#{time_format.yellow}\n\n\t\t#{session}\n\t\t#{ip}"
|
33
|
+
puts information_text
|
34
34
|
puts "\n"
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
|
39
|
-
if
|
40
|
-
|
37
|
+
def log(left, center, right)
|
38
|
+
time = Time.new.strftime("%k:%M:%S")
|
39
|
+
if time[" "]
|
40
|
+
time[" "] = "0"
|
41
41
|
end
|
42
|
-
if (!
|
43
|
-
|
44
|
-
puts
|
42
|
+
if (!left.is_a?(String) || !center.is_a?(String) || !right.is_a?(String))
|
43
|
+
format_text = "[#{time}]".cyan + " Sadece String Değere izin verilir".yellow
|
44
|
+
puts format_text
|
45
45
|
return
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
left1 = "#{left[0,12]}".red + ("~".cyan if left.length > 13).to_s
|
49
|
+
center1 = "#{center[0,18]}".yellow + ("~".cyan if center.length > 19).to_s
|
50
|
+
right1 = "#{right[0,13]}".magenta + ("~".cyan if right.length > 14).to_s
|
51
51
|
|
52
52
|
|
53
|
-
|
54
|
-
puts
|
53
|
+
format_text = "[#{time}]".cyan + " #{left1}" + (" " * (15 - left[0,13].to_s.length)).to_s + "||".green + " #{center1} " + (" " * (21 - center[0,19].to_s.length)).to_s + "||".green + " #{right1}"
|
54
|
+
puts format_text
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
58
|
-
|
59
|
-
if
|
60
|
-
|
57
|
+
def error(exception)
|
58
|
+
time = Time.new.strftime("%k:%M:%S")
|
59
|
+
if time[" "]
|
60
|
+
time[" "] = "0"
|
61
61
|
end
|
62
62
|
|
63
|
-
|
64
|
-
puts
|
63
|
+
format_text = "[#{time}]".cyan + " #{exception.class.name}".yellow + " || ".magenta + "#{exception.message}"
|
64
|
+
puts format_text
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
67
|
+
def clear
|
68
68
|
Gem.win_platform? ? (system "cls") : (system "clear")
|
69
69
|
end
|
70
70
|
|
71
|
-
def global_ip
|
71
|
+
def global_ip
|
72
72
|
begin
|
73
73
|
uri = URI("http://ip-api.com/json")
|
74
74
|
res = Net::HTTP.get_response(uri)
|