milkode 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.ja.rdoc CHANGED
@@ -1,3 +1,19 @@
1
+ === 0.2.4 2011/10/02
2
+
3
+ * gem 1.3.6, 1.3.7 でインストール出来ない問題を修正
4
+
5
+ === 0.2.3 2011/09/29
6
+
7
+ * webインターフェースの検索速度向上
8
+ * ミニファイされたJavaScript等、一行の長いファイルの検索が高速になりました。
9
+ * 日本語ファイル名に対応
10
+ * #10: windows環境(mswin32)で、日本語ファイル、日英混在文字が化ける (thanks aki1999)
11
+ * OSXの濁点ファイル名問題を修正 (Ruby1.9.2を使えば、濁点付きの日本語ファイルを正常に処理出来ます)
12
+ * #9: 検索文字列に特定の文字が含まれるとInternal Server Error (thanks vividtone)
13
+ * バグ修正、特定ディレクトリ以下の検索で横のパッケージが'../milkode'のように表示されてしまう問題の修正
14
+ * archive-zip 0.4.0に対応。vendor/archive/support/io.rb は必要なくなったので削除。
15
+ * 既に追加済みのパッケージを再度 milk add したら milk update するように
16
+
1
17
  === 0.2.2 2011/08/26
2
18
 
3
19
  * ファイル内grepを追加
data/README.rdoc CHANGED
@@ -2,18 +2,5 @@
2
2
 
3
3
  Line based local source code search engine & web-app.
4
4
 
