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 +8 -8
- data/.travis.yml +3 -1
- data/CHANGELOG.md +11 -1
- data/Gemfile.lock +1 -1
- data/README.md +11 -181
- data/lib/bubble-wrap/version.rb +2 -2
- data/motion/core/app.rb +4 -0
- data/motion/http/query.rb +1 -1
- data/motion/reactor/eventable.rb +5 -5
- data/samples/osx/Gemfile +1 -1
- data/spec/motion/http/query_spec.rb +3 -3
- data/spec/motion/reactor/eventable_spec.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTMyNzRlMzhmMzlkODllNWQxMmIwOGNkZWZjZWI1MzliY2UzMThkMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODU4NjExZjljN2ViYTNmYjk0YmQ2NjU5ZTVlYzRiNTQ3OTIyZjE1MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjY5ZTNmMjc2NzIzMGUxZmI1NDYyN2U1NGQwNWYxY2VlYjI0OTExMWU5MTJk
|
10
|
+
NWRjODAzMTNjYmVmODg0NWZhZWI5MDE2N2NiZDg2ZmJhZTcyNDgzZThkZjYz
|
11
|
+
MzUyYzViMzU4MzM2ODU3NGIzZjA0OWVkNDM2OTVhNGEwOTg2MDk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGEyZmMyNDRjYjdiNjFhZWQ5NmMxMjJiNWMyNWUwZmE5NzE2ODMwMjBiZmYz
|
14
|
+
MDk3YjIzZTY2ZTQ4MmVkZDBlYTVlOGVjY2YzYTUyNzM4NGU1ZWMxMzAzZGVj
|
15
|
+
ZmE4ODc4NjZiM2Q5ZGU2ZTE0MGMyNDhhYzM4YWYwNjI5MDRkMTM=
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
-
[Commit history](https://github.com/rubymotion/BubbleWrap/compare/v1.
|
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
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
|
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.
|
204
|
+
> Device.camera.front?
|
197
205
|
# true
|
198
|
-
> Device.
|
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.
|
data/lib/bubble-wrap/version.rb
CHANGED
data/motion/core/app.rb
CHANGED
data/motion/http/query.rb
CHANGED
data/motion/reactor/eventable.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
30
|
-
@
|
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
@@ -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
|
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
|
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
|
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(:@
|
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(:@
|
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
|
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-
|
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:
|
354
|
+
version: '0'
|
355
355
|
requirements: []
|
356
356
|
rubyforge_project:
|
357
357
|
rubygems_version: 2.0.3
|