milkode 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ === 0.3.0 2012/01/20
2
+
3
+ * gmilk
4
+ * -k, -lオプションの追加、絞り込み検索が簡単に出来るように
5
+ * 全て小文字で入力したら大文字小文字は無視、大文字が一つでも入れば厳密に検索
6
+ * milk
7
+ * milk info コマンドを追加
8
+ * milk list コマンドの際、パッケージのファイル数を表示するように
9
+ * その他
10
+ * cdv, cdview を削除
11
+
1
12
  === 0.2.9 2011/12/24
2
13
 
3
14
  * gmilk
@@ -1,3 +1,14 @@
1
+ === 0.3.0 2012/01/20
2
+
3
+ * gmilk
4
+ * Add -k -l option.
5
+ * If you type lowercase all ignore case, case is one of the strictly search.
6
+ * milk
7
+ * Add 'milk info'.
8
+ * To display the number of files in the package when 'milk list'.
9
+ * etc
10
+ * Delete cdv, cdview.
11
+
1
12
  === 0.2.9 2011/12/24
2
13
 
3
14
  * gmilk
data/Rakefile CHANGED
@@ -16,8 +16,8 @@ Jeweler::Tasks.new do |gem|
16
16
  gem.name = "milkode"
17
17
  gem.homepage = "http://github.com/ongaeshi/milkode"
18
18
  gem.license = "MIT"
19
- gem.summary = %Q{Line based local source code search engine & web-app.}
20
- gem.description = %Q{Line based local source code search engine & web-app.}
19
+ gem.summary = %Q{Line based local source code search engine & grep-command & web-app.}
20
+ gem.description = %Q{Line based local source code search engine & grep-command & web-app.}
21
21
  gem.email = "ongaeshi0621@gmail.com"
22
22
  gem.authors = ["ongaeshi"]
23
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.3.0
data/bin/gmilk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/grep/cli_grep'
8
8
 
9
- Version = "0.2.9"
9
+ Version = "0.3.0"
10
10
  Milkode::CLI_Grep.execute(STDOUT, ARGV)
data/bin/milk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/cdstk/cli_cdstk'
8
8
 
9
- Version = "0.2.9"
9
+ Version = "0.3.0"
10
10
  Milkode::CLI_Cdstk.execute(STDOUT, ARGV)
@@ -276,6 +276,13 @@ module Milkode
276
276
  }.join("\n")
277
277
 
278
278
  @out.puts str
279
+
280
+ # print information
281
+ if args.empty?
282
+ milkode_info
283
+ else
284
+ list_info(a) unless a.empty?
285
+ end
279
286
  end
280
287
 
281
288
  def pwd(options)
