bubble-wrap 1.2.0 → 1.3.0.osx

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +4 -2
  3. data/Gemfile.lock +1 -1
  4. data/README.md +217 -7
  5. data/Rakefile +23 -2
  6. data/lib/bubble-wrap/camera.rb +10 -6
  7. data/lib/bubble-wrap/core.rb +14 -1
  8. data/lib/bubble-wrap/ext/motion_project_app.rb +8 -0
  9. data/lib/bubble-wrap/font.rb +3 -1
  10. data/lib/bubble-wrap/http.rb +2 -0
  11. data/lib/bubble-wrap/loader.rb +17 -2
  12. data/lib/bubble-wrap/location.rb +9 -6
  13. data/lib/bubble-wrap/media.rb +10 -6
  14. data/lib/bubble-wrap/test.rb +6 -1
  15. data/lib/bubble-wrap/ui.rb +5 -2
  16. data/lib/bubble-wrap/version.rb +2 -7
  17. data/motion/core.rb +6 -1
  18. data/motion/core/app.rb +3 -64
  19. data/motion/core/device.rb +0 -55
  20. data/motion/core/device/{camera.rb → ios/camera.rb} +0 -0
  21. data/motion/core/device/{camera_wrapper.rb → ios/camera_wrapper.rb} +0 -0
  22. data/motion/core/device/ios/screen.rb +75 -0
  23. data/motion/core/device/osx/screen.rb +18 -0
  24. data/motion/core/device/screen.rb +1 -69
  25. data/motion/core/ios/app.rb +71 -0
  26. data/motion/core/ios/device.rb +59 -0
  27. data/motion/core/osx/app.rb +15 -0
  28. data/motion/core/osx/device.rb +6 -0
  29. data/motion/core/string.rb +3 -2
  30. data/motion/http.rb +0 -364
  31. data/motion/http/query.rb +367 -0
  32. data/motion/http/response.rb +32 -0
  33. data/motion/test_suite_delegate.rb +58 -0
  34. data/motion/ui/ui_alert_view.rb +169 -0
  35. data/motion/ui/ui_bar_button_item.rb +55 -53
  36. data/motion/util/constants.rb +34 -32
  37. data/samples/alert/.gitignore +16 -0
  38. data/samples/alert/Gemfile +3 -0
  39. data/samples/alert/Rakefile +10 -0
  40. data/samples/alert/app/app_delegate.rb +8 -0
  41. data/samples/alert/app/controllers/alert_view_controller.rb +74 -0
  42. data/samples/alert/resources/Default-568h@2x.png +0 -0
  43. data/samples/alert/spec/main_spec.rb +9 -0
  44. data/samples/media/.gitignore +16 -0
  45. data/samples/media/Rakefile +11 -0
  46. data/samples/media/app/app_delegate.rb +8 -0
  47. data/samples/media/app/controllers/play_controller.rb +46 -0
  48. data/samples/media/resources/Default-568h@2x.png +0 -0
  49. data/samples/media/resources/test.mp3 +0 -0
  50. data/samples/media/spec/main_spec.rb +9 -0
  51. data/samples/osx/Gemfile +3 -0
  52. data/samples/osx/Gemfile.lock +10 -0
  53. data/samples/osx/Rakefile +11 -0
  54. data/samples/osx/app/app_delegate.rb +69 -0
  55. data/samples/osx/app/menu.rb +108 -0
  56. data/samples/osx/resources/Credits.rtf +29 -0
  57. data/samples/osx/spec/main_spec.rb +9 -0
  58. data/spec/motion/core/app_spec.rb +5 -164
  59. data/spec/motion/core/device/{camera_spec.rb → ios/camera_spec.rb} +0 -0
  60. data/spec/motion/core/device/{camera_wrapper_spec.rb → ios/camera_wrapper_spec.rb} +0 -0
  61. data/spec/motion/core/device/ios/device_spec.rb +74 -0
  62. data/spec/motion/core/device/{screen_spec.rb → ios/screen_spec.rb} +2 -1
  63. data/spec/motion/core/device/osx/screen_spec.rb +26 -0
  64. data/spec/motion/core/device_spec.rb +0 -71
  65. data/spec/motion/core/ios/app_spec.rb +180 -0
  66. data/spec/motion/core/kvo_spec.rb +23 -7
  67. data/spec/motion/core/ns_index_path_spec.rb +10 -2
  68. data/spec/motion/core/osx/app_spec.rb +15 -0
  69. data/spec/motion/core/string_spec.rb +11 -5
  70. data/spec/motion/core_spec.rb +13 -2
  71. data/spec/motion/http/query_spec.rb +731 -0
  72. data/spec/motion/http/response_spec.rb +44 -0
  73. data/spec/motion/http_spec.rb +0 -722
  74. data/spec/motion/{core → ui}/gestures_spec.rb +0 -0
  75. data/spec/motion/ui/ui_alert_view_spec.rb +1188 -0
  76. data/spec/motion/{core → ui}/ui_bar_button_item_spec.rb +80 -24
  77. data/spec/motion/{core → ui}/ui_control_spec.rb +0 -0
  78. data/spec/motion/util/constants_spec.rb +4 -4
  79. metadata +86 -26
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWZlNDIwNzliYTA3ODMxZGQ2ZTc4NWQzMjhhMmM5YjU1Y2VmYzg4ZA==
4
+ MmE3N2Q1N2NjYTZmY2ZmYTU5OWU3YjMwMDk3OGM4OTU5MTc1MzY3ZA==
5
5
  data.tar.gz: !binary |-
