lib/hoe.rb in hoe-2.12.3 vs lib/hoe.rb in hoe-2.12.4

- old
+ new

@@ -66,11 +66,11 @@ class Hoe include Rake::DSL if defined?(Rake::DSL) # duh - VERSION = '2.12.3' + VERSION = '2.12.4' @@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package, :publish, :rcov, :gemcutter, :signing, :test] ## @@ -95,11 +95,11 @@ } ## # True if you're a masochistic developer. Used for building commands. - WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ unless defined? WINDOZE + WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ## # *MANDATORY*: The author(s) of the package. (can be array) # # Use the #developer method to fill in both author and email cleanly. @@ -472,11 +472,11 @@ version = nil version_re = /VERSION += +([\"\'])([\d][\w\.]+)\1/ spec.files.each do |file| next unless File.exist? file - version = File.read_utf(file)[version_re, 2] + version = File.read_utf(file)[version_re, 2] rescue nil break if version end spec.version = self.version = version if version @@ -757,10 +757,17 @@ end class File # Like File::read, but strips out a BOM marker if it exists. def self.read_utf path - open path, 'rb' do |f| - f.read.sub %r/\A\xEF\xBB\xBF/, '' + r19 = "<3".respond_to? :encoding + opt = r19 ? "r:bom|utf-8" : "rb" + + open path, opt do |f| + if r19 then + f.read + else + f.read.sub %r/\A\xEF\xBB\xBF/, '' + end end end end