@@ -416,6 +423,10 @@ mcd() {
416
423
  EOF
417
424
  end
418
425
 
426
+ def info(args, options)
427
+ milkode_info
428
+ end
429
+
419
430
  private
420
431
 
421
432
  def db_file
@@ -498,6 +509,17 @@ EOF
498
509
  end
499
510
  end
500
511
 
512
+ def list_info(packages)
513
+ option = FindGrep::FindGrep::DEFAULT_OPTION.dup
514
+ option.dbFile = Dbdir.groonga_path(Dbdir.default_dir)
515
+ option.isSilent = true
516
+ option.packages = packages.map{|v| v[1]}
517
+ findGrep = FindGrep::FindGrep.new([], option)
518
+ records = findGrep.pickupRecords
519
+
520
+ alert('*milk_list*', "#{packages.size} packages, #{records.size} records in #{db_file}.")
521
+ end
522
+
501
523
  def db_define
502
524
  Groonga::Schema.define do |schema|
503
525
  schema.create_table("documents", :type => :hash) do |table|
@@ -19,6 +19,7 @@ The most commonly used #{File.basename($0)} are:
19
19
  dir Disp package dir.
20
20
  dump Dump records.
21
21
  grep Print lines matching a pattern
22
+ info Disp information.
22
23
  init Init db.
23
24
  list List packages.
24
25
  mcd Print 'mcd' command.
@@ -60,6 +61,7 @@ EOF
60
61
  subopt['dir'], suboptions['dir'] = CLI_Cdstksub.setup_dir
61
62
  subopt['setdb'], suboptions['setdb'] = CLI_Cdstksub.setup_setdb
62
63
  subopt['mcd'], suboptions['mcd'] = CLI_Cdstksub.setup_mcd
64
+ subopt['info'], suboptions['info'] = CLI_Cdstksub.setup_info
63
65
 
64
66
  if (subopt[subcommand])
65
67
  subopt[subcommand].parse!(arguments) unless arguments.empty?
@@ -97,6 +99,8 @@ EOF
97
99
  obj.setdb(arguments, suboptions[subcommand])
98
100
  when 'mcd'
99
101
  obj.mcd(arguments, suboptions[subcommand])
102
+ when 'info'
103
+ obj.info(arguments, suboptions[subcommand])
100
104
  end
101
105
  else
102
106
  if subcommand
@@ -133,5 +133,13 @@ EOF
133
133
 
134
134
  return opt, options
135
135
  end
136
+
137
+ def self.setup_info
138
+ options = {}
139
+
140
+ opt = OptionParser.new("#{File.basename($0)} info")
141
+
142
+ return opt, options
143
+ end
136
144
  end
137
145
  end
@@ -18,7 +18,7 @@ require 'milkode/cdweb/lib/mkurl'
18
18
  set :haml, :format => :html5
19
19
 
20
20
  get '/' do
21
- @version = "0.2.9"
21
+ @version = "0.3.0"
22
22
  @package_num = Database.instance.fileList('').size
23
23
  @file_num = Database.instance.fileNum
24
24
  haml :index
@@ -99,6 +99,11 @@ module Milkode
99
99
  str
100
100
  end
101
101
  end
102
+
103
+ def downcase?(str)
104
+ str == str.downcase
105
+ end
106
+
102
107
  end
103
108
  end
104
109
 
@@ -197,6 +202,5 @@ module Gren
197
202
  puts
198
203
  end
199
204
  module_function :p_classtree_sub
200
-
201
205
  end
202
206
  end
@@ -15,8 +15,8 @@ require 'pathname'
15
15
 
16
16
  module FindGrep
17
17
  class FindGrep
18
- Option = Struct.new(:keywordsNot,
19
- :keywordsOr,
18
+ Option = Struct.new(:patternsNot,
19
+ :patternsOr,
20
20
  :directory,
21
21
  :depth,
22
22
  :ignoreCase,
@@ -34,7 +34,8 @@ module FindGrep
34
34
  :groongaOnly,
35
35
  :isMatchFile,
36
36
  :dispHtml,
37
- :matchCountLimit)
37
+ :matchCountLimit,
38
+ :keywords)
38
39
 
39
40
  DEFAULT_OPTION = Option.new([],
40
41
  [],
@@ -55,7 +56,8 @@ module FindGrep
55
56
  false,
56
57
  false,
57
58
  false,
58
- -1)
59
+ -1,
60
+ [])
59
61
 
60
62
  class MatchCountOverError < RuntimeError ; end
61
63
 
@@ -65,8 +67,8 @@ module FindGrep
65
67
  @patterns = patterns
66
68
  @option = option
67
69
  @patternRegexps = strs2regs(patterns, @option.ignoreCase)
68
- @subRegexps = strs2regs(option.keywordsNot, @option.ignoreCase)
69
- @orRegexps = strs2regs(option.keywordsOr, @option.ignoreCase)
70
+ @subRegexps = strs2regs(option.patternsNot, @option.ignoreCase)
71
+ @orRegexps = strs2regs(option.patternsOr, @option.ignoreCase)
70
72
  @filePatterns = (!@option.dbFile) ? strs2regs(option.filePatterns) : []
71
73
  @ignoreFiles = strs2regs(option.ignoreFiles)
72
74
  @ignoreDirs = strs2regs(option.ignoreDirs)
@@ -135,12 +137,47 @@ module FindGrep
135
137
  end
136
138
  end
137
139
 
