Browse Source

Uses rails 4.2 compatible threadsafe branch of AR

Chris Saunders 10 years ago
parent
commit
565002d928
9 changed files with 34 additions and 21 deletions
  1. 1 1
      Gemfile
  2. 13 15
      Gemfile.lock
  3. 1 0
      Gemfile_ar31
  4. 1 0
      Gemfile_ar32
  5. 1 1
      Gemfile_ar40threadsafe
  6. 7 0
      Gemfile_ar42threadsafe
  7. 2 2
      README.md
  8. 1 1
      shopify_api.gemspec
  9. 7 1
      test/recurring_application_charge_test.rb

+ 1 - 1
Gemfile

@@ -2,4 +2,4 @@ source "https://rubygems.org"
 
 gemspec
 
-gem "activeresource", "~> 4.0.0"
+gem "activeresource", '~> 4.0.0'

+ 13 - 15
Gemfile.lock

@@ -2,49 +2,47 @@ PATH
   remote: .
   specs:
     shopify_api (3.2.6)
-      activeresource (>= 3.0.0)
+      activeresource
       pry (>= 0.9.12.6)
       thor (~> 0.18.1)
 
 GEM
   remote: https://rubygems.org/
   specs:
-    activemodel (4.0.3)
-      activesupport (= 4.0.3)
+    activemodel (4.0.13)
+      activesupport (= 4.0.13)
       builder (~> 3.1.0)
     activeresource (4.0.0)
       activemodel (~> 4.0)
       activesupport (~> 4.0)
       rails-observers (~> 0.1.1)
-    activesupport (4.0.3)
-      i18n (~> 0.6, >= 0.6.4)
+    activesupport (4.0.13)
+      i18n (~> 0.6, >= 0.6.9)
       minitest (~> 4.2)
       multi_json (~> 1.3)
       thread_safe (~> 0.1)
       tzinfo (~> 0.3.37)
-    atomic (1.1.14)
     builder (3.1.4)
     coderay (1.1.0)
     fakeweb (1.3.0)
-    i18n (0.6.9)
+    i18n (0.7.0)
     metaclass (0.0.1)
     method_source (0.8.2)
     minitest (4.7.5)
     mocha (0.14.0)
       metaclass (~> 0.0.1)
-    multi_json (1.8.4)
-    pry (0.9.12.6)
-      coderay (~> 1.0)
-      method_source (~> 0.8)
+    multi_json (1.10.1)
+    pry (0.10.1)
+      coderay (~> 1.1.0)
+      method_source (~> 0.8.1)
       slop (~> 3.4)
     rails-observers (0.1.2)
       activemodel (~> 4.0)
     rake (10.1.0)
-    slop (3.5.0)
+    slop (3.6.0)
     thor (0.18.1)
-    thread_safe (0.1.3)
-      atomic
-    tzinfo (0.3.38)
+    thread_safe (0.3.4)
+    tzinfo (0.3.42)
 
 PLATFORMS
   ruby

+ 1 - 0
Gemfile_ar31

@@ -6,4 +6,5 @@ gem "activeresource", "~> 3.1.0"
 
 if ENV['OLD_RAKE'] == '1'
   gem "rake", "~> 0.9.2"
+  gem "i18n", "~> 0.6.11"
 end

+ 1 - 0
Gemfile_ar32

@@ -6,4 +6,5 @@ gem "activeresource", "~> 3.2.0"
 
 if ENV['OLD_RAKE'] == '1'
   gem "rake", "~> 0.9.2"
+  gem "i18n", "~> 0.6.11"
 end

+ 1 - 1
Gemfile_ar40threadsafe

@@ -2,6 +2,6 @@ source "https://rubygems.org"
 
 gemspec
 
-gem 'activeresource', :git => 'git://github.com/Shopify/activeresource', :ref => 'e9dc76b4aa'
+gem 'activeresource', :git => 'git://github.com/Shopify/activeresource', tag: '4.0-threadsafe'
 
 gem 'minitest', "~> 4.2"

+ 7 - 0
Gemfile_ar42threadsafe

@@ -0,0 +1,7 @@
+source "https://rubygems.org"
+
+gemspec
+
+gem 'activeresource', :git => 'git://github.com/Shopify/activeresource', tag: '4.2-threadsafe'
+
+gem 'minitest', "~> 4.2"

+ 2 - 2
README.md

@@ -175,10 +175,10 @@ ActiveResource is inherently non-threadsafe, because class variables like Active
 
 We have a forked version of ActiveResource that stores these class variables in threadlocal variables. Using this forked version will allow ShopifyAPI to be used in a threaded environment.
 
-To enable threadsafety with ShopifyAPI, add the following to your Gemfile:
+To enable threadsafety with ShopifyAPI, add the following to your Gemfile. There are various threadsafe tags that you can use, [depending on which version of rails you are using](https://github.com/shopify/activeresource/tags).
 
 ```
-gem 'activeresource', git: 'git://github.com/Shopify/activeresource', branch: 'threadsafe'
+gem 'activeresource', git: 'git://github.com/Shopify/activeresource', tag: '4.2-threadsafe'
 gem 'shopify_api', '>= 3.2.1'
 ```
 

+ 1 - 1
shopify_api.gemspec

@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
   s.summary = %q{ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web services}
   s.license = 'MIT'
 
-  s.add_dependency("activeresource", [">= 3.0.0"])
+  s.add_dependency("activeresource")
   s.add_dependency("thor", ["~> 0.18.1"])
   s.add_dependency("pry", [">= 0.9.12.6"])
 

+ 7 - 1
test/recurring_application_charge_test.rb

@@ -107,7 +107,13 @@ class RecurringApplicationChargeTest < Test::Unit::TestCase
   def test_recurring_application_charge_not_found_error
     fake "recurring_application_charges", :body => '{"errors":"Not Found"}', :status => 404
 
-    assert_equal nil, ShopifyAPI::RecurringApplicationCharge.all
+    all_application_charges = ShopifyAPI::RecurringApplicationCharge.all
+    if ActiveResource::VERSION::MAJOR >= 4 && ActiveResource::VERSION::MINOR >= 2
+      assert_equal [], all_application_charges
+    else
+      assert_equal nil, all_application_charges
+    end
+
     assert_equal nil, ShopifyAPI::RecurringApplicationCharge.current
     assert_equal [],  ShopifyAPI::RecurringApplicationCharge.pending
   end