milkode 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Gemfile +1 -1
  2. data/HISTORY.ja.rdoc +29 -0
  3. data/HISTORY.rdoc +14 -0
  4. data/VERSION +1 -1
  5. data/bin/gmilk +1 -1
  6. data/bin/milk +1 -1
  7. data/lib/milkode/cdstk/cdstk.rb +90 -38
  8. data/lib/milkode/cdstk/milkode_yaml.rb +6 -0
  9. data/lib/milkode/cdstk/yaml_file_wrapper.rb +4 -0
  10. data/lib/milkode/cdweb/app.rb +5 -5
  11. data/lib/milkode/cdweb/lib/command.rb +20 -4
  12. data/lib/milkode/cdweb/lib/database.rb +20 -16
  13. data/lib/milkode/cdweb/lib/grep.rb +6 -6
  14. data/lib/milkode/cdweb/lib/query.rb +36 -1
  15. data/lib/milkode/cdweb/lib/search_contents.rb +134 -19
  16. data/lib/milkode/cdweb/lib/search_fuzzy_gotoline.rb +162 -0
  17. data/lib/milkode/cdweb/lib/web_setting.rb +9 -1
  18. data/lib/milkode/cdweb/public/css/milkode.css +5 -0
  19. data/lib/milkode/cdweb/public/images/favicon.ico +0 -0
  20. data/lib/milkode/cdweb/public/js/milkode.js +46 -48
  21. data/lib/milkode/cdweb/views/index.haml +1 -0
  22. data/lib/milkode/cli.rb +6 -3
  23. data/lib/milkode/common/util.rb +19 -0
  24. data/lib/milkode/database/document_table.rb +40 -22
  25. data/lib/milkode/database/package_table.rb +1 -1
  26. data/lib/milkode/database/updater.rb +14 -7
  27. data/lib/milkode/findgrep/findgrep.rb +23 -11
  28. data/lib/milkode/grep/cli_grep.rb +1 -4
  29. data/milkode.gemspec +10 -5
  30. data/test/data/.gitignore.sjis +46 -0
  31. data/test/data/ignore_test_sjis/.gitignore +2 -0
  32. data/test/data/ignore_test_sjis/a.txt +1 -0
  33. data/test/test_cdstk.rb +2 -1
  34. data/test/test_ignore_setting.rb +9 -0
  35. data/test/test_query.rb +6 -0
  36. data/test/test_updater.rb +13 -1
  37. data/test/test_util.rb +10 -0
  38. metadata +17 -4
@@ -60,7 +60,7 @@ EOF
60
60
  opt.on('-c', '--count', 'Disp count num.') {|v| my_option[:count] = true }
61
61
  opt.on('--cache', 'Search only db.') {|v| option.groongaOnly = true }
62
62
  opt.on('--color', 'Color highlight.') {|v| option.colorHighlight = true}
63
- opt.on('--cs', '--case-sensitive', 'Case sensitivity.') {|v| my_option[:case_sensitive] = true }
63
+ opt.on('--cs', '--case-sensitive', 'Case sensitivity.') {|v| option.caseSensitive = true }
64
64
  opt.on('-d DIR', '--directory DIR', 'Start directory. (deafult:".")') {|v| current_dir = File.expand_path(v); my_option[:find_mode] = true}
65
65
  opt.on('--db DB_DIR', "Specify dbdir. (Use often with '-a')") {|v| option.dbFile = Dbdir.groonga_path(v) }
66
66
  opt.on('-f FILE_PATH', '--file-path FILE_PATH', 'File path. (Enable multiple call)') {|v| option.filePatterns << v; my_option[:find_mode] = true }
@@ -116,9 +116,6 @@ EOF
116
116
  end
117
117
 
118
118
  if (arguments.size > 0 || my_option[:find_mode])
119
- # ignore?
120
- option.ignoreCase = true if Util::ignore_case?(arguments, my_option[:case_sensitive])
121
-
122
119
  # update
123
120
  if my_option[:update]
124
121
  cdstk = Cdstk.new(stdout, Dbdir.select_dbdir)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.9.5"
8
+ s.version = "0.9.6"
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{2012-12-09}
12
+ s.date = %q{2012-12-28}
13
13
  s.description = %q{Line based local source code search engine & grep-command & web-app.}
14
14
  s.email = %q{ongaeshi0621@gmail.com}