140
+ def pickupRecords
141
+ raise unless @option.dbFile
142
+ searchDatabase
143
+ end
144
+
138
145
  def searchFromDB(stdout, dir)
146
+ # データベースを検索
147
+ records = searchDatabase
148
+
149
+ # ヒットしたレコード数
150
+ stdout.puts "Found : #{records.size} records." if (!@option.dispHtml && !@option.isSilent)
151
+
152
+ # 検索にヒットしたファイルを実際に検索
153
+ begin
154
+ if (@patterns.size > 0)
155
+ records.each do |record|
156
+ if (@option.groongaOnly)
157
+ searchGroongaOnly(stdout, record)
158
+ else
159
+ searchFile(stdout, record.path, record.path) if FileTest.exist?(record.path)
160
+ end
161
+ end
162
+ else
163
+ records.each do |record|
164
+ path = record.path
165
+ relative_path = Milkode::Util::relative_path(path, Dir.pwd).to_s
166
+ stdout.puts relative_path
167
+ @result.match_file_count += 1
168
+ raise MatchCountOverError if (0 < @option.matchCountLimit && @option.matchCountLimit <= @result.match_file_count)
169
+ end
170
+ end
171
+ rescue MatchCountOverError
172
+ end
173
+ end
174
+
175
+ def searchDatabase
139
176
  # 全てのパターンを検索
140
177
  table = @documents.select do |record|
141
178
  expression = nil
142
179
 
143
- # キーワード
180
+ # パターン(マッチ行)
144
181
  @patterns.each do |word|
145
182
  sub_expression = record.content =~ word
146
183
  if expression.nil?
@@ -149,6 +186,17 @@ module FindGrep
149
186
  expression &= sub_expression
150
187
  end
151
188
  end
189
+
190
+ # キーワード(絞り込むための手がかり)
191
+ @option.keywords.each do |word|
192
+ sub_expression = record.content =~ word
193
+ sub_expression |= record.path =~ word
194
+ if expression.nil?
195
+ expression = sub_expression
196
+ else
197
+ expression &= sub_expression
198
+ end
199
+ end
152
200
 
153
201
  # パッケージ(OR)
154
202
  pe = package_expression(record, @option.packages)
@@ -190,32 +238,7 @@ module FindGrep
190
238
  # {:key => "timestamp", :order => "descending"}])
191
239
 
192
240
  # ファイル名でソート
193
- records = table.sort([{:key => "shortpath", :order => "ascending"}])
194
-
195
- # データベースにヒット
196
- stdout.puts "Found : #{records.size} records." if (!@option.dispHtml && !@option.isSilent)
197
-
198
- # 検索にヒットしたファイルを実際に検索
199
- begin
200
- if (@patterns.size > 0)
201
- records.each do |record|
202
- if (@option.groongaOnly)
203
- searchGroongaOnly(stdout, record)
204
- else
205
- searchFile(stdout, record.path, record.path) if FileTest.exist?(record.path)
206
- end
207
- end
208
- else
209
- records.each do |record|
210
- path = record.path
211
- relative_path = Milkode::Util::relative_path(path, Dir.pwd).to_s
212
- stdout.puts relative_path
213
- @result.match_file_count += 1
214
- raise MatchCountOverError if (0 < @option.matchCountLimit && @option.matchCountLimit <= @result.match_file_count)
215
- end
216
- end
217
- rescue MatchCountOverError
218
- end
241
+ table.sort([{:key => "shortpath", :order => "ascending"}])
219
242
  end
220
243
 
221
244
  def and_expression(key, list)
@@ -10,9 +10,12 @@ module Milkode
10
10
  class CLI_Grep
11
11
  def self.execute(stdout, arguments=[])
12
12
  option = FindGrep::FindGrep::DEFAULT_OPTION.dup
13
+
14
+ # default option
13
15
  option.dbFile = Dbdir.groonga_path(Dbdir.default_dir)
14
16
  option.isSilent = true
15
-
17
+
18
+ # local option
16
19
  my_option = {}
17
20
  my_option[:packages] = []
18
21
 
@@ -21,24 +24,48 @@ module Milkode
21
24
  rescue NotFoundPackage => e
