milkode 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,45 @@
1
+ === 0.5.0 2012/03/09
2
+
3
+ * milk
4
+ * 仕様を見直して使い勝手を大幅に改善
5
+ * milk add
6
+ * パッケージ内の.gitignoreを自動で読み込み、検索対象から外すように
7
+ * .gitignoreを読み込みたくない場合は --no-auto-ignore オプションを指定して下さい
8
+ * 大量に表示されるメッセージを抑制 (-vオプションで表示)
9
+ * 除外対象を指定する -i オプションを追加
10
+ * 'milk add .' の時に 'package : .' -> 'package : milkode' に
11
+ * milk ignore
12
+ * 検索対象に含めないファイルやディレクトリを指定することが出来る
13
+ * milk ignore --test で.gitignoreも含めて除外される可能性のあるファイルとディレクトリを表示
14
+ * milk ignore -p PACKAGE_NAME でパッケージ指定
15
+ * milk ignore -d IGNORE_PATH .. で除外対象から削除
16
+ * milk init
17
+ * milk init 'a_dir' でディレクトリを自動で掘ってくれるように。
18
+ * milk init --setdb オプションを追加
19
+ * milk rebuild
20
+ * 正確にパッケージ名を指定しなければリビルド出来ないように
21
+ * 引数無しで実行すると現在位置のパッケージをリビルド
22
+ * milk remove
23
+ * 正確にパッケージ名を指定しなければ削除出来ないように
24
+ * 引数無しで実行すると現在位置のパッケージを削除
25
+ * milk update
26
+ * 大量に表示されるメッセージを抑制 (-vオプションで表示)
27
+ * 'milk update NOT_EXIST_PACKAGE'の時に milkode_info が表示されないように
28
+ * milk setdb
29
+ * milk setdb --default でデフォルトデータベースに戻るように (milk setdb --reset と同義)
30
+ * milk pwd
31
+ * パッケージ名も表示するように 'milkode in ~/.milkode'
32
+
33
+ * milk web
34
+ * ファイル毎のすべてのマッチを検索し、結果に表示するようにした (Fix #12) (thanks tomykaira, miau)
35
+ * ラジオボタンとラベルをタグ付け (Fix #15) (thanks tomykaira, miau)
36
+ * 1ファイル1マッチ'チェックボックスを追加。
37
+
38
+ * lib
39
+ * CdstkYamlを削除
40
+ * Package, MilkodeYaml, YamlFileWrapperを追加。
41
+ * 古いバージョンのmilkode.yamlにアクセスしたら自動でアップグレードするように。
42
+
1
43
  === 0.4.0 2012/02/02
2
44
 
3
45
  * gmilk
@@ -1,3 +1,27 @@
1
+ === 0.5.0 2012/03/09
2
+
3
+ * milk
4
+ * Review the specifications and significantly improve ease of use
5
+ * milk add
6
+ * Reads automatic .gitignore in the package, to ignore from the search
7
+ * If you do not want to load the .gitignore please specify '--no-auto-ignore'
8
+ * milk ignore
9
+ * Can specify the directories and files not included in the search
10
+ * milk init
11
+ * milk rebuild
12
+ * milk remove
13
+ * milk update
14
+ * milk setdb
15
+ * milk pwd
16
+
17
+ * milk web
18
+ * Find all the matches every file so that the displayed results (Fix #12) (thanks tomykaira, miau)
19
+
20
+ * lib
21
+ * Delete CdstkYaml
22
+ * Add Package, MilkodeYaml, YamlFileWrapper
23
+ * milkode.yaml version up, 0.1 -> '0.2'.
24
+
1
25
  === 0.4.0 2012/02/02
2
26
 
3
27
  * gmilk
data/Rakefile CHANGED
@@ -55,7 +55,7 @@ end
55
55
 
56
56
  Rake::TestTask.new(:test) do |test|
57
57
  test.libs << 'lib' << 'test'
58
- test.pattern = 'test/**/test_*.rb'
58
+ test.test_files = FileList['test/**/test_*.rb']
59
59
  test.verbose = true
60
60
  end
61
61
 
@@ -78,7 +78,7 @@ end
78
78
 
79
79
  task :default => :test
80
80
 
81
- require 'rake/rdoctask'
81
+ require 'rdoc/task'
82
82
  Rake::RDocTask.new do |rdoc|
83
83
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
84
84
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -19,22 +19,34 @@ set :haml, :format => :html5
19
19
 
20
20
  get '/' do
21
21
  @version = "0.5.0"
22
- @package_num = Database.instance.fileList('').size
23
- @file_num = Database.instance.fileNum
22
+ @package_num = Database.instance.yaml_package_num
23
+ @file_num = Database.instance.totalRecords
24
24
  haml :index
25
25
  end
26
26
 
27
+ def package_path(path)
28
+ path.split('/')[0,3].join('/')
29
+ end
30
+
27
31
  post '/search*' do
28
32
  path = unescape(params[:pathname])
29
-
30
- case params[:shead]
31
- when 'all'
32
- path = "/home"
33
- when 'package'
34
- path = path.split('/')[0,3].join('/')
35
- end
36
33
 
37
- redirect Mkurl.new("#{path}", params).inherit_query_shead
34
+ if params[:clear]
35
+ redirect Mkurl.new("#{path}", params).inherit_shead
36
+ else
37
+ case params[:shead]
38
+ when 'all'
39
+ path = "/home"
40
+ when 'package'
41
+ path = package_path(path)
42
+ when 'directory'
43
+ # do nothing
44
+ else
45
+ path = package_path(path)
46
+ end
47
+
48
+ redirect Mkurl.new("#{path}", params).inherit_query_shead
49
+ end
38
50
  end
39
51
 
40
52
  get '/home*' do |path|
@@ -10,6 +10,7 @@ require 'pathname'
10
10
  require 'singleton'
11
11
  require 'groonga'
12
12
  require 'milkode/common/dbdir'
13
+ require 'milkode/cdstk/yaml_file_wrapper'
13
14
  include Milkode
14
15
 
15
16
  module Milkode
@@ -22,8 +23,16 @@ module Milkode
22
23
  @@db_dir = db_dir
23
24
  end
24
25
 
26
+ attr_reader :yaml
27
+
25
28
  def initialize
26
- open(@@db_dir || Dbdir.default_dir)
29
+ db_dir = @@db_dir || Dbdir.default_dir
30
+ open(db_dir)
31
+ @yaml = YamlFileWrapper.load_if(db_dir)
32
+ end
33
+
34
+ def yaml_reload
35
+ @yaml = YamlFileWrapper.load_if(@@db_dir || Dbdir.default_dir)
27
36
  end
28
37
 
29
38
  def open(db_dir)
@@ -43,10 +52,6 @@ module Milkode
43
52
  return table.records[0]
44
53
  end
45
54
 
46
- def fileNum
47
- @documents.select.size
48
- end
49
-
50
55
  def search(patterns, packages, fpaths, suffixs, offset = 0, limit = -1)
51
56
  # @todo fpathを厳密に検索するには、検索結果からさらに先頭からのパスではないものを除外する
52
57
  records, total_records = searchMain(patterns, packages, fpaths, suffixs, offset, limit)
@@ -88,10 +93,20 @@ module Milkode
88
93
  @documents.select.size
89
94
  end
90
95
 
96
+ # yamlからパッケージの総数を得る
97
+ def yaml_package_num
98
+ @yaml.contents.size
99
+ end
100
+
91
101
  # @sample test/test_database.rb:43 TestDatabase#t_fileList
92
102
  def fileList(base)
93
103
  base_parts = base.split("/")
94
104
  base_depth = base_parts.length
105
+
106
+ # 'depth==0'の時はMilkodeYaml#contentsからファイルリストを生成して高速化
107
+ if (base_depth == 0)
108
+ return @yaml.contents.sort_by{|v| v.name}.map{|v| [v.name, false] }
109
+ end
95
110
 
96
111
  # shortpathにマッチするものだけに絞り込む
97
112
  if (base == "")
@@ -149,7 +164,7 @@ module Milkode
149
164
  end
150
165
  end
151
166
  end
152
-
167
+
153
168
  private
154
169
 
155
170
  def reopen_patch
@@ -213,7 +228,7 @@ module Milkode
213
228
  :limit => limit)
214
229
 
215
230
  # ファイル名でソート
216
- # @todo 本当はこっちが望ましい
231
+ # @todo 本当はこっちが望ましいが、パッケージ検索を正確にしないことには出来ない
217
232
  # records = table.sort([{:key => "shortpath", :order => "ascending"}],
218
233
  # :offset => offset,
219
234
  # :limit => limit)
@@ -71,3 +71,20 @@ a.headmenu {
71
71
  font-weight: normal;
72
72
  }
73
73
 
74
+ input#query {
75
+ height: 24px;
76
+ font-size: 12px;
77
+ }
78
+
79
+ input#search {
80
+ margin-left: 10px;
81
+ width: 80px;
82
+ font-size: 20px;
83
+ }
84
+
85
+ input#clear {
86
+ margin-left: 0px;
87
+ width: 80px;
88
+ font-size: 18px;
89
+ }
90
+
@@ -4,8 +4,9 @@
4
4
  }
