Permalink
Browse files

Add support for ruby 2.0.0-p0, needed to preferentially use zlib

  • Loading branch information...
1 parent bc51917 commit 9b4f62905f0eacb8331ba0372a42345f4d7252b6 @smarterclayton smarterclayton committed Feb 25, 2013
Showing with 20 additions and 18 deletions.
  1. +3 −12 .travis.yml
  2. +16 −5 lib/rhc/tar_gz.rb
  3. +1 −1 spec/rhc/helpers_spec.rb
View
@@ -2,22 +2,13 @@ language: ruby
rvm:
- 1.8.7
- 1.9.3
+ - 2.0.0
gemfile: Gemfile
after_install: gem list
script: bundle exec rake spec
notifications:
email:
- recipients:
- - dev@openshift.redhat.com
+ #recipients:
+ # - dev@lists.openshift.redhat.com
irc:
- "irc.freenode.org#openshift-dev"
-env:
- global:
- - "ARTIFACTS_AWS_REGION=us-east-1"
- - "ARTIFACTS_S3_BUCKET=libra_travis_artifacts"
- - secure: "X/3WPJkR5dQOyZbklqovK3EB8gye5k7yeczfqoRIjfsf7Y3GQbyNR10kAIX9\nwx4TFxV3617GSxqPrFI2esU0N2uqwbGsGdnd7sHcz27df861CsIdtgwtX3mM\nw/ZoEVwe5DRjCUPXroMwfmh20q8kVXUnlW2wR8vbzRC/fQji+u0="
- - secure: "lKAXyrHz4cbzKbDrOsAWrv/r8S9ZFPw4f2Zev1PRBMqO0FPdntcsoIESE9hQ\nKnrwIIyRfYaSHgN8jKquUPvSotGfiubrTXww9fOLUlJDvkbumxYqVxge92ut\nXP4XOyGw5Lcpc582kTdfg/uYElkqH1VC7FesFcWewEgL8Rhhz+8="
-before_script:
- - "gem install travis-artifacts"
-after_failure:
- - "travis-artifacts upload --path coverage/spec --private"
View
@@ -1,5 +1,4 @@
require 'stringio'
-require 'rhc/vendor/zliby'
require 'archive/tar/minitar'
include Archive::Tar
@@ -16,7 +15,7 @@ def self.contains(filename, search, force_ruby=false)
regex = Regexp.new search
if RHC::Helpers.windows? or force_ruby
begin
- RHC::Vendor::Zlib::GzipReader.open(filename) do |gz|
+ zlib::GzipReader.open(filename) do |gz|
Minitar::Reader.open gz do |tar|
tar.each_entry do |entry|
if entry.full_name =~ regex
@@ -25,16 +24,28 @@ def self.contains(filename, search, force_ruby=false)
end
end
end
- rescue RHC::Vendor::Zlib::GzipFile::Error
- return false
+ rescue zlib::GzipFile::Error, zlib::GzipFile::Error
+ false
end
else
# combining STDOUT and STDERR (i.e., 2>&1) does not suppress output
# when the specs run via 'bundle exec rake spec'
- return system "#{TAR_BIN} --wildcards -tf #{filename} #{regex.source} 2>/dev/null >/dev/null"
+ system "#{TAR_BIN} --wildcards -tf #{filename} #{regex.source} 2>/dev/null >/dev/null"
end
end
+ private
+ def self.zlib
+ #:nocov:
+ require 'zlib' rescue nil
+ if defined? Zlib::GzipReader
+ Zlib
+ else
+ require 'rhc/vendor/zliby'
+ RHC::Vendor::Zlib
+ end
+ #:nocov:
+ end
end
end
@@ -25,7 +25,7 @@ def config
@config ||= RHC::Config.new
end
def options
- @options ||= OpenStruct.new([:server])
+ @options ||= OpenStruct.new(:server => nil)
end
end.new
end

0 comments on commit 9b4f629

Please sign in to comment.