gren 0.3.2 → 1.0.0

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.
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,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gren.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+
@@ -1,15 +1,41 @@
1
- === 0.3.2 2011/02/20
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
- === 0.3.1 2010/11/20
33
+ # 0.3.1 2010/11/20
8
34
 
9
35
  * grenweb
10
36
  * 相対パスで動作するように
11
37
 
12
- === 0.3.0 2010/11/02
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
- === 0.2.4 2010/10/09
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
- === 0.2.3 2010/09/25
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
- === 0.2.2 2010/09/14
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
- === 0.2.1 2010/09/13
90
+ # 0.2.1 2010/09/13
65
91
 
66
92
  * デフォルトのignoreファイル追加 .d, .map, .MAP
67
93
  * オプション名変更 : --sub → --not
68
94
 
69
- === 0.2.0 2010/09/13
95
+ # 0.2.0 2010/09/13
70
96
 
71
97
  * grooongaを利用して超高速検索を実現した、grendbをリリース
72
98
  * mkgrendbでデータベース生成
73
99
  * grendbでデータベース検索
74
100
 
75
- === 0.1.4 2010/08/14
101
+ # 0.1.4 2010/08/14
76
102
 
77
103
  * snipモード
78
104
  * 一行が長過ぎる場合は適当に省略する機能を追加
79
105
  * 圧縮したJavascript等で効果を発揮
80
106
 
81
- === 0.1.3 2010/08/13
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
- === 0.1.2 2010/08/05
117
+ # 0.1.2 2010/08/05
92
118
 
93
119
  * Bug fix.
94
120
  * 読み込み禁止ディレクトリがあるとハングアップする問題を修正
95
121
 
96
- === 0.1.1 2010/08/04
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
- === 0.1.0 2010/08/02
129
+ # 0.1.0 2010/08/02
104
130
 
105
131
  * Update README.doc (to English).
106
132
 
107
- === 0.0.6 2010/07/29
133
+ # 0.0.6 2010/07/29
108
134
 
109
135
  * update github
110
136
  * http://github.com/ongaeshi/gren
111
137
 
112
- === 0.0.1 2010-07-22
138
+ # 0.0.1 2010-07-22
113
139
 
114
140
  * 1 major enhancement:
115
141
  * Initial release
@@ -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
@@ -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.
@@ -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)
@@ -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
- # -*- coding: utf-8 -*-
2
- # -*- ruby -*-
3
-
4
- require 'rubygems'
5
- gem 'hoe', '>= 2.1.0'
6
- require 'hoe'
7
- require 'fileutils'
8
- require './lib/gren'
9
- require 'rake_rdoc_custom'
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 'rubygems'
7
- require File.expand_path(File.dirname(__FILE__) + "/../lib/gren")
8
- require "gren/cli"
3
+ require 'gren'
9
4
 
10
- Version = "0.2.1"
5
+ Version = Gren::VERSION
11
6
  Gren::CLI.execute(STDOUT, ARGV)