5
5
  %form(name="searchform" action="/search" method="post")
6
6
  %p
7
- %input(name="query" size="60" type="text"){:value => params[:query]}
8
- %input(type="submit" value="検索" onclick="set_pathname()")
7
+ %input#query(name="query" size="70" type="text"){:value => params[:query]}
8
+ %input#search(type="submit" name="search" value="検索" onclick="set_pathname()")
9
+ %input#clear(type="submit" name="clear" value="クリア" onclick="set_pathname()")
9
10
  %br
10
11
  %label
11
12
  = create_radio('all', params[:shead])
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.5.0"
8
+ s.version = "0.4.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{2012-03-09}
12
+ s.date = %q{2012-02-02}
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"]
@@ -31,11 +31,9 @@ Gem::Specification.new do |s|
31
31
  "bin/milk",
32
32
  "lib/milkode/cdstk/cdstk.rb",
33
33
  "lib/milkode/cdstk/cdstk_command.rb",
34
+ "lib/milkode/cdstk/cdstk_yaml.rb",
34
35
  "lib/milkode/cdstk/cli_cdstk.rb",
35
36
  "lib/milkode/cdstk/cli_cdstksub.rb",
36
- "lib/milkode/cdstk/milkode_yaml.rb",
37
- "lib/milkode/cdstk/package.rb",
38
- "lib/milkode/cdstk/yaml_file_wrapper.rb",
39
37
  "lib/milkode/cdweb/app.rb",
