toolman 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -2
- data/lib/toolman/version.rb +1 -1
- data/lib/toolman.rb +80 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07c7d4b07541b7312a6221c6f479b9cadc2b6996
|
4
|
+
data.tar.gz: 78f8cae8e0a6511d7fd9cc8505a05cc94aafefdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c04aefd406fa7325c6c8781d18623594b8a2766a0bd9aac31ca6cd7b05765db8264a93c0c6aa83d105bfbb53c28d0167e550be8d176f240281ea9f43d1566d
|
7
|
+
data.tar.gz: 7a0c2ddd042c8ebde2628382337dd1cb4c8eaecce71e8da0be9d77908dd2ce7843ecc6dbd166611a1025df88c5bc144e9251f076110530cb3963791ed3afc060
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# Toolman
|
2
2
|
|
3
|
-
|
3
|
+
A wrap for tool that I create by myself.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
+
### RubyGem
|
7
8
|
Add this line to your application's Gemfile:
|
8
9
|
|
9
10
|
gem 'toolman'
|
@@ -16,9 +17,28 @@ Or install it yourself as:
|
|
16
17
|
|
17
18
|
$ gem install toolman
|
18
19
|
|
20
|
+
### Clone from github
|
21
|
+
Step1: Clone this gem to your dir
|
22
|
+
|
23
|
+
git clone
|
24
|
+
|
25
|
+
Step2: Gem build
|
26
|
+
|
27
|
+
gem build debugman.gemspec
|
28
|
+
|
29
|
+
Step3: Gem install
|
30
|
+
|
31
|
+
gem install ./debugman-0.0.1.gem
|
32
|
+
(0.0.1 is version number and will change)
|
19
33
|
## Usage
|
20
34
|
|
21
|
-
|
35
|
+
Create a instance
|
36
|
+
|
37
|
+
man = Toolman.new
|
38
|
+
man.say "hi"
|
39
|
+
# => >>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>
|
40
|
+
# => hi
|
41
|
+
# => >>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>
|
22
42
|
|
23
43
|
## Contributing
|
24
44
|
|
data/lib/toolman/version.rb
CHANGED
data/lib/toolman.rb
CHANGED
@@ -5,6 +5,10 @@ module Toolman
|
|
5
5
|
ToolObject.new
|
6
6
|
end
|
7
7
|
|
8
|
+
def self.new_special
|
9
|
+
ToolmanS.new
|
10
|
+
end
|
11
|
+
|
8
12
|
def self.done
|
9
13
|
puts "\n=============================\n Done!\n Every thing is good!\n=============================\n"
|
10
14
|
end
|
@@ -48,4 +52,80 @@ module Toolman
|
|
48
52
|
@tempPoint = (@tempPoint + 1) % @circleSize
|
49
53
|
end
|
50
54
|
end
|
55
|
+
|
56
|
+
class ToolmanS
|
57
|
+
|
58
|
+
def initialize
|
59
|
+
@tempPoint = 0
|
60
|
+
@circle = ["|","\\","-","/"]
|
61
|
+
@circleSize = @circle.size
|
62
|
+
@loadBarPid = 0
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def say(data)
|
68
|
+
puts "\n>>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>"
|
69
|
+
puts "#{data}"
|
70
|
+
puts ">>>>>>>>>>>>>>>>>Messange>>>>>>>>>>>>>>>>>\n"
|
71
|
+
end
|
72
|
+
|
73
|
+
def loading_bar(nowPoint,endPoint)
|
74
|
+
read, write = IO.pipe
|
75
|
+
@loadBarPid = fork {
|
76
|
+
|
77
|
+
|
78
|
+
write.close
|
79
|
+
continue = true
|
80
|
+
sleep_time = 1.0/7.0
|
81
|
+
index = 0
|
82
|
+
while(continue) do
|
83
|
+
p = (( (nowPoint*1.0) / endPoint) * 100).floor
|
84
|
+
print "\r"
|
85
|
+
print " \r"
|
86
|
+
print "%5d%s%3s%-3s" % [p,"%","#{@circle[@tempPoint]}",""]
|
87
|
+
@tempPoint = (@tempPoint + 1) % @circleSize
|
88
|
+
if p == 100
|
89
|
+
print "\r"
|
90
|
+
print " \r"
|
91
|
+
print "%5d%s%3s%-3s" % [p,"%","",""]
|
92
|
+
read.close
|
93
|
+
exit(0)
|
94
|
+
end
|
95
|
+
sleep(sleep_time)
|
96
|
+
s = IO.select([read],[],[],sleep_time)
|
97
|
+
if s
|
98
|
+
result = read.read(1)
|
99
|
+
if result
|
100
|
+
if result.to_i == 1
|
101
|
+
nowPoint += 1
|
102
|
+
elsif result.to_i == 0
|
103
|
+
puts ""
|
104
|
+
puts "Early break..."
|
105
|
+
read.close
|
106
|
+
exit(0)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
index += 1
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
}
|
116
|
+
read.close
|
117
|
+
@write = write
|
118
|
+
# Process.wait(@loadBarPid)
|
119
|
+
# puts "hi"
|
120
|
+
end
|
121
|
+
|
122
|
+
def loading_bar_add()
|
123
|
+
@write.write(1)
|
124
|
+
end
|
125
|
+
|
126
|
+
def loading_bar_end()
|
127
|
+
@write.write(0)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
51
131
|
end
|