sugarcube 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -12
- data/lib/ios/sugarcube-factories/nserror.rb +8 -1
- data/lib/ios/sugarcube-factories/uilabel.rb +6 -5
- data/lib/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d3f8cd69b62fb92dd1c6fb42af4f89eaa842790
|
4
|
+
data.tar.gz: 6843f02fd47747244cf1b6f9f8fd39419d77cf4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95ad104f6663bb9bf3b38499127450ccbc0f400c496a7cdad37001655353e227da806100973b8ee163881a58265996f1d0911999af08a0e0f00e8affe785b218
|
7
|
+
data.tar.gz: 9f568687eea341dd35e7aa9253d46b977b3cd2597c62207e2d9540837cd1037c8e90cdf3cbd528f487649dddf341ec644a466f10b4437c9cafb1af63bb5909b9
|
data/README.md
CHANGED
@@ -11,9 +11,9 @@ CocoaTouch/iOS is a *verbose* framework. These extensions hope to make
|
|
11
11
|
development in rubymotion more enjoyable. With SugarCube, you can create a color
|
12
12
|
from an integer or symbol, or create a UIFont or UIImage from a string.
|
13
13
|
|
14
|
-
|
14
|
+
Many core classes are opened up as well, like adding the '<<' operator to a
|
15
15
|
UIView instance, instead of view.addSubview(subview), you can use the more
|
16
|
-
idiomatic: view << subview
|
16
|
+
idiomatic: `view << subview`.
|
17
17
|
|
18
18
|
The basic idea of SugarCube is to turn operations on their head. So instead of:
|
19
19
|
|
@@ -33,11 +33,14 @@ Cocoa-wrappage.
|
|
33
33
|
|
34
34
|
**CONTRIBUTIONS**
|
35
35
|
|
36
|
-
SugarCube
|
37
|
-
[
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
SugarCube is the result of the hard work of many developers, but it’s mostly
|
37
|
+
maintained by [Colin Gray][colinta], with help from members of the RubyMotion
|
38
|
+
community. If you have an idea, please open a pull request so we can discuss
|
39
|
+
it! All PRs must be submitted with specs.
|
40
|
+
|
41
|
+
If you use SugarCube on your projects, please consider donating a small amount
|
42
|
+
via [gratipay.com](https://gratipay.com/colinta), or better yet: fork the
|
43
|
+
project, add some specs, and improve the quality of this super-handy gem!
|
41
44
|
|
42
45
|
Documentation
|
43
46
|
=============
|
@@ -998,12 +1001,30 @@ UITabBarItem.system(:top_rated, tag: MY_ITEM_TAG, badge: 'hi')
|
|
998
1001
|
```
|
999
1002
|
|
1000
1003
|
###### NSError
|
1004
|
+
|
1005
|
+
> **WARNING:** Breaking change in 3.3.0, this method name *was* `new`, but that
|
1006
|
+
> caused conflicts with a bunch of 3rd party CocoaPods.
|
1007
|
+
|
1001
1008
|
```ruby
|
1002
|
-
# usually, NSError.
|
1009
|
+
# usually, NSError.error doesn't work, because the only initializer for NSError
|
1003
1010
|
# needs more arguments. This method passes some defaults in.
|
1004
|
-
NSError.
|
1011
|
+
NSError.error('message')
|
1005
1012
|
# same as =>
|
1006
|
-
NSError.
|
1013
|
+
NSError.error('message', domain: 'Error', code: 0, userInfo: {})
|
1014
|
+
```
|
1015
|
+
|
1016
|
+
###### UILabel
|
1017
|
+
|
1018
|
+
> **WARNING:** Breaking change in 3.3.0, this method name *was* `new`, but that
|
1019
|
+
> caused conflicts with a bunch of 3rd party CocoaPods.
|
1020
|
+
|
1021
|
+
```ruby
|
1022
|
+
# supports text, font, and font size
|
1023
|
+
UILabel.label('label text')
|
1024
|
+
UILabel.label('label text'.attrd) # detects attributed strings, too
|
1025
|
+
UILabel.label('label text', 'Font name') # You can pass just a font name
|
1026
|
+
UILabel.label('label text', UIFont.fontWithName('Font name', size: 20)) # Or a UIFont object
|
1027
|
+
UILabel.label('label text', 'Font name', 20) # Or the name *and* the size
|
1007
1028
|
```
|
1008
1029
|
|
1009
1030
|
Animations ([wiki][Animations Wiki])
|
@@ -1855,7 +1876,6 @@ If you want to see new features, please fork, commit, and pull-request! :smiley:
|
|
1855
1876
|
[nsnulldammit]: https://github.com/colinta/nsnulldammit
|
1856
1877
|
[geomotion]: https://github.com/clayallsopp/geomotion
|
1857
1878
|
|
1858
|
-
[Fusionbox]: http://www.fusionbox.com/
|
1859
|
-
[fusionbox announcement]: http://fusionbox.org/projects/rubymotion-sugarcube/
|
1860
1879
|
[Clay Allsopp]: https://github.com/clayallsopp
|
1861
1880
|
[Thom Parkin]: https://github.com/ParkinT
|
1881
|
+
[colinta]: https://github.com/colinta
|
@@ -1,6 +1,13 @@
|
|
1
1
|
class NSError
|
2
2
|
|
3
|
-
|
3
|
+
# @example
|
4
|
+
# NSError.error('just a simple error message')
|
5
|
+
# NSError.error('just a simple error message',
|
6
|
+
# domain: 'foo',
|
7
|
+
# code: 255,
|
8
|
+
# userInfo: { 'object' => 'foo' }
|
9
|
+
# )
|
10
|
+
def self.error(message='Error', options={})
|
4
11
|
domain = options[:domain] || 'Error'
|
5
12
|
code = options[:code] || 0
|
6
13
|
info = { NSLocalizedDescriptionKey => message }
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class UILabel
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
3
|
+
# @example
|
4
|
+
# UILabel.label('test')
|
5
|
+
# UILabel.label('test', another_label.font)
|
6
|
+
# UILabel.label('test', 'Helvetica')
|
7
|
+
# UILabel.label('test', 'Helvetica', 20)
|
8
|
+
def self.label(text=nil, font=nil, size=nil)
|
8
9
|
return super() if text.nil?
|
9
10
|
|
10
11
|
font = font.uifont(size) if font.respond_to?(:uifont)
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|
@@ -33,19 +33,19 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
-
-
|
37
|
-
- lib/all/sugarcube/look_in.rb
|
36
|
+
- README.md
|
38
37
|
- lib/all/sugarcube-legacy/activesupport.rb
|
39
38
|
- lib/all/sugarcube-numbers/fixnum.rb
|
40
39
|
- lib/all/sugarcube-numbers/numeric.rb
|
41
40
|
- lib/all/sugarcube-numbers/time.rb
|
42
41
|
- lib/all/sugarcube-repl/repl.rb
|
43
42
|
- lib/all/sugarcube-unholy/ivar.rb
|
44
|
-
- lib/
|
43
|
+
- lib/all/sugarcube/log.rb
|
44
|
+
- lib/all/sugarcube/look_in.rb
|
45
45
|
- lib/android/sugarcube-repl/kernel.rb
|
46
46
|
- lib/android/sugarcube-repl/repl.rb
|
47
47
|
- lib/android/sugarcube-ui/android.view_group.rb
|
48
|
-
- lib/
|
48
|
+
- lib/android/sugarcube/log.rb
|
49
49
|
- lib/cocoa/sugarcube-animations/caanimation.rb
|
50
50
|
- lib/cocoa/sugarcube-animations/calayer.rb
|
51
51
|
- lib/cocoa/sugarcube-anonymous/anonymous.rb
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/cocoa/sugarcube-to_s/nsurl.rb
|
99
99
|
- lib/cocoa/sugarcube-ui/calayer.rb
|
100
100
|
- lib/cocoa/sugarcube-ui/frameable.rb
|
101
|
+
- lib/cocoa/sugarcube/log.rb
|
101
102
|
- lib/ios/sugarcube-568/uiimage.rb
|
102
103
|
- lib/ios/sugarcube-animations/animation_chain.rb
|
103
104
|
- lib/ios/sugarcube-animations/uiview.rb
|
@@ -220,7 +221,6 @@ files:
|
|
220
221
|
- lib/sugarcube.rb
|
221
222
|
- lib/sugarcube_pre_setup.rb
|
222
223
|
- lib/version.rb
|
223
|
-
- README.md
|
224
224
|
- spec/all/anonymous_spec.rb
|
225
225
|
- spec/all/numeric_spec.rb
|
226
226
|
- spec/cocoa/base64_spec.rb
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|
318
318
|
rubyforge_project:
|
319
|
-
rubygems_version: 2.
|
319
|
+
rubygems_version: 2.4.5
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully
|