5
- == Contributing to milkode
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 ongaeshi. See LICENSE.txt for
18
- further details.
19
-
5
+ * {History.rdoc}[https://github.com/ongaeshi/milkode/blob/master/HISTORY.rdoc]
6
+ * {更新履歴}[https://github.com/ongaeshi/milkode/blob/master/HISTORY.ja.rdoc]
data/Rakefile CHANGED
@@ -27,9 +27,9 @@ Jeweler::Tasks.new do |gem|
27
27
  gem.add_runtime_dependency 'rack','>=1.2.1'
28
28
  gem.add_runtime_dependency 'sinatra', '>=1.2.6'
29
29
  gem.add_runtime_dependency 'launchy', '>=0.3.7'
30
- gem.add_runtime_dependency 'coderay', '>=0.9.8'
30
+ gem.add_runtime_dependency 'coderay', '=0.9.8'
31
31
  gem.add_runtime_dependency 'thin', '>=1.2.10'
32
- gem.add_runtime_dependency 'archive-zip', '>=0.3.0'
32
+ gem.add_runtime_dependency 'archive-zip', '>=0.4.0'
33
33
  gem.add_runtime_dependency 'haml', '>=3.1.2'
34
34
  gem.add_runtime_dependency 'sass', '>=3.1.3'
35
35
  gem.add_runtime_dependency 'nokogiri', '>=1.5.0'
@@ -58,17 +58,23 @@ Rake::TestTask.new(:test) do |test|
58
58
  test.verbose = true
59
59
  end
60
60
 
61
- # task :test do
62
- # load "test/runner.rb"
63
- # end
61
+ task :test_all do
62
+ puts "--- rvm 1.9.2@milkode ---"
63
+ system('rvm 1.9.2@milkode')
64
+ system('rake test')
64
65
 
65
- require 'rcov/rcovtask'
66
- Rcov::RcovTask.new do |test|
67
- test.libs << 'test'
68
- test.pattern = 'test/**/test_*.rb'
69
- test.verbose = true
66
+ puts "--- rvm system ---"
67
+ system('rvm system')
68
+ system('rake test')
70
69
  end
71
70
 
71
+ # require 'rcov/rcovtask'
72
+ # Rcov::RcovTask.new do |test|
73
+ # test.libs << 'test'
74
+ # test.pattern = 'test/**/test_*.rb'
75
+ # test.verbose = true
76
+ # end
77
+
72
78
  task :default => :test
73
79
 
74
80
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.4
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.2"
9
+ Version = "0.2.4"
10
10
  Milkode::CLI_Cdstk.execute(STDOUT, ARGV)
@@ -34,6 +34,7 @@ module Milkode
34
34
  @db_dir = db_dir
35
35
  Database.setup(@db_dir)
36
36
  @out = io
37
+ # @out = $stdout # 強制出力
37
38
  clear_count
38
39
  end
39
40
 
@@ -91,11 +92,12 @@ module Milkode
91
92
  # 存在しないコンテンツがあった場合はその場で終了
92
93
  contents.each do |v|
93
94
  shortname = File.basename v
94
- if (yaml.exist? shortname)
95
+
96
+ if (yaml.cant_add_directory? v)
95
97
  error_alert("already exist '#{shortname}'.")
96
98
  return
97
99
  end
98
-
100
+
99
101
  unless (File.exist? v)
100
102
  error_alert("not found '#{v}'.")
101
103
  return
@@ -432,13 +434,18 @@ module Milkode
432
434
  private :db_add_dir
433
435
 
434
436
  def db_add_file(stdout, filename, shortpath)
437
+ # ファイル名を全てUTF-8に変換
438
+ filename_utf8 = Util::filename_to_utf8(filename)
439
+ shortpath_utf8 = Util::filename_to_utf8(shortpath)
440
+ suffix_utf8 = File::extname(filename_utf8)
441
+
435
442
  # 格納するデータ
436
443
  values = {
437
- :path => filename,
438
- :shortpath => shortpath,
444
+ :path => filename_utf8,
445
+ :shortpath => shortpath_utf8,
439
446
  :content => nil,
440
447
  :timestamp => File.mtime(filename),
441
- :suffix => File::extname(filename),
448
+ :suffix => suffix_utf8,
442
449
  }
443
450
 
444
451
  # 検索するデータベース
@@ -518,7 +525,11 @@ module Milkode
518
525
  private :ignoreFile?
519
526
 
520
527
  def alert(title, msg)
521
- @out.puts "#{title.ljust(10)} : #{msg}"
528
+ if (Util::platform_win?)
529
+ @out.puts "#{title.ljust(10)} : #{Kconv.kconv(msg, Kconv::SJIS)}"
530
+ else
531
+ @out.puts "#{title.ljust(10)} : #{msg}"
532
+ end
522
533
  end
523
534
 
524
535
  def error_alert(msg)
@@ -76,6 +76,13 @@ module Milkode
76
76
  @data['contents'].find {|v| File.basename(v['directory']) == shortname }
77
77
  end
78
78
 
79
+ def cant_add_directory?(dir)
80
+ @data['contents'].find {|v|
81
+ v['directory'] != File.expand_path(dir) &&
82
+ File.basename(v['directory']) == File.basename(dir)
83
+ }
84
+ end
85
+
79
86
  def cleanup
80
87
  contents.delete_if do |v|
81
88
  if (!File.exist? v['directory'])
@@ -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.2"
21
+ @version = "0.2.4"
22
22
  @package_num = Database.instance.fileList('').size
23
23
  @file_num = Database.instance.fileNum
24
24
  haml :index
@@ -9,6 +9,7 @@ require 'rubygems'
9
9
  require 'coderay'
10
10
  require 'coderay/helpers/file_type'
11
11
  require 'nokogiri'
12
+ require 'milkode/common/util'
12
13
 
13
14
  module Milkode
14
15
  class CodeRayWrapper
@@ -22,6 +23,18 @@ module Milkode
22
23
  @line_number_start = 1
23
24
  end
24
25
 
26
+ def col_limit(limit_num)
27
+ content_a = @content.split("\n")
28
+
29
+ @content = content_a.map{|v|
30
+ if (v.length > limit_num)
31
+ v[0...limit_num] + " ..."
32
+ else
33
+ v
34
+ end
35
+ }.join("\n")
36
+ end
37
+
25
38
  def set_range(range)
26
39
  content_a = @content.split("\n")
27
40
  range = limit_range(range, content_a)
@@ -43,7 +56,13 @@ module Milkode
43
56
  :highlight_lines => @highlight_lines,
44
57
  :line_number_start => @line_number_start
45
58
  )
46
- milkode_ornament(html)
59
+
60
+ if (is_ornament?)
61
+ html_doc = Nokogiri::HTML(html)
62
+ add_spanid(html_doc)
63
+ else
64
+ html
65
+ end
47
66
  end
48
67
 
49
68
  def to_html_anchor
@@ -55,39 +74,36 @@ module Milkode
55
74
  :highlight_lines => @highlight_lines,
56
75
  :line_number_start => @line_number_start
57
76
  )
