milkode 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.5 2011/08/02
2
+
3
+ * Compatibility Ruby 1.9.2p290.
4
+
1
5
  === 0.1.4 2011/08/01
2
6
 
3
7
  * To act reasonably even if it fails to require 'readline'.
data/Rakefile CHANGED
@@ -30,6 +30,8 @@ Jeweler::Tasks.new do |gem|
30
30
  gem.add_runtime_dependency 'coderay', '>=0.9.8'
31
31
  gem.add_runtime_dependency 'thin', '>=1.2.10'
32
32
  gem.add_runtime_dependency 'archive-zip', '>=0.3.0'
33
+ gem.add_runtime_dependency 'haml', '>=3.1.2'
34
+ gem.add_runtime_dependency 'sass', '>=3.1.3'
33
35
 
34
36
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
35
37
  # gem.add_development_dependency 'rspec', '> 1.2.3'
@@ -39,6 +41,7 @@ Jeweler::RubygemsDotOrgTasks.new
39
41
  require 'rake/testtask'
40
42
 
41
43
  # groonga関連のテストが通らないため、独自のrake_test_loaderを読み込む
44
+ $LOAD_PATH.unshift '.'
42
45
  module Rake
43
46
  class TestTask < TaskLib
44
47
  def rake_loader # :nodoc:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/bin/milk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/cdstk/cli_cdstk'
8
8
 
9
- Version = "0.1.4"
9
+ Version = "0.1.5"
10
10
  Milkode::CLI_Cdstk.execute(STDOUT, ARGV)
@@ -194,7 +194,7 @@ module Milkode
194
194
  alert("rm_package", package)
195
195
  @package_count += 1
196
196
 
197
- Database.instance.remove(package) do |record|
197
+ Database.instance.remove([package]) do |record|
198
198
  alert("rm_record", record.path)
199
199
  @file_count += 1
200
200
  end
@@ -447,7 +447,7 @@ module Milkode
447
447
  # 実際に使うタイミングでファイルの内容を読み込み
448
448
  # values[:content] = open(filename).read
449
449
  # データベース内の文字コードは'utf-8'で統一
450
- values[:content] = File.read(filename).kconv(Kconv::UTF8)
450
+ values[:content] = Kconv.kconv(File.read(filename), Kconv::UTF8)
451
451
 
452
452
  # データベースに格納
453
453
  values.each do |key, value|
@@ -18,7 +18,7 @@ require 'milkode/cdweb/lib/mkurl'
18
18
  set :haml, :format => :html5
19
19
 
20
20
  get '/' do
21
- @version = "0.1.4"
21
+ @version = "0.1.5"
22
22
  @package_num = Database.instance.fileList('').size
23
23
  @file_num = Database.instance.fileNum
24
24
  haml :index
@@ -22,9 +22,9 @@ module Milkode
22
22
  end
23
23
 
24
24
  def set_range(range)
25
- content_a = @content.to_a
25
+ content_a = @content.split("\n")
26
26
  range = limit_range(range, content_a)
27
- @content = content_a[range]
27
+ @content = content_a[range].join("\n")
28
28
  @line_number_start = range.first + 1
29
29
  end
30
30
 
@@ -55,7 +55,7 @@ module Milkode
55
55
  @total_records = fileList.size
56
56
  @record_content = fileList.map do |v|
57
57
  "<dt class='result-file'>#{file_or_dirimg(v[1])}<a href='#{Mkurl.new('/home/' + v[0], params).inherit_query_shead}'>#{File.basename v[0]}</a></dt>"
58
- end
58
+ end.join
59
59
  @elapsed = Time.now - before
60
60
  haml :filelist
61
61
  end
@@ -58,7 +58,7 @@ module Gren
58
58
  t = t % 3600
59
59
  m = t / 60
60
60
  t = t % 60
61
- t += round(time - time.prec_i, 2)
61
+ t += round(time - time.to_i, 2)
62
62
 
63
63
  if (h > 0 && m > 0)
64
64
  "#{h}h #{m}m #{t}s"
@@ -82,13 +82,13 @@ module Gren
82
82
  kb = 1024
83
83
 
84
84
  if (size >= tb)
85
- round(size / tb.prec_f, 2).to_s + "TB"
85
+ round(size / tb.to_f, 2).to_s + "TB"
86
86
  elsif (size >= gb)
87
- round(size / gb.prec_f, 2).to_s + "GB"
87
+ round(size / gb.to_f, 2).to_s + "GB"
88
88
  elsif (size >= mb)
89
- round(size / mb.prec_f, 2).to_s + "MB"
89
+ round(size / mb.to_f, 2).to_s + "MB"
90
90
  elsif (size >= kb)
