Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 493965e + 86f7e45 commit 8afe7aa6ac6d663a89562ea7be6d977be206e004 @ongaeshi committed Aug 3, 2011
Showing with 50 additions and 4 deletions.
  1. +4 −0 HISTORY.rdoc
  2. +1 −1 VERSION
  3. +1 −1 bin/milk
  4. +1 −1 lib/milkode/cdweb/app.rb
  5. +42 −0 lib/milkode/common/archive-zip.rb
  6. +1 −1 lib/milkode/common/util.rb
View
@@ -1,3 +1,7 @@
+=== 0.1.7 2011/08/04
+
+* archive-zip patch for Ruby1.9.2.
+
=== 0.1.6 2011/08/03
* Bug fix, faild 'milk init' for Ubunts. (thanks kumonopanya, and maroekun)
View
@@ -1 +1 @@
-0.1.6
+0.1.7
View
@@ -6,5 +6,5 @@
require 'rubygems'
require 'milkode/cdstk/cli_cdstk'
-Version = "0.1.6"
+Version = "0.1.7"
Milkode::CLI_Cdstk.execute(STDOUT, ARGV)
@@ -18,7 +18,7 @@
set :haml, :format => :html5
get '/' do
- @version = "0.1.6"
+ @version = "0.1.7"
@package_num = Database.instance.fileList('').size
@file_num = Database.instance.fileNum
haml :index
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+#
+# @file
+# @brief archive-zipがRuby1.9.2に対応するまでのパッチ、readbytesが無ければ実装する
+# @author ongaeshi
+# @date 2011/08/04
+
+begin
+ require 'readbytes'
+rescue LoadError
+ # for Ruby 1.9.2
+ class TruncatedDataError<IOError
+ def initialize(mesg, data) # :nodoc:
+ @data = data
+ super(mesg)
+ end
+
+ # The read portion of an IO#readbytes attempt.
+ attr_reader :data
+ end
+
+ class IO
+ # Reads exactly +n+ bytes.
+ #
+ # If the data read is nil an EOFError is raised.
+ #
+ # If the data read is too short a TruncatedDataError is raised and the read
+ # data is obtainable via its #data method.
+ def readbytes(n)
+ str = read(n)
+ if str == nil
+ raise EOFError, "End of file reached"
+ end
+ if str.size < n
+ raise TruncatedDataError.new("data truncated", str)
+ end
+ str
+ end
+ end
+end
+
+require 'archive/zip'
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
require 'rubygems'
-require 'archive/zip'
+require 'milkode/common/archive-zip'
require 'fileutils'
module Milkode

0 comments on commit 8afe7aa

Please sign in to comment.