milkode 0.9.9 → 0.9.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.travis.yml +2 -1
  2. data/Gemfile +12 -11
  3. data/HISTORY.ja.rdoc +41 -1
  4. data/HISTORY.rdoc +28 -1
  5. data/VERSION +1 -1
  6. data/bin/gmilk +1 -1
  7. data/bin/milk +1 -1
  8. data/lib/milkode/cdstk/cdstk.rb +15 -1
  9. data/lib/milkode/cdstk/package.rb +16 -0
  10. data/lib/milkode/cdweb/app.rb +72 -9
  11. data/lib/milkode/cdweb/cli_cdweb.rb +25 -55
  12. data/lib/milkode/cdweb/lib/database.rb +14 -0
  13. data/lib/milkode/cdweb/lib/info_home.rb +30 -0
  14. data/lib/milkode/cdweb/lib/info_package.rb +83 -0
  15. data/lib/milkode/cdweb/lib/package_list.rb +18 -0
  16. data/lib/milkode/cdweb/public/css/milkode.css +93 -8
  17. data/lib/milkode/cdweb/public/images/info-big.png +0 -0
  18. data/lib/milkode/cdweb/public/images/info.png +0 -0
  19. data/lib/milkode/cdweb/public/images/milkode-directpath-copy.gif +0 -0
  20. data/lib/milkode/cdweb/public/images/milkode-star.png +0 -0
  21. data/lib/milkode/cdweb/public/js/milkode.js +35 -5
  22. data/lib/milkode/cdweb/views/filelist.haml +9 -1
  23. data/lib/milkode/cdweb/views/header_menu.haml +1 -1
  24. data/lib/milkode/cdweb/views/help.haml +70 -23
  25. data/lib/milkode/cdweb/views/info_home.haml +14 -0
  26. data/lib/milkode/cdweb/views/info_package.haml +13 -0
  27. data/lib/milkode/cdweb/views/layout.haml +1 -0
  28. data/lib/milkode/cdweb/views/packages.haml +6 -2
  29. data/lib/milkode/cdweb/views/search.haml +13 -7
  30. data/lib/milkode/cdweb/views/search_form.haml +2 -0
  31. data/lib/milkode/cdweb/views/view.haml +9 -1
  32. data/lib/milkode/cli.rb +3 -2
  33. data/lib/milkode/common/util.rb +6 -2
  34. data/lib/milkode/database/document_table.rb +4 -0
  35. data/lib/milkode/database/package_table.rb +4 -0
  36. data/lib/milkode/grep/cli_grep.rb +48 -36
  37. data/lib/milkode/grep/fast_gotoline.rb +53 -0
  38. data/lib/milkode/{findgrep → grep}/findgrep.rb +42 -56
  39. data/lib/milkode/grep/findgrep_option.rb +63 -0
  40. data/milkode.gemspec +22 -11
  41. data/test/test_cli.rb +3 -1
  42. data/test/test_cli_grep.rb +1 -1
  43. data/test/test_findgrep.rb +2 -2
  44. data/test/test_milkode_yaml.rb +48 -4
  45. data/test/test_query.rb +2 -0
  46. metadata +39 -22
  47. data/lib/milkode/common/archive-zip.rb +0 -10
  48. data/lib/milkode/findgrep/result.rb +0 -43
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # @file
4
+ # @brief
5
+ # @author ongaeshi
6
+ # @date 2013/05/03
7
+
8
+ module Milkode
9
+ class FindGrepOption
10
+ Option = Struct.new(:patternsNot,
11
+ :patternsOr,
12
+ :directory,
13
+ :depth,
14
+ :ignoreCase,
15
+ :caseSensitive,
16
+ :colorHighlight,
17
+ :isSilent,
18
+ :debugMode,
19
+ :packages,
20
+ :strict_packages,
21
+ :filePatterns,
22
+ :suffixs,
23
+ :ignoreFiles,
24
+ :ignoreDirs,
25
+ :kcode,
26
+ :noSnip,
27
+ :dbFile,
28
+ :groongaOnly,
29
+ :isMatchFile,
30
+ :dispHtml,
31
+ :matchCountLimit,
32
+ :keywords,
33
+ :gotoline)
34
+
35
+ def self.create_default
36
+ Option.new([],
37
+ [],
38
+ ".",
39
+ -1,
40
+ false,
41
+ false,
42
+ false,
43
+ false,
44
+ false,
45
+ [],
46
+ [],
47
+ [],
48
+ [],
49
+ [],
50
+ [],
51
+ Kconv::UTF8, # Platform.get_shell_kcode,
52
+ false,
53
+ nil,
54
+ false,
55
+ false,
56
+ false,
57
+ -1,
58
+ [],
59
+ -1)
60
+ end
61
+ end
62
+ end
63
+
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.9.9"
8
+ s.version = "0.9.9.9"
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{2013-03-26}
12
+ s.date = %q{2013-05-05}
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"]
@@ -43,6 +43,8 @@ Gem::Specification.new do |s|
43
43
  "lib/milkode/cdweb/lib/command.rb",