22
25
  current_dir = File.expand_path(".")
23
26
  end
24
-
27
+
25
28
  # opt = OptionParser.new "#{File.basename($0)} [option] pattern"
26
- opt = OptionParser.new "gmilk [option] pattern" # @memo milk grep からも呼ばれるため
27
- opt.on('-f KEYWORD', '--file-keyword KEYWORD', 'File path. (Enable multiple call)') {|v| option.filePatterns << v; my_option[:find_mode] = true }
28
- opt.on('-d DIR', '--directory DIR', 'Start directory. (deafult:".")') {|v| current_dir = File.expand_path(v); my_option[:find_mode] = true}
29
- opt.on('-s SUFFIX', '--suffix SUFFIX', 'Suffix.') {|v| option.suffixs << v; my_option[:find_mode] = true }
30
- opt.on('-r', '--root', 'Search from package root.') {|v| current_dir = package_root_dir(File.expand_path(".")) }
31
- opt.on('-p PACKAGE', '--package PACKAGE', 'Specify search package.') {|v| setup_package(option, my_option, v) }
29
+ opt = OptionParser.new <<EOF
30
+ gmilk [option] pattern
31
+ gmilk is 'milk grep'.
32
+
33
+ Stateful:
34
+ -l, Change state 'line'. (Match line words.)
35
+ -k, Change state 'keyword'. (Match file-content or file-path.)
36
+ First state is 'line'.
37
+ Example: gmilk line1 line2 -k keyword1 keyword2 -l line3 -k keyword3 ...
38
+
39
+ Normal:
40
+ EOF
32
41
  opt.on('-a', '--all', 'Search all package.') {|v| my_option[:all] = true }
33
- opt.on('-n NUM', 'Limits the number of match to show.') {|v| option.matchCountLimit = v.to_i }
34
- opt.on('-i', '--ignore', 'Ignore case.') {|v| option.ignoreCase = true}
42
+ opt.on('--cache', 'Search only db.') {|v| option.groongaOnly = true }
35
43
  opt.on('--color', 'Color highlight.') {|v| option.colorHighlight = true}
44
+ opt.on('--cs', '--case-sensitive', 'Case sensitivity.') {|v| my_option[:case_sensitive] = true }
45
+ opt.on('-d DIR', '--directory DIR', 'Start directory. (deafult:".")') {|v| current_dir = File.expand_path(v); my_option[:find_mode] = true}
46
+ opt.on('-f FILE_PATH', '--file-path FILE_PATH', 'File path. (Enable multiple call)') {|v| option.filePatterns << v; my_option[:find_mode] = true }
47
+ opt.on('-n NUM', 'Limits the number of match to show.') {|v| option.matchCountLimit = v.to_i }
36
48
  opt.on('--no-snip', 'There being a long line, it does not snip.') {|v| option.noSnip = true }
37
- opt.on('--cache', 'Search only db.') {|v| option.groongaOnly = true }
38
- opt.on('--verbose', 'Set the verbose level of output.') {|v| option.isSilent = false }
49
+ opt.on('-p PACKAGE', '--package PACKAGE', 'Specify search package.') {|v| setup_package(option, my_option, v) }
50
+ opt.on('-r', '--root', 'Search from package root.') {|v| current_dir = package_root_dir(File.expand_path(".")); my_option[:find_mode] = true }
51
+ opt.on('-s SUFFIX', '--suffix SUFFIX', 'Suffix.') {|v| option.suffixs << v; my_option[:find_mode] = true }
39
52
  opt.on('-u', '--update', 'With update db.') {|v| my_option[:update] = true }
53
+ opt.on('--verbose', 'Set the verbose level of output.') {|v| option.isSilent = false }
54
+
40
55
  begin
56
+ ap = ArgumentParser.new arguments
57
+
58
+ ap.prev
41
59
  opt.parse!(arguments)
60
+ ap.after
61
+
62
+ arguments = ap.arguments
63
+ option.keywords = ap.keywords
64
+ my_option[:find_mode] = true unless ap.keywords.empty?
65
+
66
+ # p ap.arguments
67
+ # p ap.keywords
68
+
42
69
  rescue NotFoundPackage => e