15
15
  s.executables = ["gmilk", "milk"]
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
47
47
  "lib/milkode/cdweb/lib/query.rb",
48
48
  "lib/milkode/cdweb/lib/search_contents.rb",
49
49
  "lib/milkode/cdweb/lib/search_files.rb",
50
+ "lib/milkode/cdweb/lib/search_fuzzy_gotoline.rb",
50
51
  "lib/milkode/cdweb/lib/search_gotoline.rb",
51
52
  "lib/milkode/cdweb/lib/web_setting.rb",
52
53
  "lib/milkode/cdweb/public/css/bootstrap-responsive.min.css",
@@ -74,6 +75,7 @@ Gem::Specification.new do |s|
74
75
  "lib/milkode/cdweb/public/images/MilkodeIcon135.png",
75
76
  "lib/milkode/cdweb/public/images/directory.png",
76
77
  "lib/milkode/cdweb/public/images/document-new-4.png",
78
+ "lib/milkode/cdweb/public/images/favicon.ico",
77
79
  "lib/milkode/cdweb/public/images/file.png",
78
80
  "lib/milkode/cdweb/public/images/go-home-5.png",
79
81
  "lib/milkode/cdweb/public/images/help.png",
@@ -121,6 +123,7 @@ Gem::Specification.new do |s|
121
123
  "lib/milkode/grep/cli_grep.rb",
122
124
  "milkode.gemspec",
123
125
  "test/data/.gitignore",
126
+ "test/data/.gitignore.sjis",
124
127
  "test/data/a_project/cdstk.rb",
125
128
  "test/data/a_project/cdstk_yaml.rb",
126
129
  "test/data/a_project/empty.txt",
@@ -138,6 +141,8 @@ Gem::Specification.new do |s|
138
141
  "test/data/c_project/to/file.rb",
139
142
  "test/data/ignore_test/.gitignore",
140
143
  "test/data/ignore_test/a.txt",
144
+ "test/data/ignore_test_sjis/.gitignore",
145
+ "test/data/ignore_test_sjis/a.txt",
141
146
  "test/data/no_auto_ignore/.gitignore",
142
147
  "test/data/no_auto_ignore/a.txt",
143
148
  "test/data/nodir_abc.zip",
@@ -189,7 +194,7 @@ Gem::Specification.new do |s|
189
194
 
190
195
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
191
196
  s.add_runtime_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
192
- s.add_runtime_dependency(%q<rroonga>, [">= 1.1.0"])
197
+ s.add_runtime_dependency(%q<rroonga>, [">= 1.1.0", "< 2.1.0"])
193
198
  s.add_runtime_dependency(%q<rack>, [">= 1.3.4"])
194
199
  s.add_runtime_dependency(%q<sinatra>, [">= 1.2.6"])
195
200
  s.add_runtime_dependency(%q<launchy>, [">= 0.3.7"])
@@ -204,7 +209,7 @@ Gem::Specification.new do |s|
204
209
  s.add_development_dependency(%q<rack-test>, [">= 0"])
205
210
  else
206
211
  s.add_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
207
- s.add_dependency(%q<rroonga>, [">= 1.1.0"])
212
+ s.add_dependency(%q<rroonga>, [">= 1.1.0", "< 2.1.0"])
208
213
  s.add_dependency(%q<rack>, [">= 1.3.4"])
209
214
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
210
215
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
@@ -220,7 +225,7 @@ Gem::Specification.new do |s|
220
225
  end
221
226
  else
222
227
  s.add_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
223
- s.add_dependency(%q<rroonga>, [">= 1.1.0"])
228
+ s.add_dependency(%q<rroonga>, [">= 1.1.0", "< 2.1.0"])
224
229
  s.add_dependency(%q<rack>, [">= 1.3.4"])