6
- NTY4OGY5MjU0MjE2YjFiYTQ0YzY2MWFmY2M1OGYzYTQ2YjM3YWNkNg==
6
+ MGM1YzNkMmZlZTExMTRlM2RkMmFlZmNkNGUxY2ExN2E2NjgzY2QwMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjcyZmVjNzFlMGNjYzBjMmY2NDY3ZWEzY2NhZTg5MzQzYjVhNGU1NjcyYzQ3
10
- NWEzNzc2OWE4MjE5MzlmMTA1MmY0NTJmMGU0MjNiZjI2OTA0NGM0MWQwOGI3
11
- M2NhM2Y1Y2NlNDg2NzJhNDFiZWVkNGY4ZTE0YzNiNjYxZjJmOTk=
9
+ NGM0ZjAzMzU5MDBmMGRjMDIyNGFiN2IwZWVkZDY1YjczZTM1Yjk4NjExMjgz
10
+ ZDZmOTlhMmYyZmQwNDc1MzcyYTIxMmE2NjNlMjA5MDhjMWM2M2I3MmExMjgy
11
+ OWIxMTBkNzg2NDMzZDUyYjJlM2I5M2I0Y2M4ZDUyNmI2NGRhY2M=
12
12
  data.tar.gz: !binary |-
13
- NDgwN2NiOTY5ZDg2NTE5ZDRhNGIzYTlkNzdlOGJiMzBjNTBhOTg2YWVlNjI1
14
- ZTE3OTlmMzI3MzllNmJmNjQwZDI4NTNhMzU2MWRkNGVhNzc2NjIzYjA4OGQ1
15
- NDFkYjg3ODE5N2RhYTA5M2ZhZDFjNDc2NTZkYTQ3MmJkMTNmYjc=
13
+ N2VhOWU4ZTE1NWRkYmZjMWIzM2E2NjA0NmUzZmZjMDA2MDc4NzY0OTMzOTMy
14
+ OTg3YTI4ODE3MmZjNjBlMjMyODM5ZTYxOWZjNjljYzJlODAzNDFjYTQ2MTRj
15
+ ZWNhZTU4MTUwMmNmM2EzNTRlNTE1OWE0NDMwNDU0M2FmZjhkNWE=
@@ -1,8 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
- ## 1.2.0.pre
3
+ [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.2.0...master)
4
4
 
