em_aws 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -6
- data/LICENSE.txt +2 -4
- data/README.md +6 -0
- data/lib/em_aws/patches.rb +17 -17
- data/lib/em_aws/version.rb +1 -1
- data/spec/patches_spec.rb +11 -30
- metadata +12 -12
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
em_aws (0.1.
|
4
|
+
em_aws (0.1.6)
|
5
5
|
aws-sdk
|
6
6
|
em-http-request
|
7
7
|
em-synchrony
|
@@ -26,10 +26,10 @@ GEM
|
|
26
26
|
http_parser.rb (>= 0.5.3)
|
27
27
|
em-socksify (0.2.0)
|
28
28
|
eventmachine (>= 1.0.0.beta.4)
|
29
|
-
em-synchrony (1.0.
|
29
|
+
em-synchrony (1.0.2)
|
30
30
|
eventmachine (>= 1.0.0.beta.1)
|
31
|
-
eventmachine (1.0.0.
|
32
|
-
eventmachine (1.0.0.
|
31
|
+
eventmachine (1.0.0.rc.2)
|
32
|
+
eventmachine (1.0.0.rc.2-java)
|
33
33
|
http_parser.rb (0.5.3)
|
34
34
|
http_parser.rb (0.5.3-java)
|
35
35
|
httparty (0.8.3)
|
@@ -39,8 +39,8 @@ GEM
|
|
39
39
|
json (1.7.3-java)
|
40
40
|
multi_json (1.3.6)
|
41
41
|
multi_xml (0.5.1)
|
42
|
-
nokogiri (1.5.
|
43
|
-
nokogiri (1.5.
|
42
|
+
nokogiri (1.5.5)
|
43
|
+
nokogiri (1.5.5-java)
|
44
44
|
rspec (2.10.0)
|
45
45
|
rspec-core (~> 2.10.0)
|
46
46
|
rspec-expectations (~> 2.10.0)
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010 Joshua T. Mckinney
|
1
|
+
Copyright (c) 2010-2012 Joshua T. Mckinney
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,6 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
ALL AWS-SDK code is covered under the AWS-SDK [license](https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/LICENSE.txt)
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -51,4 +51,10 @@ All requests to AWS will use EM-Synchrony's implementation of em-http-request fo
|
|
51
51
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
52
52
|
|
53
53
|
## Thanks
|
54
|
+
|
54
55
|
Code based on HTTParty Hander in [aws-sdk](https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/README.rdoc)
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
EmAws [license](https://github.com/JoshMcKin/em_aws/blob/master/LICENSE.txt)
|
60
|
+
AWS-SDK [license](https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/LICENSE.txt)
|
data/lib/em_aws/patches.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'em-synchrony'
|
2
2
|
require 'em-synchrony/thread'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
|
4
|
+
Mutex.class_eval do
|
5
|
+
class << self
|
6
|
+
alias :mutex_new :new
|
7
|
+
def new
|
8
|
+
return EM::Synchrony::Thread::Mutex.new if defined?(EM) && EM.reactor_running?
|
9
|
+
mutex_new
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Kernel.class_eval do
|
15
|
+
class << self
|
16
|
+
alias :kernel_sleep :sleep
|
17
|
+
def sleep(count)
|
18
|
+
return EM::Synchrony.sleep(count) if defined?(EM) && EM.reactor_running?
|
19
|
+
kernel_sleep(count)
|
15
20
|
end
|
16
21
|
end
|
17
|
-
|
18
|
-
Kernel = PatchKernel
|
19
|
-
|
20
|
-
# Use a fiber safe mutex for Mutex in AWS
|
21
|
-
Mutex = EM::Synchrony::Thread::Mutex
|
22
22
|
end
|
data/lib/em_aws/version.rb
CHANGED
data/spec/patches_spec.rb
CHANGED
@@ -1,18 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'aws'
|
3
|
-
describe
|
3
|
+
describe Mutex do
|
4
4
|
it "should be a fiber safe mutex" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
it "should be a fiber mutex when called within AWS module" do
|
9
|
-
AWS.module_eval <<-STR
|
10
|
-
def self.mutex_new
|
11
|
-
Mutex.new
|
5
|
+
EM.synchrony do
|
6
|
+
Mutex.new.should be_kind_of(EM::Synchrony::Thread::Mutex)
|
7
|
+
EM.stop
|
12
8
|
end
|
13
|
-
STR
|
14
|
-
|
15
|
-
AWS.mutex_new.should be_kind_of(EM::Synchrony::Thread::Mutex)
|
16
9
|
end
|
17
10
|
|
18
11
|
it "should not affect Mutex outside AWS" do
|
@@ -20,29 +13,17 @@ describe AWS::Mutex do
|
|
20
13
|
end
|
21
14
|
end
|
22
15
|
|
23
|
-
describe
|
16
|
+
describe Kernel,'#sleep' do
|
24
17
|
it "should be a fiber safe sleep from with AWS module" do
|
25
|
-
EM
|
26
|
-
|
18
|
+
EM.synchrony do
|
19
|
+
EM::Synchrony.stub(:sleep).and_return("fiber safe")
|
20
|
+
Kernel.sleep(1).should eql("fiber safe")
|
21
|
+
EM.stop
|
22
|
+
end
|
27
23
|
end
|
28
24
|
|
29
|
-
it "should not affect normal Kernel.sleep " do
|
30
|
-
EM::Synchrony.stub(:sleep).and_return("fiber safe")
|
25
|
+
it "should not affect normal Kernel.sleep if not in EM" do
|
31
26
|
Kernel.sleep(1).should eql(1)
|
32
27
|
end
|
33
|
-
|
34
|
-
it "should be a fiber mutex when called within AWS module" do
|
35
|
-
AWS.module_eval <<-STR
|
36
|
-
def self.sleep(time)
|
37
|
-
Kernel.sleep(time)
|
38
|
-
end
|
39
|
-
STR
|
40
|
-
EM::Synchrony.stub(:sleep).and_return("fiber safe")
|
41
|
-
AWS.sleep(0.01).should eql("fiber safe")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should not interfer with other Kernel methods" do
|
45
|
-
lambda {AWS::Kernel.rand}.should_not raise_error
|
46
|
-
end
|
47
28
|
end
|
48
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em_aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-26 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
16
|
-
requirement: &
|
16
|
+
requirement: &70257021529300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70257021529300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: em-synchrony
|
27
|
-
requirement: &
|
27
|
+
requirement: &70257021528820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70257021528820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: em-http-request
|
38
|
-
requirement: &
|
38
|
+
requirement: &70257021528380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70257021528380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70257021527920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70257021527920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: builder
|
60
|
-
requirement: &
|
60
|
+
requirement: &70257021527460 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70257021527460
|
69
69
|
description: Adds EM-Synchrony support to AWS-SDK gem
|
70
70
|
email:
|
71
71
|
- joshmckin@gmail.com
|