225
230
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
226
231
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
@@ -0,0 +1,46 @@
1
+ # -----------------------------
2
+ # ��UTF-8�̃t�@�C����ǂݍ��ރe�X�g
3
+ # -----------------------------
4
+
5
+ # rcov generated
6
+ coverage
7
+
8
+ # rdoc generated
9
+ rdoc
10
+
11
+ # yard generated
12
+ doc
13
+ .yardoc
14
+
15
+ # bundler
16
+ .bundle
17
+
18
+ # jeweler generated
19
+ pkg
20
+
21
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
22
+ #
23
+ # * Create a file at ~/.gitignore
24
+ # * Include files you want ignored
25
+ # * Run: git config --global core.excludesfile ~/.gitignore
26
+ #
27
+ # After doing this, these files will be ignored in all your git projects,
28
+ # saving you from having to 'pollute' every project you touch with them
29
+ #
30
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
31
+ #
32
+ # For MacOS:
33
+ #
34
+ #.DS_Store
35
+ #
36
+ # For TextMate
37
+ #*.tmproj
38
+ #tmtags
39
+ #
40
+ # For emacs:
41
+ #*~
42
+ #\#*
43
+ #.\#*
44
+ #
45
+ # For vim:
46
+ #*.swp
@@ -0,0 +1,2 @@
1
+ # ���{��(SJIS)
2
+ *.bak
@@ -42,7 +42,8 @@ class TestCdstk < Test::Unit::TestCase
42
42
  # obj.add(['git@github.com:ongaeshi/kodeworld.git'], {})
43
43
  assert_raise(OpenURI::HTTPError) { obj.add(['http://ongaeshi.me/test_data/not_found.zip'], {}) }
44
44
  obj.add(['../data/no_auto_ignore'], {:no_auto_ignore => true})
45
-
45
+ obj.add(['git://github.com/ongaeshi/duplicate-thing.git'], {:protocol => 'git', :name => 'ddd'})
46
+
46
47
  FileUtils.touch('last1.txt')
47
48
  obj.add(['last1.txt'], {})
48
49
  FileUtils.touch('atodekesu.txt')
@@ -104,6 +104,15 @@ EOF
104
104
  end
105
105
  end
106
106
 
107
+ def test_create_from_gitignore_sjis
108
+ Dir.chdir(File.join(File.dirname(__FILE__))) do
109
+ str = Milkode::Util::load_content($stdout, "data/.gitignore.sjis") # sjis -> utf-8
110
+ is = IgnoreSetting.create_from_gitignore("/doc", str)
111
+ assert_equal "/doc", is.path
112
+ assert_equal ["coverage", "rdoc", "doc", ".yardoc", ".bundle", "pkg"], is.ignores
113
+ end
114
+ end
115
+
107
116
  def test_last_slash
108
117
  is = IgnoreSetting.new "/doc", ["/lib/"]
109
118
 
@@ -72,6 +72,12 @@ module Milkode
72
72
  assert_equal q.conv_keywords_to_fpath_or_packages.query_string, 'fp:array fp:test s:rb'
73
73
  end
74
74
 
75
+ def test_gotolines
76
+ q = create_query("g:test.rb:11 a.rb")
77
+ assert_equal q.gotolines, ['test.rb:11']
78
+ assert_equal q.keywords , ['a.rb']
79
+ end
80
+
75
81
  def create_query(query)
76
82
  Query.new(query)
77
83
  end
@@ -22,6 +22,9 @@ module Milkode
22
22
  FileUtils.cp_r @work.expand_path("../data/ignore_test"), @work.expand_path(".")
23
23
  @work.add_package "db1", @work.expand_path("ignore_test")
24
24
 
25
+ FileUtils.cp_r @work.expand_path("../data/ignore_test_sjis"), @work.expand_path(".")
26
+ @work.add_package "db1", @work.expand_path("ignore_test_sjis")
27
+
25
28
  @grndb = GroongaDatabase.new
26
29
  @grndb.open(@work.expand_path("db1"))
27
30
  end
@@ -32,6 +35,7 @@ module Milkode
32
35
  t_add_file
33
36
  t_update_file
34
37
  t_local_gitignore
38
+ t_local_gitignore_sjis
35
39
  t_global_ignore
36
40
  t_no_auto_ignore
37
41
  t_silent_mode
@@ -45,7 +49,7 @@ module Milkode
45
49
  private
46
50
 
47
51
  def t_pre_check
48
- assert_equal 2, @grndb.packages.size
52
+ assert_equal 3, @grndb.packages.size
49
53
  assert_not_nil @grndb.packages['a_project']
50
54
  end
51
55
 
@@ -78,6 +82,14 @@ module Milkode
78
82
  result_test updater.result, 3, 1, 0
79
83
  end
80
84
 
