lib/linner/bundler.rb in linner-0.6.1 vs lib/linner/bundler.rb in linner-0.6.2

- old
+ new

@@ -1,5 +1,6 @@ +require "uri" require "digest" require "fileutils" require "open-uri" module Linner @@ -50,17 +51,20 @@ private def install_to_repository(url, path) FileUtils.mkdir_p File.dirname(path) File.open(path, "w") do |dist| - open(url, "r:UTF-8") {|file| dist.write file.read} + if url =~ URI::regexp + open(url, "r:UTF-8") {|file| dist.write file.read} + else + dist.write(File.read Pathname(url).expand_path) + end end end def link_to_vendor(path, dist) - if !File.exist?(dist) or Digest::MD5.file(path).hexdigest != Digest::MD5.file(dist).hexdigest - FileUtils.mkdir_p File.dirname(dist) - FileUtils.cp path, dist - end + return if File.exist?(dist) and Digest::MD5.file(path).hexdigest == Digest::MD5.file(dist).hexdigest + FileUtils.mkdir_p File.dirname(dist) + FileUtils.cp path, dist end end end