58
-
59
- html_doc = Nokogiri::HTML(html)
60
- anchor = create_anchorlink(html_doc.at_css("table.CodeRay td.code pre").inner_html)
61
- body = milkode_ornament(html)
62
- return anchor + body
77
+
78
+ if (is_ornament?)
79
+ html_doc = Nokogiri::HTML(html)
80
+ anchor = create_anchorlink(html_doc.at_css("table.CodeRay td.code pre").inner_html)
81
+ body = add_spanid(html_doc)
82
+ anchor + body
83
+ else
84
+ html
85
+ end
63
86
  end
64
87
 
65
- def milkode_ornament(html)
66
- # @todo nokogiri使う?
67
- a = html.split("\n")
88
+ def add_spanid(html_doc)
89
+ table = html_doc.at_css("table.CodeRay")
90
+
91
+ # preに<span id="行番号"> を付ける
92
+ pre = table.at_css("td.code pre")
93
+ pre.inner_html = add_spanid_in(pre.inner_html)
94
+
95
+ # 結果を文字列で返す
96
+ table.to_html
97
+ end
68
98
 
99
+ def add_spanid_in(html)
100
+ lines = html.split("<tt>\n</tt>")
69
101
  line_number = @line_number_start
70
- is_code_content = false
71
-
72
- a.each_with_index do |l, index|
73
- if (l =~ / <td class="code"><pre (.*?)>(.*)<tt>/)
74
- a[index] = " <td class=\"code\"><pre #{$1}><span #{line_attr(line_number)}>#{$2}</span><tt>"
75
- is_code_content = true
76
- line_number += 1
77
- next
78
- elsif (l =~ %r|</tt></pre></td>|)
79
- is_code_content = false
80
- end
81
102
 
82
- if (is_code_content)
83
- if (l =~ %r|</tt>(.*)<tt>|)
84
- a[index] = "</tt><span #{line_attr(line_number)}>#{$1}</span><tt>"
85
- line_number += 1
86
- end
87
- end
88
- end
89
-
90
- a.join("\n") + "\n"
103
+ lines.map {|l|
104
+ line_number += 1
105
+ "<span #{line_attr(line_number - 1)}>#{l}</span>"
106
+ }.join("<tt>\n</tt>") + "<tt>\n</tt>"
91
107
  end
92
108
 
93
109
  def file_type
@@ -127,6 +143,11 @@ EOF
127
143
  ""
128
144
  end
129
145
  end
146
+
147
+ def is_ornament?
148
+ Util::larger_than_oneline(@content)
149
+ end
150
+
130
151
  end
131
152
  end
132
153
 
@@ -10,6 +10,7 @@ require 'milkode/cdweb/lib/coderay_wrapper'
10
10
  require 'milkode/cdweb/lib/search_contents'
11
11
  require 'milkode/cdweb/lib/search_files'
12
12
  require 'milkode/cdweb/lib/mkurl'
13
+ require 'milkode/common/util'
13
14
 
14
15
  module Milkode
15
16
  def view(record, params, before)
@@ -18,7 +19,7 @@ module Milkode
18
19
 
19
20
  q = params[:query] && Query.new(params[:query])
20
21
 
21
- if (q and !q.keywords.empty?)
22
+ if (Util::larger_than_oneline(record.content) and q and !q.keywords.empty?)
22
23
  grep = Grep.new(record.content)
23
24
  match_lines = grep.match_lines_and(q.keywords)
24
25
  @record_content = CodeRayWrapper.new(record.content, record.shortpath, match_lines).to_html_anchor
@@ -58,7 +58,7 @@ module Milkode
58
58
  strs.each do |v|
59
59
  option = 0
60
60
  option |= Regexp::IGNORECASE if (ignore)
61
- regs << Regexp.new(v, option)
61
+ regs << Regexp.new(Regexp.escape(v), option)
62
62
  end
63
63
 
64
64
  regs
@@ -19,9 +19,12 @@ module Milkode
19
19
  DISP_NUM = 20 # 1ページの表示数
