gren 0.3.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +7 -0
- data/{History.ja.txt → HISTORY.ja.md} +41 -15
- data/HISTORY.md +92 -0
- data/LICENSE.txt +22 -0
- data/README.ja.md +57 -0
- data/README.md +51 -0
- data/Rakefile +9 -39
- data/bin/gren +2 -7
- data/gren.gemspec +21 -0
- data/lib/gren.rb +3 -3
- data/lib/gren/cli.rb +13 -10
- data/lib/{common → gren/common}/grenfiletest.rb +0 -0
- data/lib/{common → gren/common}/grensnip.rb +1 -1
- data/lib/{common → gren/common}/platform.rb +0 -0
- data/lib/{common → gren/common}/string_snip.rb +0 -0
- data/lib/{common → gren/common}/util.rb +16 -10
- data/lib/{findgrep → gren/findgrep}/findgrep.rb +47 -143
- data/lib/{findgrep → gren/findgrep}/result.rb +1 -1
- data/lib/gren/version.rb +3 -0
- data/test/data/aaa.txt +1 -0
- data/test/data/abc.rb +8 -0
- data/test/data/bbb.txt +1 -0
- data/test/data/ccc.c +1 -0
- data/test/data/sub/ccc.txt +1 -0
- data/test/test_cli.rb +80 -0
- data/test/test_gren.rb +10 -10
- data/test/test_gren_util.rb +3 -2
- data/test/test_string_snip.rb +31 -31
- metadata +67 -177
- data/History.txt +0 -66
- data/Manifest.txt +0 -48
- data/PostInstall.txt +0 -7
- data/README.rdoc +0 -181
- data/bin/grendb +0 -11
- data/bin/grenweb +0 -11
- data/bin/mkgrendb +0 -11
- data/lib/common/display_util.rb +0 -62
- data/lib/grendb/cli.rb +0 -41
- data/lib/grenweb/cli.rb +0 -52
- data/lib/grenweb/database.rb +0 -179
- data/lib/grenweb/grenweb.ru +0 -35
- data/lib/grenweb/grep.rb +0 -52
- data/lib/grenweb/help.rb +0 -39
- data/lib/grenweb/home.rb +0 -39
- data/lib/grenweb/html_renderer.rb +0 -243
- data/lib/grenweb/public/css/gren.css +0 -63
- data/lib/grenweb/public/images/gren-icon-mini.png +0 -0
- data/lib/grenweb/public/images/gren-icon.png +0 -0
- data/lib/grenweb/query.rb +0 -82
- data/lib/grenweb/searcher.rb +0 -129
- data/lib/grenweb/viewer.rb +0 -51
- data/lib/mkgrendb/cli.rb +0 -49
- data/lib/mkgrendb/mkgrendb.rb +0 -230
- data/rake_rdoc_custom.rb +0 -13
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/test/test_grenweb_cli.rb +0 -10
- data/test/test_grenweb_html_renderer.rb +0 -41
- data/test/test_grenweb_query.rb +0 -54
- data/test/test_grenweb_searcher.rb +0 -35
data/test/data/bbb.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bbb
|
data/test/data/ccc.c
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ccc
|
@@ -0,0 +1 @@
|
|
1
|
+
ccc
|
data/test/test_cli.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2011/12/03
|
7
|
+
|
8
|
+
require 'gren/cli'
|
9
|
+
require 'test_helper'
|
10
|
+
|
11
|
+
class TestCLI < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@old = Dir.pwd
|
14
|
+
Dir.chdir(File.join(File.dirname(__FILE__), "data"))
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
Dir.chdir(@old)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_help
|
22
|
+
# command("-h") # 呼ぶとexitするのでコメントアウト
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_simple
|
26
|
+
assert_equal <<EOF, command("aaa")
|
27
|
+
aaa.txt:1:aaa
|
28
|
+
EOF
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_and_search
|
32
|
+
assert_equal <<EOF, command("def abc")
|
33
|
+
abc.rb:1:def abc
|
34
|
+
EOF
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_not
|
38
|
+
assert_equal <<EOF, command("abc --not def")
|
39
|
+
abc.rb:6:abc
|
40
|
+
EOF
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_verbose
|
44
|
+
assert_match /dir.*match.*files/m, command("aaa --verbose")
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_directory
|
48
|
+
assert_equal <<EOF, command("ccc")
|
49
|
+
ccc.c:1:ccc
|
50
|
+
sub/ccc.txt:1:ccc
|
51
|
+
EOF
|
52
|
+
|
53
|
+
assert_equal <<EOF, command("ccc -d sub")
|
54
|
+
sub/ccc.txt:1:ccc
|
55
|
+
EOF
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_files
|
59
|
+
assert_equal <<EOF, command("bb")
|
60
|
+
abc.rb:4:bb
|
61
|
+
bbb.txt:1:bbb
|
62
|
+
EOF
|
63
|
+
|
64
|
+
assert_equal <<EOF, command("bb -f abc")
|
65
|
+
abc.rb:4:bb
|
66
|
+
EOF
|
67
|
+
|
68
|
+
assert_equal <<EOF, command("bb --if abc")
|
69
|
+
bbb.txt:1:bbb
|
70
|
+
EOF
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def command(arg)
|
76
|
+
io = StringIO.new
|
77
|
+
CLI.execute(io, arg.split)
|
78
|
+
io.string
|
79
|
+
end
|
80
|
+
end
|
data/test/test_gren.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
class TestGren < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
end
|
6
|
-
|
7
|
-
def test_truth
|
8
|
-
assert true
|
9
|
-
end
|
10
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestGren < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_truth
|
8
|
+
assert true
|
9
|
+
end
|
10
|
+
end
|
data/test/test_gren_util.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gren/common/util'
|
3
|
+
require 'gren/common/grensnip'
|
3
4
|
|
4
5
|
class TestGrenSnip < Test::Unit::TestCase
|
5
6
|
def setup
|
data/test/test_string_snip.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
class TestStringSnip < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_ranges_compound
|
10
|
-
ranges = [0..7, 8..232, 121..150, 248..255]
|
11
|
-
assert_equal(StringSnip.ranges_compound(ranges), [0..232, 248..255])
|
12
|
-
|
13
|
-
ranges = [10..20, 22..30, 33..40]
|
14
|
-
assert_equal(StringSnip.ranges_compound(ranges), [10..20, 22..30, 33..40])
|
15
|
-
|
16
|
-
ranges = [10..30, 20..30, 30..40]
|
17
|
-
assert_equal(StringSnip.ranges_compound(ranges), [10..40])
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_string_snip
|
21
|
-
str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|12345678901234567890123456789012345678901234567890123456"
|
22
|
-
|
23
|
-
snipper = StringSnip.new
|
24
|
-
snip_str = snipper.snip(str, [0..7, -8..-1])
|
25
|
-
assert_equal(snip_str, str)
|
26
|
-
|
27
|
-
snipper = StringSnip.new(64)
|
28
|
-
snip_str = snipper.snip(str, [-8..-1, 10..20, 0..7])
|
29
|
-
assert_equal(snip_str, "12345678<<snip>>12345678901<<snip>>90123456")
|
30
|
-
end
|
31
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gren/common/util'
|
3
|
+
require 'gren/common/grensnip'
|
4
|
+
|
5
|
+
class TestStringSnip < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_ranges_compound
|
10
|
+
ranges = [0..7, 8..232, 121..150, 248..255]
|
11
|
+
assert_equal(StringSnip.ranges_compound(ranges), [0..232, 248..255])
|
12
|
+
|
13
|
+
ranges = [10..20, 22..30, 33..40]
|
14
|
+
assert_equal(StringSnip.ranges_compound(ranges), [10..20, 22..30, 33..40])
|
15
|
+
|
16
|
+
ranges = [10..30, 20..30, 30..40]
|
17
|
+
assert_equal(StringSnip.ranges_compound(ranges), [10..40])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_string_snip
|
21
|
+
str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789|12345678901234567890123456789012345678901234567890123456"
|
22
|
+
|
23
|
+
snipper = StringSnip.new
|
24
|
+
snip_str = snipper.snip(str, [0..7, -8..-1])
|
25
|
+
assert_equal(snip_str, str)
|
26
|
+
|
27
|
+
snipper = StringSnip.new(64)
|
28
|
+
snip_str = snipper.snip(str, [-8..-1, 10..20, 0..7])
|
29
|
+
assert_equal(snip_str, "12345678<<snip>>12345678901<<snip>>90123456")
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,208 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gren
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 2
|
9
|
-
version: 0.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- ongaeshi
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-04-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: termcolor
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 2
|
30
|
-
- 0
|
16
|
+
requirement: &2152930480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
31
21
|
version: 1.2.0
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rroonga
|
36
|
-
prerelease: false
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 1
|
43
|
-
- 0
|
44
|
-
- 0
|
45
|
-
version: 1.0.0
|
46
|
-
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rack
|
50
|
-
prerelease: false
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 1
|
57
|
-
- 2
|
58
|
-
- 1
|
59
|
-
version: 1.2.1
|
60
|
-
type: :runtime
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: launchy
|
64
|
-
prerelease: false
|
65
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
segments:
|
70
|
-
- 0
|
71
|
-
- 3
|
72
|
-
- 7
|
73
|
-
version: 0.3.7
|
74
|
-
type: :runtime
|
75
|
-
version_requirements: *id004
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: rubyforge
|
78
|
-
prerelease: false
|
79
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
segments:
|
84
|
-
- 2
|
85
|
-
- 0
|
86
|
-
- 4
|
87
|
-
version: 2.0.4
|
88
|
-
type: :development
|
89
|
-
version_requirements: *id005
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: hoe
|
92
23
|
prerelease: false
|
93
|
-
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
segments:
|
98
|
-
- 2
|
99
|
-
- 6
|
100
|
-
- 1
|
101
|
-
version: 2.6.1
|
102
|
-
type: :development
|
103
|
-
version_requirements: *id006
|
24
|
+
version_requirements: *2152930480
|
104
25
|
description: gren is a next grep tool.
|
105
|
-
email:
|
26
|
+
email:
|
106
27
|
- ongaeshi0621@gmail.com
|
107
|
-
executables:
|
28
|
+
executables:
|
108
29
|
- gren
|
109
|
-
- grendb
|
110
|
-
- grenweb
|
111
|
-
- mkgrendb
|
112
30
|
extensions: []
|
113
|
-
|
114
|
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
|
121
|
-
-
|
122
|
-
- History.txt
|
123
|
-
- Manifest.txt
|
124
|
-
- PostInstall.txt
|
125
|
-
- README.rdoc
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- HISTORY.ja.md
|
36
|
+
- HISTORY.md
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.ja.md
|
39
|
+
- README.md
|
126
40
|
- Rakefile
|
127
41
|
- bin/gren
|
128
|
-
-
|
129
|
-
- bin/grenweb
|
130
|
-
- bin/mkgrendb
|
131
|
-
- lib/common/display_util.rb
|
132
|
-
- lib/common/grenfiletest.rb
|
133
|
-
- lib/common/grensnip.rb
|
134
|
-
- lib/common/platform.rb
|
135
|
-
- lib/common/string_snip.rb
|
136
|
-
- lib/common/util.rb
|
137
|
-
- lib/findgrep/findgrep.rb
|
138
|
-
- lib/findgrep/result.rb
|
42
|
+
- gren.gemspec
|
139
43
|
- lib/gren.rb
|
140
44
|
- lib/gren/cli.rb
|
141
|
-
- lib/
|
142
|
-
- lib/
|
143
|
-
- lib/
|
144
|
-
- lib/
|
145
|
-
- lib/
|
146
|
-
- lib/
|
147
|
-
- lib/
|
148
|
-
- lib/
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
153
|
-
-
|
154
|
-
-
|
155
|
-
- lib/mkgrendb/cli.rb
|
156
|
-
- lib/mkgrendb/mkgrendb.rb
|
157
|
-
- rake_rdoc_custom.rb
|
158
|
-
- script/console
|
159
|
-
- script/destroy
|
160
|
-
- script/generate
|
45
|
+
- lib/gren/common/grenfiletest.rb
|
46
|
+
- lib/gren/common/grensnip.rb
|
47
|
+
- lib/gren/common/platform.rb
|
48
|
+
- lib/gren/common/string_snip.rb
|
49
|
+
- lib/gren/common/util.rb
|
50
|
+
- lib/gren/findgrep/findgrep.rb
|
51
|
+
- lib/gren/findgrep/result.rb
|
52
|
+
- lib/gren/version.rb
|
53
|
+
- test/data/aaa.txt
|
54
|
+
- test/data/abc.rb
|
55
|
+
- test/data/bbb.txt
|
56
|
+
- test/data/ccc.c
|
57
|
+
- test/data/sub/ccc.txt
|
58
|
+
- test/test_cli.rb
|
161
59
|
- test/test_gren.rb
|
162
60
|
- test/test_gren_util.rb
|
163
|
-
- test/test_grenweb_cli.rb
|
164
|
-
- test/test_grenweb_html_renderer.rb
|
165
|
-
- test/test_grenweb_query.rb
|
166
|
-
- test/test_grenweb_searcher.rb
|
167
61
|
- test/test_helper.rb
|
168
62
|
- test/test_string_snip.rb
|
169
|
-
|
170
|
-
homepage: http://ongaeshi.github.com/gren
|
63
|
+
homepage: ''
|
171
64
|
licenses: []
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
- --main
|
176
|
-
- README.rdoc
|
177
|
-
require_paths:
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
178
68
|
- lib
|
179
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
requirements:
|
188
|
-
- -
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
|
191
|
-
- 0
|
192
|
-
version: "0"
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
193
81
|
requirements: []
|
194
|
-
|
195
|
-
|
196
|
-
rubygems_version: 1.3.6
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.8.11
|
197
84
|
signing_key:
|
198
85
|
specification_version: 3
|
199
|
-
summary: gren is a next grep tool.
|
200
|
-
test_files:
|
86
|
+
summary: gren is a next grep tool. The basis is find+grep.
|
87
|
+
test_files:
|
88
|
+
- test/data/aaa.txt
|
89
|
+
- test/data/abc.rb
|
90
|
+
- test/data/bbb.txt
|
91
|
+
- test/data/ccc.c
|
92
|
+
- test/data/sub/ccc.txt
|
93
|
+
- test/test_cli.rb
|
201
94
|
- test/test_gren.rb
|
202
95
|
- test/test_gren_util.rb
|
203
|
-
- test/test_grenweb_cli.rb
|
204
|
-
- test/test_grenweb_html_renderer.rb
|
205
|
-
- test/test_grenweb_query.rb
|
206
|
-
- test/test_grenweb_searcher.rb
|
207
96
|
- test/test_helper.rb
|
208
97
|
- test/test_string_snip.rb
|
98
|
+
has_rdoc:
|