Permalink
Browse files

suppress rubygems deprecations during artifice setup

  • Loading branch information...
1 parent 5f35373 commit 040430d2fb5f41baf7de3295909e5fd38c194090 @indirect indirect committed May 27, 2012
Showing with 27 additions and 14 deletions.
  1. +27 −14 spec/support/artifice/endpoint.rb
@@ -12,23 +12,36 @@
class Endpoint < Sinatra::Base
+ if defined? ::Deprecate
+ Deprecate = ::Deprecate
+ elsif defined? Gem::Deprecate
+ Deprecate = Gem::Deprecate
+ else
+ class Deprecate
+ def skip_during; yield; end
+ end
+ end
+
helpers do
def dependencies_for(gem_names, marshal = gem_repo1("Marshal.4.8"))
require 'rubygems'
- Marshal.load(File.open(marshal).read).map do |gem, spec|
- if gem_names.include?(spec.name)
- {
- :name => spec.name,
- :number => spec.version.version,
- :platform => spec.platform.to_s,
- :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
- [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
- end
- }
- end
- end.compact
- end
- end
+ gems = Deprecate.skip_during do
+ Marshal.load(File.open(marshal).read).map do |gem, spec|
+ if gem_names.include?(spec.name)
+ {
+ :name => spec.name,
+ :number => spec.version.version,
+ :platform => spec.platform.to_s,
+ :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
+ [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
+ end
+ }
+ end
+ end # Marshal.load
+ end # Deprecate.skip_during
+ gems.compact
+ end # def dependencies_for
+ end # helpers
get "/quick/Marshal.4.8/:id" do
redirect "/fetch/actual/gem/#{params[:id]}"

0 comments on commit 040430d

Please sign in to comment.