44
44
  "lib/milkode/cdweb/lib/database.rb",
45
45
  "lib/milkode/cdweb/lib/grep.rb",
46
+ "lib/milkode/cdweb/lib/info_home.rb",
47
+ "lib/milkode/cdweb/lib/info_package.rb",
46
48
  "lib/milkode/cdweb/lib/mkurl.rb",
47
49
  "lib/milkode/cdweb/lib/package_list.rb",
48
50
  "lib/milkode/cdweb/lib/query.rb",
@@ -82,6 +84,10 @@ Gem::Specification.new do |s|
82
84
  "lib/milkode/cdweb/public/images/file.png",
83
85
  "lib/milkode/cdweb/public/images/go-home-5.png",
84
86
  "lib/milkode/cdweb/public/images/help.png",
87
+ "lib/milkode/cdweb/public/images/info-big.png",
88
+ "lib/milkode/cdweb/public/images/info.png",
89
+ "lib/milkode/cdweb/public/images/milkode-directpath-copy.gif",
90
+ "lib/milkode/cdweb/public/images/milkode-star.png",
85
91
  "lib/milkode/cdweb/public/images/view-refresh-4.png",
86
92
  "lib/milkode/cdweb/public/images/waiting.gif",
87
93
  "lib/milkode/cdweb/public/img/glyphicons-halflings-white.png",
@@ -97,13 +103,14 @@ Gem::Specification.new do |s|
97
103
  "lib/milkode/cdweb/views/header_menu.haml",
98
104
  "lib/milkode/cdweb/views/help.haml",
99
105
  "lib/milkode/cdweb/views/index.haml",
106
+ "lib/milkode/cdweb/views/info_home.haml",
107
+ "lib/milkode/cdweb/views/info_package.haml",
100
108
  "lib/milkode/cdweb/views/layout.haml",
101
109
  "lib/milkode/cdweb/views/packages.haml",
102
110
  "lib/milkode/cdweb/views/search.haml",
103
111
  "lib/milkode/cdweb/views/search_form.haml",
104
112
  "lib/milkode/cdweb/views/view.haml",
105
113
  "lib/milkode/cli.rb",
106
- "lib/milkode/common/archive-zip.rb",
107
114
  "lib/milkode/common/array_diff.rb",
108
115
  "lib/milkode/common/dbdir.rb",
109
116
  "lib/milkode/common/dir.rb",
@@ -122,9 +129,10 @@ Gem::Specification.new do |s|
122
129
  "lib/milkode/database/groonga_database.rb",
123
130
  "lib/milkode/database/package_table.rb",
124
131
  "lib/milkode/database/updater.rb",
125
- "lib/milkode/findgrep/findgrep.rb",
126
- "lib/milkode/findgrep/result.rb",
127
132
  "lib/milkode/grep/cli_grep.rb",
133
+ "lib/milkode/grep/fast_gotoline.rb",
134
+ "lib/milkode/grep/findgrep.rb",
135
+ "lib/milkode/grep/findgrep_option.rb",
128
136
  "milkode.gemspec",
129
137
  "test/data/.gitignore",
130
138
  "test/data/.gitignore.sjis",
@@ -200,7 +208,7 @@ Gem::Specification.new do |s|
200
208
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
201
209
  s.add_runtime_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
202
210
  s.add_runtime_dependency(%q<rroonga>, [">= 1.1.0"])
203
- s.add_runtime_dependency(%q<rack>, [">= 1.3.4", "~> 1.4.0"])
211
+ s.add_runtime_dependency(%q<rack>, [">= 1.5.2"])
204
212
  s.add_runtime_dependency(%q<sinatra>, [">= 1.2.6"])
205
213
  s.add_runtime_dependency(%q<launchy>, [">= 0.3.7"])
206
214
  s.add_runtime_dependency(%q<coderay>, [">= 1.0.5"])
@@ -208,15 +216,16 @@ Gem::Specification.new do |s|
208
216
  s.add_runtime_dependency(%q<archive-zip>, [">= 0.4.0"])
209
217
  s.add_runtime_dependency(%q<haml>, [">= 3.1.2"])
210
218
  s.add_runtime_dependency(%q<sass>, [">= 3.1.3"])