85
+ def t_local_gitignore_sjis
86
+ FileUtils.touch(@work.expand_path("ignore_test_sjis/b.bak")) # *.bak は除外対象
87
+ FileUtils.touch(@work.expand_path("ignore_test_sjis/b.txt"))
88
+ updater = Updater.new(@grndb, 'ignore_test_sjis')
89
+ updater.exec
90
+ result_test updater.result, 3, 1, 0
91
+ end
92
+
81
93
  def t_global_ignore
82
94
  FileUtils.touch(@work.expand_path("ignore_test/c.txt"))
83
95
 
@@ -102,6 +102,16 @@ class TestUtil < Test::Unit::TestCase
102
102
  assert_equal true, Milkode::Util::git_url?('ssh:foo@bar/baz.git')
103
103
  end
104
104
 
105
+ def test_svn_url?
106
+ assert_equal true, Milkode::Util::svn_url?('svn://ongaeshi.me/svn/trunk/')
107
+ assert_equal true, Milkode::Util::svn_url?('svn+ssh://ongaeshi.me/svn/trunk/')
108
+ assert_equal false, Milkode::Util::svn_url?('svna://ongaeshi.me/svn/trunk/')
109
+ assert_equal false, Milkode::Util::svn_url?('http:://ongaeshi.me')
110
+ assert_equal false, Milkode::Util::svn_url?('git://github.com/ongaeshi/milkode.git')
111
+ assert_equal false, Milkode::Util::svn_url?('git@github.com:ongaeshi/milkode.git')
112
+ assert_equal false, Milkode::Util::svn_url?('ssh:foo@bar/baz.git')
113
+ end
114
+
105
115
  def test_divide_shortpath
106
116
  package, restpath = Milkode::Util::divide_shortpath('package/to/a.txt')
107
117
  assert_equal 'package', package
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - ongaeshi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-09 00:00:00 +09:00
18
+ date: 2012-12-28 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,14 @@ dependencies:
57
57
  - 1
58
58
  - 0
59
59
  version: 1.1.0
60
+ - - <
61
+ - !ruby/object:Gem::Version
62
+ hash: 11
63
+ segments:
64
+ - 2
65
+ - 1
66
+ - 0
67
+ version: 2.1.0
60
68
  requirement: *id002
61
69
  - !ruby/object:Gem::Dependency
62
70
  type: :runtime
@@ -284,6 +292,7 @@ files:
284
292
  - lib/milkode/cdweb/lib/query.rb
285
293
  - lib/milkode/cdweb/lib/search_contents.rb
286
294
  - lib/milkode/cdweb/lib/search_files.rb
295
+ - lib/milkode/cdweb/lib/search_fuzzy_gotoline.rb
287
296
  - lib/milkode/cdweb/lib/search_gotoline.rb
288
297
  - lib/milkode/cdweb/lib/web_setting.rb
289
298
  - lib/milkode/cdweb/public/css/bootstrap-responsive.min.css
@@ -311,6 +320,7 @@ files:
311
320
  - lib/milkode/cdweb/public/images/MilkodeIcon135.png
312
321
  - lib/milkode/cdweb/public/images/directory.png
313
322
  - lib/milkode/cdweb/public/images/document-new-4.png
323
+ - lib/milkode/cdweb/public/images/favicon.ico
314
324
  - lib/milkode/cdweb/public/images/file.png
315
325
  - lib/milkode/cdweb/public/images/go-home-5.png
316
326
  - lib/milkode/cdweb/public/images/help.png
@@ -358,6 +368,7 @@ files:
358
368
  - lib/milkode/grep/cli_grep.rb
359
369
  - milkode.gemspec
360
370
  - test/data/.gitignore
371
+ - test/data/.gitignore.sjis
361
372
  - test/data/a_project/cdstk.rb
362
373
  - test/data/a_project/cdstk_yaml.rb
363
374
  - test/data/a_project/empty.txt
@@ -375,6 +386,8 @@ files:
375
386
  - test/data/c_project/to/file.rb
376
387
  - test/data/ignore_test/.gitignore
377
388
  - test/data/ignore_test/a.txt
389
+ - test/data/ignore_test_sjis/.gitignore
390
+ - test/data/ignore_test_sjis/a.txt
378
391
  - test/data/no_auto_ignore/.gitignore
379
392
  - test/data/no_auto_ignore/a.txt
380
393
  - test/data/nodir_abc.zip