40
38
  "lib/milkode/cdweb/cli_cdweb.rb",
41
39
  "lib/milkode/cdweb/config.ru",
@@ -58,12 +56,10 @@ Gem::Specification.new do |s|
58
56
  "lib/milkode/cdweb/public/images/go-home-5.png",
59
57
  "lib/milkode/cdweb/public/js/milkode.js",
60
58
  "lib/milkode/cdweb/views/filelist.haml",
61
- "lib/milkode/cdweb/views/header_menu.haml",
62
59
  "lib/milkode/cdweb/views/help.haml",
63
60
  "lib/milkode/cdweb/views/index.haml",
64
61
  "lib/milkode/cdweb/views/layout.haml",
65
62
  "lib/milkode/cdweb/views/search.haml",
66
- "lib/milkode/cdweb/views/search_form.haml",
67
63
  "lib/milkode/cdweb/views/view.haml",
68
64
  "lib/milkode/common/archive-zip.rb",
69
65
  "lib/milkode/common/dbdir.rb",
@@ -71,8 +67,6 @@ Gem::Specification.new do |s|
71
67
  "lib/milkode/common/display_util.rb",
72
68
  "lib/milkode/common/grenfiletest.rb",
73
69
  "lib/milkode/common/grensnip.rb",
74
- "lib/milkode/common/ignore_checker.rb",
75
- "lib/milkode/common/ignore_setting.rb",
76
70
  "lib/milkode/common/platform.rb",
