inaba 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.
- data/CHANGELOG.md +8 -3
- data/CHANGELOG_jp.md +8 -3
- data/Rakefile +1 -1
- data/lib/inaba/manipulator.rb +3 -2
- data/test/tb_manipulator.rb +28 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
Inaba
|
2
|
-
|
1
|
+
Inaba SDBM Manipulator
|
2
|
+
======================
|
3
|
+
|
4
|
+
## Ver 0.0.2
|
5
|
+
|
6
|
+
- 2012/12/18
|
7
|
+
- A bug related "help" command is fixed.
|
3
8
|
|
4
9
|
## Ver 0.0.1
|
5
10
|
|
6
11
|
- 2012/12/07
|
7
|
-
- First release
|
12
|
+
- First release
|
data/CHANGELOG_jp.md
CHANGED
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ spec = Gem::Specification.new do |s|
|
|
4
4
|
s.name = "inaba"
|
5
5
|
s.summary = "Inaba SDBM Manipulator is a command line tool to manipulate SDBM database."
|
6
6
|
s.description = File.read(File.join(File.dirname(__FILE__), "README.md"))
|
7
|
-
s.version = "0.0.
|
7
|
+
s.version = "0.0.2"
|
8
8
|
s.author = "Moza USANE"
|
9
9
|
s.email = "mozamimy@quellencode.org"
|
10
10
|
s.homepage = "http://quellencode.org/"
|
data/lib/inaba/manipulator.rb
CHANGED
@@ -81,7 +81,7 @@ module Inaba
|
|
81
81
|
|
82
82
|
def print_unrecognizable_error
|
83
83
|
warn "**Unrecognizable command '#{@argv[0]}'"
|
84
|
-
operate_help
|
84
|
+
operate_help(nil)
|
85
85
|
end
|
86
86
|
|
87
87
|
def operate_add(cmd_line)
|
@@ -114,7 +114,7 @@ module Inaba
|
|
114
114
|
operate(cmd_line, 1) {print @dbm.csv_each}
|
115
115
|
end
|
116
116
|
|
117
|
-
def operate_help
|
117
|
+
def operate_help(cmd_line)
|
118
118
|
puts "[command] [description]"
|
119
119
|
puts "add key value :: Add a key-value pair"
|
120
120
|
puts "del key :: Delete value on key"
|
@@ -123,6 +123,7 @@ module Inaba
|
|
123
123
|
puts "values :: Print all values"
|
124
124
|
puts "csv :: Print all values as CSV format"
|
125
125
|
puts "help :: Print this help"
|
126
|
+
return SUCCESS
|
126
127
|
end
|
127
128
|
|
128
129
|
def operate(cmd, cmd_length, &block)
|
data/test/tb_manipulator.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require "test/unit"
|
5
5
|
require "ariete"
|
6
|
+
require "stringio"
|
6
7
|
require_relative "../lib/inaba/manipulator"
|
7
8
|
|
8
9
|
include Inaba
|
@@ -73,6 +74,14 @@ class ManipulatorTest < Test::Unit::TestCase
|
|
73
74
|
csv_common(["s"])
|
74
75
|
end
|
75
76
|
|
77
|
+
def test_help
|
78
|
+
help_common(["help"])
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_help_abbr
|
82
|
+
help_common(["h"])
|
83
|
+
end
|
84
|
+
|
76
85
|
def test_arg_error
|
77
86
|
argv = ["add", "invalid"]
|
78
87
|
@mnp.instance_variable_set(:@argv, argv)
|
@@ -164,10 +173,29 @@ class ManipulatorTest < Test::Unit::TestCase
|
|
164
173
|
assert_equal("rabbit,RABBIT\r\nhakto,HAKTO\r\ninaba,INABA\r\n", result)
|
165
174
|
end
|
166
175
|
|
176
|
+
def help_common(argv)
|
177
|
+
@mnp.instance_variable_set(:@argv, argv)
|
178
|
+
result = capture_stdout {@mnp.run}
|
179
|
+
assert_equal(result, put_help_string)
|
180
|
+
end
|
181
|
+
|
167
182
|
def add_some_pair(dbm)
|
168
183
|
dbm["rabbit"] = "RABBIT"
|
169
184
|
dbm["hakto"] = "HAKTO"
|
170
185
|
dbm["inaba"] = "INABA"
|
171
186
|
end
|
172
187
|
|
188
|
+
def put_help_string
|
189
|
+
str_io = StringIO.new
|
190
|
+
str_io.puts "[command] [description]"
|
191
|
+
str_io.puts "add key value :: Add a key-value pair"
|
192
|
+
str_io.puts "del key :: Delete value on key"
|
193
|
+
str_io.puts "list :: Print all key-value pairs"
|
194
|
+
str_io.puts "keys :: Print all keys"
|
195
|
+
str_io.puts "values :: Print all values"
|
196
|
+
str_io.puts "csv :: Print all values as CSV format"
|
197
|
+
str_io.puts "help :: Print this help"
|
198
|
+
str_io.string
|
199
|
+
end
|
200
|
+
|
173
201
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inaba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hakto
|