teacup 2.1.11 → 2.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/teacup/layout.rb +0 -1
- data/lib/teacup/stylesheet.rb +18 -12
- data/lib/teacup/teacup_controller.rb +2 -3
- data/lib/teacup/version.rb +1 -1
- data/spec/ios/main_spec.rb +3 -3
- data/spec/ios/memory_leak_spec.rb +0 -2
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/teacup/layout.rb
CHANGED
data/lib/teacup/stylesheet.rb
CHANGED
@@ -125,19 +125,23 @@ module Teacup
|
|
125
125
|
# @stylesheet_cache object is manipulated directly (to invalidate entries,
|
126
126
|
# or the entire cache)
|
127
127
|
def stylesheet_cache
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
128
|
+
return nil
|
129
|
+
# @stylesheet_cache ||= Hash.new do |by_stylename,_stylename|
|
130
|
+
# by_stylename[_stylename] = Hash.new do |by_target,_target|
|
131
|
+
# by_orientation = {}
|
132
|
+
# by_target[_target] = by_orientation
|
133
|
+
# end
|
134
|
+
# end
|
133
135
|
end
|
134
136
|
|
135
137
|
def get_stylesheet_cache(stylename, target, orientation)
|
136
|
-
|
138
|
+
return nil
|
139
|
+
# self.stylesheet_cache[stylename][target][orientation]
|
137
140
|
end
|
138
141
|
|
139
142
|
def set_stylesheet_cache(stylename, target, orientation, value)
|
140
|
-
|
143
|
+
return
|
144
|
+
# self.stylesheet_cache[stylename][target][orientation] = value
|
141
145
|
end
|
142
146
|
|
143
147
|
# Include another Stylesheet into this one, the rules defined
|
@@ -211,15 +215,17 @@ module Teacup
|
|
211
215
|
return {} if seen[self]
|
212
216
|
return {} unless stylename
|
213
217
|
|
214
|
-
|
218
|
+
p stylename: stylename, target: target, orientation: orientation
|
219
|
+
if cached = get_stylesheet_cache(stylename, target, orientation)
|
220
|
+
return cached.dup
|
221
|
+
else
|
215
222
|
run_block
|
216
223
|
seen[self] = true
|
217
224
|
|
218
|
-
|
225
|
+
built = styles[stylename].build(target, orientation, seen)
|
226
|
+
set_stylesheet_cache(stylename, target, orientation, built)
|
227
|
+
return built.dup
|
219
228
|
end
|
220
|
-
|
221
|
-
# mutable hashes could mess with our cache, so return a duplicate
|
222
|
-
get_stylesheet_cache(stylename, target, orientation).dup
|
223
229
|
end
|
224
230
|
|
225
231
|
# Add a set of properties for a given stylename or multiple stylenames.
|
@@ -101,6 +101,8 @@ module Teacup
|
|
101
101
|
layout(top_level_view, stylename, properties, &block)
|
102
102
|
end
|
103
103
|
|
104
|
+
layoutDidLoad
|
105
|
+
|
104
106
|
if should_restyle
|
105
107
|
Teacup.should_restyle!
|
106
108
|
self.top_level_view.restyle!
|
@@ -109,12 +111,9 @@ module Teacup
|
|
109
111
|
if defined? NSLayoutConstraint
|
110
112
|
self.top_level_view.apply_constraints
|
111
113
|
end
|
112
|
-
|
113
|
-
layoutDidLoad
|
114
114
|
end
|
115
115
|
|
116
116
|
def layoutDidLoad
|
117
|
-
true
|
118
117
|
end
|
119
118
|
|
120
119
|
end
|
data/lib/teacup/version.rb
CHANGED
data/spec/ios/main_spec.rb
CHANGED
@@ -25,9 +25,9 @@ describe "Application 'Teacup'" do
|
|
25
25
|
it "root view should be styled as :root" do
|
26
26
|
@root_view.stylename.should == :root
|
27
27
|
@root_view.frame.origin.x.should == 0
|
28
|
-
@root_view.frame.origin.y.should ==
|
29
|
-
@root_view.frame.size.width.should ==
|
30
|
-
@root_view.frame.size.height.should ==
|
28
|
+
@root_view.frame.origin.y.should == 0
|
29
|
+
@root_view.frame.size.width.should == UIApplication.sharedApplication.keyWindow.frame.size.width
|
30
|
+
@root_view.frame.size.height.should == UIApplication.sharedApplication.keyWindow.frame.size.height
|
31
31
|
@root_view.backgroundColor.should == UIColor.yellowColor
|
32
32
|
end
|
33
33
|
|
@@ -19,7 +19,6 @@ describe "Memory leaks" do
|
|
19
19
|
|
20
20
|
def controller
|
21
21
|
unless @controller
|
22
|
-
puts("=============== memory_leak_spec.rb line #{__LINE__} ===============")
|
23
22
|
root = UIViewController.new
|
24
23
|
@controller = UINavigationController.alloc.initWithRootViewController(root)
|
25
24
|
end
|
@@ -31,7 +30,6 @@ describe "Memory leaks" do
|
|
31
30
|
detector = LeakDetector.new
|
32
31
|
|
33
32
|
memory_leak = MemoryLeakController.new
|
34
|
-
p memory_leak.view
|
35
33
|
|
36
34
|
NSNotificationCenter.defaultCenter.addObserver(detector,
|
37
35
|
selector: :'did_dealloc:',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teacup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
|
15
15
|
layouts for
|