5
- [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.2...master)
5
+ ## 1.2.0
6
+
7
+ [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.1.5...v1.2.0)
6
8
 
7
9
  * Added `BW::UIBarButtonItem`, a factory-esque wrapper for `UIBarButtonItem` ([#202](https://github.com/rubymotion/BubbleWrap/pull/202))
8
10
  * Added `BW::Font`, a wrapper for creating `UIFont` objects ([#206](https://github.com/rubymotion/BubbleWrap/pull/206))
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bubble-wrap (1.2.0)
4
+ bubble-wrap (1.3.0.osx)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -413,7 +413,11 @@ end
413
413
 
414
414
  ### UIBarButtonItem
415
415
 
416
- `BW::UIBarButtonItem` provides an idiomatic Ruby syntax for instantiating `UIBarButtonItem` objects. Instead of a target-action pair, each method accepts a block. When the button is tapped, the block is executed. As a convenience, the block is optional.
416
+ `BW::UIBarButtonItem` is a subclass of `UIBarButtonItem` with an natural Ruby syntax.
417
+
418
+ #### Constructors
419
+
420
+ Instead specifying a target-action pair, each constructor method accepts an optional block. When the button is tapped, the block is executed.
417
421
 
418
422
  ```ruby
419
423
  BW::UIBarButtonItem.system(:save) do
@@ -443,21 +447,21 @@ end
443
447
  # NOTE: The block is attached to the view as a single tap gesture recognizer.
444
448
  ```
445
449
 
446
- Alternatively, `BW::UIBarButtonItem` provides a flexible, builder-style syntax for dynamically instantiating `UIBarButtonItem` objects.
450
+ The `.new` constructor provides a flexible, builder-style syntax.
447
451
 
448
452
  ```ruby
449
453
  options = { :system => :save }
450
- BW::UIBarButtonItem.build(options) do
454
+ BW::UIBarButtonItem.new(options) do
451
455
  # ...
452
456
  end
453
457
 
454
458
  options = { :styled => :plain, :title => "Friends" }
455
- BW::UIBarButtonItem.build(options) do
459
+ BW::UIBarButtonItem.new(options) do
456
460
  # ...
457
461
  end
458
462
 
459
463
  options = { :styled => :bordered, :image => UIImage.alloc.init }
460
- BW::UIBarButtonItem.build(options) do
464
+ BW::UIBarButtonItem.new(options) do
461
465
  # ...
462
466
  end
463
467
 
@@ -466,17 +470,19 @@ options = {
466
470
  :image => UIImage.alloc.init,
467
471
  :landscape => UIImage.alloc.init
468
472
  }
469
- BW::UIBarButtonItem.build(options) do
473
+ BW::UIBarButtonItem.new(options) do
470
474
  # ...
471
475
  end
472
476
 
473
477
  options = { :custom => UIView.alloc.init }
474
- BW::UIBarButtonItem.build(options) do
478
+ BW::UIBarButtonItem.new(options) do
475
479
  # ...
476
480
  end
477
481
  # NOTE: The block is attached to the view as a single tap gesture recognizer.
478
482
  ```
479
483
 
484
+ #### Button types
485
+
480
486
  The `.styled` button types are:
481
487
 
482
488
  ```ruby
@@ -514,6 +520,184 @@ And the `.system` button types are:
514
520
  :page_curl
515
521
  ```
516
522
 
523
+ ### UIAlertView
524
+
525
+ `BW::UIAlertView` is a subclass of `UIAlertView` with an natural Ruby syntax.
526
+
527
+ #### Default alert
528
+
529
+ The `.default` constructor accepts an optional `Hash` of options and returns a `BW::UIAlertView` instance in the `UIAlertViewStyleDefault` style. The instance can then be given an `#on_click` callback to be executed when it's button is clicked. For example:
530
+
531
+ ![iOS Simulator Screen shot Apr 24 2013 10 54 28 AM](https://f.cloud.github.com/assets/5688/421437/59a5376c-ad08-11e2-9ccc-0df83eb360e0.png)
532
+
533
+ ```ruby
534
+ options = { :title => "Are you ready?" }
535
+ ready_alert = BW::UIAlertView.default(options).on_click do |alert|
536
+ # ...
537
+ end
538
+
539
+ ready_alert.show
540
+ ```
541
+
542
+ #### Input alerts
543
+
544
+ `BW::UIAlertView` has constructors for input alerts too.
545
+
546
+ `.plain_text_input` returns an instance in the `UIAlertViewStylePlainTextInput` style.
547
+
548
+ ![iOS Simulator Screen shot Apr 24 2013 10 58 27 AM](https://f.cloud.github.com/assets/5688/421453/a6c15698-ad08-11e2-9bef-a755732e9b91.png)
549
+
550
+ ```ruby
551
+ options = { :title => "Replicator" }
552
+ replicator_alert = BW::UIAlertView.plain_text_input(options).on_click do |alert|
553
+ alert.plain_text_field.text #=> "Tea. Early Grey. Hot."
554
+ end
555
+
556
+ replicator_alert.show
557
+ ```
558
+
559
+ `.secure_text_input` returns an instance in the `UIAlertViewStyleSecureTextInput` style.
560
+
561
+ ![iOS Simulator Screen shot Apr 24 2013 11 09 43 AM](https://f.cloud.github.com/assets/5688/421503/396084dc-ad0a-11e2-9e09-c778d2a6cdc4.png)
562
+
563
+ ```ruby
564
+ options = { :title => "Authorization" }
565
+ replicator_alert = BW::UIAlertView.secure_text_input(options).on_click do |alert|
566
+ alert.secure_text_field.text #=> "Theta2997"
567
+ end
568
+
569
+ replicator_alert.show
570
+ ```
571
+
572
+ And `.login_and_password_input` returns an instance in the `UIAlertViewStyleLoginAndPasswordInput` style.
573
+
574
+ ![iOS Simulator Screen shot Apr 24 2013 11 27 20 AM](https://f.cloud.github.com/assets/5688/421608/b26ab51c-ad0c-11e2-8356-d73fd20c8d7f.png)
575
+
576
+ ```ruby
577
+ options = { :title => "Authorization" }
578
+ auth_alert = BW::UIAlertView.login_and_password_input(options).on_click do |alert|
579
+ alert.login_text_field.text #=> "La Forge"
580
+ alert.password_text_field.text #=> "Theta2997"
581
+ end
582
+
583
+ auth_alert.show
584
+ ```
585
+
586
+ #### Buttons
587
+
588
+ Each alert style has sane, default button titles. Yet they're fully customizable by providing either a `String` to the constructor's `:buttons` argument
589
+
590
+ ![iOS Simulator Screen shot Apr 24 2013 11 34 12 AM](https://f.cloud.github.com/assets/5688/421633/ac364106-ad0d-11e2-9b0a-ec1692da0c7f.png)
591
+
592
+ ```ruby
593
+ alert = BW::UIAlertView.default(:title => "BubbleWrap is", :buttons => "Awesome")
594
+
595
+ alert.show
596
+ ```
597
+
598
+ Or an `Array` of strings to the constructor's `:buttons` argument.
599
+
600
+ ![iOS Simulator Screen shot Apr 24 2013 11 35 36 AM](https://f.cloud.github.com/assets/5688/421640/ce9e4d9c-ad0d-11e2-96bd-ca5327570f4d.png)
601
+
602
+ ```ruby
603
+ options = {
604
+ :title => "Dinner this Friday?",
605
+ :message => "My treat!",
606
+ :buttons => ["No", "Maybe", "Yes"]
607
+ }
608
+ alert = BW::UIAlertView.default(options)
609
+
610
+ alert.show
611
+ ```
612
+
613
+ Inside a callback, the `#clicked_button` method contains the `index` and `title` of the clicked button.
614
+
615
+ ![iOS Simulator Screen shot Apr 24 2013 11 43 26 AM](https://f.cloud.github.com/assets/5688/421755/d3bf35cc-ad10-11e2-995d-ca45adaad504.png)
616
+
617
+ ```ruby
618
+ options = {
619
+ :title => "Warp Engine Online",
620
+ :message => "Plot a course for Starbase 118. Warp 7.",
621
+ :buttons => ["Cancel", "Engage"],
622
+ }
623
+ warp_alert = BW::UIAlertView.default(options).on_click do |alert|
624
+ if alert.clicked_button.index == 0
625
+ # ...
626
+ else
627
+ # ...
628
+ end
629
+
630
+ if alert.clicked_button.title == "Cancel"
631
+ # ...
632
+ else
633
+ # ...
634
+ end
635
+ end
636
+
637
+ warp_alert.show
638
+ ```
639
+
640
+ When the constructor's `:cancel_button_index` argument is provided, the `clicked_button` knows whether or not it's a `cancel?` button. Conveniently, the argument is automatically set to `0` for all constructors **EXCEPT** `.default` and `.new`.
641
+
642
+ ![iOS Simulator Screen shot Apr 24 2013 11 43 26 AM](https://f.cloud.github.com/assets/5688/421755/d3bf35cc-ad10-11e2-995d-ca45adaad504.png)
643
+
644
+ ```ruby
645
+ options = {
646
+ :title => "Warp Engine Online",
647
+ :message => "Plot a course for Starbase 118. Warp 7.",
648
+ :buttons => ["Cancel", "Engage"],
649
+ :cancel_button_index => 0 # set for all constructors EXCEPT `.default` and `.new`
650
+ }
651
+ warp_alert = BW::UIAlertView.default(options).on_click do |alert|
652
+ # NOTE: uses the :cancel_button_index argument
653
+ if alert.clicked_button.cancel?
654
+ # ...
655
+ else
656
+ # ...
657
+ end
658
+ end
659
+
660
+ warp_alert.show
661
+ ```
662
+
663
+ #### Callbacks
664
+
665
+ `BW::UIAlertView` instances are their own delegate. The complete `UIAlertViewDelegte` protocol is available via callbacks.
666
+
667
+ ```ruby
668
+ alert = BW::UIAlertView.default
669
+
670
+ alert.will_present do |alert|
671
+ # aka willPresentAlertView:
672
+ end
673
+
674
+ alert.did_present do |alert|
675
+ # aka didPresentAlertView:
676
+ end
677
+
678
+ alert.on_click do |alert|
679
+ # aka alertView:clickedButtonAtIndex:
680
+ end
681
+
682
+ alert.will_dismiss do |alert|
683
+ # aka alertView:willDismissWithButtonIndex:
684
+ end
685
+
686
+ alert.did_dismiss do |alert|
687
+ # aka alertView:didDismissWithButtonIndex:
688
+ end
689
+
690
+ alert.on_system_cancel do |alert|
691
+ # aka alertViewCancel:
692
+ end
693
+
694
+ alert.enable_first_other_button? do |alert|
695
+ # aka alertViewShouldEnableFirstOtherButton:
696
+ # NOTE: must return a boolean
697
+ true
698
+ end
699
+ ```
700
+
517
701
  ## HTTP
518
702
 
519
703
  `BW::HTTP` wraps `NSURLRequest`, `NSURLConnection` and friends to provide Ruby developers with a more familiar and easier to use API.
@@ -557,6 +741,32 @@ would be a Proc that takes two arguments: a float representing the
557
741
  amount of data currently received and another float representing the
558
742
  total amount of data expected.
559
743
 
744
+ ### Gotchas
745
+
746
+ Because of how RubyMotion currently works, you sometimes need to assign objects as `@instance_variables` in order to retain their callbacks.
747
+
748
+ For example:
749
+
750
+ ```ruby
751
+ class HttpClient
752
+ def get_user(user_id, &callback)
753
+ BW::HTTP.get(user_url(user_id)) do |response|
754
+ # ..
755
+ end
756
+ end
757
+ end
758
+ ```
759
+
760
+ This class should be invoked in your code as:
761
+
762
+ ```ruby
763
+ @http_client = HttpClient.new
764
+ @http_client.get_user(user_id) do |user|
765
+ # ..
766
+ end
767
+ ```
768
+
769
+ (instead of doing an instance-variable-less `HttpClient.new.get_user`)
560
770
 
561
771
  ## RSS Parser
562
772
  **Since: > version 1.0.0**
data/Rakefile CHANGED
@@ -1,16 +1,37 @@
1
1
  require "bundler/gem_tasks"
2
2
  $:.unshift("/Library/RubyMotion/lib")
3
- require 'motion/project'
3
+ if ENV['osx']
4
+ require 'motion/project/template/osx'
5
+ else
6
+ require 'motion/project/template/ios'
7
+ end
4
8
  Bundler.setup
5
9
  Bundler.require
6
10
 
7
11
  require 'bubble-wrap/all'
8
12
  require 'bubble-wrap/test'
9
13
 
14
+ module Motion; module Project
15
+ class Config
16
+ def spec_files=(spec_files)
17
+ @spec_files = spec_files
18
+ end
19
+ end
20
+ end; end
21
+
10
22
  Motion::Project::App.setup do |app|
11
23
  app.name = 'testSuite'
12
24
  app.identifier = 'io.bubblewrap.testSuite'
13
25
  app.specs_dir = './spec/motion'
26
+ app.spec_files
27
+ if Motion::Project::App.osx?
28
+ app.spec_files -= Dir.glob("./spec/motion/**/ios/**.rb")
29
+ ["font", "location", "media", "ui"].each do |package|
30
+ app.spec_files -= Dir.glob("./spec/motion/#{package}/**/*.rb")
31
+ end
32
+ else
33
+ app.spec_files -= Dir.glob("./spec/motion/**/osx/**.rb")
34
+ end
14
35
  app.version = '1.2.3'
15
36
  end
16
37
 
@@ -22,4 +43,4 @@ namespace :spec do
22
43
  task :motion => 'spec'
23
44
 
24
45
  task :all => [:lib, :motion]
25
- end
46
+ end
@@ -1,8 +1,12 @@
1
1
  require 'bubble-wrap/loader'
2
- BubbleWrap.require('motion/util/constants.rb')
3
- BubbleWrap.require('motion/core/device.rb')
4
- BubbleWrap.require('motion/core/device/**/*.rb') do
5
- file('motion/core/device/camera_wrapper.rb').depends_on 'motion/core/device/camera.rb'
6
- file('motion/core/device/camera.rb').depends_on ['motion/core/device.rb', 'motion/util/constants.rb']
7
- file('motion/core/device/screen.rb').depends_on 'motion/core/device.rb'
2
+
3
+ BubbleWrap.require_ios("camera") do
4
+ BubbleWrap.require('motion/util/constants.rb')
5
+ BubbleWrap.require('motion/core/device.rb')
6
+ BubbleWrap.require('motion/core/device/*.rb')
7
+ BubbleWrap.require('motion/core/device/ios/*.rb') do
8
+ file('motion/core/device/ios/camera_wrapper.rb').depends_on 'motion/core/device/ios/camera.rb'
9
+ file('motion/core/device/ios/camera.rb').depends_on ['motion/core/ios/device.rb', 'motion/util/constants.rb']
10
+ file('motion/core/device/ios/screen.rb').depends_on 'motion/core/ios/device.rb'
11
+ end
8
12
  end
@@ -1,7 +1,20 @@
1
1
  require 'bubble-wrap/loader'
2
+
2
3
  BubbleWrap.require('motion/core.rb')
3
- BubbleWrap.require('motion/core/**/*.rb') do
4
+ BubbleWrap.require('motion/core/*.rb') do
4
5
  file('motion/core/pollute.rb').depends_on 'motion/core/ns_index_path.rb'
5
6
  end
7
+ BubbleWrap.require('motion/core/device/*.rb')
8
+
9
+ BubbleWrap.require_ios do
10
+ BubbleWrap.require('motion/core/ios/**/*.rb')
11
+ BubbleWrap.require('motion/core/device/ios/**/*.rb')
12
+ end
13
+
14
+ BubbleWrap.require_osx do
15
+ BubbleWrap.require('motion/core/osx/**/*.rb')
16
+ BubbleWrap.require('motion/core/device/osx/**/*.rb')
17
+ end
18
+
6
19
  require 'bubble-wrap/camera'
7
20
  require 'bubble-wrap/ui'
@@ -19,7 +19,15 @@ module BubbleWrap
19
19
  end
20
20
 
21
21
  end
22
+
23
+ module Platforms
24
+ def osx?
25
+ self.respond_to?(:template) && self.template == :osx
26
+ end
27
+ end
22
28
  end
23
29
  end
24
30
 
25
31
  Motion::Project::App.extend(BubbleWrap::Ext::BuildTask)
32
+
33
+ Motion::Project::App.extend(BubbleWrap::Ext::Platforms)
@@ -1,2 +1,4 @@
1
1
  require 'bubble-wrap/loader'
2
- BubbleWrap.require('motion/font/font.rb')
2
+ BubbleWrap.require_ios("font") do
3
+ BubbleWrap.require('motion/font/font.rb')
4
+ end
@@ -2,3 +2,5 @@ require 'bubble-wrap/loader'
2
2
  BubbleWrap.require('motion/core/ns_url_request.rb')
3
3
  BubbleWrap.require('motion/core.rb')
4
4
  BubbleWrap.require('motion/http.rb')
5
+ BubbleWrap.require('motion/http/query.rb')
6
+ BubbleWrap.require('motion/http/response.rb')
@@ -4,8 +4,8 @@ end
4
4
 
5
5
  unless defined?(BubbleWrap::LOADER_PRESENT)
6
6
  require 'bubble-wrap/version' unless defined?(VERSION)
7
- if BubbleWrap::minor_version(Motion::Version) < BubbleWrap::minor_version(BubbleWrap::MIN_MOTION_VERSION)
8
- raise "BubbleWrap #{BubbleWrap::VERSION} requires at least rubymotion #{BubbleWrap::MIN_MOTION_VERSION}"
7
+ if Gem::Version.new(Motion::Version) < Gem::Version.new(BubbleWrap::MIN_MOTION_VERSION)
8
+ raise "BubbleWrap #{BubbleWrap::VERSION} requires at least RubyMotion #{BubbleWrap::MIN_MOTION_VERSION}"
9
9
  end
10
10
 
11
11
  require 'bubble-wrap/ext'
@@ -24,6 +24,21 @@ unless defined?(BubbleWrap::LOADER_PRESENT)
24
24
  Requirement.scan(caller.first, file_spec, &block)
25
25
  end
26
26
 
27
+ def require_ios(requirement = nil, &callback)
28
+ if !Motion::Project::App.osx?
29
+ callback.call
30
+ else
31
+ puts "bubble-wrap/#{requirement} requires iOS to use." if requirement
32
+ end
33
+ end
34
+
35
+ def require_osx(requirement = nil, &callback)
36
+ if Motion::Project::App.osx?
37
+ callback.call
38
+ else
39
+ puts "bubble-wrap/#{requirement} requires OS X to use." if requirement
40
+ end
41
+ end
27
42
  end
28
43
 
29
44
  BW = BubbleWrap unless defined?(BW)