bubble-wrap 1.3.0 → 1.4.0

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.
Files changed (72) hide show
  1. checksums.yaml +6 -14
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.md +26 -2
  4. data/GETTING_STARTED.md +1 -1
  5. data/Gemfile.lock +1 -1
  6. data/HACKING.md +6 -4
  7. data/README.md +83 -3
  8. data/Rakefile +9 -7
  9. data/lib/bubble-wrap/all.rb +2 -2
  10. data/lib/bubble-wrap/mail.rb +9 -0
  11. data/lib/bubble-wrap/sms.rb +9 -0
  12. data/lib/bubble-wrap/ui.rb +6 -2
  13. data/lib/bubble-wrap/version.rb +1 -1
  14. data/motion/core.rb +1 -1
  15. data/motion/core/app.rb +7 -2
  16. data/motion/core/device/ios/camera.rb +3 -2
  17. data/motion/core/device/ios/screen.rb +19 -0
  18. data/motion/core/ios/app.rb +13 -1
  19. data/motion/core/ios/device.rb +5 -0
  20. data/motion/core/json.rb +1 -3
  21. data/motion/core/kvo.rb +11 -13
  22. data/motion/core/persistence.rb +8 -1
  23. data/motion/core/string.rb +3 -3
  24. data/motion/core/time.rb +5 -0
  25. data/motion/http.rb +1 -1
  26. data/motion/http/query.rb +39 -19
  27. data/motion/http/response.rb +4 -4
  28. data/motion/mail/mail.rb +59 -0
  29. data/motion/mail/result.rb +29 -0
  30. data/motion/reactor/eventable.rb +3 -2
  31. data/motion/reactor/periodic_timer.rb +12 -8
  32. data/motion/reactor/timer.rb +11 -7
  33. data/motion/sms/result.rb +24 -0
  34. data/motion/sms/sms.rb +47 -0
  35. data/motion/ui/pollute.rb +4 -1
  36. data/motion/ui/ui_alert_view.rb +15 -8
  37. data/motion/ui/ui_control_wrapper.rb +16 -0
  38. data/motion/ui/ui_view_controller_wrapper.rb +13 -0
  39. data/motion/ui/ui_view_wrapper.rb +55 -0
  40. data/resources/Localizable.strings +1 -0
  41. data/samples/gesture/Gemfile +2 -2
  42. data/samples/location/Gemfile +1 -1
  43. data/samples/osx/Gemfile +2 -2
  44. data/spec/motion/core/app_spec.rb +6 -0
  45. data/spec/motion/core/device/ios/camera_spec.rb +3 -3
  46. data/spec/motion/core/device/ios/screen_spec.rb +45 -0
  47. data/spec/motion/core/ios/app_spec.rb +29 -0
  48. data/spec/motion/core/persistence_spec.rb +25 -0
  49. data/spec/motion/core/string_spec.rb +2 -2
  50. data/spec/motion/core/time_spec.rb +14 -4
  51. data/spec/motion/core_spec.rb +9 -8
  52. data/spec/motion/http/query_spec.rb +92 -15
  53. data/spec/motion/http/response_spec.rb +4 -3
  54. data/spec/motion/location/location_spec.rb +1 -1
  55. data/spec/motion/mail/mail_spec.rb +125 -0
  56. data/spec/motion/mail/result_spec.rb +53 -0
  57. data/spec/motion/reactor/eventable_spec.rb +85 -0
  58. data/spec/motion/reactor_spec.rb +0 -20
  59. data/spec/motion/sms/result_spec.rb +38 -0
  60. data/spec/motion/sms/sms_spec.rb +71 -0
  61. data/spec/motion/ui/pollute_spec.rb +13 -0
  62. data/spec/motion/ui/ui_bar_button_item_spec.rb +8 -8
  63. data/spec/motion/ui/ui_control_wrapper_spec.rb +35 -0
  64. data/spec/motion/ui/ui_view_controller_wrapper_spec.rb +34 -0
  65. data/spec/motion/ui/ui_view_wrapper_spec.rb +62 -0
  66. data/travis.sh +7 -0
  67. metadata +52 -22
  68. data/motion/ui/gestures.rb +0 -57
  69. data/motion/ui/ui_control.rb +0 -14
  70. data/motion/ui/ui_view_controller.rb +0 -11
  71. data/spec/motion/ui/gestures_spec.rb +0 -62
  72. data/spec/motion/ui/ui_control_spec.rb +0 -42
