From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS12876 195.154.0.0/16 X-Spam-Status: No, score=-1.5 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_XBL,RDNS_NONE,URIBL_BLOCKED shortcircuit=no autolearn=no version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from 80x24.org (unknown [195.154.243.53]) by dcvr.yhbt.net (Postfix) with ESMTP id 5DC841FA57 for ; Tue, 16 Dec 2014 22:54:56 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH 2/2] make sendfile an optional dependency Date: Tue, 16 Dec 2014 22:54:55 +0000 Message-Id: <1418770495-28848-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.2.0 List-Id: Not everybody needs to serve or even buffer to regular files, so make sendfile optional to avoid the extra memory use and relocations. --- lib/yahns/wbuf_common.rb | 7 ++++--- yahns.gemspec | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index 69fd00d..0ce4526 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -1,10 +1,11 @@ # -*- encoding: binary -*- # Copyright (C) 2009-2013, Eric Wong et. al. # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) -if ENV["SENDFILE_BROKEN"] - require_relative 'sendfile_compat' -else +begin + raise LoadError, "SENDFILE_BROKEN env set" if ENV["SENDFILE_BROKEN"] require 'sendfile' +rescue LoadError + require_relative 'sendfile_compat' end module Yahns::WbufCommon # :nodoc: diff --git a/yahns.gemspec b/yahns.gemspec index db1d50e..120dc46 100644 --- a/yahns.gemspec +++ b/yahns.gemspec @@ -12,8 +12,8 @@ Gem::Specification.new do |s| s.files = manifest s.add_dependency(%q, '~> 2.9') s.add_dependency(%q, '~> 3.2') - s.add_dependency(%q, '~> 1.2') s.add_dependency(%q, '~> 4.6', '>= 4.6.3') + # s.add_dependency(%q, '~> 1.2') # optional # minitest is standard in Ruby 2.0, 4.3 is packaged with Ruby 2.0.0, # 4.7.5 with 2.1. We work with minitest 5, too. 6.x does not exist -- EW