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/.gitignore
ADDED
data/Gemfile
ADDED
@@ -1,15 +1,41 @@
|
|
1
|
-
|
1
|
+
# 1.0.0 2013/04/06
|
2
|
+
|
3
|
+
* gren
|
4
|
+
* デフォルトでは詳細表示をOFF
|
5
|
+
* --verbose オプションを追加
|
6
|
+
* 小文字の単語は大文字小文字を無視する
|
7
|
+
* test -> 'ignore' , Test -> 'not ignore'
|
8
|
+
* パイプをサポート
|
9
|
+
* ls | gren test
|
10
|
+
|
11
|
+
* Support Ruby 1.9
|
12
|
+
* prec_i -> to_i, prec_f -> to_f
|
13
|
+
|
14
|
+
* File rename & add
|
15
|
+
* History.*.txt -> HISTORY.*.md
|
16
|
+
* README.rdoc -> README.md
|
17
|
+
* Add README.ja.md
|
18
|
+
* require join -> require 'gren/..'
|
19
|
+
* Add test_cli.rb
|
20
|
+
* gren/gren/cli -> gren/cli
|
21
|
+
* Delete display_util.rb
|
22
|
+
|
23
|
+
* etc
|
24
|
+
* hoe -> bundler に移行
|
25
|
+
* Delete grendb(rroonga, rack) dependency
|
26
|
+
|
27
|
+
# 0.3.2 2011/02/20
|
2
28
|
|
3
29
|
* mkgrendb
|
4
30
|
* Bugfix : yamlに記述されたディレクトリが存在しない時にハングアップするバグを修正
|
5
31
|
* Bugfix : --fullオプションが正しく動作しない問題を修正
|
6
32
|
|
7
|
-
|
33
|
+
# 0.3.1 2010/11/20
|
8
34
|
|
9
35
|
* grenweb
|
10
36
|
* 相対パスで動作するように
|
11
37
|
|
12
|
-
|
38
|
+
# 0.3.0 2010/11/02
|
13
39
|
|
14
40
|
* grenweb
|
15
41
|
* webベースのソースコード検索エンジンを追加
|
@@ -17,7 +43,7 @@
|
|
17
43
|
* mkgrendb
|
18
44
|
* 結果表示画面に追加されたファイルの数を追加
|
19
45
|
|
20
|
-
|
46
|
+
# 0.2.4 2010/10/09
|
21
47
|
|
22
48
|
* mkgrendb
|
23
49
|
* データベースの形式を変更
|
@@ -35,7 +61,7 @@
|
|
35
61
|
* 実際のファイルを辿らず、データベースの情報のみで探索出来るように
|
36
62
|
* 検索結果を更新時刻順で表示するように
|
37
63
|
|
38
|
-
|
64
|
+
# 0.2.3 2010/09/25
|
39
65
|
|
40
66
|
* mkgrendb
|
41
67
|
* ymal入力時にパスを展開していないバグを修正
|
@@ -50,7 +76,7 @@
|
|
50
76
|
* 正規化 .. 各語彙を正規化して登録(大文字、小文字を区別しない)
|
51
77
|
* with_position .. 転置索引に出現位置情報を合わせて格納
|
52
78
|
|
53
|
-
|
79
|
+
# 0.2.2 2010/09/14
|
54
80
|
|
55
81
|
* mkgrendb
|
56
82
|
* 複数引数に対応
|
@@ -61,24 +87,24 @@
|
|
61
87
|
* --delete データベースを削除(yamlは消さない)
|
62
88
|
* ファイルのタイムスタンプを比較して、すでに更新されているものは再生成しないように
|
63
89
|
|
64
|
-
|
90
|
+
# 0.2.1 2010/09/13
|
65
91
|
|
66
92
|
* デフォルトのignoreファイル追加 .d, .map, .MAP
|
67
93
|
* オプション名変更 : --sub → --not
|
68
94
|
|
69
|
-
|
95
|
+
# 0.2.0 2010/09/13
|
70
96
|
|
71
97
|
* grooongaを利用して超高速検索を実現した、grendbをリリース
|
72
98
|
* mkgrendbでデータベース生成
|
73
99
|
* grendbでデータベース検索
|
74
100
|
|
75
|
-
|
101
|
+
# 0.1.4 2010/08/14
|
76
102
|
|
77
103
|
* snipモード
|
78
104
|
* 一行が長過ぎる場合は適当に省略する機能を追加
|
79
105
|
* 圧縮したJavascript等で効果を発揮
|
80
106
|
|
81
|
-
|
107
|
+
# 0.1.3 2010/08/13
|
82
108
|
|
83
109
|
* 含まれない検索、OR検索に対応
|
84
110
|
* --subで指定したキーワードは''含まれない''
|
@@ -88,28 +114,28 @@
|
|
88
114
|
* ファイルの文字コードがばらばらでも、自動的にシェルで使用している文字コードにあわせてくれるようにした
|
89
115
|
* -e, --encode ENCODE Specify encode(none, auto, jis, sjis, euc, ascii, utf8, utf16). Default is "auto"
|
90
116
|
|
91
|
-
|
117
|
+
# 0.1.2 2010/08/05
|
92
118
|
|
93
119
|
* Bug fix.
|
94
120
|
* 読み込み禁止ディレクトリがあるとハングアップする問題を修正
|
95
121
|
|
96
|
-
|
122
|
+
# 0.1.1 2010/08/04
|
97
123
|
|
98
124
|
* --depth, --this(== "--depth 0")、探索する階層数を指定出来るように
|
99
125
|
* -sでサイレントモード、マッチした行のみを表示する
|
100
126
|
* -f, --if, --idオプションを何個でも設定出来るように
|
101
127
|
* -cで色付き表示
|
102
128
|
|
103
|
-
|
129
|
+
# 0.1.0 2010/08/02
|
104
130
|
|
105
131
|
* Update README.doc (to English).
|
106
132
|
|
107
|
-
|
133
|
+
# 0.0.6 2010/07/29
|
108
134
|
|
109
135
|
* update github
|
110
136
|
* http://github.com/ongaeshi/gren
|
111
137
|
|
112
|
-
|
138
|
+
# 0.0.1 2010-07-22
|
113
139
|
|
114
140
|
* 1 major enhancement:
|
115
141
|
* Initial release
|
data/HISTORY.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# 1.0.0 2013/04/06
|
2
|
+
|
3
|
+
* gren
|
4
|
+
* Do not drill in the default
|
5
|
+
* Add --verbose options
|
6
|
+
* Lowercase word ignores capitalization
|
7
|
+
* test -> 'ignore' , Test -> 'not ignore'
|
8
|
+
* Support pipe
|
9
|
+
* ls | gren test
|
10
|
+
|
11
|
+
* Support Ruby 1.9
|
12
|
+
* prec_i -> to_i, prec_f -> to_f
|
13
|
+
|
14
|
+
* File rename & add
|
15
|
+
* History.*.txt -> HISTORY.*.md
|
16
|
+
* README.rdoc -> README.md
|
17
|
+
* Add README.ja.md
|
18
|
+
* require join -> require 'gren/..'
|
19
|
+
* Add test_cli.rb
|
20
|
+
* gren/gren/cli -> gren/cli
|
21
|
+
* Delete display_util.rb
|
22
|
+
|
23
|
+
* etc
|
24
|
+
* hoe -> bundler
|
25
|
+
* Delete grendb(rroonga, rack) dependency
|
26
|
+
|
27
|
+
# 0.3.2 2011/02/20
|
28
|
+
|
29
|
+
* mkgrendb
|
30
|
+
* Bugfix
|
31
|
+
|
32
|
+
# 0.3.1 2010/11/20
|
33
|
+
|
34
|
+
* grenweb
|
35
|
+
|
36
|
+
# 0.3.0 2010/11/02
|
37
|
+
|
38
|
+
* grenweb
|
39
|
+
* mkgrendb
|
40
|
+
|
41
|
+
# 0.2.4 2010/10/09
|
42
|
+
|
43
|
+
* mkgrendb
|
44
|
+
* grendb
|
45
|
+
|
46
|
+
# 0.2.3 2010/09/25
|
47
|
+
|
48
|
+
* mkgrendb
|
49
|
+
|
50
|
+
# 0.2.2 2010/09/14
|
51
|
+
|
52
|
+
* mkgrendb
|
53
|
+
|
54
|
+
# 0.2.1 2010/09/13
|
55
|
+
|
56
|
+
* gren
|
57
|
+
|
58
|
+
# 0.2.0 2010/09/13
|
59
|
+
|
60
|
+
* grendb
|
61
|
+
|
62
|
+
# 0.1.4 2010/08/14
|
63
|
+
|
64
|
+
* gren
|
65
|
+
* snip-mode
|
66
|
+
|
67
|
+
# 0.1.3 2010/08/13
|
68
|
+
|
69
|
+
* gren
|
70
|
+
|
71
|
+
# 0.1.2 2010/08/05
|
72
|
+
|
73
|
+
* gren
|
74
|
+
* Bug fix.
|
75
|
+
|
76
|
+
# 0.1.1 2010/08/04
|
77
|
+
|
78
|
+
* gren
|
79
|
+
|
80
|
+
# 0.1.0 2010/08/02
|
81
|
+
|
82
|
+
* Update README.doc (to English).
|
83
|
+
|
84
|
+
# 0.0.6 2010/07/29
|
85
|
+
|
86
|
+
* update github
|
87
|
+
* http://github.com/ongaeshi/gren
|
88
|
+
|
89
|
+
# 0.0.1 2010-07-22
|
90
|
+
|
91
|
+
* 1 major enhancement:
|
92
|
+
* Initial release
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 ongaeshi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.ja.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Gren (grep next)
|
2
|
+
|
3
|
+
[gren](http://gren.ongaeshi.me)はgrepの置き換えを目指して作ったコマンドラインツールです。
|
4
|
+
|
5
|
+
## 特徴
|
6
|
+
|
7
|
+
* 基本はfind+grep
|
8
|
+
* 指定ディレクトリ以下にある全てのファイルの中身を調べます。
|
9
|
+
* ユーザーが指定する項目を最小限に
|
10
|
+
* デフォルトで除外ディレクトリが設定されています
|
11
|
+
* AND検索、
|
12
|
+
* バイナリファイルの自動判別
|
13
|
+
* The binary or the text or the tool judges it from the automatic operation.
|
14
|
+
* grepとの互換性
|
15
|
+
|
16
|
+
* Convenient retrieval result
|
17
|
+
|
18
|
+
## インストール
|
19
|
+
|
20
|
+
```
|
21
|
+
$ gem install gren
|
22
|
+
```
|
23
|
+
|
24
|
+
## オプション
|
25
|
+
|
26
|
+
```
|
27
|
+
$ gren -h
|
28
|
+
gren [option] pattern
|
29
|
+
--not PATTERN Keyword is not included.
|
30
|
+
--or PATTERN Either of keyword is contained.
|
31
|
+
-d, --directory DIR Start directory. (deafult:".")
|
32
|
+
--depth DEPTH Limit search depth.
|
33
|
+
--this "--depth 0"
|
34
|
+
-i, --ignore Ignore case.
|
35
|
+
-s, --silent Silent. Display match line only.
|
36
|
+
--debug Debug display.
|
37
|
+
-c, --color Color highlight.
|
38
|
+
-f, --file-regexp REGEXP Search file regexp. (Enable multiple call)
|
39
|
+
--if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
|
40
|
+
--id, --ignore-dir REGEXP Ignore dir pattern. (Enable multiple call)
|
41
|
+
-e, --encode ENCODE Specify encode(none, auto, jis, sjis, euc, ascii, utf8, utf16). Default is "auto"
|
42
|
+
--no-snip There being a long line, it does not snip.
|
43
|
+
```
|
44
|
+
|
45
|
+
## エディタとの連携
|
46
|
+
### Emacs
|
47
|
+
|
48
|
+
```lisp
|
49
|
+
(global-set-key (kbd "C-x C-g") 'grep-find) ; your favarite key
|
50
|
+
(setq grep-find-command "gren ") ; "gren.bat" for Windows
|
51
|
+
```
|
52
|
+
|
53
|
+
### ライセンス
|
54
|
+
See LISENCE.txt
|
55
|
+
|
56
|
+
### 作者
|
57
|
+
[ongaeshi](http://ongaeshi.me)
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Gren (grep next)
|
2
|
+
|
3
|
+
[gren](http://gren.ongaeshi.me) is a next grep tool.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
* The basis is find+grep.
|
8
|
+
* The item that the user specifies to the minimum
|
9
|
+
* The binary or the text or the tool judges it from the automatic operation.
|
10
|
+
* Convenient retrieval result
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
```
|
15
|
+
$ gem install gren
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
```
|
21
|
+
$ gren -h
|
22
|
+
gren [option] pattern
|
23
|
+
--not PATTERN Keyword is not included.
|
24
|
+
--or PATTERN Either of keyword is contained.
|
25
|
+
-d, --directory DIR Start directory. (deafult:".")
|
26
|
+
--depth DEPTH Limit search depth.
|
27
|
+
--this "--depth 0"
|
28
|
+
-i, --ignore Ignore case.
|
29
|
+
-s, --silent Silent. Display match line only.
|
30
|
+
--debug Debug display.
|
31
|
+
-c, --color Color highlight.
|
32
|
+
-f, --file-regexp REGEXP Search file regexp. (Enable multiple call)
|
33
|
+
--if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
|
34
|
+
--id, --ignore-dir REGEXP Ignore dir pattern. (Enable multiple call)
|
35
|
+
-e, --encode ENCODE Specify encode(none, auto, jis, sjis, euc, ascii, utf8, utf16). Default is "auto"
|
36
|
+
--no-snip There being a long line, it does not snip.
|
37
|
+
```
|
38
|
+
|
39
|
+
## Editor Setting
|
40
|
+
### Emacs
|
41
|
+
|
42
|
+
```lisp
|
43
|
+
(global-set-key (kbd "C-x C-g") 'grep-find) ; your favarite key
|
44
|
+
(setq grep-find-command "gren ") ; "gren.bat" for Windows
|
45
|
+
```
|
46
|
+
|
47
|
+
### License
|
48
|
+
See LISENCE.txt
|
49
|
+
|
50
|
+
### Author
|
51
|
+
[ongaeshi](http://ongaeshi.me)
|
data/Rakefile
CHANGED
@@ -1,39 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Hoe.plugin :newgem
|
12
|
-
# Hoe.plugin :website
|
13
|
-
# Hoe.plugin :cucumberfeatures
|
14
|
-
|
15
|
-
# Generate all the Rake tasks
|
16
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
17
|
-
$hoe = Hoe.spec 'gren' do
|
18
|
-
self.developer 'ongaeshi', 'ongaeshi0621@gmail.com'
|
19
|
-
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
20
|
-
self.rubyforge_name = self.name # TODO this is default value
|
21
|
-
|
22
|
-
# 必要とするgem
|
23
|
-
self.extra_deps = [
|
24
|
-
['termcolor','>= 1.2.0'],
|
25
|
-
['rroonga','>= 1.0.0'],
|
26
|
-
['rack','>=1.2.1'],
|
27
|
-
['launchy', '>=0.3.7']
|
28
|
-
]
|
29
|
-
|
30
|
-
# 本来はnewgemの中で設定されるべき(後で報告した方がいいかも)
|
31
|
-
self.extra_rdoc_files << "README.rdoc"
|
32
|
-
|
33
|
-
# 本当はhoeの中でこう設定出来たら良い
|
34
|
-
# self.spec_extras[:rdoc_options] = ['-c', 'utf8']
|
35
|
-
end
|
36
|
-
|
37
|
-
require 'newgem/tasks'
|
38
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
39
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
# rake test (Use 'test/unit')
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new(:test) do |test|
|
6
|
+
test.libs << 'lib' << 'test'
|
7
|
+
test.test_files = FileList['test/**/test_*.rb']
|
8
|
+
test.verbose = true
|
9
|
+
end
|
data/bin/gren
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Created on 2010-7-22.
|
4
|
-
# Copyright (c) 2010. All rights reserved.
|
5
2
|
|
6
|
-
require '
|
7
|
-
require File.expand_path(File.dirname(__FILE__) + "/../lib/gren")
|
8
|
-
require "gren/cli"
|
3
|
+
require 'gren'
|
9
4
|
|
10
|
-
Version =
|
5
|
+
Version = Gren::VERSION
|
11
6
|
Gren::CLI.execute(STDOUT, ARGV)
|