gren 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/History.txt +5 -0
  2. data/README.rdoc +177 -39
  3. data/Rakefile +9 -3
  4. data/lib/gren.rb +1 -1
  5. metadata +15 -8
@@ -1,3 +1,8 @@
1
+ === 0.0.6 2010/07/29
2
+
3
+ * update github
4
+ * http://github.com/ongaeshi/gren
5
+
1
6
  === 0.0.1 2010-07-22
2
7
 
3
8
  * 1 major enhancement:
@@ -1,48 +1,186 @@
1
- = gren
1
+ = gren (grep next)
2
2
 
3
- * http://github.com/#{github_username}/#{project_name}
3
+ * http://github.com/ongaeshi/gren
4
4
 
5
5
  == DESCRIPTION:
6
+ grenはgrepの置き換えを狙った次世代型grepツールです。
6
7
 
7
- FIX (describe your package)
8
+ == CONCEPT:
9
+ grepと比べた時の特徴は、
8
10
 
9
- == FEATURES/PROBLEMS:
10
-
11
- * FIX (list of features or problems)
12
-
13
- == SYNOPSIS:
14
-
15
- FIX (code sample of usage)
16
-
17
- == REQUIREMENTS:
18
-
19
- * FIX (list of requirements)
11
+ * 指定ディレクトリ以下にある全てのファイルの中身を調べます
12
+ * バイナリかテキストかをツールが自動で判断して検索してくれます
13
+ * 対象設定(*.rbとか*/*.cpp)は指定しなくて構いません
14
+ * README,README.jaのような特殊な拡張子のファイルも検索対象に含めます
15
+ * .pngや.exeの中身は調べません。
16
+ * *~, .svn, .git, CVS等はデフォルトで探索対象から除外します
17
+ * 表示形式はgrepと同じです
18
+ * emacsのgrep-mode等でそのまま使えます
20
19
 
21
20
  == INSTALL:
22
-
23
- * FIX (sudo gem install, anything else)
21
+ RubyGemからインストールして下さい。
22
+
23
+ gem install gren
24
+
25
+ == USAGE:
26
+ gren [option] pattern [dir]
27
+ -i, --ignore Ignore case.
28
+ -l, --listing The searched file name is displayed.
29
+ -f, --file-regexp REGEXP Search file regexp. (default: ".")
30
+ --if, --ignore-file REGEXP Ignore file pattern.
31
+ --id, --ignore-dir REGEXP Ignore dir pattern.
32
+
33
+ == SAMPLE:
34
+ === 現在ディレクトリ以下で"FileTest"を検索
35
+ % gren FileTest
36
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:34: next unless FileTest.file?(fpath)
37
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:39: unless FileTest.readable?(fpath)
38
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:44: @result.size += FileTest.size(fpath)
39
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:53: @result.search_size += FileTest.size(fpath)
40
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:95: FileTest.directory?(fpath) &&
41
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:34: next unless FileTest.file?(fpath)
42
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:39: unless FileTest.readable?(fpath)
43
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:44: @result.size += FileTest.size(fpath)
44
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:53: @result.search_size += FileTest.size(fpath)
45
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:95: FileTest.directory?(fpath) &&
46
+ lib/gren/findgrep.rb:34: next unless FileTest.file?(fpath)
47
+ lib/gren/findgrep.rb:39: unless FileTest.readable?(fpath)
48
+ lib/gren/findgrep.rb:44: @result.size += FileTest.size(fpath)
49
+ lib/gren/findgrep.rb:53: @result.search_size += FileTest.size(fpath)
50
+ lib/gren/findgrep.rb:95: FileTest.directory?(fpath) &&
51
+
52
+ dir : /Users/ongaeshi/Documents/gren (0.01sec)
53
+ files : 49 in 53 (35.63KB in 61.53KB)
54
+ match : 3 files, 15 hit
55
+
56
+ === pkg/ディレクトリ以下で"FileTest"を検索
57
+ % gren FileTest pkg/
58
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:34: next unless FileTest.file?(fpath)
59
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:39: unless FileTest.readable?(fpath)
60
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:44: @result.size += FileTest.size(fpath)
61
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:53: @result.search_size += FileTest.size(fpath)
62
+ pkg/gren-0.0.5/lib/gren/findgrep.rb:95: FileTest.directory?(fpath) &&
63
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:34: next unless FileTest.file?(fpath)
64
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:39: unless FileTest.readable?(fpath)
65
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:44: @result.size += FileTest.size(fpath)
66
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:53: @result.search_size += FileTest.size(fpath)
67
+ pkg/gren-0.0.4/lib/gren/findgrep.rb:95: FileTest.directory?(fpath) &&
68
+
69
+ dir : /Users/ongaeshi/Documents/gren/pkg (0.01sec)
70
+ files : 32 in 36 (22.64KB in 48.54KB)
71
+ match : 2 files, 10 hit
72
+
73
+ === pkg/ディレクトリ以下、.rbファイルに限定して"FILE"を検索(file : 32 in 36 → file : 14 in 36 になっていることに注目)
74
+ % gren FILE -f "\.rb$"
75
+ pkg/gren-0.0.5/test/test_helper.rb:3:require File.dirname(__FILE__) + '/../lib/gren'
76
+ .
77
+ .
78
+ .
79
+ pkg/gren-0.0.4/lib/gren/cli.rb:3:require File.join(File.dirname(__FILE__), 'findgrep')
80
+
81
+ dir : /Users/ongaeshi/Documents/gren/pkg (0.1sec)
82
+ files : 14 in 36 (15.36KB in 48.54KB)
83
+ match : 12 files, 18 hit
84
+
85
+ === .rbファイルに限定して"FILE"を検索する、ただしpkg/ディレクトリ以下は探索対象から除外
86
+ --id で指定されたディレクトリはそれ以下の探索自体がスキップされます
87
+ % gren FILE -f "\.rb$" --id pkg
88
+ test/test_helper.rb:3:require File.dirname(__FILE__) + '/../lib/gren'
89
+ test/test_gren_cli.rb:1:require File.join(File.dirname(__FILE__), "test_helper.rb")
90
+ test/test_gren.rb:1:require File.dirname(__FILE__) + '/test_helper.rb'
91
+ lib/gren.rb:1:$:.unshift(File.dirname(__FILE__)) unless
92
+ lib/gren.rb:2: $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
93
+ lib/gren/findgrep.rb:3:require File.join(File.dirname(__FILE__), 'result')
94
+ lib/gren/findgrep.rb:7: IGNORE_FILE = /(\A#.*#\Z)|(~\Z)|(\A\.#)/
95
+ lib/gren/findgrep.rb:103: IGNORE_FILE.match(File.basename(fpath)) ||
96
+ lib/gren/cli.rb:3:require File.join(File.dirname(__FILE__), 'findgrep')
97
+
98
+ dir : /Users/ongaeshi/Documents/gren (0.01sec)
99
+ files : 7 in 17 (7.68KB in 11.32KB)
100
+ match : 6 files, 9 hit
101
+
102
+ === .rbファイルに限定して"FILE"を検索する、ただしpkgディレクトリ以下は探索対象から除外、test_*.rbという名前のファイルも除外
103
+ % gren FILE -f "\.rb$" --id pkg --if "test_.+\.rb$"
104
+ lib/gren.rb:1:$:.unshift(File.dirname(__FILE__)) unless
105
+ lib/gren.rb:2: $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
106
+ lib/gren/findgrep.rb:3:require File.join(File.dirname(__FILE__), 'result')
107
+ lib/gren/findgrep.rb:7: IGNORE_FILE = /(\A#.*#\Z)|(~\Z)|(\A\.#)/
108
+ lib/gren/findgrep.rb:103: IGNORE_FILE.match(File.basename(fpath)) ||
109
+ lib/gren/cli.rb:3:require File.join(File.dirname(__FILE__), 'findgrep')
110
+
111
+ dir : /Users/ongaeshi/Documents/gren (0.0sec)
112
+ files : 4 in 17 (7.07KB in 11.32KB)
113
+ match : 3 files, 6 hit
114
+
115
+ === -iオプションを付けると大文字、小文字の違いを無視する
116
+ % gren FILE -i -f "\.rb$" --id pkg --if "test_.+\.rb$"
117
+ lib/gren.rb:1:$:.unshift(File.dirname(__FILE__)) unless
118
+ lib/gren.rb:2: $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
119
+ lib/gren/result.rb:8: attr_accessor :match_file_count
120
+ .
121
+ .
122
+ .
123
+ lib/gren/cli.rb:16: opt.on('--if REGEXP', '--ignore-file REGEXP', 'Ignore file pattern.') {|v| option.ignoreFile = v}
124
+
125
+ dir : /Users/ongaeshi/Documents/gren (0.1sec)
126
+ files : 4 in 17 (7.07KB in 11.32KB)
127
+ match : 4 files, 53 hit
128
+
129
+ === -lでリスティングモード、探索時に辿ったファイル、マッチしたファイル、無視したファイル、無視したディレクトリ、読み込み禁止で読めなかったもの等が一覧出来る
130
+ 大量にテキストが出力される可能性があるので注意(リダイレクト推奨)
131
+ % gren FILE -l
132
+ test/test_helper.rb:3:require File.dirname(__FILE__) + '/../lib/gren'
133
+ .
134
+ .
135
+
136
+ --- search --------
137
+ test/test_helper.rb
138
+ test/test_gren_cli.rb
139
+ .
140
+ .
141
+ total: 49
142
+
143
+ --- match --------
144
+ test/test_helper.rb
145
+ test/test_gren_cli.rb
146
+ .
147
+ .
148
+ total: 30
149
+
150
+ --- ignore-file --------
151
+ pkg/gren-0.0.5.tgz
152
+ pkg/gren-0.0.5.gem
153
+ .
154
+ .
155
+ total: 4
156
+
157
+ --- ignore-dir --------
158
+ .git
159
+ total: 1
160
+
161
+ --- unreadable --------
162
+ total: 0
163
+
164
+
165
+ dir : /Users/ongaeshi/Documents/gren (0.01sec)
166
+ files : 49 in 53 (33.96KB in 59.86KB)
167
+ match : 30 files, 42 hit
168
+
169
+ === おまけ : 自分のホームディレクトリでエゴサーチ(結構ヒットするなー)
170
+ % cd ~
171
+ % gren ongaeshi
172
+ .
173
+ .
174
+ .
175
+
176
+ dir : /Users/ongaeshi (8m 52.45s)
177
+ files : 70237 in 153566 (713.45MB in 91.92GB)
178
+ match : 44 files, 162 hit
179
+
180
+ == for Emacs:
181
+ (global-set-key "\C-x\C-g" 'grep-find) ; キーバインドはお好みで
182
+ ;(setq grep-find-command "gren ") ; for OSX
183
+ ;(setq grep-find-command "gren.bat ") ; for Windows
24
184
 
25
185
  == LICENSE:
26
-
27
- (The MIT License)
28
-
29
- Copyright (c) 2010 ongaeshi
30
-
31
- Permission is hereby granted, free of charge, to any person obtaining
32
- a copy of this software and associated documentation files (the
33
- 'Software'), to deal in the Software without restriction, including
34
- without limitation the rights to use, copy, modify, merge, publish,
35
- distribute, sublicense, and/or sell copies of the Software, and to
36
- permit persons to whom the Software is furnished to do so, subject to
37
- the following conditions:
38
-
39
- The above copyright notice and this permission notice shall be
40
- included in all copies or substantial portions of the Software.
41
-
42
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
186
+ MIT License
data/Rakefile CHANGED
@@ -1,8 +1,12 @@
1
+ # -*- coding: utf-8 -*-
2
+ # -*- ruby -*-
3
+
1
4
  require 'rubygems'
2
5
  gem 'hoe', '>= 2.1.0'
3
6
  require 'hoe'
4
7
  require 'fileutils'
5
8
  require './lib/gren'
9
+ require 'rake_rdoc_custom'
6
10
 
7
11
  Hoe.plugin :newgem
8
12
  # Hoe.plugin :website
@@ -16,11 +20,13 @@ $hoe = Hoe.spec 'gren' do
16
20
  self.rubyforge_name = self.name # TODO this is default value
17
21
  # self.extra_deps = [['activesupport','>= 2.0.2']]
18
22
 
23
+ # 本来はnewgemの中で設定されるべき(後で報告した方がいいかも)
24
+ self.extra_rdoc_files << "README.rdoc"
25
+
26
+ # 本当はhoeの中でこう設定出来たら良い
27
+ # self.spec_extras[:rdoc_options] = ['-c', 'utf8']
19
28
  end
20
29
 
21
30
  require 'newgem/tasks'
22
31
  Dir['tasks/**/*.rake'].each { |t| load t }
23
32
 
24
- # TODO - want other tests/tasks run by default? Add them to the list
25
- # remove_task :default
26
- # task :default => [:spec, :features]
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Gren
5
- VERSION = '0.0.5'
5
+ VERSION = '0.0.6'
6
6
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - ongaeshi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-25 00:00:00 +09:00
17
+ date: 2010-07-29 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,11 +41,14 @@ dependencies:
41
41
  segments:
42
42
  - 2
43
43
  - 6
44
- - 0
45
- version: 2.6.0
44
+ - 1
45
+ version: 2.6.1
46
46
  type: :development
47
47
  version_requirements: *id002
48
- description: FIX (describe your package)
48
+ description: !binary |
49
+ Z3JlbuOBr2dyZXDjga7nva7jgY3mj5vjgYjjgpLni5njgaPjgZ/mrKHkuJbk
50
+ u6PlnotncmVw44OE44O844Or44Gn44GZ44CC
51
+
49
52
  email:
50
53
  - ongaeshi0621@gmail.com
51
54
  executables:
@@ -56,6 +59,7 @@ extra_rdoc_files:
56
59
  - History.txt
57
60
  - Manifest.txt
58
61
  - PostInstall.txt
62
+ - README.rdoc
59
63
  files:
60
64
  - History.txt
61
65
  - Manifest.txt
@@ -74,7 +78,7 @@ files:
74
78
  - test/test_gren_cli.rb
75
79
  - test/test_helper.rb
76
80
  has_rdoc: true
77
- homepage: http://github.com/#{github_username}/#{project_name}
81
+ homepage: http://github.com/ongaeshi/gren
78
82
  licenses: []
79
83
 
80
84
  post_install_message: PostInstall.txt
@@ -103,7 +107,10 @@ rubyforge_project: gren
103
107
  rubygems_version: 1.3.6
104
108
  signing_key:
105
109
  specification_version: 3
106
- summary: FIX (describe your package)
110
+ summary: !binary |
111
+ Z3JlbuOBr2dyZXDjga7nva7jgY3mj5vjgYjjgpLni5njgaPjgZ/mrKHkuJbk
112
+ u6PlnotncmVw44OE44O844Or44Gn44GZ44CC
113
+
107
114
  test_files:
108
115
  - test/test_gren.rb
109
116
  - test/test_gren_cli.rb