toolman 0.2.1 → 0.2.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/toolman/color.rb +28 -0
- data/lib/toolman/toolS.rb +79 -0
- data/lib/toolman/toolobject.rb +29 -0
- data/lib/toolman/version.rb +1 -1
- data/lib/toolman.rb +3 -138
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a15f0d2d0eb5c1e48c7ebd53afe35f1b8ac475dc
|
4
|
+
data.tar.gz: 52ab4b953329695398df3aefee37d56d72dbd414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2079398c7c86469331b0763cfa670dc09d527fed2be426055d5699ccc575eb355fc18c7f50439f7d11faeb4da87256e3a9064371b2265750e90165172986059f
|
7
|
+
data.tar.gz: 6ecba7718f81c017168f801b547e69faf4e5a85ee3ebe7b4119b7236f21f0a10a748175c500f36ee6bb3a84e3e599ca116455faf7216ddc3fd5d288ed481406c
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Color
|
2
|
+
def red(string)
|
3
|
+
puts colorize1(string, 31)
|
4
|
+
end
|
5
|
+
|
6
|
+
def green(string)
|
7
|
+
puts colorize1(string, 32)
|
8
|
+
end
|
9
|
+
def yellow(string)
|
10
|
+
puts colorize1(string, 33)
|
11
|
+
end
|
12
|
+
|
13
|
+
def blue(string)
|
14
|
+
puts colorize1(string, 34)
|
15
|
+
end
|
16
|
+
|
17
|
+
def cyan(string)
|
18
|
+
puts colorize1(string, 36)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def colorize2(text, color_code)
|
23
|
+
"\e[1;#{color_code}m#{text}\e[0m"
|
24
|
+
end
|
25
|
+
def colorize1(text, color_code)
|
26
|
+
"\e[#{color_code}m#{text}\e[0m"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require "toolman/color"
|
2
|
+
class ToolmanS
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@tempPoint = 0
|
6
|
+
@circle = ["|","\\","-","/"]
|
7
|
+
@circleSize = @circle.size
|
8
|
+
@loadBarPid = 0
|
9
|
+
@colorMechine = Color.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def puts
|
13
|
+
@colorMechine
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def say(data)
|
18
|
+
puts "\n>>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>"
|
19
|
+
puts "#{data}"
|
20
|
+
puts ">>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
def loading_bar(nowPoint,endPoint)
|
24
|
+
read, write = IO.pipe
|
25
|
+
@loadBarPid = fork {
|
26
|
+
|
27
|
+
|
28
|
+
write.close
|
29
|
+
continue = true
|
30
|
+
sleep_time = 1.0/7.0
|
31
|
+
index = 0
|
32
|
+
while(continue) do
|
33
|
+
p = (( (nowPoint*1.0) / endPoint) * 100).floor
|
34
|
+
print "\r"
|
35
|
+
print " \r"
|
36
|
+
print "%5d%s%3s%-3s" % [p,"%","#{@circle[@tempPoint]}",""]
|
37
|
+
@tempPoint = (@tempPoint + 1) % @circleSize
|
38
|
+
if p == 100
|
39
|
+
print "\r"
|
40
|
+
print " \r"
|
41
|
+
print "%5d%s%3s%-3s" % [p,"%","",""]
|
42
|
+
read.close
|
43
|
+
exit(0)
|
44
|
+
end
|
45
|
+
sleep(sleep_time)
|
46
|
+
s = IO.select([read],[],[],sleep_time)
|
47
|
+
if s
|
48
|
+
result = read.read(1)
|
49
|
+
if result
|
50
|
+
if result.to_i == 1
|
51
|
+
nowPoint += 1
|
52
|
+
elsif result.to_i == 0
|
53
|
+
puts ""
|
54
|
+
puts "Early break..."
|
55
|
+
read.close
|
56
|
+
exit(0)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
index += 1
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
}
|
66
|
+
read.close
|
67
|
+
@write = write
|
68
|
+
# Process.wait(@loadBarPid)
|
69
|
+
# puts "hi"
|
70
|
+
end
|
71
|
+
|
72
|
+
def loading_bar_add()
|
73
|
+
@write.write(1)
|
74
|
+
end
|
75
|
+
|
76
|
+
def loading_bar_end()
|
77
|
+
@write.write(0)
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "toolman/color"
|
2
|
+
class ToolObject
|
3
|
+
def initialize
|
4
|
+
@tempPoint = 0
|
5
|
+
@circle = [">",">>",">>>",">>>>"," >>>"," >>"," >"," "]
|
6
|
+
@circleSize = @circle.size
|
7
|
+
@colorMechine = Color.new
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
def say(data)
|
13
|
+
puts "\n>>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>"
|
14
|
+
puts "#{data}"
|
15
|
+
puts ">>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
def loading_bar(nowPoint,endPoint)
|
19
|
+
p = (( (nowPoint*1.0) / endPoint) * 100).floor
|
20
|
+
print "\r"
|
21
|
+
print " \r"
|
22
|
+
print "%5d%-3s%-5s%-3s" % [p,"%","#{@circle[@tempPoint]}",""]
|
23
|
+
@tempPoint = (@tempPoint + 1) % @circleSize
|
24
|
+
end
|
25
|
+
|
26
|
+
def puts
|
27
|
+
@colorMechine
|
28
|
+
end
|
29
|
+
end
|
data/lib/toolman/version.rb
CHANGED
data/lib/toolman.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require "toolman/version"
|
2
|
+
require "toolman/color"
|
3
|
+
require "toolman/toolobject"
|
4
|
+
require "toolman/toolS"
|
2
5
|
module Toolman
|
3
6
|
|
4
7
|
def self.new
|
@@ -28,142 +31,4 @@ module Toolman
|
|
28
31
|
end
|
29
32
|
|
30
33
|
|
31
|
-
class ToolObject
|
32
|
-
|
33
|
-
def initialize
|
34
|
-
@tempPoint = 0
|
35
|
-
@circle = [">",">>",">>>",">>>>"," >>>"," >>"," >"," "]
|
36
|
-
@circleSize = @circle.size
|
37
|
-
@colorMechine = Color.new
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
def say(data)
|
43
|
-
puts "\n>>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>"
|
44
|
-
puts "#{data}"
|
45
|
-
puts ">>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>\n"
|
46
|
-
end
|
47
|
-
|
48
|
-
def loading_bar(nowPoint,endPoint)
|
49
|
-
p = (( (nowPoint*1.0) / endPoint) * 100).floor
|
50
|
-
print "\r"
|
51
|
-
print " \r"
|
52
|
-
print "%5d%-3s%-5s%-3s" % [p,"%","#{@circle[@tempPoint]}",""]
|
53
|
-
@tempPoint = (@tempPoint + 1) % @circleSize
|
54
|
-
end
|
55
|
-
|
56
|
-
def puts
|
57
|
-
@colorMechine
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
class ToolmanS
|
62
|
-
|
63
|
-
def initialize
|
64
|
-
@tempPoint = 0
|
65
|
-
@circle = ["|","\\","-","/"]
|
66
|
-
@circleSize = @circle.size
|
67
|
-
@loadBarPid = 0
|
68
|
-
@colorMechine = Color.new
|
69
|
-
end
|
70
|
-
|
71
|
-
def puts
|
72
|
-
@colorMechine
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
def say(data)
|
77
|
-
puts "\n>>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>"
|
78
|
-
puts "#{data}"
|
79
|
-
puts ">>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>\n"
|
80
|
-
end
|
81
|
-
|
82
|
-
def loading_bar(nowPoint,endPoint)
|
83
|
-
read, write = IO.pipe
|
84
|
-
@loadBarPid = fork {
|
85
|
-
|
86
|
-
|
87
|
-
write.close
|
88
|
-
continue = true
|
89
|
-
sleep_time = 1.0/7.0
|
90
|
-
index = 0
|
91
|
-
while(continue) do
|
92
|
-
p = (( (nowPoint*1.0) / endPoint) * 100).floor
|
93
|
-
print "\r"
|
94
|
-
print " \r"
|
95
|
-
print "%5d%s%3s%-3s" % [p,"%","#{@circle[@tempPoint]}",""]
|
96
|
-
@tempPoint = (@tempPoint + 1) % @circleSize
|
97
|
-
if p == 100
|
98
|
-
print "\r"
|
99
|
-
print " \r"
|
100
|
-
print "%5d%s%3s%-3s" % [p,"%","",""]
|
101
|
-
read.close
|
102
|
-
exit(0)
|
103
|
-
end
|
104
|
-
sleep(sleep_time)
|
105
|
-
s = IO.select([read],[],[],sleep_time)
|
106
|
-
if s
|
107
|
-
result = read.read(1)
|
108
|
-
if result
|
109
|
-
if result.to_i == 1
|
110
|
-
nowPoint += 1
|
111
|
-
elsif result.to_i == 0
|
112
|
-
puts ""
|
113
|
-
puts "Early break..."
|
114
|
-
read.close
|
115
|
-
exit(0)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
index += 1
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
end
|
123
|
-
|
124
|
-
}
|
125
|
-
read.close
|
126
|
-
@write = write
|
127
|
-
# Process.wait(@loadBarPid)
|
128
|
-
# puts "hi"
|
129
|
-
end
|
130
|
-
|
131
|
-
def loading_bar_add()
|
132
|
-
@write.write(1)
|
133
|
-
end
|
134
|
-
|
135
|
-
def loading_bar_end()
|
136
|
-
@write.write(0)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
class Color
|
141
|
-
def red(string)
|
142
|
-
puts colorize1(string, 31)
|
143
|
-
end
|
144
|
-
|
145
|
-
def green(string)
|
146
|
-
puts colorize1(string, 32)
|
147
|
-
end
|
148
|
-
def blue(string)
|
149
|
-
puts colorize1(string, 33)
|
150
|
-
end
|
151
|
-
|
152
|
-
def blue(string)
|
153
|
-
puts colorize1(string, 34)
|
154
|
-
end
|
155
|
-
|
156
|
-
def cyan(string)
|
157
|
-
puts colorize1(string, 36)
|
158
|
-
end
|
159
|
-
|
160
|
-
|
161
|
-
def colorize2(text, color_code)
|
162
|
-
"\e[1;#{color_code}m#{text}\e[0m"
|
163
|
-
end
|
164
|
-
def colorize1(text, color_code)
|
165
|
-
"\e[#{color_code}m#{text}\e[0m"
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikeva
|
@@ -51,6 +51,9 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/toolman.rb
|
54
|
+
- lib/toolman/color.rb
|
55
|
+
- lib/toolman/toolS.rb
|
56
|
+
- lib/toolman/toolobject.rb
|
54
57
|
- lib/toolman/version.rb
|
55
58
|
- toolman.gemspec
|
56
59
|
homepage: https://github.com/eva0919/debugman
|