gren 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # 1.0.1 2013/04/21
2
+
3
+ * 起動時間の短縮。色付けしない時は termcolor の読み込みを外す
4
+
1
5
  # 1.0.1 2013/04/08
2
6
 
3
7
  * 一部ファイルを検索時にエンコードエラーが出る問題を修正
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.1 2013/04/21
2
+
3
+ * Faster startup. Don't require 'termcolor' not coloring.
4
+
1
5
  # 1.0.1 2013/04/08
2
6
 
3
7
  * Fix encoding error
@@ -4,16 +4,18 @@
4
4
 
5
5
  ## 特徴
6
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
7
+ * Rubyがあれば簡単にインストール可能
8
+ * Windowsでも使えます
9
+ * 簡単に使える
10
+ * ユーザーの指定する項目を最小限に
11
+ * ディレクトリ以下の全てのファイルを検索
12
+ * 不要なファイルは検索しない
13
+ * .git, .svn, CVS, バイナリ
14
+ * AND、NOT、OR、正規表現
15
+ * 複数の文字エンコードが混ざっていても大丈夫
16
+ * utf-8, utf-16, sjis, euc ..
17
+
18
+ 大量のファイルを高速に検索したい時は [Milkode](http://milkode.ongaeshi.me) をどうぞ
17
19
 
18
20
  ## インストール
19
21
 
@@ -21,6 +23,8 @@
21
23
  $ gem install gren
22
24
  ```
23
25
 
26
+ 重たいgemは使っていないのでRubyが動けば環境によらず使えるはずです。
27
+
24
28
  ## オプション
25
29
 
26
30
  ```
@@ -28,18 +32,116 @@ $ gren -h
28
32
  gren [option] pattern
29
33
  --not PATTERN Keyword is not included.
30
34
  --or PATTERN Either of keyword is contained.
35
+ -c, --color Color highlight.
36
+ --cs, --case-sensitive Case sensitivity.
31
37
  -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
38
  --debug Debug display.
37
- -c, --color Color highlight.
39
+ --depth DEPTH Limit search depth.
40
+ -e, --encode ENCODE Specify encode(none, auto, jis, sjis, euc, ascii, utf8, utf16).
38
41
  -f, --file-regexp REGEXP Search file regexp. (Enable multiple call)
39
- --if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
42
+ -i, --ignore Ignore case.
40
43
  --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"
44
+ --if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
42
45
  --no-snip There being a long line, it does not snip.
46
+ --silent Silent. Display match line only.
47
+ --this "--depth 0"
48
+ -v, --verbose Set the verbose level of output.
49
+ ```
50
+
51
+ ## チュートリアル
52
+
53
+ ### ディレクトリ以下にある全てのファイルを検索
54
+
55
+ ```
56
+ $ cd ~/gren/test/data
57
+
58
+ $ gren abc
59
+ abc.rb:1:def abc
60
+ abc.rb:6:abc
61
+ ```
62
+
63
+ ### ヒューリスティックな大文字、小文字の区別
64
+
65
+ ```shell
66
+ # 全て小文字の時は大文字、小文字の区別をしない
67
+ $ gren testcase
68
+ testcase.txt:1:testcase
69
+ testcase.txt:2:TestCase
70
+ testcase.txt:3:TESTCASE
71
+
72
+ # 大文字混じりの文字は厳密に検索
73
+ $ gren TestCase
74
+ testcase.txt:2:TestCase
75
+ $ gren TESTCase
76
+ Not found..
77
+
78
+ # 厳密に小文字を検索したい時は --cs(--case-sensitive) を使う
79
+ $ gren testcase --cs
80
+ testcase.txt:1:testcase
81
+ ```
82
+
83
+ ### キーワードを重ねてAND検索
84
+
85
+ ```
86
+ $ gren abc def
87
+ abc.rb:1:def abc
88
+ ```
89
+
90
+ ### NOT検索
91
+
92
+ ```
93
+ $ gren abc --not def
94
+ abc.rb:6:abc
95
+ ```
96
+
97
+ ### OR検索
98
+
99
+ ```
100
+ $ gren --or aaa --or bbb
101
+ aaa.txt:1:aaa
102
+ bbb.txt:1:bbb
103
+ ```
104
+
105
+ ### 開始ディレクトリを指定
106
+
107
+ ```
108
+ $ gren ccc -d sub
109
+ sub/ccc.txt:1:ccc
110
+ ```
111
+
112
+ ### ファイル名で絞り込み
113
+
114
+ ```
115
+ $ gren bb
116
+ abc.rb:4:bb
117
+ bbb.txt:1:bbb
118
+
119
+ $ gren bb -f abc
120
+ abc.rb:4:bb
121
+
122
+ $ gren bb --if abc
123
+ bbb.txt:1:bbb
124
+ ```
125
+
126
+ ### ディレクトリ名で絞り込み
127
+
128
+ ```
129
+ $ gren ccc --id sub
130
+ ccc.c:1:ccc
131
+ ```
132
+
133
+ ### 詳細表示
134
+
135
+ ```
136
+ $ gren a --verbose
137
+ aaa.txt:1:aaa
138
+ abc.rb:1:def abc
139
+ abc.rb:3:a
140
+ abc.rb:6:abc
141
+
142
+ dir : /path/to/gren/data/test (0.0sec)
143
+ files : 5 in 5 (54Byte in 54Byte)
144
+ match : 2 files, 4 hit
43
145
  ```
44
146
 
45
147
  ## エディタとの連携
@@ -50,8 +152,8 @@ gren [option] pattern
50
152
  (setq grep-find-command "gren ") ; "gren.bat" for Windows
51
153
  ```
52
154
 
53
- ### ライセンス
155
+ ## ライセンス
54
156
  See LISENCE.txt
55
157
 
56
- ### 作者
158
+ ## 作者
57
159
  [ongaeshi](http://ongaeshi.me)
data/README.md CHANGED
@@ -4,10 +4,17 @@
4
4
 
5
5
  ## Features
6
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
7
+ * Need Ruby, only
8
+ * It is available on Windows
9
+ * Easy to use
10
+ * Search files in the directory below
11
+ * Don't search the unnecessary files
12
+ * .git, .svn, CVS, binary
13
+ * AND, NOT, OR, Regexp
14
+ * Search mixed character encoding
15
+ * utf-8, utf-16, sjis, euc ..
16
+
17
+ If you want to search many files faster, Please use [Milkode](http://milkode.ongaeshi.me).
11
18
 
12
19
  ## Installation
13
20
 
@@ -15,6 +22,8 @@
15
22
  $ gem install gren
16
23
  ```
17
24
 
25
+ Not use any heavy gem :-)
26
+
18
27
  ## Usage
19
28
 
20
29
  ```
@@ -22,18 +31,115 @@ $ gren -h
22
31
  gren [option] pattern
23
32
  --not PATTERN Keyword is not included.
24
33
  --or PATTERN Either of keyword is contained.
34
+ -c, --color Color highlight.
35
+ --cs, --case-sensitive Case sensitivity.
25
36
  -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
37
  --debug Debug display.
31
- -c, --color Color highlight.
38
+ --depth DEPTH Limit search depth.
39
+ -e, --encode ENCODE Specify encode(none, auto, jis, sjis, euc, ascii, utf8, utf16).
32
40
  -f, --file-regexp REGEXP Search file regexp. (Enable multiple call)
33
- --if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
41
+ -i, --ignore Ignore case.
34
42
  --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"
43
+ --if, --ignore-file REGEXP Ignore file pattern. (Enable multiple call)
36
44
  --no-snip There being a long line, it does not snip.
45
+ --silent Silent. Display match line only.
46
+ --this "--depth 0"
47
+ -v, --verbose Set the verbose level of output.
48
+ ```
49
+
50
+ ## Tutorial
51
+
52
+ ### Search for all files in the directory below
53
+
54
+ ```
55
+ $ cd ~/gren/test/data
56
+
57
+ $ gren abc
58
+ abc.rb:1:def abc
59
+ abc.rb:6:abc
60
+ ```
61
+
62
+ ### Heuristic, case-sensitive
63
+
64
+ ```shell
65
+ # The case-insensitive when all lower case
66
+ $ gren testcase
67
+ testcase.txt:1:testcase
68
+ testcase.txt:2:TestCase
69
+ testcase.txt:3:TESTCASE
70
+
71
+ # Character mixed capitalization is strictly Search
72
+ $ gren TestCase
73
+ testcase.txt:2:TestCase
74
+ $ gren TESTCase
75
+ Not found..
76
+
77
+ # If you would like to search case strictly, use --cs(--case-sensitive)
78
+ $ gren testcase --cs
79
+ testcase.txt:1:testcase
80
+ ```
81
+ ### AND search in piles keyword
82
+
83
+ ```
84
+ $ gren abc def
85
+ abc.rb:1:def abc
86
+ ```
87
+
88
+ ### NOT
89
+
90
+ ```
91
+ $ gren abc --not def
92
+ abc.rb:6:abc
93
+ ```
94
+
95
+ ### OR
96
+
97
+ ```
98
+ $ gren --or aaa --or bbb
99
+ aaa.txt:1:aaa
100
+ bbb.txt:1:bbb
101
+ ```
102
+
103
+ ### Specify starting directory
104
+
105
+ ```
106
+ $ gren ccc -d sub
107
+ sub/ccc.txt:1:ccc
108
+ ```
109
+
110
+ ### Filter by filename
111
+
112
+ ```
113
+ $ gren bb
114
+ abc.rb:4:bb
115
+ bbb.txt:1:bbb
116
+
117
+ $ gren bb -f abc
118
+ abc.rb:4:bb
119
+
120
+ $ gren bb --if abc
121
+ bbb.txt:1:bbb
122
+ ```
123
+
124
+ ### Fileter by directory
125
+
126
+ ```
127
+ $ gren ccc --id sub
128
+ ccc.c:1:ccc
129
+ ```
130
+
131
+ ### Detail display
132
+
133
+ ```
134
+ $ gren a --verbose
135
+ aaa.txt:1:aaa
136
+ abc.rb:1:def abc
137
+ abc.rb:3:a
138
+ abc.rb:6:abc
139
+
140
+ dir : /path/to/gren/data/test (0.0sec)
141
+ files : 5 in 5 (54Byte in 54Byte)
142
+ match : 2 files, 4 hit
37
143
  ```
38
144
 
39
145
  ## Editor Setting
@@ -2,14 +2,13 @@
2
2
  require 'find'
3
3
  require 'gren/findgrep/result'
4
4
  require 'rubygems'
5
- require 'termcolor'
5
+ # require 'termcolor'
6
6
  require 'kconv'
7
7
  require 'gren/common/platform'
8
8
  require 'gren/common/grenfiletest'
9
9
  require 'gren/common/grensnip'
10
10
  require 'gren/common/util'
11
11
  include Gren
12
- require 'cgi'
13
12
 
14
13
  module FindGrep
15
14
  class FindGrep
@@ -61,6 +60,8 @@ module FindGrep
61
60
  @ignoreFiles = strs2regs(option.ignoreFiles)
62
61
  @ignoreDirs = strs2regs(option.ignoreDirs)
63
62
  @result = Result.new(option.directory)
63
+
64
+ require 'termcolor' if @option.colorHighlight
64
65
  end
65
66
 
66
67
  def strs2regs(strs)
@@ -1,3 +1,3 @@
1
1
  module Gren
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -0,0 +1,3 @@
1
+ testcase
2
+ TestCase
3
+ TESTCASE
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gren
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-07 00:00:00.000000000 Z
12
+ date: 2013-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: termcolor
16
- requirement: &2157299740 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157299740
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.0
25
30
  description: gren is a next grep tool.
26
31
  email:
27
32
  - ongaeshi0621@gmail.com
@@ -55,6 +60,7 @@ files:
55
60
  - test/data/bbb.txt
56
61
  - test/data/ccc.c
57
62
  - test/data/sub/ccc.txt
63
+ - test/data/testcase.txt
58
64
  - test/test_cli.rb
59
65
  - test/test_gren.rb
60
66
  - test/test_gren_util.rb
@@ -80,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
86
  version: '0'
81
87
  requirements: []
82
88
  rubyforge_project:
83
- rubygems_version: 1.8.11
89
+ rubygems_version: 1.8.23
84
90
  signing_key:
85
91
  specification_version: 3
86
92
  summary: gren is a next grep tool. The basis is find+grep.
@@ -90,6 +96,7 @@ test_files:
90
96
  - test/data/bbb.txt
91
97
  - test/data/ccc.c
92
98
  - test/data/sub/ccc.txt
99
+ - test/data/testcase.txt
93
100
  - test/test_cli.rb
94
101
  - test/test_gren.rb
95
102
  - test/test_gren_util.rb