211
- s.add_runtime_dependency(%q<thor>, ["~> 0.15.0"])
219
+ s.add_runtime_dependency(%q<thor>, [">= 0.18.1"])
212
220
  s.add_development_dependency(%q<bundler>, [">= 0"])
213
221
  s.add_development_dependency(%q<jeweler>, [">= 0"])
214
222
  s.add_development_dependency(%q<rack-test>, [">= 0"])
215
223
  s.add_development_dependency(%q<sinatra-reloader>, [">= 0"])
224
+ s.add_development_dependency(%q<test-unit>, [">= 2.5.4"])
216
225
  else
217
226
  s.add_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
218
227
  s.add_dependency(%q<rroonga>, [">= 1.1.0"])
219
- s.add_dependency(%q<rack>, [">= 1.3.4", "~> 1.4.0"])
228
+ s.add_dependency(%q<rack>, [">= 1.5.2"])
220
229
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
221
230
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
222
231
  s.add_dependency(%q<coderay>, [">= 1.0.5"])
@@ -224,16 +233,17 @@ Gem::Specification.new do |s|
224
233
  s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
225
234
  s.add_dependency(%q<haml>, [">= 3.1.2"])
226
235
  s.add_dependency(%q<sass>, [">= 3.1.3"])
227
- s.add_dependency(%q<thor>, ["~> 0.15.0"])
236
+ s.add_dependency(%q<thor>, [">= 0.18.1"])
228
237
  s.add_dependency(%q<bundler>, [">= 0"])
229
238
  s.add_dependency(%q<jeweler>, [">= 0"])
230
239
  s.add_dependency(%q<rack-test>, [">= 0"])
231
240
  s.add_dependency(%q<sinatra-reloader>, [">= 0"])
241
+ s.add_dependency(%q<test-unit>, [">= 2.5.4"])
232
242
  end
233
243
  else
234
244
  s.add_dependency(%q<termcolor>, [">= 1.2.0", "< 1.2.2"])
235
245
  s.add_dependency(%q<rroonga>, [">= 1.1.0"])
236
- s.add_dependency(%q<rack>, [">= 1.3.4", "~> 1.4.0"])
246
+ s.add_dependency(%q<rack>, [">= 1.5.2"])
237
247
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
238
248
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
239
249
  s.add_dependency(%q<coderay>, [">= 1.0.5"])
@@ -241,11 +251,12 @@ Gem::Specification.new do |s|
241
251
  s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
242
252
  s.add_dependency(%q<haml>, [">= 3.1.2"])
243
253
  s.add_dependency(%q<sass>, [">= 3.1.3"])
244
- s.add_dependency(%q<thor>, ["~> 0.15.0"])
254
+ s.add_dependency(%q<thor>, [">= 0.18.1"])
245
255
  s.add_dependency(%q<bundler>, [">= 0"])
246
256
  s.add_dependency(%q<jeweler>, [">= 0"])
247
257
  s.add_dependency(%q<rack-test>, [">= 0"])
248
258
  s.add_dependency(%q<sinatra-reloader>, [">= 0"])
259
+ s.add_dependency(%q<test-unit>, [">= 2.5.4"])
249
260
  end
250
261
  end
251
262
 
@@ -11,7 +11,7 @@ require 'milkode_test_work'
11
11
 
12
12
  class TestCLI < Test::Unit::TestCase
13
13
  def setup
14
- $stdout = StringIO.new
14
+ $stdout = @stringio = StringIO.new
15
15
  @first_default_dir = Dbdir.default_dir
16
16
  @work = MilkodeTestWork.new({:default_db => true})
17
17
  @work.add_package "db1", @work.expand_path("../data/a_project")
@@ -65,8 +65,10 @@ class TestCLI < Test::Unit::TestCase
65
65
  def test_fav
66
66
  command("fav")
67
67
  command("fav a_not_found_package_xxxxxxx")
68
+ @stringio.string = ""
68
69
  # command("fav package")
69
70
  # command("fav -d package")
71
+ assert_equal "", command("fav --sync-yaml")
70
72
  end
71
73
 
72
74
  def test_help_with_h_option
@@ -5,7 +5,7 @@
5
5
  # @author ongaeshi
6
6
  # @date 2011/12/03
7
7
 
8
- require 'milkode/grep/cli_grep.rb'
8
+ require 'milkode/grep/cli_grep'
9
9
  require 'test_helper'
10
10
  require 'milkode_test_work'
11
11
 
@@ -7,9 +7,9 @@
7
7
 
8
8
  require 'test_helper'
9
9
  require 'file_assert'