20
20
  LIMIT_NUM = 50 # 最大検索ファイル数
21
21
  NTH = 3 # 表示範囲
22
+ COL_LIMIT = 200 # 1行の桁制限
23
+
22
24
  # DISP_NUM = 1000 # 1ページの表示数
23
25
  # LIMIT_NUM = 1000 # 最大検索ファイル数
24
26
  # NTH = 3 # 表示範囲
27
+ # COL_LIMIT = 200 # 1行の桁制限
25
28
 
26
29
  def initialize(path, params, query)
27
30
  @path = path
@@ -30,7 +33,7 @@ module Milkode
30
33
  @page = params[:page].to_i || 0
31
34
  @offset = params[:offset].to_i
32
35
  fpaths = @q.fpaths
33
- fpaths << path unless path == ""
36
+ fpaths << path + "/" unless path == ""
34
37
  @records, @total_records, @elapsed = Database.instance.search(@q.keywords, @q.packages, fpaths, @q.suffixs, @offset, LIMIT_NUM)
35
38
  grep_contents
36
39
  end
@@ -75,9 +78,13 @@ EOF
75
78
  @next_index = @records.size
76
79
 
77
80
  @records.each_with_index do |record, index|
78
- grep = Grep.new(record.content)
79
- match_line = grep.one_match_and(@q.keywords)
80
- @match_records << MatchRecord.new(record, match_line) if match_line
81
+ if (Util::larger_than_oneline(record.content))
82
+ grep = Grep.new(record.content)
83
+ match_line = grep.one_match_and(@q.keywords)
84
+ @match_records << MatchRecord.new(record, match_line) if match_line
85
+ else
86
+ @match_records << MatchRecord.new(record, Grep::MatchLineResult.new(0, nil))
87
+ end
81
88
 
82
89
  if @match_records.size >= DISP_NUM
83
90
  @next_index = index + 1
@@ -94,6 +101,7 @@ EOF
94
101
  last_index = match_line.index + NTH
95
102
 
96
103
  coderay = CodeRayWrapper.new(record.content, record.shortpath, [match_line])
104
+ coderay.col_limit(COL_LIMIT)
97
105
  coderay.set_range(first_index..last_index)
98
106
 
99
107
  <<EOS
@@ -24,7 +24,7 @@ module Milkode
24
24
  @offset = params[:offset].to_i
25
25
 
26
26
  fpaths = @q.fpaths
27
- fpaths << path unless path == ""
27
+ fpaths << path + "/" unless path == ""
28
28
 
29
29
  if (fpaths.include?("*"))
30
30
  @records, @total_records = Database.instance.selectAll(@offset, DISP_NUM)
@@ -5,5 +5,6 @@
5
5
  # @author ongaeshi
6
6
  # @date 2011/08/04
7
7
 
8
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../../../vendor')
8
+ # 0.4.0になったため、必要なくなった。
9
+ # $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../../../vendor')
9
10
  require 'archive/zip'
@@ -4,6 +4,7 @@ require 'rubygems'
4
4
  require 'milkode/common/archive-zip'
5
5
  require 'fileutils'
6
6
  require 'pathname'
7
+ require 'kconv'
7
8
 
8
9
  module Milkode
9
10
  module Util
@@ -48,6 +49,44 @@ module Milkode
48
49
  basedir = Pathname.new(basedir)
49
50
  path.relative_path_from(basedir)
50
51
  end
52
+
53
+ def ruby19?
54
+ RUBY_VERSION >= '1.9.0'
55
+ end
56
+
57
+ def platform_win?
58
+ RUBY_PLATFORM =~ /mswin(?!ce)|mingw|cygwin|bccwin/
59
+ end
60
+
61
+ def platform_osx?
62
+ RUBY_PLATFORM =~ /darwin/
63
+ end
64
+
65
+ def shell_kcode
66
+ if platform_win?
67
+ Kconv::SJIS # win7? cygwin utf8?
68
+ else
69
+ Kconv::UTF8
70
+ end
71
+ end
72
+
73
+ def filename_to_utf8(str_from_file)
74
+ if platform_osx?
75
+ if (ruby19?)
76
+ str_from_file.encode('UTF-8', 'UTF8-MAC')
77
+ else
78
+ str_from_file
79
+ end
80
+ elsif platform_win?
81
+ Kconv.kconv(str_from_file, Kconv::UTF8)
82
+ else
83
+ str_from_file
84
+ end
85
+ end
86
+
87
+ def larger_than_oneline(content)
88
+ content.count("\n") > 1
89
+ end
51
90
  end