43
70
  stdout.puts "fatal: Not found package '#{e}'."
44
71
  return
@@ -54,6 +81,10 @@ module Milkode
54
81
  end
55
82
 
56
83
  if (arguments.size > 0 || my_option[:find_mode])
84
+ # ignore?
85
+ downcase_all = arguments.all? {|v| Util::downcase? v}
86
+ option.ignoreCase = true if downcase_all && !my_option[:case_sensitive]
87
+
57
88
  # update
58
89
  if my_option[:update]
59
90
  cdstk = Cdstk.new(stdout, Dbdir.select_dbdir)
@@ -106,6 +137,48 @@ module Milkode
106
137
  CdstkYaml.load(Dbdir.select_dbdir)
107
138
  end
108
139
 
140
+ class ArgumentParser
141
+ attr_reader :arguments
142
+ attr_reader :keywords
143
+
144
+ def initialize(arguments)
145
+ @arguments = arguments
146
+ @keywords = []
147
+ @state = :line
148
+ end
149
+
150
+ def prev
151
+ @arguments.map! do |v|
152
+ v.gsub("-l", ":l").
153
+ gsub("-k", ":k")
154
+ end
155
+ end
156
+
157
+ def after
158
+ result = []
159
+
160
+ @arguments.each do |v|
161
+ case v
162
+ when ":l"
163
+ @state = :line
164
+ next
165
+ when ":k"
166
+ @state = :keyword
167
+ next
168
+ end
169
+
170
+ case @state
171
+ when :line
172
+ result << v
173
+ when :keyword
174
+ @keywords << v
175
+ end
176
+ end
177
+
178
+ @arguments = result
179
+ end
180
+ end
181
+
109
182
  # --- error ---
110
183
  class NotFoundPackage < RuntimeError ; end
111
184
 
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.2.9"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ongaeshi"]
12
- s.date = %q{2011-12-24}
13
- s.description = %q{Line based local source code search engine & web-app.}
12
+ s.date = %q{2012-01-20}
13
+ s.description = %q{Line based local source code search engine & grep-command & web-app.}
14
14
  s.email = %q{ongaeshi0621@gmail.com}