10
- require 'milkode/findgrep/findgrep'
10
+ require 'milkode/grep/findgrep'
11
11
 
12
- module FindGrep
12
+ module Milkode
13
13
  class TestFindGrep < Test::Unit::TestCase
14
14
  def test_basic
15
15
 
@@ -19,7 +19,7 @@ contents:
19
19
  - directory: /a/dir1
20
20
  - directory: /path/to/dir
21
21
  ignore:
22
- - ! '*.bak'
22
+ - '*.bak'
23
23
  - /rdoc
24
24
  - directory: /a/b/c
25
25
  EOF
@@ -36,7 +36,21 @@ EOF
36
36
 
37
37
  def test_dump
38
38
  obj = MilkodeYaml.new(SRC)
39
- assert_equal SRC, obj.dump if Milkode::Util::ruby19?
39
+ if Milkode::Util::ruby20?
40
+ assert_equal SRC, obj.dump
41
+ elsif Milkode::Util::ruby19?
42
+ assert_equal <<EOF, obj.dump
43
+ ---
44
+ version: '0.2'
45
+ contents:
46
+ - directory: /a/dir1
47
+ - directory: /path/to/dir
48
+ ignore:
49
+ - ! '*.bak'
50
+ - /rdoc
51
+ - directory: /a/b/c
52
+ EOF
53
+ end
40
54
  end
41
55
 
42
56
  def test_version
@@ -75,7 +89,19 @@ EOF
75
89
 
76
90
  assert_equal 2, obj.contents.size
77
91
 
78
- assert_equal <<EOF, obj.dump if Milkode::Util::ruby19?
92
+ if Milkode::Util::ruby20?
93
+ assert_equal <<EOF, obj.dump
94
+ ---
95
+ version: '0.2'
96
+ contents:
97
+ - directory: /a/dir1
98
+ - directory: /path/to/dir
99
+ ignore:
100
+ - '*.bak'
101
+ - /rdoc
102
+ EOF
103
+ elsif Milkode::Util::ruby19?
104
+ assert_equal <<EOF, obj.dump
79
105
  ---
80
106
  version: '0.2'
81
107
  contents:
@@ -85,6 +111,8 @@ contents:
85
111
  - ! '*.bak'
86
112
  - /rdoc
87
113
  EOF
114
+ end
115
+
88
116
  end
89
117
 
90
118
  def test_migrate
@@ -117,7 +145,21 @@ EOF
117
145
  p = Package.create(p.directory, p.ignore + ['*.a'])
118
146
  obj.update(p)
119
147
 
120
- assert_equal <<EOF, obj.dump if Milkode::Util::ruby19?
148
+ if Milkode::Util::ruby20?
149
+ assert_equal <<EOF, obj.dump
150
+ ---
151
+ version: '0.2'
152
+ contents:
153
+ - directory: /a/dir1
154
+ - directory: /path/to/dir
155
+ ignore:
156
+ - '*.bak'
157
+ - /rdoc
158
+ - '*.a'
159
+ - directory: /a/b/c
160
+ EOF
161
+ elsif Milkode::Util::ruby19?
162
+ assert_equal <<EOF, obj.dump
121
163
  ---
122
164
  version: '0.2'
123
165
  contents:
@@ -129,6 +171,8 @@ contents:
129
171
  - ! '*.a'
130
172
  - directory: /a/b/c
131
173
  EOF
174
+ end
175
+
132
176
 
133
177
  p = Package.create("not_found")
134
178
  assert_raise(RuntimeError) { obj.update(p) }
@@ -88,6 +88,8 @@ module Milkode
88
88
  assert_equal 6 , create_query("w:5 w:6").wide_match_range
89
89
  assert_equal 0 , create_query("w:0").wide_match_range
90
90
  assert_equal 0 , create_query("w:aaa").wide_match_range
91
+ assert_equal 0 , create_query("w:日本語").wide_match_range
92
+ assert_equal false , create_query("w:日本語").wide_match_range_empty?
91
93
  end
92
94
 
93
95
  private
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 9
10
- version: 0.9.9
10
+ - 9
11
+ version: 0.9.9.9
11
12
  platform: ruby
12
13
  authors:
13
14
  - ongaeshi
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2013-03-26 00:00:00 +09:00
19
+ date: 2013-05-05 00:00:00 +09:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -66,21 +67,13 @@ dependencies:
66
67
  none: false
67
68
  requirements:
68
69
  - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 19
71
- segments:
72
- - 1
73
- - 3
74
- - 4
75
- version: 1.3.4
76
- - - ~>
77
70
  - !ruby/object:Gem::Version
78
71
  hash: 7
79
72
  segments:
80
73
  - 1
81
- - 4
82
- - 0
83
- version: 1.4.0
74
+ - 5
75
+ - 2
76
+ version: 1.5.2
84
77
  requirement: *id003
85
78
  - !ruby/object:Gem::Dependency
86
79
  type: :runtime
@@ -201,14 +194,14 @@ dependencies:
201
194
  version_requirements: &id011 !ruby/object:Gem::Requirement
202
195
  none: false
203
196
  requirements:
204
- - - ~>
197
+ - - ">="
205
198
  - !ruby/object:Gem::Version
206
- hash: 35
199
+ hash: 85
207
200
  segments:
208
201
  - 0
209
- - 15
210
- - 0
211
- version: 0.15.0
202
+ - 18
203
+ - 1
204
+ version: 0.18.1
212
205
  requirement: *id011
213
206
  - !ruby/object:Gem::Dependency
214
207
  type: :development
@@ -266,6 +259,22 @@ dependencies:
266
259
  - 0
267
260
  version: "0"
268
261
  requirement: *id015
262
+ - !ruby/object:Gem::Dependency
263
+ type: :development
264
+ prerelease: false
265
+ name: test-unit
266
+ version_requirements: &id016 !ruby/object:Gem::Requirement
267
+ none: false
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ hash: 19
272
+ segments:
273
+ - 2
274
+ - 5
275
+ - 4
276
+ version: 2.5.4
277
+ requirement: *id016
269
278
  description: Line based local source code search engine & grep-command & web-app.
270
279
  email: ongaeshi0621@gmail.com
271
280
  executables:
@@ -302,6 +311,8 @@ files:
302
311
  - lib/milkode/cdweb/lib/command.rb
303
312
  - lib/milkode/cdweb/lib/database.rb
304
313
  - lib/milkode/cdweb/lib/grep.rb
314
+ - lib/milkode/cdweb/lib/info_home.rb
315
+ - lib/milkode/cdweb/lib/info_package.rb
305
316
  - lib/milkode/cdweb/lib/mkurl.rb
306
317
  - lib/milkode/cdweb/lib/package_list.rb
307
318
  - lib/milkode/cdweb/lib/query.rb
@@ -341,6 +352,10 @@ files:
341
352
  - lib/milkode/cdweb/public/images/file.png
342
353
  - lib/milkode/cdweb/public/images/go-home-5.png
343
354
  - lib/milkode/cdweb/public/images/help.png
355
+ - lib/milkode/cdweb/public/images/info-big.png
356
+ - lib/milkode/cdweb/public/images/info.png
357
+ - lib/milkode/cdweb/public/images/milkode-directpath-copy.gif
358
+ - lib/milkode/cdweb/public/images/milkode-star.png
344
359
  - lib/milkode/cdweb/public/images/view-refresh-4.png
345
360
  - lib/milkode/cdweb/public/images/waiting.gif
346
361
  - lib/milkode/cdweb/public/img/glyphicons-halflings-white.png
@@ -356,13 +371,14 @@ files:
356
371
  - lib/milkode/cdweb/views/header_menu.haml
357
372
  - lib/milkode/cdweb/views/help.haml
358
373
  - lib/milkode/cdweb/views/index.haml
374
+ - lib/milkode/cdweb/views/info_home.haml
375
+ - lib/milkode/cdweb/views/info_package.haml
359
376
  - lib/milkode/cdweb/views/layout.haml
360
377
  - lib/milkode/cdweb/views/packages.haml
361
378
  - lib/milkode/cdweb/views/search.haml
362
379
  - lib/milkode/cdweb/views/search_form.haml
363
380
  - lib/milkode/cdweb/views/view.haml
364
381
  - lib/milkode/cli.rb
365
- - lib/milkode/common/archive-zip.rb
366
382
  - lib/milkode/common/array_diff.rb
367
383
  - lib/milkode/common/dbdir.rb
368
384
  - lib/milkode/common/dir.rb
@@ -381,9 +397,10 @@ files:
381
397
  - lib/milkode/database/groonga_database.rb
382
398
  - lib/milkode/database/package_table.rb
383
399
  - lib/milkode/database/updater.rb
384
- - lib/milkode/findgrep/findgrep.rb
385
- - lib/milkode/findgrep/result.rb
386
400
  - lib/milkode/grep/cli_grep.rb
401
+ - lib/milkode/grep/fast_gotoline.rb
402
+ - lib/milkode/grep/findgrep.rb
403
+ - lib/milkode/grep/findgrep_option.rb
387
404
  - milkode.gemspec
388
405
  - test/data/.gitignore
389
406
  - test/data/.gitignore.sjis