motion-bundler 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +7 -0
- data/VERSION +1 -1
- data/lib/motion-bundler/mocks/httparty.rb +16 -8
- data/lib/motion-bundler/version.rb +1 -1
- data/lib/motion-bundler.rb +4 -7
- data/sample_app/Rakefile +1 -1
- data/sample_app/app/controllers/app_controller.rb +1 -0
- data/test/.gemfiles/simulator/test_setup.lock +1 -1
- data/test/motion/device/test_core_ext.rb +1 -3
- data/test/motion/simulator/test_core_ext.rb +1 -4
- data/test/unit/test_motion-bundler.rb +2 -2
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= MotionBundler CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.2 (May 20, 2013)
|
4
|
+
|
5
|
+
* Updated mocked HTTParty module:
|
6
|
+
|
7
|
+
* Support passing block when sending request
|
8
|
+
* Support asynchronous requests
|
9
|
+
|
3
10
|
== Version 0.1.1 (May 15, 2013)
|
4
11
|
|
5
12
|
* Fixed device/core_ext.rb when running `rake device`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -18,24 +18,24 @@ module HTTParty
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get(path, options = {}, &block)
|
21
|
-
send_request path, :get
|
21
|
+
send_request path, :get, options, &block
|
22
22
|
end
|
23
23
|
|
24
24
|
def post(path, options = {}, &block)
|
25
|
-
send_request path, :post
|
25
|
+
send_request path, :post, options, &block
|
26
26
|
end
|
27
27
|
|
28
28
|
def put(path, options = {}, &block)
|
29
|
-
send_request path, :put
|
29
|
+
send_request path, :put, options, &block
|
30
30
|
end
|
31
31
|
|
32
32
|
def delete(path, options = {}, &block)
|
33
|
-
send_request path, :delete
|
33
|
+
send_request path, :delete, options, &block
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
def send_request(path, method, options = {})
|
38
|
+
def send_request(path, method, options = {}, &block)
|
39
39
|
path = "#{@base_uri}/#{path}" if @base_uri && !path.match(/^\w+:\/\//)
|
40
40
|
path = path.stringByAddingPercentEscapesUsingEncoding NSUTF8StringEncoding
|
41
41
|
method = method.to_s.upcase
|
@@ -63,9 +63,17 @@ private
|
|
63
63
|
|
64
64
|
response = Pointer.new :object
|
65
65
|
error = Pointer.new :object
|
66
|
-
data = NSURLConnection.sendSynchronousRequest request, returningResponse: response, error: error
|
67
66
|
|
68
|
-
|
67
|
+
if options[:async]
|
68
|
+
queue = NSOperationQueue.alloc.init
|
69
|
+
NSURLConnection.sendAsynchronousRequest request, queue: queue, completionHandler: proc { |response, data, error|
|
70
|
+
block.call HTTParty::Response.new(response, data, {:format => @format || options[:format], :error => error})
|
71
|
+
}
|
72
|
+
else
|
73
|
+
data = NSURLConnection.sendSynchronousRequest request, returningResponse: response, error: error
|
74
|
+
response = HTTParty::Response.new(response.value, data, {:format => @format || options[:format], :error => error})
|
75
|
+
block_given? ? block.call(response) : response
|
76
|
+
end
|
69
77
|
end
|
70
78
|
|
71
79
|
def payload_to_query_string(payload_hash)
|
@@ -98,7 +106,7 @@ module HTTParty
|
|
98
106
|
class Response
|
99
107
|
|
100
108
|
def initialize(response, data, options = {})
|
101
|
-
@cached_response = NSCachedURLResponse.alloc.initWithResponse response
|
109
|
+
@cached_response = NSCachedURLResponse.alloc.initWithResponse response, data: data
|
102
110
|
@options = options
|
103
111
|
end
|
104
112
|
|
data/lib/motion-bundler.rb
CHANGED
@@ -36,8 +36,8 @@ module MotionBundler
|
|
36
36
|
argv.include? "device"
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
|
39
|
+
def boot_file
|
40
|
+
File.expand_path "../motion-bundler/#{simulator? ? "simulator" : "device"}/boot.rb", __FILE__
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
@@ -67,9 +67,7 @@ private
|
|
67
67
|
def tracer_require(files, files_dependencies, required)
|
68
68
|
Require.trace do
|
69
69
|
require MOTION_BUNDLER_FILE
|
70
|
-
|
71
|
-
require file
|
72
|
-
end
|
70
|
+
require boot_file
|
73
71
|
Bundler.require :motion
|
74
72
|
app_requires.delete_if do |file|
|
75
73
|
require file, "APP"
|
@@ -88,8 +86,7 @@ private
|
|
88
86
|
files_dependencies.merge!(
|
89
87
|
Require.files_dependencies.tap do |dependencies|
|
90
88
|
(dependencies.delete("BUNDLER") || []).each do |file|
|
91
|
-
dependencies[file] ||= []
|
92
|
-
dependencies[file] = default_files + dependencies[file]
|
89
|
+
(dependencies[file] ||= []).unshift boot_file
|
93
90
|
end
|
94
91
|
dependencies.delete("APP")
|
95
92
|
dependencies.delete(__FILE__)
|
data/sample_app/Rakefile
CHANGED
@@ -14,9 +14,7 @@ module Motion
|
|
14
14
|
last_loaded_feature = nil
|
15
15
|
|
16
16
|
assert_output "" do
|
17
|
-
MotionBundler.
|
18
|
-
require default_file
|
19
|
-
end
|
17
|
+
require MotionBundler.boot_file
|
20
18
|
last_loaded_feature = $LOADED_FEATURES.last
|
21
19
|
|
22
20
|
assert_nil require("a")
|
@@ -17,10 +17,7 @@ module Motion
|
|
17
17
|
last_loaded_feature = nil
|
18
18
|
fu = Fu.new
|
19
19
|
|
20
|
-
MotionBundler.
|
21
|
-
require default_file
|
22
|
-
end
|
23
|
-
|
20
|
+
require MotionBundler.boot_file
|
24
21
|
last_loaded_feature = $LOADED_FEATURES.last
|
25
22
|
|
26
23
|
assert_nil require("a")
|
@@ -19,10 +19,10 @@ module Unit
|
|
19
19
|
|
20
20
|
it "should determine Motion::Project::App default files" do
|
21
21
|
MotionBundler.expects(:simulator?).returns(true)
|
22
|
-
assert_equal
|
22
|
+
assert_equal motion_bundler_file("motion-bundler/simulator/boot.rb"), MotionBundler.boot_file
|
23
23
|
|
24
24
|
MotionBundler.expects(:simulator?).returns(false)
|
25
|
-
assert_equal
|
25
|
+
assert_equal motion_bundler_file("motion-bundler/device/boot.rb"), MotionBundler.boot_file
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should be able to touch MotionBundler::MOTION_BUNDLER_FILE" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -199,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
segments:
|
201
201
|
- 0
|
202
|
-
hash:
|
202
|
+
hash: 3167972286108752732
|
203
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
204
|
none: false
|
205
205
|
requirements:
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: 3167972286108752732
|
212
212
|
requirements: []
|
213
213
|
rubyforge_project:
|
214
214
|
rubygems_version: 1.8.25
|