52
91
  end
53
92
 
data/milkode.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.4"
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-08-26}
12
+ s.date = %q{2011-10-02}
13
13
  s.description = %q{Line based local source code search engine & web-app.}
14
14
  s.email = %q{ongaeshi0621@gmail.com}
15
15
  s.executables = ["cdv", "milk", "cdview"]
@@ -93,8 +93,7 @@ Gem::Specification.new do |s|
93
93
  "test/test_mkurl.rb",
94
94
  "test/test_query.rb",
95
95
  "test/test_string_snip.rb",
96
- "test/test_util.rb",
97
- "vendor/archive/support/io.rb"
96
+ "test/test_util.rb"
98
97
  ]
99
98
  s.homepage = %q{http://github.com/ongaeshi/milkode}
100
99
  s.licenses = ["MIT"]
@@ -135,9 +134,9 @@ Gem::Specification.new do |s|
135
134
  s.add_runtime_dependency(%q<rack>, [">= 1.2.1"])
136
135
  s.add_runtime_dependency(%q<sinatra>, [">= 1.2.6"])
137
136
  s.add_runtime_dependency(%q<launchy>, [">= 0.3.7"])
138
- s.add_runtime_dependency(%q<coderay>, [">= 0.9.8"])
137
+ s.add_runtime_dependency(%q<coderay>, ["= 0.9.8"])
139
138
  s.add_runtime_dependency(%q<thin>, [">= 1.2.10"])
140
- s.add_runtime_dependency(%q<archive-zip>, [">= 0.3.0"])
139
+ s.add_runtime_dependency(%q<archive-zip>, [">= 0.4.0"])
141
140
  s.add_runtime_dependency(%q<haml>, [">= 3.1.2"])
142
141
  s.add_runtime_dependency(%q<sass>, [">= 3.1.3"])
143
142
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.5.0"])
@@ -150,9 +149,9 @@ Gem::Specification.new do |s|
150
149
  s.add_dependency(%q<rack>, [">= 1.2.1"])
151
150
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
152
151
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
153
- s.add_dependency(%q<coderay>, [">= 0.9.8"])
152
+ s.add_dependency(%q<coderay>, ["= 0.9.8"])
154
153
  s.add_dependency(%q<thin>, [">= 1.2.10"])
155
- s.add_dependency(%q<archive-zip>, [">= 0.3.0"])
154
+ s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
156
155
  s.add_dependency(%q<haml>, [">= 3.1.2"])
157
156
  s.add_dependency(%q<sass>, [">= 3.1.3"])
158
157
  s.add_dependency(%q<nokogiri>, [">= 1.5.0"])
@@ -166,9 +165,9 @@ Gem::Specification.new do |s|
166
165
  s.add_dependency(%q<rack>, [">= 1.2.1"])
167
166
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
168
167
  s.add_dependency(%q<launchy>, [">= 0.3.7"])
169
- s.add_dependency(%q<coderay>, [">= 0.9.8"])
168
+ s.add_dependency(%q<coderay>, ["= 0.9.8"])
170
169
  s.add_dependency(%q<thin>, [">= 1.2.10"])
171
- s.add_dependency(%q<archive-zip>, [">= 0.3.0"])
170
+ s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
172
171
  s.add_dependency(%q<haml>, [">= 3.1.2"])
173
172
  s.add_dependency(%q<sass>, [">= 3.1.3"])
174
173
  s.add_dependency(%q<nokogiri>, [">= 1.5.0"])
data/test/test_util.rb CHANGED
@@ -8,6 +8,7 @@
8
8
  require 'milkode/common/util'
9
9
  require 'test/unit'
10
10
  require 'file_test_utils'
11
+ require 'tmpdir'
11
12
 
12
13
  class TestUtil < Test::Unit::TestCase
13
14
  include FileTestUtils
@@ -30,6 +31,38 @@ class TestUtil < Test::Unit::TestCase
30
31
  assert_equal ['abc/'], Milkode::Util::root_entrylist('../data/abc.zip')
31
32
  assert_equal ['a.txt', 'b.txt', 'c.txt'], Milkode::Util::root_entrylist('../data/nodir_abc.zip')
32
33
  end
34
+
35
+ def test_platform
36
+ if (Milkode::Util::platform_osx?)
37
+ assert_equal Milkode::Util::shell_kcode, Kconv::UTF8
38
+ end
39
+
40
+ if (Milkode::Util::platform_win?)
41
+ assert_equal Milkode::Util::shell_kcode, Kconv::SJIS
42
+ end
43
+ end
44
+
45
+ def create_filename_str(name)
46
+ Dir.mktmpdir do |dir|
47
+ FileUtils.touch( File.join(dir, name) )
48
+
49
+ Dir.foreach(dir) do |f|
50
+ next if (f == "." or f == "..")
51
+ return f
52
+ end
53
+ end
54
+ end
55
+
56
+ def test_filename_to_utf8
57
+ if (Milkode::Util::ruby19?)
58
+ assert_equal Encoding::UTF_8, Milkode::Util::filename_to_utf8('ダミー').encoding
59
+ assert_equal Encoding::UTF_8, Milkode::Util::filename_to_utf8(create_filename_str('ダミー')).encoding
60
+ else
61
+ # 実行だけはしておく
62
+ Milkode::Util::filename_to_utf8('ダミー')
63
+ Milkode::Util::filename_to_utf8(create_filename_str('ダミー'))
64
+ end
65
+ end
33
66
 
34
67
  def teardown
35
68
  teardown_custom(true)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 4
9
+ version: 0.2.4
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-08-26 00:00:00 +09:00
17
+ date: 2011-10-02 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -130,7 +130,7 @@ dependencies:
130
130
  - !ruby/object:Gem::Dependency
131
131
  version_requirements: &id009 !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - ">="
133
+ - - "="
134
134
  - !ruby/object:Gem::Version
135
135
  segments:
136
136
  - 0
@@ -162,9 +162,9 @@ dependencies:
162
162
  - !ruby/object:Gem::Version
163
163
  segments:
164
164
  - 0
165
- - 3
165
+ - 4
166
166
  - 0
167
- version: 0.3.0
167
+ version: 0.4.0
168
168
  name: archive-zip
169
169
  requirement: *id011
170
170
  prerelease: false
@@ -299,7 +299,6 @@ files:
299
299
  - test/test_query.rb
300
300
  - test/test_string_snip.rb
301
301
  - test/test_util.rb
302
- - vendor/archive/support/io.rb
303
302
  has_rdoc: true
304
303
  homepage: http://github.com/ongaeshi/milkode
305
304
  licenses:
@@ -1,53 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # @file
4
- # @brief archive-zip/lib/archive/support/io.rb patch, removed in the future.
5
- # @author ongaeshi
6
- # @date 2011/08/04
7
-
8
- begin
9
- require 'readbytes'
10
- rescue LoadError
11
- # for Ruby 1.9.2
12
- class TruncatedDataError<IOError
13
- def initialize(mesg, data) # :nodoc:
14
- @data = data
15
- super(mesg)
16
- end
17
-
18
- # The read portion of an IO#readbytes attempt.
19
- attr_reader :data
20
- end
21
-
22
- class IO
23
- # Reads exactly +n+ bytes.
24
- #
25
- # If the data read is nil an EOFError is raised.
26
- #
27
- # If the data read is too short a TruncatedDataError is raised and the read
28
- # data is obtainable via its #data method.
29
- def readbytes(n)
30
- str = read(n)
31
- if str == nil
32
- raise EOFError, "End of file reached"
33
- end
34
- if str.size < n
35
- raise TruncatedDataError.new("data truncated", str)
36
- end
37
- str
38
- end
39
- end
40
- end
41
-
42
- class IO
43
- # Returns +true+ if the seek method of this IO instance would succeed, +false+
44
- # otherwise.
45
- def seekable?
46
- begin
47
- pos
48
- true
49
- rescue SystemCallError
50
- false
51
- end
52
- end
53
- end