Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'develop'

  • Loading branch information...
commit 8afe7aa6ac6d663a89562ea7be6d977be206e004 2 parents 493965e + 86f7e45
ongaeshi authored
4 HISTORY.rdoc
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)
2  VERSION
View
@@ -1 +1 @@
-0.1.6
+0.1.7
2  bin/milk
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)
2  lib/milkode/cdweb/app.rb
View
@@ -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
42 lib/milkode/common/archive-zip.rb
View
@@ -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'
2  lib/milkode/common/util.rb
View
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
require 'rubygems'
-require 'archive/zip'
+require 'milkode/common/archive-zip'
require 'fileutils'
module Milkode
Please sign in to comment.
Something went wrong with that request. Please try again.