@@ -0,0 +1,62 @@
1
+ describe BW::UIViewWrapper do
2
+ describe "gestures" do
3
+ before do
4
+ @view = App.delegate.window.rootViewController.view
5
+ @orig = @view.isUserInteractionEnabled
6
+ @view.setUserInteractionEnabled false
7
+ end
8
+
9
+ after do
10
+ @view.setUserInteractionEnabled @orig
11
+ end
12
+
13
+ testMethod = proc do |method|
14
+ it "returns a gesture recognizer" do
15
+ recognizer = @view.send(method, false, &:nil)
16
+ recognizer.is_a?(UIGestureRecognizer).should == true
17
+ end
18
+
19
+ it 'enables interaction when called' do
20
+ @view.send(method, &:nil)
21
+ @view.isUserInteractionEnabled.should == true
22
+ end
23
+
24
+ it "doesn't enable interaction if asked not to" do
25
+ @view.send(method, false, &:nil)
26
+ @view.isUserInteractionEnabled.should == false
27
+ end
28
+
29
+ # it 'responds to interaction'
30
+ end
31
+
32
+ describe '#when_tapped' do
33
+ testMethod.call :when_tapped
34
+ testMethod.call :whenTapped
35
+ end
36
+
37
+ describe '#when_pinched' do
38
+ testMethod.call :when_pinched
39
+ testMethod.call :whenPinched
40
+ end
41
+
42
+ describe '#when_rotated' do
43
+ testMethod.call :when_rotated
44
+ testMethod.call :whenRotated
45
+ end
46
+
47
+ describe '#when_swiped' do
48
+ testMethod.call :when_swiped
49
+ testMethod.call :whenSwiped
50
+ end
51
+
52
+ describe '#when_panned' do
53
+ testMethod.call :when_panned
54
+ testMethod.call :whenPanned
55
+ end
56
+
57
+ describe '#when_pressed' do
58
+ testMethod.call :when_pressed
59
+ testMethod.call :whenPressed
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env sh
2
+
3
+ bundle install &&
4
+ bundle exec rake clean &&
5
+ bundle exec rake spec &&
6
+ bundle exec rake clean &&
7
+ bundle exec rake spec osx=true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubble-wrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Aimonetti
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2013-05-15 00:00:00.000000000 Z
17
+ date: 2013-10-06 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: mocha
@@ -34,42 +34,42 @@ dependencies:
34
34
  name: mocha-on-bacon
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ! '>='
37
+ - - '>='
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ! '>='
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bacon
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ! '>='
51
+ - - '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ! '>='
58
+ - - '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ! '>='
65
+ - - '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ! '>='
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  description: RubyMotion wrappers and helpers (Ruby for iOS) - Making Cocoa APIs more
@@ -115,6 +115,8 @@ extra_rdoc_files:
115
115
  - motion/http/response.rb
116
116
  - motion/location/location.rb
117
117
  - motion/location/pollute.rb
118
+ - motion/mail/mail.rb
119
+ - motion/mail/result.rb
118
120
  - motion/media/media.rb
119
121
  - motion/media/player.rb
120
122
  - motion/reactor.rb
@@ -127,13 +129,15 @@ extra_rdoc_files:
127
129
  - motion/reactor/timer.rb
128
130
  - motion/rss_parser.rb
129
131
  - motion/shortcut.rb
132
+ - motion/sms/result.rb
133
+ - motion/sms/sms.rb
130
134
  - motion/test_suite_delegate.rb
131
- - motion/ui/gestures.rb
132
135
  - motion/ui/pollute.rb
133
136
  - motion/ui/ui_alert_view.rb
134
137
  - motion/ui/ui_bar_button_item.rb
135
- - motion/ui/ui_control.rb
136
- - motion/ui/ui_view_controller.rb
138
+ - motion/ui/ui_control_wrapper.rb
139
+ - motion/ui/ui_view_controller_wrapper.rb
140
+ - motion/ui/ui_view_wrapper.rb
137
141
  - motion/util/constants.rb
138
142
  - spec/lib/bubble-wrap/ext/motion_project_app_spec.rb
139
143
  - spec/lib/bubble-wrap/ext/motion_project_config_spec.rb
@@ -160,14 +164,20 @@ extra_rdoc_files:
160
164
  - spec/motion/http/response_spec.rb
