gren 0.3.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +7 -0
  3. data/{History.ja.txt → HISTORY.ja.md} +41 -15
  4. data/HISTORY.md +92 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.ja.md +57 -0
  7. data/README.md +51 -0
  8. data/Rakefile +9 -39
  9. data/bin/gren +2 -7
  10. data/gren.gemspec +21 -0
  11. data/lib/gren.rb +3 -3
  12. data/lib/gren/cli.rb +13 -10
  13. data/lib/{common → gren/common}/grenfiletest.rb +0 -0
  14. data/lib/{common → gren/common}/grensnip.rb +1 -1
  15. data/lib/{common → gren/common}/platform.rb +0 -0
  16. data/lib/{common → gren/common}/string_snip.rb +0 -0
  17. data/lib/{common → gren/common}/util.rb +16 -10
  18. data/lib/{findgrep → gren/findgrep}/findgrep.rb +47 -143
  19. data/lib/{findgrep → gren/findgrep}/result.rb +1 -1
  20. data/lib/gren/version.rb +3 -0
  21. data/test/data/aaa.txt +1 -0
  22. data/test/data/abc.rb +8 -0
  23. data/test/data/bbb.txt +1 -0
  24. data/test/data/ccc.c +1 -0
  25. data/test/data/sub/ccc.txt +1 -0
  26. data/test/test_cli.rb +80 -0
  27. data/test/test_gren.rb +10 -10
  28. data/test/test_gren_util.rb +3 -2
  29. data/test/test_string_snip.rb +31 -31
  30. metadata +67 -177
  31. data/History.txt +0 -66
  32. data/Manifest.txt +0 -48
  33. data/PostInstall.txt +0 -7
  34. data/README.rdoc +0 -181
  35. data/bin/grendb +0 -11
  36. data/bin/grenweb +0 -11
  37. data/bin/mkgrendb +0 -11
  38. data/lib/common/display_util.rb +0 -62
  39. data/lib/grendb/cli.rb +0 -41
  40. data/lib/grenweb/cli.rb +0 -52
  41. data/lib/grenweb/database.rb +0 -179
  42. data/lib/grenweb/grenweb.ru +0 -35
  43. data/lib/grenweb/grep.rb +0 -52
  44. data/lib/grenweb/help.rb +0 -39
  45. data/lib/grenweb/home.rb +0 -39
  46. data/lib/grenweb/html_renderer.rb +0 -243
  47. data/lib/grenweb/public/css/gren.css +0 -63
  48. data/lib/grenweb/public/images/gren-icon-mini.png +0 -0
  49. data/lib/grenweb/public/images/gren-icon.png +0 -0
  50. data/lib/grenweb/query.rb +0 -82
  51. data/lib/grenweb/searcher.rb +0 -129
  52. data/lib/grenweb/viewer.rb +0 -51
  53. data/lib/mkgrendb/cli.rb +0 -49
  54. data/lib/mkgrendb/mkgrendb.rb +0 -230
  55. data/rake_rdoc_custom.rb +0 -13
  56. data/script/console +0 -10
  57. data/script/destroy +0 -14
  58. data/script/generate +0 -14
  59. data/test/test_grenweb_cli.rb +0 -10
  60. data/test/test_grenweb_html_renderer.rb +0 -41
  61. data/test/test_grenweb_query.rb +0 -54
  62. data/test/test_grenweb_searcher.rb +0 -35
@@ -0,0 +1 @@
1
+ bbb
@@ -0,0 +1 @@
1
+ ccc
@@ -0,0 +1 @@
1
+ ccc
@@ -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
@@ -1,10 +1,10 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
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
@@ -1,5 +1,6 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
2
- require File.join(File.dirname(__FILE__), "../lib/common/util.rb")
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
@@ -1,31 +1,31 @@
1
- require File.join(File.dirname(__FILE__), "test_helper.rb")
2
- require File.join(File.dirname(__FILE__), "../lib/common/util.rb")
3
- require File.join(File.dirname(__FILE__), "../lib/common/grensnip.rb")
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
- prerelease: false
5
- segments:
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
- date: 2011-02-20 00:00:00 +09:00
18
- default_executable:
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
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
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
- requirement: &id006 !ruby/object:Gem::Requirement
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
- extra_rdoc_files:
115
- - History.ja.txt
116
- - History.txt
117
- - Manifest.txt
118
- - PostInstall.txt
119
- - README.rdoc
120
- files:
121
- - History.ja.txt
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
- - bin/grendb
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/grendb/cli.rb
142
- - lib/grenweb/cli.rb
143
- - lib/grenweb/database.rb
144
- - lib/grenweb/grenweb.ru
145
- - lib/grenweb/grep.rb
146
- - lib/grenweb/help.rb
147
- - lib/grenweb/home.rb
148
- - lib/grenweb/html_renderer.rb
149
- - lib/grenweb/public/css/gren.css
150
- - lib/grenweb/public/images/gren-icon-mini.png
151
- - lib/grenweb/public/images/gren-icon.png
152
- - lib/grenweb/query.rb
153
- - lib/grenweb/searcher.rb
154
- - lib/grenweb/viewer.rb
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
- has_rdoc: true
170
- homepage: http://ongaeshi.github.com/gren
63
+ homepage: ''
171
64
  licenses: []
172
-
173
- post_install_message: PostInstall.txt
174
- rdoc_options:
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
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- segments:
184
- - 0
185
- version: "0"
186
- required_rubygems_version: !ruby/object:Gem::Requirement
187
- requirements:
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- segments:
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
- rubyforge_project: gren
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: