Browse files

Ruby 1.8 compatibility

  • Loading branch information...
1 parent 2e6f558 commit 7b214c2a5a34f9d05d9df2ac80b5dc8c0cbdacfc Andrew Kirilenko committed Jan 15, 2013
View
28 Gemfile.lock
@@ -1,32 +1,32 @@
PATH
remote: .
specs:
- iron_mq (3.0.2)
- iron_core (>= 0.4.4)
+ iron_mq (3.1.0)
+ iron_core (>= 0.5.1)
GEM
remote: https://rubygems.org/
specs:
beanstalk-client (1.1.1)
concur (1.0.2)
- ethon (0.5.3)
- ffi (~> 1.0.11)
+ ethon (0.5.7)
+ ffi (~> 1.2.0)
mime-types (~> 1.18)
- ffi (1.0.11)
- iron_core (0.4.4)
- rest (>= 2.1.1)
+ ffi (1.2.1)
+ iron_core (0.5.1)
+ rest (>= 2.2.0)
mime-types (1.19)
- minitest (4.2.0)
+ minitest (4.4.0)
net-http-persistent (2.8)
- rake (10.0.0)
- rest (2.1.1)
+ rake (10.0.3)
+ rest (2.2.0)
net-http-persistent
rest-client (>= 0.3.0)
rest-client (1.6.7)
mime-types (>= 1.16)
- test-unit (2.5.2)
- typhoeus (0.5.1)
- ethon (= 0.5.3)
+ test-unit (2.5.3)
+ typhoeus (0.5.4)
+ ethon (~> 0.5.7)
uber_config (1.0.5)
PLATFORMS
@@ -40,5 +40,5 @@ DEPENDENCIES
net-http-persistent
rake
test-unit
- typhoeus
+ typhoeus (>= 0.5.4)
uber_config
View
6 iron_mq.gemspec
@@ -15,15 +15,15 @@ Gem::Specification.new do |gem|
gem.version = IronMQ::VERSION
gem.required_rubygems_version = ">= 1.3.6"
- gem.required_ruby_version = Gem::Requirement.new(">= 1.9")
- gem.add_runtime_dependency "iron_core", ">= 0.4.4"
+ gem.required_ruby_version = Gem::Requirement.new(">= 1.8")
+ gem.add_runtime_dependency "iron_core", ">= 0.5.1"
gem.add_development_dependency "test-unit"
gem.add_development_dependency "minitest"
gem.add_development_dependency "rake"
gem.add_development_dependency "beanstalk-client"
gem.add_development_dependency "uber_config"
- gem.add_development_dependency "typhoeus"
+ gem.add_development_dependency "typhoeus", ">= 0.5.4"
gem.add_development_dependency "concur"
gem.add_development_dependency "net-http-persistent"
View
11 lib/iron_mq.rb
@@ -1,6 +1,5 @@
-require 'rest'
-require_relative 'iron_mq/response'
-require_relative 'iron_mq/queues'
-require_relative 'iron_mq/messages'
-require_relative 'iron_mq/client'
-require_relative 'iron_mq/version'
+require 'iron_mq/response'
+require 'iron_mq/queues'
+require 'iron_mq/messages'
+require 'iron_mq/client'
+require 'iron_mq/version'
View
2 lib/iron_mq/client.rb
@@ -1,7 +1,7 @@
require 'yaml'
require 'iron_core'
-require_relative 'queues'
+require 'iron_mq/queues'
module IronMQ
View
2 lib/iron_mq/messages.rb
@@ -116,7 +116,7 @@ def release(options={})
end
def subscribers(options={})
- res = @messages.client.get(@messages.path(options.merge(msg_id: id)) + "/subscribers", options)
+ res = @messages.client.get(@messages.path(options.merge(:msg_id => id)) + "/subscribers", options)
res = @messages.client.parse_response(res)
ret = []
res['subscribers'].each do |m|
View
6 lib/iron_mq/queues.rb
@@ -1,5 +1,5 @@
require 'cgi'
-require_relative 'subscribers'
+require 'iron_mq/subscribers'
module IronMQ
class Queues
@@ -151,14 +151,14 @@ def subscribers
end
def add_subscriber(subscriber_hash, options={})
- res = @client.post("#{@client.queues.path(name: name)}/subscribers", subscribers: [subscriber_hash])
+ res = @client.post("#{@client.queues.path(:name => name)}/subscribers", :subscribers => [subscriber_hash])
res = @client.parse_response(res)
#p res
res
end
def remove_subscriber(subscriber_hash)
- res = @client.delete("#{@client.queues.path(name: name)}/subscribers", {subscribers: [subscriber_hash]}, {"Content-Type"=>@client.content_type})
+ res = @client.delete("#{@client.queues.path(:name => name)}/subscribers", {:subscribers => [subscriber_hash]}, {"Content-Type"=>@client.content_type})
res = @client.parse_response(res)
#p res
res
View
2 lib/iron_mq/version.rb
@@ -1,4 +1,4 @@
module IronMQ
- VERSION = "3.0.2"
+ VERSION = "3.1.0"
end
View
8 test/long_run.rb
@@ -1,6 +1,14 @@
require 'yaml'
require 'concur'
require 'uber_config'
+
+unless Hash.instance_methods.include?(:default_proc=)
+ class Hash
+ def default_proc=(proc)
+ end
+ end
+end
+
begin
require File.join(File.dirname(__FILE__), '..', 'lib', 'iron_mq')
rescue Exception => ex
View
2 test/quick_run.rb
@@ -1,4 +1,4 @@
-require_relative 'test_base'
+require 'test_base'
TIMES = 1
View
2 test/schedule_abt.rb
@@ -1,6 +1,6 @@
require 'abt'
require 'time'
-require_relative 'test_base'
+require 'test_base'
# Config for abt tests to run on IronWorker
@abt_config = YAML::load_file(File.expand_path(File.join("~", "Dropbox", "configs", "abt", "test", "config.yml")))
View
10 test/test_base.rb
@@ -1,7 +1,15 @@
-gem 'test-unit'
+require 'rubygems'
require 'test/unit'
require 'yaml'
require 'uber_config'
+
+unless Hash.instance_methods.include?(:default_proc=)
+ class Hash
+ def default_proc=(proc)
+ end
+ end
+end
+
begin
require File.join(File.dirname(__FILE__), '../lib/iron_mq')
rescue Exception => ex
View
3 test/test_beanstalkd.rb
@@ -1,8 +1,7 @@
-gem 'test-unit'
require 'test/unit'
require 'beanstalk-client'
require 'yaml'
-require_relative 'test_base'
+require 'test_base'
class BeanstalkTests < TestBase
def setup
View
2 test/test_bulk.rb
@@ -1,4 +1,4 @@
-require_relative 'test_base'
+require 'test_base'
class TestBulk < TestBase
View
7 test/test_iron_mq.rb
@@ -1,7 +1,6 @@
-gem 'test-unit'
require 'test/unit'
require 'yaml'
-require_relative 'test_base'
+require 'test_base'
class IronMQTests < TestBase
def setup
@@ -406,15 +405,15 @@ def test_webhooks
omit_if @skip
puts "skip webhooks: #{@skip}"
qname ="webhook_queue"
- path = "#{IronMQ::Messages.path(project_id: @client.project_id, queue_name: qname)}/webhook"
+ path = "#{IronMQ::Messages.path(:project_id => @client.project_id, :queue_name => qname)}/webhook"
url = "#{@client.base_url}#{path}"
url << "?oauth=#{@client.token}"
p url
v = "hello webhook"
@rest = Rest::Client.new
- p @rest.post(url, body: v)
+ p @rest.post(url, :body => v)
queue = @client.queue(qname)
msg = queue.get
View
14 test/test_push_queues.rb
@@ -1,5 +1,5 @@
# Put config.yml file in ~/Dropbox/configs/ironmq_gem/test/config.yml
-require_relative 'test_base'
+require 'test_base'
require 'logger'
class TestPushQueues < TestBase
@@ -30,7 +30,7 @@ def test_queue_subscriptions
x = rand(1000)
num_subscribers.times do |i|
key = make_key(i, t, x)
- subscribers << {url: "http://rest-test.iron.io/code/200?store=#{key}"}
+ subscribers << {:url => "http://rest-test.iron.io/code/200?store=#{key}"}
end
queue = @client.queue(qname)
@@ -43,10 +43,10 @@ def test_queue_subscriptions
# add the last one
queue.reload # temporary, can remove
- queue.add_subscriber({url: "http://nowhere.com"})
+ queue.add_subscriber({:url => "http://nowhere.com"})
queue.reload
assert_equal num_subscribers + 1, queue.subscribers.size
- queue.remove_subscriber({url: "http://nowhere.com"})
+ queue.remove_subscriber({:url => "http://nowhere.com"})
queue.reload
assert_equal num_subscribers, queue.subscribers.size
@@ -153,8 +153,8 @@ def test_failure
x = rand(1000)
subscribers = []
- subscribers << {url: "http://rest-test.iron.io/code/503?switch_after=2&switch_to=200&namespace=push-test-failures-#{x}"}
- subscribers << {url: "http://rest-test.iron.io/code/503"}
+ subscribers << {:url => "http://rest-test.iron.io/code/503?switch_after=2&switch_to=200&namespace=push-test-failures-#{x}"}
+ subscribers << {:url => "http://rest-test.iron.io/code/503"}
num_subscribers = 2
@@ -236,7 +236,7 @@ def test_202
x = rand(1000)
num_subscribers.times do |i|
key = make_key(i, t, x)
- subscribers << {url: "http://rest-test.iron.io/code/202?store=#{key}"}
+ subscribers << {:url => "http://rest-test.iron.io/code/202?store=#{key}"}
end
queue = @client.queue(qname)

0 comments on commit 7b214c2

Please sign in to comment.