bubble-wrap 1.3.0.osx → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmE3N2Q1N2NjYTZmY2ZmYTU5OWU3YjMwMDk3OGM4OTU5MTc1MzY3ZA==
4
+ MTMyNzRlMzhmMzlkODllNWQxMmIwOGNkZWZjZWI1MzliY2UzMThkMw==
5
5
  data.tar.gz: !binary |-
6
- MGM1YzNkMmZlZTExMTRlM2RkMmFlZmNkNGUxY2ExN2E2NjgzY2QwMA==
6
+ ODU4NjExZjljN2ViYTNmYjk0YmQ2NjU5ZTVlYzRiNTQ3OTIyZjE1MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NGM0ZjAzMzU5MDBmMGRjMDIyNGFiN2IwZWVkZDY1YjczZTM1Yjk4NjExMjgz
10
- ZDZmOTlhMmYyZmQwNDc1MzcyYTIxMmE2NjNlMjA5MDhjMWM2M2I3MmExMjgy
11
- OWIxMTBkNzg2NDMzZDUyYjJlM2I5M2I0Y2M4ZDUyNmI2NGRhY2M=
9
+ YjY5ZTNmMjc2NzIzMGUxZmI1NDYyN2U1NGQwNWYxY2VlYjI0OTExMWU5MTJk
10
+ NWRjODAzMTNjYmVmODg0NWZhZWI5MDE2N2NiZDg2ZmJhZTcyNDgzZThkZjYz
11
+ MzUyYzViMzU4MzM2ODU3NGIzZjA0OWVkNDM2OTVhNGEwOTg2MDk=
12
12
  data.tar.gz: !binary |-
13
- N2VhOWU4ZTE1NWRkYmZjMWIzM2E2NjA0NmUzZmZjMDA2MDc4NzY0OTMzOTMy
14
- OTg3YTI4ODE3MmZjNjBlMjMyODM5ZTYxOWZjNjljYzJlODAzNDFjYTQ2MTRj
15
- ZWNhZTU4MTUwMmNmM2EzNTRlNTE1OWE0NDMwNDU0M2FmZjhkNWE=
13
+ MGEyZmMyNDRjYjdiNjFhZWQ5NmMxMjJiNWMyNWUwZmE5NzE2ODMwMjBiZmYz
14
+ MDk3YjIzZTY2ZTQ4MmVkZDBlYTVlOGVjY2YzYTUyNzM4NGU1ZWMxMzAzZGVj
15
+ ZmE4ODc4NjZiM2Q5ZGU2ZTE0MGMyNDhhYzM4YWYwNjI5MDRkMTM=
data/.travis.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  language: objective-c
2
- before_install: ruby --version
2
+ before_install:
3
+ - (ruby --version)
4
+ script: "(bundle install) && (bundle exec rake clean) && (bundle exec rake spec) && (bundle exec rake clean) && (bundle exec rake spec osx=true)"
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  ## Unreleased
2
2
 