161
165
  - spec/motion/http_spec.rb
162
166
  - spec/motion/location/location_spec.rb
167
+ - spec/motion/mail/mail_spec.rb
168
+ - spec/motion/mail/result_spec.rb
163
169
  - spec/motion/media/player_spec.rb
164
170
  - spec/motion/reactor/eventable_spec.rb
165
171
  - spec/motion/reactor_spec.rb
166
172
  - spec/motion/rss_parser_spec.rb
167
- - spec/motion/ui/gestures_spec.rb
173
+ - spec/motion/sms/result_spec.rb
174
+ - spec/motion/sms/sms_spec.rb
175
+ - spec/motion/ui/pollute_spec.rb
168
176
  - spec/motion/ui/ui_alert_view_spec.rb
169
177
  - spec/motion/ui/ui_bar_button_item_spec.rb
170
- - spec/motion/ui/ui_control_spec.rb
178
+ - spec/motion/ui/ui_control_wrapper_spec.rb
179
+ - spec/motion/ui/ui_view_controller_wrapper_spec.rb
180
+ - spec/motion/ui/ui_view_wrapper_spec.rb
171
181
  - spec/motion/util/constants_spec.rb
172
182
  files:
173
183
  - .gitignore
@@ -194,11 +204,13 @@ files:
194
204
  - lib/bubble-wrap/http.rb
195
205
  - lib/bubble-wrap/loader.rb
196
206
  - lib/bubble-wrap/location.rb
207
+ - lib/bubble-wrap/mail.rb
197
208
  - lib/bubble-wrap/media.rb
198
209
  - lib/bubble-wrap/reactor.rb
199
210
  - lib/bubble-wrap/requirement.rb
200
211
  - lib/bubble-wrap/requirement/path_manipulation.rb
201
212
  - lib/bubble-wrap/rss_parser.rb
213
+ - lib/bubble-wrap/sms.rb
202
214
  - lib/bubble-wrap/test.rb
203
215
  - lib/bubble-wrap/ui.rb
204
216
  - lib/bubble-wrap/version.rb
@@ -230,6 +242,8 @@ files:
230
242
  - motion/http/response.rb
231
243
  - motion/location/location.rb
232
244
  - motion/location/pollute.rb
245
+ - motion/mail/mail.rb
246
+ - motion/mail/result.rb
233
247
  - motion/media/media.rb
234
248
  - motion/media/player.rb
235
249
  - motion/reactor.rb
@@ -242,14 +256,17 @@ files:
242
256
  - motion/reactor/timer.rb
243
257
  - motion/rss_parser.rb
244
258
  - motion/shortcut.rb
259
+ - motion/sms/result.rb
260
+ - motion/sms/sms.rb
245
261
  - motion/test_suite_delegate.rb
246
- - motion/ui/gestures.rb
247
262
  - motion/ui/pollute.rb
248
263
  - motion/ui/ui_alert_view.rb
249
264
  - motion/ui/ui_bar_button_item.rb
250
- - motion/ui/ui_control.rb
251
- - motion/ui/ui_view_controller.rb
265
+ - motion/ui/ui_control_wrapper.rb
266
+ - motion/ui/ui_view_controller_wrapper.rb
267
+ - motion/ui/ui_view_wrapper.rb
252
268
  - motion/util/constants.rb
269
+ - resources/Localizable.strings
253
270
  - resources/atom.xml
254
271
  - resources/test.mp3
255
272
  - samples/alert/.gitignore
@@ -326,15 +343,22 @@ files:
326
343
  - spec/motion/http/response_spec.rb
327
344
  - spec/motion/http_spec.rb
328
345
  - spec/motion/location/location_spec.rb
346
+ - spec/motion/mail/mail_spec.rb
347
+ - spec/motion/mail/result_spec.rb
329
348
  - spec/motion/media/player_spec.rb
330
349
  - spec/motion/reactor/eventable_spec.rb
331
350
  - spec/motion/reactor_spec.rb
332
351
  - spec/motion/rss_parser_spec.rb
333
- - spec/motion/ui/gestures_spec.rb
352
+ - spec/motion/sms/result_spec.rb
353
+ - spec/motion/sms/sms_spec.rb
354
+ - spec/motion/ui/pollute_spec.rb
334
355
  - spec/motion/ui/ui_alert_view_spec.rb