77
71
  "lib/milkode/common/string_snip.rb",
78
72
  "lib/milkode/common/util.rb",
@@ -80,14 +74,11 @@ Gem::Specification.new do |s|
80
74
  "lib/milkode/findgrep/result.rb",
81
75
  "lib/milkode/grep/cli_grep.rb",
82
76
  "milkode.gemspec",
83
- "test/data/.gitignore",
84
77
  "test/data/a_project/cdstk.rb",
85
78
  "test/data/a_project/cdstk_yaml.rb",
86
79
  "test/data/abc.zip",
87
80
  "test/data/b_project/runner.rb",
88
81
  "test/data/b_project/test_dir.rb",
89
- "test/data/no_auto_ignore/.gitignore",
90
- "test/data/no_auto_ignore/a.txt",
91
82
  "test/data/nodir_abc.zip",
92
83
  "test/data/nodir_abc_xpi.xpi",
93
84
  "test/file_assert.rb",
@@ -98,6 +89,7 @@ Gem::Specification.new do |s|
98
89
  "test/test_bin_exec.rb",
99
90
  "test/test_cdstk.rb",
100
91
  "test/test_cdstk_command.rb",
92
+ "test/test_cdstk_yaml.rb",
101
93
  "test/test_cli_cdstk.rb",
102
94
  "test/test_cli_grep.rb",
103
95
  "test/test_coderay_wrapper.rb",
@@ -107,15 +99,10 @@ Gem::Specification.new do |s|
107
99
  "test/test_dir.rb",
108
100
  "test/test_gren_util.rb",
109
101
  "test/test_helper.rb",
110
- "test/test_ignore_checker.rb",
111
- "test/test_ignore_setting.rb",
112
- "test/test_milkode_yaml.rb",
113
102
  "test/test_mkurl.rb",
114
- "test/test_package.rb",
115
103
  "test/test_query.rb",
116
104
  "test/test_string_snip.rb",
117
- "test/test_util.rb",
118
- "test/test_yaml_file_wrapper.rb"
105
+ "test/test_util.rb"
119
106
  ]