15
- s.executables = ["cdv", "gmilk", "milk", "cdview"]
15
+ s.executables = ["gmilk", "milk"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.rdoc"
@@ -27,8 +27,6 @@ Gem::Specification.new do |s|
27
27
  "README.rdoc",
28
28
  "Rakefile",
29
29
  "VERSION",
30
- "bin/cdv",
31
- "bin/cdview",
32
30
  "bin/gmilk",
33
31
  "bin/milk",
34
32
  "lib/milkode/cdstk/cdstk.rb",
@@ -36,7 +34,6 @@ Gem::Specification.new do |s|
36
34
  "lib/milkode/cdstk/cdstk_yaml.rb",
37
35
  "lib/milkode/cdstk/cli_cdstk.rb",
38
36
  "lib/milkode/cdstk/cli_cdstksub.rb",
39
- "lib/milkode/cdview/cli_cdview.rb",
40
37
  "lib/milkode/cdweb/app.rb",
41
38
  "lib/milkode/cdweb/cli_cdweb.rb",
42
39
  "lib/milkode/cdweb/config.ru",
@@ -111,7 +108,7 @@ Gem::Specification.new do |s|
111
108
  s.licenses = ["MIT"]
112
109
  s.require_paths = ["lib"]
113
110
  s.rubygems_version = %q{1.3.6}
114
- s.summary = %q{Line based local source code search engine & web-app.}
111
+ s.summary = %q{Line based local source code search engine & grep-command & web-app.}
115
112
  s.test_files = [
116
113
  "test/data/a_project/cdstk.rb",
117
114
  "test/data/a_project/cdstk_yaml.rb",
@@ -8,16 +8,14 @@
8
8
  require 'rubygems'
9
9
  require 'test/unit'
10
10
  require 'milkode/cdstk/cli_cdstk'
11
- require 'milkode/cdview/cli_cdview'
12
11
 
13
12
  class TestBinExec < Test::Unit::TestCase
14
13
  def test_bin_exec
15
14
  io = StringIO.new
16
-
15
+
16
+ # milk
17
17
  Milkode::CLI_Cdstk.execute(io)
18
18
 
19
- Milkode::CLI_Cdview.execute(io)
20
-
21
19
  # 一定時間だけ起動するような仕組みは無いものか
22
20
  # Milkode::CLI_Cdweb.execute(io, "--no-browser -p 5555".split)
23
21
 
@@ -22,6 +22,7 @@ class TestCLI_Cdstk < Test::Unit::TestCase
22
22
  t_grep
23
23
  t_mcd
24
24
  t_setdb
25
+ t_info
25
26
  end
26
27
 
27
28
  def teardown
@@ -40,6 +41,10 @@ class TestCLI_Cdstk < Test::Unit::TestCase
40
41
  assert_match /mcd/, command("mcd")
41
42
  end
42
43
 
44
+ def t_info
45
+ assert_match /.*packages.*records/, command("info")
46
+ end
47
+
43
48
  def t_setdb
44
49
  # 引数無しで現在の値を表示
45
50
  assert_equal @work.expand_path("db1") + "\n", command("setdb")
@@ -23,6 +23,8 @@ class TestCLI_Grep < Test::Unit::TestCase
23
23
  t_not_package_root
24
24
  t_exec_onlysuffix
25
25
  t_cache
26
+ t_case_sensitive
27
+ t_keyword
26
28
  end
27
29
 
28
30
  def teardown
@@ -72,6 +74,24 @@ class TestCLI_Grep < Test::Unit::TestCase
72
74
  CLI_Grep.execute(io, "-p a_project test --cache".split)
73
75
  assert_match "grenfiletest", io.string
74
76
  end
77
+
78
+ def t_case_sensitive
79
+ io = StringIO.new
80
+ CLI_Grep.execute(io, "-p a_project default tokenizer".split)
81
+ assert_equal 3, io.string.split("\n").count
82
+
83
+ io = StringIO.new
84
+ CLI_Grep.execute(io, "-p a_project default tokenizer --cs".split)
85
+ assert_equal 1, io.string.split("\n").count
86
+ end
87
+
88
+ def t_keyword
89
+ io = StringIO.new
90
+ CLI_Grep.execute(io, "a b -k c d".split)
91
+ CLI_Grep.execute(io, "a -n 5 b -k c d".split)
92
+ CLI_Grep.execute(io, "a b -k -p a_project c d".split)
93
+ CLI_Grep.execute(io, "a b -k c d -l e -k f".split)
94
+ end
75
95
  end
76
96
 
77
97
 
@@ -63,6 +63,13 @@ class TestUtil < Test::Unit::TestCase
63
63
  Milkode::Util::filename_to_utf8(create_filename_str('ダミー'))
64
64
  end
65
65
  end
66
+
67
+ def test_downcase?
68
+ assert !Milkode::Util::downcase?("DUMMY")
69
+ assert Milkode::Util::downcase?("dummy")
70
+ assert !Milkode::Util::downcase?("Dummy")
71
+ assert !Milkode::Util::downcase?("dummyNode")
72
+ end
66
73
 
67
74
  def teardown
68
75
  teardown_custom(true)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 9
9
- version: 0.2.9
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
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: 2011-12-24 00:00:00 +09:00
17
+ date: 2012-01-20 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -225,13 +225,11 @@ dependencies:
225
225
  requirement: *id015
226
226
  prerelease: false
227
227
  type: :runtime
228
- description: Line based local source code search engine & web-app.
228
+ description: Line based local source code search engine & grep-command & web-app.
229
229
  email: ongaeshi0621@gmail.com
230
230
  executables:
231
- - cdv
232
231
  - gmilk
233
232
  - milk
234
- - cdview
235
233
  extensions: []
236
234
 
237
235
  extra_rdoc_files:
@@ -247,8 +245,6 @@ files:
247
245
  - README.rdoc
248
246
  - Rakefile
249
247
  - VERSION
250
- - bin/cdv
251
- - bin/cdview
252
248
  - bin/gmilk
253
249
  - bin/milk
254
250
  - lib/milkode/cdstk/cdstk.rb
@@ -256,7 +252,6 @@ files:
256
252
  - lib/milkode/cdstk/cdstk_yaml.rb
257
253
  - lib/milkode/cdstk/cli_cdstk.rb
258
254
  - lib/milkode/cdstk/cli_cdstksub.rb
259
- - lib/milkode/cdview/cli_cdview.rb
260
255
  - lib/milkode/cdweb/app.rb
261
256
  - lib/milkode/cdweb/cli_cdweb.rb
262
257
  - lib/milkode/cdweb/config.ru
@@ -355,7 +350,7 @@ rubyforge_project:
355
350
  rubygems_version: 1.3.6
356
351
  signing_key:
357
352
  specification_version: 3
358
- summary: Line based local source code search engine & web-app.
353
+ summary: Line based local source code search engine & grep-command & web-app.
359
354
  test_files:
360
355
  - test/data/a_project/cdstk.rb
361
356
  - test/data/a_project/cdstk_yaml.rb
data/bin/cdv DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Created on 2010-8-25.
4
- # Copyright (c) 2010. All rights reserved.
5
-
6
- load File.join(File.dirname(__FILE__), "cdview")
data/bin/cdview DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Created on 2010-8-25.
4
- # Copyright (c) 2010. All rights reserved.
5
-
6
- require 'rubygems'
7
- require 'milkode/cdview/cli_cdview'
8
-
9
- Version = "0.1.0"
10
- Milkode::CLI_Cdview.execute(STDOUT, ARGV)
@@ -1,43 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'optparse'
3
- require 'milkode/findgrep/findgrep'
4
- require 'milkode/common/dbdir'
5
- include Milkode
6
-
7
- module Milkode
8
- class CLI_Cdview
9
- def self.execute(stdout, arguments=[])
10
- # オプション
11
- option = FindGrep::FindGrep::DEFAULT_OPTION
12
- option.dbFile = Dbdir.groonga_path(Dbdir.default_dir)
13
-
14
- # デフォルトのマッチモードは'File'
15
- option.isMatchFile = true
16
-
17
- # オプション解析
18
- opt = OptionParser.new("#{File.basename($0)} [option] keyword1 [keyword2 ...]")
19
- opt.on('--db [GREN_DB_FILE]', 'Search from the grendb database.') {|v| option.dbFile = Dbdir.groonga_path(v) }
20
- opt.on('-f KEYWORD', '--file-keyword KEYWORD', 'Path keyword. (Enable multiple call)') {|v| option.filePatterns << v}
21
- opt.on('-s SUFFIX', '--suffix SUFFIX', 'Search suffix.') {|v| option.suffixs << v }
22
- opt.on('-i', '--ignore', 'Ignore case.') {|v| option.ignoreCase = true}
23
- opt.on('-c', '--color', 'Color highlight.') {|v| option.colorHighlight = true}
24
- opt.on('--no-snip', 'There being a long line, it does not snip.') {|v| option.noSnip = true }
25
- opt.on('-g', '--groonga-only', 'Search only groonga db.') {|v| option.groongaOnly = true }
26
- opt.on('--mf', '--match-file', 'Match file. (Default)') {|v| option.isMatchFile = true }
27
- opt.on('-l', '--ml', '--match-line', 'Match line, same mode as "gren".') {|v| option.isMatchFile = false }
28
-
29
- opt.parse!(arguments)
30
-
31
- # 検索オブジェクトの生成
32
- if (option.dbFile && (arguments.size > 0 || option.keywordsOr.size > 0))
33
- findGrep = FindGrep::FindGrep.new(arguments, option)
34
- findGrep.searchAndPrint(stdout)
35
- else
36
- stdout.print opt.help
37
- stdout.puts
38
- stdout.puts "please set GREN DATABSE FILE!! (--db option, or set ENV['GRENDB_DEFAULT_DB'].)" unless option.dbFile
39
- end
40
-
41
- end
42
- end
43
- end