sugarcube 0.20.22 → 0.20.23

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  language: objective-c
2
- before_install: rvm use 1.9.3
2
+ before_install: rvm use ruby-1.9.3-p392
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (0.20.21)
4
+ sugarcube (0.20.23)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,9 +37,8 @@ module SugarCube
37
37
 
38
38
  private
39
39
  def self.detect(date_string)
40
- error = Pointer.new(:object)
41
- detector = NSDataDetector.dataDetectorWithTypes(NSTextCheckingTypeDate, error:error)
42
- matches = detector.matchesInString(date_string, options:0, range:NSMakeRange(0, date_string.length))
40
+ @@detector ||= NSDataDetector.dataDetectorWithTypes(NSTextCheckingTypeDate, error:Pointer.new(:object))
41
+ matches = @@detector.matchesInString(date_string, options:0, range:NSMakeRange(0, date_string.length))
43
42
  end
44
43
  end
45
44
  end
@@ -64,4 +63,4 @@ class String
64
63
  def to_duration
65
64
  SugarCube::DateParser.parse_duration(self)
66
65
  end
67
- end
66
+ end
@@ -14,6 +14,13 @@ class NSString
14
14
  @@sugarcube_caches.stringByAppendingPathComponent(self)
15
15
  end
16
16
 
17
+ def app_support
18
+ @@sugarcube_app_suppert ||= NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true)[0]
19
+ return self if self.hasPrefix(@@sugarcube_app_suppert)
20
+
21
+ @@sugarcube_app_suppert.stringByAppendingPathComponent(self)
22
+ end
23
+
17
24
  def exists?
18
25
  path = self.hasPrefix('/') ? self : self.document
19
26
  NSFileManager.defaultManager.fileExistsAtPath(path)
@@ -347,8 +347,17 @@ class UIView
347
347
  duration /= repeat
348
348
  end
349
349
  keypath = options[:keypath] || 'transform.translation.x'
350
+ if keypath == 'transform.rotation'
351
+ value_keypath = 'layer.transform.rotation.z'
352
+ else
353
+ value_keypath = keypath
354
+ end
350
355
 
351
- origin = options[:origin] || 0
356
+ if options[:from_current]
357
+ origin = options[:origin] || valueForKeyPath(value_keypath)
358
+ else
359
+ origin = options[:origin] || 0
360
+ end
352
361
  left = origin - offset
353
362
  right = origin + offset
354
363
 
@@ -361,6 +370,12 @@ class UIView
361
370
  self
362
371
  end
363
372
 
373
+ # this dummy method is needed to define the setDuration method
374
+ def dummy
375
+ self.setDuration(nil)
376
+ end
377
+ private :dummy
378
+
364
379
  # Moves the view off screen while slowly rotating it.
365
380
  #
366
381
  # Based on https://github.com/warrenm/AHAlertView/blob/master/AHAlertView/AHAlertView.m
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.20.22'
2
+ Version = '0.20.23'
3
3
  end
@@ -61,10 +61,6 @@ describe 'NSAttributeString' do
61
61
  @subject.isEqualToAttributedString('test'.attrd.underline_style(NSUnderlineStyleSingle)).should != true
62
62
  end
63
63
 
64
- it 'should have `superscript`' do
65
- @subject.isEqualToAttributedString('test'.attrd.superscript(1)).should != true
66
- end
67
-
68
64
  it 'should have `background_color`' do
69
65
  @subject.isEqualToAttributedString('test'.attrd.background_color(UIColor.redColor)).should != true
70
66
  @subject.isEqualToAttributedString('test'.attrd.bg_color(UIColor.redColor)).should != true
@@ -79,18 +75,10 @@ describe 'NSAttributeString' do
79
75
  @subject.isEqualToAttributedString('test'.attrd.ligature(2)).should != true
80
76
  end
81
77
 