335
356
  - spec/motion/ui/ui_bar_button_item_spec.rb
336
- - spec/motion/ui/ui_control_spec.rb
357
+ - spec/motion/ui/ui_control_wrapper_spec.rb
358
+ - spec/motion/ui/ui_view_controller_wrapper_spec.rb
359
+ - spec/motion/ui/ui_view_wrapper_spec.rb
337
360
  - spec/motion/util/constants_spec.rb
361
+ - travis.sh
338
362
  homepage: http://bubblewrap.io/
339
363
  licenses: []
340
364
  metadata: {}
@@ -344,12 +368,12 @@ require_paths:
344
368
  - lib
345
369
  required_ruby_version: !ruby/object:Gem::Requirement
346
370
  requirements:
347
- - - ! '>='
371
+ - - '>='
348
372
  - !ruby/object:Gem::Version
349
373
  version: '0'
350
374
  required_rubygems_version: !ruby/object:Gem::Requirement
351
375
  requirements:
352
- - - ! '>='
376
+ - - '>='
353
377
  - !ruby/object:Gem::Version
354
378
  version: '0'
355
379
  requirements: []
@@ -388,12 +412,18 @@ test_files:
388
412
  - spec/motion/http/response_spec.rb
389
413
  - spec/motion/http_spec.rb
390
414
  - spec/motion/location/location_spec.rb
415
+ - spec/motion/mail/mail_spec.rb
416
+ - spec/motion/mail/result_spec.rb
391
417
  - spec/motion/media/player_spec.rb
392
418
  - spec/motion/reactor/eventable_spec.rb
393
419
  - spec/motion/reactor_spec.rb
394
420
  - spec/motion/rss_parser_spec.rb
395
- - spec/motion/ui/gestures_spec.rb
421
+ - spec/motion/sms/result_spec.rb
422
+ - spec/motion/sms/sms_spec.rb
423
+ - spec/motion/ui/pollute_spec.rb
396
424
  - spec/motion/ui/ui_alert_view_spec.rb
397
425
  - spec/motion/ui/ui_bar_button_item_spec.rb
398
- - spec/motion/ui/ui_control_spec.rb
426
+ - spec/motion/ui/ui_control_wrapper_spec.rb
427
+ - spec/motion/ui/ui_view_controller_wrapper_spec.rb
428
+ - spec/motion/ui/ui_view_wrapper_spec.rb
399
429
  - spec/motion/util/constants_spec.rb