120
107
  s.homepage = %q{http://github.com/ongaeshi/milkode}
121
108
  s.licenses = ["MIT"]
@@ -33,6 +33,9 @@ module Milkode
33
33
 
34
34
  # データベースのセットアップ
35
35
  Database.setup('.')
36
+
37
+ # yamlファイルのリロード
38
+ Database.instance.yaml_reload
36
39
  end
37
40
 
38
41
  def test_database
@@ -49,7 +52,7 @@ module Milkode
49
52
 
50
53
  def t_fileList
51
54
  db = Database.instance
52
- assert_equal [['lib', false], ['test', false], ["notfound.file", true]], db.fileList('')
55
+ assert_equal [['lib', false], ["notfound.file", false], ['test', false]], db.fileList('')
53
56
  assert db.fileList('test').include? ['test/test_database.rb', true]
54
57
  assert_equal ['lib/milkode', false], db.fileList('lib')[0]
55
58
  assert_equal ['lib/milkode/cdstk/cdstk.rb', true], db.fileList('lib/milkode/cdstk')[0]
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- segments_generated: true
11
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
12
11
  platform: ruby
13
12
  authors:
14
13
  - ongaeshi
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2012-03-09 00:00:00 +09:00
18
+ date: 2012-03-15 00:00:00 +09:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -33,7 +32,6 @@ dependencies:
33
32
  - 1
34
33
  - 0
35
34
  - 0
36
- segments_generated: true
37
35
  version: 1.0.0
38
36
  requirement: *id001
39
37
  - !ruby/object:Gem::Dependency
@@ -50,7 +48,6 @@ dependencies:
50
48
  - 1
51
49
  - 5
52
50
  - 2
53
- segments_generated: true
54
51
  version: 1.5.2
55
52
  requirement: *id002
56
53
  - !ruby/object:Gem::Dependency
@@ -65,7 +62,6 @@ dependencies:
65
62
  hash: 3
66
63
  segments:
67
64
  - 0
68
- segments_generated: true
69
65
  version: "0"
70
66
  requirement: *id003
71
67
  - !ruby/object:Gem::Dependency
@@ -82,7 +78,6 @@ dependencies:
82
78
  - 1
83
79
  - 2
84
80
  - 0
85
- segments_generated: true
86
81
  version: 1.2.0
87
82
  requirement: *id004
88
83
  - !ruby/object:Gem::Dependency
@@ -99,7 +94,6 @@ dependencies:
99
94
  - 1
100
95
  - 1
101
96
  - 0
102
- segments_generated: true
103
97
  version: 1.1.0
104
98
  requirement: *id005
105
99
  - !ruby/object:Gem::Dependency
@@ -116,7 +110,6 @@ dependencies:
116
110
  - 1
117
111
  - 3
118
112
  - 4
119
- segments_generated: true
120
113
  version: 1.3.4
121
114
  requirement: *id006
122
115
  - !ruby/object:Gem::Dependency
@@ -133,7 +126,6 @@ dependencies:
133
126
  - 1
134
127
  - 2
135
128
  - 6
136
- segments_generated: true
137
129
  version: 1.2.6
138
130
  requirement: *id007
139
131
  - !ruby/object:Gem::Dependency
@@ -150,7 +142,6 @@ dependencies:
150
142
  - 0
151
143
  - 3
152
144
  - 7
153
- segments_generated: true
154
145
  version: 0.3.7
155
146
  requirement: *id008
156
147
  - !ruby/object:Gem::Dependency
@@ -167,7 +158,6 @@ dependencies:
167
158
  - 0
168
159
  - 9
169
160
  - 8
170
- segments_generated: true
171
161
  version: 0.9.8
172
162
  requirement: *id009
173
163
  - !ruby/object:Gem::Dependency
@@ -184,7 +174,6 @@ dependencies:
184
174
  - 1
185
175
  - 2
186
176
  - 10
187
- segments_generated: true
188
177
  version: 1.2.10
189
178
  requirement: *id010
190
179
  - !ruby/object:Gem::Dependency
@@ -201,7 +190,6 @@ dependencies:
201
190
  - 0
202
191
  - 4
203
192
  - 0
204
- segments_generated: true
205
193
  version: 0.4.0
206
194
  requirement: *id011
207
195
  - !ruby/object:Gem::Dependency
@@ -218,7 +206,6 @@ dependencies:
218
206
  - 3
219
207
  - 1
220
208
  - 2
221
- segments_generated: true
222
209
  version: 3.1.2
223
210
  requirement: *id012
224
211
  - !ruby/object:Gem::Dependency
@@ -235,7 +222,6 @@ dependencies:
235
222
  - 3
236
223
  - 1
237
224
  - 3
238
- segments_generated: true
239
225
  version: 3.1.3
240
226
  requirement: *id013
241
227
  - !ruby/object:Gem::Dependency
@@ -252,7 +238,6 @@ dependencies:
252
238
  - 1
253
239
  - 5
254
240
  - 0
255
- segments_generated: true
256
241
  version: 1.5.0
257
242
  requirement: *id014
258
243
  - !ruby/object:Gem::Dependency
@@ -269,7 +254,6 @@ dependencies:
269
254
  - 0
270
255
  - 8
271
256
  - 2
272
- segments_generated: true
273
257
  version: 0.8.2
274
258
  requirement: *id015
275
259
  description: Line based local source code search engine & grep-command & web-app.
@@ -398,7 +382,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
398
382
  hash: 3
399
383
  segments:
400
384
  - 0
401
- segments_generated: true
402
385
  version: "0"
403
386
  required_rubygems_version: !ruby/object:Gem::Requirement
404
387
  none: false
@@ -408,7 +391,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
391
  hash: 3
409
392
  segments:
410
393
  - 0
411
- segments_generated: true
412
394
  version: "0"
413
395
  requirements: []
414
396