3
- [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.2.0...master)
3
+ [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.3.0...master)
4
+
5
+ ## 1.3.0
6
+
7
+ [Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.2.0...v1.3.0)
8
+
9
+ * Added OS X support for RubyMotion 2.0 ([#233](https://github.com/rubymotion/BubbleWrap/pull/233)). BubbleWrap *drops support* for RubyMotion 1.x.
10
+ * Changed `BW::UIBarButtonItem` internals; `.build` is now deprecated and forwards to `.ne` ([#226](https://github.com/rubymotion/BubbleWrap/pull/226))
11
+ * Changed `HTTP` to present credentials with an `Authorization` header *before* any requests are made, unless the `:present_credentials` option `== false` ([#199](https://github.com/rubymotion/BubbleWrap/pull/199))
12
+ * Fixed `HTTP` to not append a question-mark (`?`) at the end of URL requests with empty `:payload`s ([#221](https://github.com/rubymotion/BubbleWrap/pull/221))
13
+ * Fixed `HTTP` to correct parameterize an array of hashes, Rails-style ([#219](https://github.com/rubymotion/BubbleWrap/pull/219))
4
14
 
5
15
  ## 1.2.0
6
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bubble-wrap (1.3.0.osx)
4
+ bubble-wrap (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BubbleWrap for RubyMotion
2
2
 
3
- A collection of (tested) helpers and wrappers used to wrap CocoaTouch code and provide more Ruby like APIs.
3
+ A collection of (tested) helpers and wrappers used to wrap Cocoa Touch and AppKit code and provide more Ruby like APIs.
4
4
 
5
5
  [BubbleWrap website](http://bubblewrap.io)
6
6
  [BubbleWrap mailing list](https://groups.google.com/forum/#!forum/bubblewrap)
@@ -23,6 +23,12 @@ gem install bubble-wrap
23
23
  require 'bubble-wrap'
24
24
  ```
25
25
 
26
+ If you are requiring bubble-wrap for RubyMotion 2.0 (iOS or OS X), use Bundler and specify version greater than 1.3.0:
27
+
28
+ ```ruby
29
+ gem "bubble-wrap", "~> 1.3.0"
30
+ ```
31
+
26
32
  BubbleWrap is split into multiple modules so that you can easily choose which parts
27
33
  are included at compile-time.
28
34
 
@@ -155,6 +161,8 @@ A module with useful methods related to the running application
155
161
  # "io.bubblewrap.testSuite"
156
162
  > App.alert("BubbleWrap is awesome!")
157
163
  # creates and shows an alert message.
164
+ > App.alert("BubbleWrap is awesome!", {cancel_button_title: "I know it is!", message: "Like, seriously awesome."})
165
+ # creates and shows an alert message with optional parameters.
158
166
  > App.run_after(0.5) { p "It's #{Time.now}" }
159
167
  # Runs the block after 0.5 seconds.
160
168
  > App.open_url("http://matt.aimonetti.net")
@@ -193,9 +201,9 @@ Examples:
193
201
  # true
194
202
  > Device.ipad?
195
203
  # false
196
- > Device.front_camera?
204
+ > Device.camera.front?
197
205
  # true
198
- > Device.rear_camera?
206
+ > Device.camera.rear?
199
207
  # true
200
208
  > Device.orientation
201
209
  # :portrait
@@ -520,184 +528,6 @@ And the `.system` button types are:
520
528
  :page_curl
521
529
  ```
522
530
 
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
-
701
531
  ## HTTP
702
532
 
703
533
  `BW::HTTP` wraps `NSURLRequest`, `NSURLConnection` and friends to provide Ruby developers with a more familiar and easier to use API.
@@ -1,4 +1,4 @@
1
1
  module BubbleWrap
2
- VERSION = '1.3.0.osx' unless defined?(BubbleWrap::VERSION)
3
- MIN_MOTION_VERSION = '1.36'
2
+ VERSION = '1.3.0' unless defined?(BubbleWrap::VERSION)
3
+ MIN_MOTION_VERSION = '2.0'
4
4
  end
data/motion/core/app.rb CHANGED
@@ -85,6 +85,10 @@ module BubbleWrap
85
85
  def osx?
86
86
  Kernel.const_defined?(:NSApplication)
87
87
  end
88
+
89
+ def ios?
90
+ Kernel.const_defined?(:UIApplication)
91
+ end
88
92
  end
89
93
  end
90
94
  ::App = BubbleWrap::App unless defined?(::App)
data/motion/http/query.rb CHANGED
@@ -149,7 +149,7 @@ Cache policy: #{@cache_policy}, response: #{@response.inspect} >"
149
149
 
150
150
  private
151
151
  def show_status_indicator(show)
152
- if !App.osx?
152
+ if App.ios?
153
153
  UIApplication.sharedApplication.networkActivityIndicatorVisible = show
154
154
  end
155
155
  end
@@ -7,27 +7,27 @@ module BubbleWrap
7
7
  # and be passed the arguments that are passed to
8
8
  # `trigger`.
9
9
  def on(event, &blk)
10
- events[event].push blk
10
+ __events__[event].push blk
11
11
  end
12
12
 
13
13
  # When `event` is triggered, do not call the given
14
14
  # block any more
15
15
  def off(event, &blk)
16
- events[event].delete_if { |b| b == blk }
16
+ __events__[event].delete_if { |b| b == blk }
17
17
  blk
18
18
  end
19
19
 
20
20
  # Trigger an event
21
21
  def trigger(event, *args)
22
- events[event].map do |event|
22
+ __events__[event].map do |event|
23
23
  event.call(*args)
24
24
  end
25
25
  end
26
26
 
27
27
  private
28
28
 
29
- def events
30
- @events ||= Hash.new { |h,k| h[k] = [] }
29
+ def __events__
30
+ @__events__ ||= Hash.new { |h,k| h[k] = [] }
31
31
  end
32
32
  end
33
33
  end
data/samples/osx/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source :rubygems
2
2
 
3
- gem 'bubble-wrap', :path => "../../" # '~> 1.3.0.osx'
3
+ gem 'bubble-wrap', :path => "../../" # '~> 1.3.0'
@@ -295,7 +295,7 @@ describe BubbleWrap::HTTP::Query do
295
295
  @query.connection.was_started.should.equal true
296
296
  end
297
297
 
298
- if !App.osx?
298
+ if App.ios?
299
299
  it "should turn on the network indicator" do
300
300
  UIApplication.sharedApplication.isNetworkActivityIndicatorVisible.should.equal true
301
301
  end
@@ -459,7 +459,7 @@ describe BubbleWrap::HTTP::Query do
459
459
  @fake_error = NSError.errorWithDomain('testing', code:7768, userInfo:nil)
460
460
  end
461
461
 
462
- if !App.osx?
462
+ if App.ios?
463
463
  it "should turn off network indicator" do
464
464
  UIApplication.sharedApplication.isNetworkActivityIndicatorVisible.should == true
465
465
  @query.connection(nil, didFailWithError:@fake_error)
@@ -495,7 +495,7 @@ describe BubbleWrap::HTTP::Query do
495
495
 
496
496
  describe "when connectionDidFinishLoading:" do
497
497
 
498
- if !App.osx?
498
+ if App.ios?
499
499
  it "should turn off the network indicator" do
500
500
  UIApplication.sharedApplication.isNetworkActivityIndicatorVisible.should == true
501
501
 
@@ -3,7 +3,7 @@ describe BubbleWrap::Reactor::Eventable do
3
3
  @subject = Class.new do
4
4
  include BubbleWrap::Reactor::Eventable
5
5
  end.new
6
- @proxy = Class.new do
6
+ @proxy = Class.new do
7
7
  attr_accessor :proof
8
8
  end.new
9
9
  end
@@ -12,7 +12,7 @@ describe BubbleWrap::Reactor::Eventable do
12
12
  it 'registers events' do
13
13
  proof = proc { }
14
14
  @subject.on(:foo, &proof)
15
- events = @subject.instance_variable_get(:@events)
15
+ events = @subject.instance_variable_get(:@__events__)
16
16
  events[:foo].member?(proof).should == true
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ describe BubbleWrap::Reactor::Eventable do
26
26
  it 'unregisters events' do
27
27
  proof = proc { }
28
28
  @subject.on(:foo, &proof)
29
- events = @subject.instance_variable_get(:@events)
29
+ events = @subject.instance_variable_get(:@__events__)
30
30
  @subject.off(:foo, &proof)
31
31
  events[:foo].member?(proof).should == false
32
32
  end
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.osx
4
+ version: 1.3.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-09 00:00:00.000000000 Z
17
+ date: 2013-05-15 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: mocha
@@ -349,9 +349,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
349
349
  version: '0'
350
350
  required_rubygems_version: !ruby/object:Gem::Requirement
351
351
  requirements:
352
- - - ! '>'
352
+ - - ! '>='
353
353
  - !ruby/object:Gem::Version
354
- version: 1.3.1
354
+ version: '0'
355
355
  requirements: []
356
356
  rubyforge_project:
357
357
  rubygems_version: 2.0.3