@@ -1,57 +0,0 @@
1
- # Opens UIView to add methods for working with gesture recognizers.
2
-
3
- class UIView
4
-
5
- def when_tapped(enableInteraction=true, &proc)
6
- add_gesture_recognizer_helper(UITapGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
7
- end
8
-
9
- def when_pinched(enableInteraction=true, &proc)
10
- add_gesture_recognizer_helper(UIPinchGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
11
- end
12
-
13
- def when_rotated(enableInteraction=true, &proc)
14
- add_gesture_recognizer_helper(UIRotationGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
15
- end
16
-
17
- def when_swiped(enableInteraction=true, &proc)
18
- add_gesture_recognizer_helper(UISwipeGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
19
- end
20
-
21
- def when_panned(enableInteraction=true, &proc)
22
- add_gesture_recognizer_helper(UIPanGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
23
- end
24
-
25
- def when_pressed(enableInteraction=true, &proc)
26
- add_gesture_recognizer_helper(UILongPressGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc)
27
- end
28
-
29
- def self.deprecated_methods
30
- %w(whenTapped whenPinched whenRotated whenSwiped whenPanned whenPressed)
31
- end
32
-
33
- deprecated_methods.each do |method|
34
- define_method(method) do |enableInteraction = true, &proc|
35
- NSLog "[DEPRECATED - #{method}] please use #{method.underscore} instead."
36
- send(method.underscore, enableInteraction, &proc)
37
- end
38
- end
39
-
40
- private
41
-
42
- def handle_gesture(recognizer)
43
- @recognizers[recognizer].call(recognizer)
44
- end
45
-
46
- # Adds the recognizer and keeps a strong reference to the Proc object.
47
- def add_gesture_recognizer_helper(recognizer, enableInteraction, proc)
48
- setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled
49
- self.addGestureRecognizer(recognizer)
50
-
51
- @recognizers = {} unless @recognizers
52
- @recognizers[recognizer] = proc
53
-
54
- recognizer
55
- end
56
-
57
- end
@@ -1,14 +0,0 @@
1
- module UIControlWrap
2
- def when(events, options={}, &block)
3
- @callback ||= {}
4
- @callback[events] ||= []
5
-
6
- unless options[:append]
7
- @callback[events] = []
8
- removeTarget(nil, action: nil, forControlEvents: events)
9
- end
10
-
11
- @callback[events] << block
12
- addTarget(@callback[events].last, action:'call', forControlEvents: events)
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- class UIViewController
2
- # Short hand to get the content frame
3
- #
4
- # Return content frame: the application frame - navigation bar frame
5
- def content_frame
6
- app_frame = App.frame
7
- navbar_height = self.navigationController.nil? ?
8
- 0 : self.navigationController.navigationBar.frame.size.height
9
- CGRectMake(0, 0, app_frame.size.width, app_frame.size.height - navbar_height)
10
- end
11
- end
@@ -1,62 +0,0 @@
1
- describe UIView do
2
-
3
- before do
4
- @view = App.delegate.window.rootViewController.view
5
- @orig = @view.isUserInteractionEnabled
6
- @view.setUserInteractionEnabled false
7
- end
8
-
9
- after do
10
- @view.setUserInteractionEnabled @orig
11
- end
12
-
13
- testMethod = proc do |method|
14
- it "returns a gesture recognizer" do
15
- recognizer = @view.send(method, false, &:nil)
16
- recognizer.is_a?(UIGestureRecognizer).should == true
17
- end
18
-
19
- it 'enables interaction when called' do
20
- @view.send(method, &:nil)
21
- @view.isUserInteractionEnabled.should == true
22
- end
23
-
24
- it "doesn't enable interaction if asked not to" do
25
- @view.send(method, false, &:nil)
26
- @view.isUserInteractionEnabled.should == false
27
- end
28
-
29
- # it 'responds to interaction'
30
- end
31
-
32
- describe '#when_tapped' do
33
- testMethod.call :when_tapped
34
- testMethod.call :whenTapped
35
- end
36
-
37
- describe '#when_pinched' do
38
- testMethod.call :when_pinched
39
- testMethod.call :whenPinched
40
- end
41
-
42
- describe '#when_rotated' do
43
- testMethod.call :when_rotated
44
- testMethod.call :whenRotated
45
- end
46
-
47
- describe '#when_swiped' do
48
- testMethod.call :when_swiped
49
- testMethod.call :whenSwiped
50
- end
51
-
52
- describe '#when_panned' do
53
- testMethod.call :when_panned
54
- testMethod.call :whenPanned
55
- end
56
-
57
- describe '#when_pressed' do
58
- testMethod.call :when_pressed
59
- testMethod.call :whenPressed
60
- end
61
-
62
- end
@@ -1,42 +0,0 @@
1
- describe "UIControlWrap" do
2
- describe 'UIButton' do
3
- before do
4
- @button = UIButton.buttonWithType(UIButtonTypeRoundedRect)
5
- @touched = []
6
- @button.when(UIControlEventTouchUpInside) do
7
- @touched << 'for the very first time'
8
- end
9
- end
10
-
11
- it "supports the 'when' event handler for UIButton" do
12
- @button.sendActionsForControlEvents(UIControlEventTouchUpInside)
13
- @touched.should == ['for the very first time']
14
- end
15
-
16
- it "replaces the target for a given control event by default" do
17
- @button.when(UIControlEventTouchUpInside) do
18
- @touched << 'touched'
19
- end
20
- @button.sendActionsForControlEvents(UIControlEventTouchUpInside)
21
- @touched.should == ['touched']
22
- end
23
-
24
- it "allows multiple targets for a given control event if specified" do
25
- @button.when(UIControlEventTouchUpInside, append: true) do
26
- @touched << 'touched'
27
- end
28
- @button.sendActionsForControlEvents(UIControlEventTouchUpInside)
29
- @touched.should == ['for the very first time', 'touched']
30
- end
31
- end
32
-
33
- it "supports the 'when' event handler for UISlider" do
34
- button = UISlider.alloc.init
35
- changed = nil
36
- button.when(UIControlEventValueChanged) do
37
- changed = 1
38
- end
39
- button.sendActionsForControlEvents(UIControlEventValueChanged)
40
- changed.should == 1
41
- end
42
- end