Skip to content

Commit

Permalink
Uses rails 4.2 compatible threadsafe branch of AR
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Saunders committed Jan 9, 2015
1 parent eec5ee9 commit 565002d
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -2,4 +2,4 @@ source "https://rubygems.org"

gemspec

gem "activeresource", "~> 4.0.0"
gem "activeresource", '~> 4.0.0'
28 changes: 13 additions & 15 deletions Gemfile.lock
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Gemfile_ar31
Expand Up @@ -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 change: 1 addition & 0 deletions Gemfile_ar32
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Gemfile_ar40threadsafe
Expand Up @@ -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 changes: 7 additions & 0 deletions 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"
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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'
```

Expand Down
2 changes: 1 addition & 1 deletion shopify_api.gemspec
Expand Up @@ -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"])

Expand Down
8 changes: 7 additions & 1 deletion test/recurring_application_charge_test.rb
Expand Up @@ -107,7 +107,13 @@ def test_no_recurring_application_charge_found
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
Expand Down

0 comments on commit 565002d

Please sign in to comment.