usefuldb 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/usefuldb/gui.rb +5 -14
- data/lib/usefuldb/utilities.rb +24 -15
- data/lib/usefuldb/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
usefuldb gem CHANGELOG
|
2
2
|
|
3
|
+
## Version 0.0.6
|
4
|
+
- Added UsefulDB::UsefulUtils.array_to_s to convert an array into a string identical to Ruby 1.9.1 +'s Array#to_s
|
5
|
+
- Removed colour output so as to display correctly on Windows hosts through JRuby
|
6
|
+
- Slightly altered output from the listing functions
|
7
|
+
|
3
8
|
## Version 0.0.5
|
4
9
|
- Fixed bordercase issue when deleting entries from the database
|
5
10
|
- Updated README
|
data/lib/usefuldb/gui.rb
CHANGED
@@ -15,21 +15,12 @@ module UsefulDB
|
|
15
15
|
UsefulDB.dbLoad
|
16
16
|
index = 0
|
17
17
|
UsefulDB::UsefulUtils.list.each do |i|
|
18
|
-
puts
|
18
|
+
puts "Element: " + index.to_s
|
19
19
|
index += 1
|
20
|
-
index_tag = 0
|
21
20
|
msg = ''
|
22
|
-
msg += "- Tags: "
|
23
|
-
|
24
|
-
|
25
|
-
msg += yellow(j)
|
26
|
-
else
|
27
|
-
msg += ", " + yellow(j)
|
28
|
-
end
|
29
|
-
index_tag += 1
|
30
|
-
end
|
31
|
-
puts msg + "\n"
|
32
|
-
puts "- Value: " + red(i["value"]) + blue("\n##\n")
|
21
|
+
msg += "- Tags: " + UsefulDB::UsefulUtils.array_to_s(i["tag"]) + "\n"
|
22
|
+
puts msg
|
23
|
+
puts "- Value: " + i["value"] + "\n\n##\n"
|
33
24
|
end
|
34
25
|
end
|
35
26
|
|
@@ -62,7 +53,7 @@ module UsefulDB
|
|
62
53
|
|
63
54
|
begin
|
64
55
|
tags = ((STDIN.gets).strip).split(', ')
|
65
|
-
puts "The following was captured: " + tags
|
56
|
+
puts "The following was captured: " + UsefulDB::UsefulUtils.array_to_s(tags)
|
66
57
|
puts "Is this correct? y/n"
|
67
58
|
|
68
59
|
input = (STDIN.gets).strip
|
data/lib/usefuldb/utilities.rb
CHANGED
@@ -84,22 +84,12 @@ module UsefulDB
|
|
84
84
|
|
85
85
|
# Search for a tag in the DB
|
86
86
|
def search(tag)
|
87
|
-
msg = "Searching the database for tag: " +
|
87
|
+
msg = "Searching the database for tag: " + tag + "\n"
|
88
88
|
|
89
89
|
@data.each do |db|
|
90
90
|
if db["tag"].include?(tag)
|
91
|
-
|
92
|
-
msg += "-
|
93
|
-
db["tag"].each do |i|
|
94
|
-
if index_tag == 0
|
95
|
-
msg += yellow(i)
|
96
|
-
else
|
97
|
-
msg += ", " + yellow(i)
|
98
|
-
end
|
99
|
-
index_tag += 1
|
100
|
-
end
|
101
|
-
msg += "\n"
|
102
|
-
msg += "- Value: " + db["value"] + blue("\n##\n")
|
91
|
+
msg += "- Tags: " + array_to_s(db["tag"]) + "\n"
|
92
|
+
msg += "- Value: " + db["value"] + "\n##\n"
|
103
93
|
end
|
104
94
|
end
|
105
95
|
return msg
|
@@ -110,8 +100,27 @@ module UsefulDB
|
|
110
100
|
def list
|
111
101
|
return @data
|
112
102
|
end
|
113
|
-
|
114
|
-
|
103
|
+
|
104
|
+
|
105
|
+
# Convert an Array to a string
|
106
|
+
def array_to_s(a)
|
107
|
+
msg = ''
|
108
|
+
index = 0
|
109
|
+
msg += "["
|
110
|
+
a.each do |i|
|
111
|
+
if index == 0
|
112
|
+
msg += "\"" + i + "\""
|
113
|
+
else
|
114
|
+
msg += ", \"" + i + "\""
|
115
|
+
end
|
116
|
+
index += 1
|
117
|
+
end
|
118
|
+
msg += "]"
|
119
|
+
|
120
|
+
return msg
|
121
|
+
end
|
122
|
+
|
123
|
+
|
115
124
|
end
|
116
125
|
end
|
117
126
|
|
data/lib/usefuldb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usefuldb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|