91
- round(size / kb.prec_f, 2).to_s + "KB"
91
+ round(size / kb.to_f, 2).to_s + "KB"
92
92
  else
93
93
  size.to_s + "Byte"
94
94
  end
data/milkode.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["ongaeshi"]
11
+ s.authors = [%q{ongaeshi}]
12
12
  s.date = %q{2011-08-01}
13
13
  s.description = %q{Line based local source code search engine & web-app.}
14
14
  s.email = %q{ongaeshi0621@gmail.com}
15
- s.executables = ["cdv", "milk", "cdview"]
15
+ s.executables = [%q{cdv}, %q{cdview}, %q{milk}]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.rdoc"
@@ -88,35 +88,15 @@ Gem::Specification.new do |s|
88
88
  "test/test_util.rb"
89
89
  ]
90
90
  s.homepage = %q{http://github.com/ongaeshi/milkode}
91
- s.licenses = ["MIT"]
92
- s.require_paths = ["lib"]
93
- s.rubygems_version = %q{1.3.6}
91
+ s.licenses = [%q{MIT}]
92
+ s.require_paths = [%q{lib}]
93
+ s.rubygems_version = %q{1.8.6}
94
94
  s.summary = %q{Line based local source code search engine & web-app.}
95
- s.test_files = [
96
- "test/file_assert.rb",
97
- "test/file_test_utils.rb",
98
- "test/rake_test_loader.rb",
99
- "test/runner.rb",
100
- "test/test_bin_exec.rb",
101
- "test/test_cdstk.rb",
102
- "test/test_cdstk_yaml.rb",
103
- "test/test_coderay_wrapper.rb",
104
- "test/test_coderay_wrapper_data.rb",
105
- "test/test_database.rb",
106
- "test/test_dbdir.rb",
107
- "test/test_gren_util.rb",
108
- "test/test_helper.rb",
109
- "test/test_mkurl.rb",
110
- "test/test_query.rb",
111
- "test/test_string_snip.rb",
112
- "test/test_util.rb"
113
- ]
114
95
 
115
96
  if s.respond_to? :specification_version then
116
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
117
97
  s.specification_version = 3
118
98
 
119
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
99
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
120
100
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
121
101
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
122
102
  s.add_development_dependency(%q<rcov>, [">= 0"])
@@ -128,6 +108,8 @@ Gem::Specification.new do |s|
128
108
  s.add_runtime_dependency(%q<coderay>, [">= 0.9.8"])
129
109
  s.add_runtime_dependency(%q<thin>, [">= 1.2.10"])
130
110
  s.add_runtime_dependency(%q<archive-zip>, [">= 0.3.0"])
111
+ s.add_runtime_dependency(%q<haml>, [">= 3.1.2"])
112
+ s.add_runtime_dependency(%q<sass>, [">= 3.1.3"])
131
113
  else
132
114
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
133
115
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -140,6 +122,8 @@ Gem::Specification.new do |s|
140
122
  s.add_dependency(%q<coderay>, [">= 0.9.8"])
141
123
  s.add_dependency(%q<thin>, [">= 1.2.10"])
142
124
  s.add_dependency(%q<archive-zip>, [">= 0.3.0"])
125
+ s.add_dependency(%q<haml>, [">= 3.1.2"])
126
+ s.add_dependency(%q<sass>, [">= 3.1.3"])
143
127
  end
144
128
  else
145
129
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -153,6 +137,8 @@ Gem::Specification.new do |s|
153
137
  s.add_dependency(%q<coderay>, [">= 0.9.8"])
154
138
  s.add_dependency(%q<thin>, [">= 1.2.10"])
155
139
  s.add_dependency(%q<archive-zip>, [">= 0.3.0"])
140
+ s.add_dependency(%q<haml>, [">= 3.1.2"])
141
+ s.add_dependency(%q<sass>, [">= 3.1.3"])
156
142
  end
157
143
  end
158
144
 
data/test/file_assert.rb CHANGED
@@ -27,8 +27,8 @@ def assert_diff_files(file1, file2)
27
27
  end
28
28
 
29
29
  def assert_lines(s1, s2)
30
- a1 = s1.to_a
31
- a2 = s2.to_a
30
+ a1 = s1.split("\n")
31
+ a2 = s2.split("\n")
32
32
 
33
33
  a1.each_index do |i|
34
34
  assert_equal a1[i], a2[i]
@@ -51,13 +51,9 @@ class TestCdstkYaml < Test::Unit::TestCase
51
51
 
52
52
  # save
53
53
  yaml.save
54
- assert_equal <<EOF, open('milkode.yaml').read
55
- ---
56
- version: 0.1
57
- contents:
58
- - directory: dir1
59
- - directory: dir4
60
- EOF
54
+ r = YAML.load(open('milkode.yaml').read)
55
+ assert_equal 0.1, r['version']
56
+ assert_equal([{'directory'=>'dir1'}, {'directory' => 'dir4'}], r['contents'])
61
57
  end
62
58
 
63
59
  def test_001
@@ -66,12 +62,9 @@ EOF
66
62
  yaml.save
67
63
 
68
64
  # save
69
- assert_equal <<EOF, open('otherpath/milkode.yaml').read
70
- ---
71
- version: 0.1
72
- contents: []
73
-
74
- EOF
65
+ r = YAML.load(open('otherpath/milkode.yaml').read)
66
+ assert_equal 0.1, r['version']
67
+ assert_equal([], r['contents'])
75
68
  end
76
69
 
77
70
  def test_query
@@ -63,8 +63,8 @@ module Milkode
63
63
 
64
64
  def t_remove
65
65
  db = Database.instance
66
- db.remove('test')
67
- db.remove('lib')
66
+ db.remove(['test'])
67
+ db.remove(['lib'])
68
68
  assert_equal 0, db.totalRecords
69
69
  end
70
70
 
metadata CHANGED
@@ -1,186 +1,170 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - ongaeshi
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-08-01 00:00:00 +09:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- requirements:
12
+ date: 2011-08-01 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &2156295840 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
23
19
  - - ~>
24
- - !ruby/object:Gem::Version
25
- segments:
26
- - 1
27
- - 0
28
- - 0
20
+ - !ruby/object:Gem::Version
29
21
  version: 1.0.0
30
- name: bundler
31
- requirement: *id001
32
- prerelease: false
33
22
  type: :development
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
- requirements:
23
+ prerelease: false
24
+ version_requirements: *2156295840
25
+ - !ruby/object:Gem::Dependency
26
+ name: jeweler
27
+ requirement: &2156294900 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
37
30
  - - ~>
38
- - !ruby/object:Gem::Version
39
- segments:
40
- - 1
41
- - 5
42
- - 2
31
+ - !ruby/object:Gem::Version
43
32
  version: 1.5.2
44
- name: jeweler
45
- requirement: *id002
46
- prerelease: false
47
33
  type: :development
48
- - !ruby/object:Gem::Dependency
49
- version_requirements: &id003 !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- segments:
54
- - 0
55
- version: "0"
56
- name: rcov
57
- requirement: *id003
58
34
  prerelease: false
35
+ version_requirements: *2156294900
36
+ - !ruby/object:Gem::Dependency
37
+ name: rcov
38
+ requirement: &2156293400 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
59
44
  type: :development
60
- - !ruby/object:Gem::Dependency
61
- version_requirements: &id004 !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- segments:
66
- - 1
67
- - 2
68
- - 0
69
- version: 1.2.0
70
- name: termcolor
71
- requirement: *id004
72
45
  prerelease: false
46
+ version_requirements: *2156293400
47
+ - !ruby/object:Gem::Dependency
48
+ name: termcolor
49
+ requirement: &2156291660 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.0
73
55
  type: :runtime
74
- - !ruby/object:Gem::Dependency
75
- version_requirements: &id005 !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- segments:
80
- - 1
81
- - 0
82
- - 0
83
- version: 1.0.0
84
- name: rroonga
85
- requirement: *id005
86
56
  prerelease: false
57
+ version_requirements: *2156291660
58
+ - !ruby/object:Gem::Dependency
59
+ name: rroonga
60
+ requirement: &2156290840 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.0
87
66
  type: :runtime
88
- - !ruby/object:Gem::Dependency
89
- version_requirements: &id006 !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 1
95
- - 2
96
- - 1
97
- version: 1.2.1
98
- name: rack
99
- requirement: *id006
100
67
  prerelease: false
68
+ version_requirements: *2156290840
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack
71
+ requirement: &2156281760 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.2.1
101
77
  type: :runtime
102
- - !ruby/object:Gem::Dependency
103
- version_requirements: &id007 !ruby/object:Gem::Requirement
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- segments:
108
- - 1
109
- - 2
110
- - 6
111
- version: 1.2.6
112
- name: sinatra
113
- requirement: *id007
114
78
  prerelease: false
79
+ version_requirements: *2156281760
80
+ - !ruby/object:Gem::Dependency
81
+ name: sinatra
82
+ requirement: &2156280900 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 1.2.6
115
88
  type: :runtime
116
- - !ruby/object:Gem::Dependency
117
- version_requirements: &id008 !ruby/object:Gem::Requirement
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- segments:
122
- - 0
123
- - 3
124
- - 7
125
- version: 0.3.7
126
- name: launchy
127
- requirement: *id008
128
89
  prerelease: false
90
+ version_requirements: *2156280900
91
+ - !ruby/object:Gem::Dependency
92
+ name: launchy
93
+ requirement: &2156280140 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: 0.3.7
129
99
  type: :runtime
130
- - !ruby/object:Gem::Dependency
131
- version_requirements: &id009 !ruby/object:Gem::Requirement
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- segments:
136
- - 0
137
- - 9
138
- - 8
139
- version: 0.9.8
140
- name: coderay
141
- requirement: *id009
142
100
  prerelease: false
101
+ version_requirements: *2156280140
102
+ - !ruby/object:Gem::Dependency
103
+ name: coderay
104
+ requirement: &2156279380 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.9.8
143
110
  type: :runtime
144
- - !ruby/object:Gem::Dependency
145
- version_requirements: &id010 !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- segments:
150
- - 1
151
- - 2
152
- - 10
153
- version: 1.2.10
154
- name: thin
155
- requirement: *id010
156
111
  prerelease: false
112
+ version_requirements: *2156279380
113
+ - !ruby/object:Gem::Dependency
114
+ name: thin
115
+ requirement: &2156278300 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: 1.2.10
157
121
  type: :runtime
158
- - !ruby/object:Gem::Dependency
159
- version_requirements: &id011 !ruby/object:Gem::Requirement
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
- - 3
166
- - 0
167
- version: 0.3.0
122
+ prerelease: false
123
+ version_requirements: *2156278300
124
+ - !ruby/object:Gem::Dependency
168
125
  name: archive-zip
169
- requirement: *id011
126
+ requirement: &2156277200 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.3.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: *2156277200
135
+ - !ruby/object:Gem::Dependency
136
+ name: haml
137
+ requirement: &2156276000 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: 3.1.2
143
+ type: :runtime
170
144
  prerelease: false
145
+ version_requirements: *2156276000
146
+ - !ruby/object:Gem::Dependency
147
+ name: sass
148
+ requirement: &2156274960 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: 3.1.3
171
154
  type: :runtime
155
+ prerelease: false
156
+ version_requirements: *2156274960
172
157
  description: Line based local source code search engine & web-app.
173
158
  email: ongaeshi0621@gmail.com
174
- executables:
159
+ executables:
175
160
  - cdv
176
- - milk
177
161
  - cdview
162
+ - milk
178
163
  extensions: []
179
-
180
- extra_rdoc_files:
164
+ extra_rdoc_files:
181
165
  - LICENSE.txt
182
166
  - README.rdoc
183
- files:
167
+ files:
184
168
  - .document
185
169
  - Gemfile
186
170
  - Gemfile.lock
@@ -249,51 +233,29 @@ files:
249
233
  - test/test_query.rb
250
234
  - test/test_string_snip.rb
251
235
  - test/test_util.rb
252
- has_rdoc: true
253
236
  homepage: http://github.com/ongaeshi/milkode
254
- licenses:
237
+ licenses:
255
238
  - MIT
256
239
  post_install_message:
257
240
  rdoc_options: []
258
-
259
- require_paths:
241
+ require_paths:
260
242
  - lib
261
- required_ruby_version: !ruby/object:Gem::Requirement
262
- requirements:
263
- - - ">="
264
- - !ruby/object:Gem::Version
265
- segments:
266
- - 0
267
- version: "0"
268
- required_rubygems_version: !ruby/object:Gem::Requirement
269
- requirements:
270
- - - ">="
271
- - !ruby/object:Gem::Version
272
- segments:
273
- - 0
274
- version: "0"
243
+ required_ruby_version: !ruby/object:Gem::Requirement
244
+ none: false
245
+ requirements:
246
+ - - ! '>='
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
250
+ none: false
251
+ requirements:
252
+ - - ! '>='
253
+ - !ruby/object:Gem::Version
254
+ version: '0'
275
255
  requirements: []
276
-
277
256
  rubyforge_project:
278
- rubygems_version: 1.3.6
257
+ rubygems_version: 1.8.6
279
258
  signing_key:
280
259
  specification_version: 3
281
260
  summary: Line based local source code search engine & web-app.
282
- test_files:
283
- - test/file_assert.rb
284
- - test/file_test_utils.rb
285
- - test/rake_test_loader.rb
286
- - test/runner.rb
287
- - test/test_bin_exec.rb
288
- - test/test_cdstk.rb
289
- - test/test_cdstk_yaml.rb
290
- - test/test_coderay_wrapper.rb
291
- - test/test_coderay_wrapper_data.rb
292
- - test/test_database.rb
293
- - test/test_dbdir.rb
294
- - test/test_gren_util.rb
295
- - test/test_helper.rb
296
- - test/test_mkurl.rb
297
- - test/test_query.rb
298
- - test/test_string_snip.rb
299
- - test/test_util.rb
261
+ test_files: []