82
- it 'should have `baseline_offset`' do
83
- @subject.isEqualToAttributedString('test'.attrd.baseline_offset(1)).should != true
84
- end
85
-
86
78
  it 'should have `kern`' do
87
79
  @subject.isEqualToAttributedString('test'.attrd.kern(1)).should != true
88
80
  end
89
81
 
90
- it 'should have `link`' do
91
- @subject.isEqualToAttributedString('test'.attrd.link('http://github.com'.nsurl)).should != true
92
- end
93
-
94
82
  it 'should have `stroke_width`' do
95
83
  @subject.isEqualToAttributedString('test'.attrd.stroke_width(1)).should != true
96
84
  end
@@ -99,57 +87,18 @@ describe 'NSAttributeString' do
99
87
  @subject.isEqualToAttributedString('test'.attrd.stroke_color(UIColor.redColor)).should != true
100
88
  end
101
89
 
102
- it 'should have `underline_color`' do
103
- @subject.isEqualToAttributedString('test'.attrd.underline_color(UIColor.redColor)).should != true
104
- end
105
-
106
90
  it 'should have `strikethrough_style`' do
107
91
  @subject.isEqualToAttributedString('test'.attrd.strikethrough_style(NSUnderlineStyleSingle)).should != true
108
92
  end
109
93
 
110
- it 'should have `strikethrough_color`' do
111
- @subject.isEqualToAttributedString('test'.attrd.strikethrough_color(UIColor.redColor)).should != true
112
- end
113
-
114
94
  it 'should have `shadow`' do
115
95
  @subject.isEqualToAttributedString('test'.attrd.shadow(NSShadow.alloc.init.tap{|s|s.shadowOffset = [1,1]})).should != true
116
96
  end
117
97
 
118
- it 'should have `obliqueness`' do
119
- @subject.isEqualToAttributedString('test'.attrd.obliqueness(0.5)).should != true
120
- end
121
-
122
- it 'should have `expansion`' do
123
- @subject.isEqualToAttributedString('test'.attrd.expansion(1)).should != true
124
- end
125
-
126
- # don't care about:
127
- # it 'should have `cursor`' do
128
- # @subject.isEqualToAttributedString('test'.attrd.cursor()).should != true
129
- # end
130
-
131
- it 'should have `tool_tip`' do
132
- @subject.isEqualToAttributedString('test'.attrd.tool_tip('test')).should != true
133
- end
134
-
135
- it 'should have `marked_clause_segment`' do
136
- @subject.isEqualToAttributedString('test'.attrd.marked_clause_segment(1)).should != true
137
- end
138
-
139
- # don't care about:
140
- # it 'should have `writing_direction`' do
141
- # @subject.isEqualToAttributedString('test'.attrd.writing_direction()).should != true
142
- # end
143
-
144
98
  it 'should have `vertical_glyph_form`' do
145
99
  @subject.isEqualToAttributedString('test'.attrd.vertical_glyph_form(1)).should != true
146
100
  end
147
101
 
148
- # don't care about:
149
- # it 'should have `text_alternatives`' do
150
- # @subject.isEqualToAttributedString('test'.attrd.text_alternatives()).should != true
151
- # end
152
-
153
102
  end
154
103
 
155
104
  end
@@ -10,6 +10,11 @@ describe 'NSString' do
10
10
  'foo'.cache.hasSuffix('Library/Caches/foo').should == true
11
11
  end
12
12
 
13
+ it "should have a #app_support method" do
14
+ 'foo'.app_support.hasPrefix('/Users').should == true
15
+ 'foo'.app_support.hasSuffix('Library/Application Support/foo').should == true
16
+ end
17
+
13
18
  it "should have an #exists? method" do
14
19
  'foo'.document.exists?.should == false
15
20
  end
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: 0.20.22
4
+ version: 0.20.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-05-29 00:00:00.000000000 Z
16
+ date: 2013-06-14 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description: ! '== Description
19
19