teacup 1.3.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +3 -3
  3. data/README.md +1172 -319
  4. data/Rakefile +8 -1
  5. data/app/app_delegate.rb +1 -1
  6. data/app/controllers/appearance_controller.rb +13 -0
  7. data/app/controllers/landscape_only_controller.rb +1 -1
  8. data/app/controllers/{first_controller.rb → main_controller.rb} +4 -3
  9. data/app/controllers/motion_layout_controller.rb +22 -0
  10. data/app/styles/appearance.rb +24 -0
  11. data/app/styles/main_styles.rb +8 -6
  12. data/app/views/custom_view.rb +1 -0
  13. data/lib/teacup/calculations.rb +2 -2
  14. data/lib/teacup/{z_core_extensions → core_extensions}/ca_layer.rb +0 -0
  15. data/lib/teacup/core_extensions/view_getters.rb +61 -0
  16. data/lib/teacup/handler.rb +14 -14
  17. data/lib/teacup/layout.rb +94 -17
  18. data/lib/teacup/stylesheet.rb +61 -26
  19. data/lib/teacup/stylesheet_extensions/transform.rb +88 -0
  20. data/lib/teacup/teacup_controller.rb +122 -0
  21. data/lib/teacup/teacup_util.rb +12 -7
  22. data/lib/teacup/teacup_view.rb +329 -0
  23. data/lib/teacup/version.rb +1 -1
  24. data/lib/teacup-ios/appearance.rb +96 -0
  25. data/lib/teacup-ios/core_extensions/teacup_handlers.rb +183 -0
  26. data/lib/teacup-ios/core_extensions/ui_view.rb +30 -0
  27. data/lib/teacup-ios/core_extensions/ui_view_controller.rb +110 -0
  28. data/lib/{dummy.rb → teacup-ios/dummy.rb} +2 -6
  29. data/lib/teacup-ios/handler.rb +23 -0
  30. data/lib/{teacup → teacup-ios}/style.rb +9 -10
  31. data/lib/teacup-ios/stylesheet_extensions/autoresize.rb +169 -0
  32. data/lib/{teacup/stylesheet_extensions/geometry.rb → teacup-ios/stylesheet_extensions/device.rb} +0 -0
  33. data/lib/teacup-osx/core_extensions/ns_view.rb +39 -0
  34. data/lib/teacup-osx/core_extensions/ns_view_controller.rb +21 -0
  35. data/lib/teacup-osx/core_extensions/ns_window.rb +39 -0
  36. data/lib/teacup-osx/core_extensions/ns_window_controller.rb +29 -0
  37. data/lib/{teacup/z_core_extensions/z_handlers.rb → teacup-osx/core_extensions/teacup_handlers.rb} +30 -47
  38. data/lib/teacup-osx/dummy.rb +80 -0
  39. data/lib/teacup-osx/handler.rb +16 -0
  40. data/lib/teacup-osx/style.rb +83 -0
  41. data/lib/teacup-osx/style_extensions/autoresize.rb +169 -0
  42. data/lib/teacup.rb +12 -11
  43. data/samples/Tweets/Gemfile +4 -0
  44. data/samples/Tweets/Gemfile.lock +16 -0
  45. data/samples/Tweets/README +7 -0
  46. data/samples/Tweets/Rakefile +9 -0
  47. data/samples/Tweets/app/app_delegate.rb +18 -0
  48. data/samples/Tweets/app/data_parser.rb +10 -0
  49. data/samples/Tweets/app/json_parser.rb +12 -0
  50. data/samples/Tweets/app/main_window.rb +99 -0
  51. data/samples/Tweets/app/menu.rb +108 -0
  52. data/samples/Tweets/app/stylesheet.rb +21 -0
  53. data/samples/Tweets/app/tweet.rb +11 -0
  54. data/samples/Tweets/resources/Credits.rtf +29 -0
  55. data/samples/Tweets/spec/main_spec.rb +9 -0
  56. data/samples/teacup-osx/.gitignore +1 -0
  57. data/samples/teacup-osx/Gemfile +4 -0
  58. data/samples/teacup-osx/Gemfile.lock +16 -0
  59. data/samples/teacup-osx/Rakefile +9 -0
  60. data/samples/teacup-osx/app/app_delegate.rb +23 -0
  61. data/samples/teacup-osx/app/controller.rb +11 -0
  62. data/samples/teacup-osx/app/menu.rb +108 -0
  63. data/samples/teacup-osx/app/window.rb +12 -0
  64. data/samples/teacup-osx/resources/Credits.rtf +29 -0
  65. data/samples/teacup-osx/resources/teacup.png +0 -0
  66. data/samples/teacup-osx/spec/main_spec.rb +9 -0
  67. data/spec/ios/appearance_spec.rb +18 -0
  68. data/spec/{calculations_spec.rb → ios/calculations_spec.rb} +0 -0
  69. data/spec/{constraints_spec.rb → ios/constraints_spec.rb} +0 -0
  70. data/spec/{custom_class_spec.rb → ios/custom_class_spec.rb} +0 -0
  71. data/spec/{gradient_spec.rb → ios/gradient_spec.rb} +1 -1
  72. data/spec/ios/layout_module_spec.rb +54 -0
  73. data/spec/ios/layout_spec.rb +50 -0
  74. data/spec/{main_spec.rb → ios/main_spec.rb} +52 -13
  75. data/spec/ios/motion_layout_spec.rb +44 -0
  76. data/spec/{present_modal_spec.rb → ios/present_modal_spec.rb} +0 -0
  77. data/spec/{style_spec.rb → ios/style_spec.rb} +1 -1
  78. data/spec/ios/stylesheet_extensions/autoresize_spec.rb +50 -0
  79. data/spec/{stylesheet_spec.rb → ios/stylesheet_spec.rb} +12 -0
  80. data/spec/{ui_view_getters_spec.rb → ios/ui_view_getters_spec.rb} +0 -0
  81. data/spec/{uiswitch_spec.rb → ios/uiswitch_spec.rb} +0 -0
  82. data/spec/{view_spec.rb → ios/view_spec.rb} +23 -2
  83. metadata +85 -35
  84. data/lib/teacup/stylesheet_extensions/autoresize.rb +0 -39
  85. data/lib/teacup/stylesheet_extensions/rotation.rb +0 -37
  86. data/lib/teacup/z_core_extensions/ui_view.rb +0 -262
  87. data/lib/teacup/z_core_extensions/ui_view_controller.rb +0 -263
  88. data/lib/teacup/z_core_extensions/ui_view_getters.rb +0 -58
@@ -1,5 +1,5 @@
1
1
  describe "Application 'Teacup'" do
2
- tests FirstController
2
+ tests MainController
3
3
 
4
4
  before do
5
5
  @root_view = window.subviews[0]
@@ -38,6 +38,7 @@ describe "Application 'Teacup'" do
38
38
  @background.frame.size.width.should == 300
39
39
  @background.frame.size.height.should == 440
40
40
  @background.backgroundColor.should == UIColor.darkGrayColor
41
+ @background.custom_attr.should == :custom_value
41
42
  end
42
43
 
43
44
  it "background view should have subviews" do
@@ -69,29 +70,37 @@ describe "Application 'Teacup'" do
69
70
  @welcome.text.should == "Welcome to teacup"
70
71
  end
71
72
 
72
- it "should be styled as :footer" do
73
- @footer.stylename.should == :footer
74
- @footer.frame.origin.x.should == 10
75
- @footer.frame.origin.y.should == 410
76
- @footer.frame.size.width.should == 280
77
- @footer.frame.size.height.should == 20
78
- @footer.text.should == "This is a teacup example"
73
+ it "should be assigned to .welcome" do
74
+ @welcome.should == controller.welcome
79
75
  end
80
76
 
81
77
  it "should be styled as :next_message" do
82
78
  @button.stylename.should == :next_message
83
79
  @button.frame.origin.x.should == 150
84
80
  @button.frame.origin.y.should == 370
85
- @button.frame.size.width.should == 130
81
+ @button.frame.size.width.should == 140
86
82
  @button.frame.size.height.should == 20
87
83
  @button.titleForState(UIControlStateNormal).should == "Next Message..."
88
84
  end
89
85
 
86
+ it "should be assigned to .button" do
87
+ @button.should == controller.button
88
+ end
89
+
90
+ it "should be styled as :footer" do
91
+ @footer.stylename.should == :footer
92
+ @footer.frame.origin.x.should == 10
93
+ @footer.frame.origin.y.should == 410
94
+ @footer.frame.size.width.should == 280
95
+ @footer.frame.size.height.should == 20
96
+ @footer.text.should == "This is a teacup example"
97
+ end
98
+
90
99
  end
91
100
 
92
101
 
93
102
  describe "background view in landscape" do
94
- tests FirstController
103
+ tests MainController
95
104
 
96
105
  before do
97
106
  @root_view = window.subviews[0]
@@ -148,16 +157,46 @@ describe "background view in landscape" do
148
157
  @button.stylename.should == :next_message
149
158
  @button.frame.origin.x.should == 20
150
159
  @button.frame.origin.y.should == 200
151
- @button.frame.size.width.should == 130
160
+ @button.frame.size.width.should == 140
152
161
  @button.frame.size.height.should == 20
153
162
  @button.titleForState(UIControlStateNormal).should == "Next Message..."
154
163
  end
155
164
 
156
165
  end
157
166
 
158
- describe "Stylesheet 'first'" do
167
+
168
+ describe "background view in landscape" do
169
+ tests MainController
170
+
171
+ before do
172
+ @root_view = window.subviews[0]
173
+ @background = @root_view.subviews[0]
174
+ @welcome = @background.subviews[0]
175
+ @footer = @background.subviews[1]
176
+ @button = @background.subviews[2]
177
+ rotate_device :to => :landscape
178
+ rotate_device :to => :portrait
179
+ end
180
+
181
+ it "should be in portrait" do
182
+ if UIApplication.sharedApplication.statusBarOrientation != UIInterfaceOrientationPortrait
183
+ NSLog("\n=====\n The device orientation is not changing to `portrait`!\n=====\n")
184
+ end
185
+ UIApplication.sharedApplication.statusBarOrientation.should == UIInterfaceOrientationPortrait
186
+ end
187
+
188
+ it "root view should be styled as :root, keeping landscape properties that weren't changed" do
189
+ @root_view.stylename.should == :root
190
+ @root_view.backgroundColor.should == UIColor.redColor
191
+ end
192
+
193
+ end
194
+
195
+
196
+ # this is the stylesheet used in MainController
197
+ describe "Stylesheet 'main'" do
159
198
  before do
160
- @stylesheet = Teacup::Stylesheet[:first]
199
+ @stylesheet = Teacup::Stylesheet[:main]
161
200
  end
162
201
 
163
202
  it "should exist" do
@@ -0,0 +1,44 @@
1
+ describe "MotionLayout" do
2
+ tests MotionLayoutController
3
+
4
+ describe 'applied constraints' do
5
+ it 'should have label1 on the left' do
6
+ label1_left = CGRectGetMinX(controller.label1.frame)
7
+ label1_left.should == 20
8
+ end
9
+
10
+ it 'should have label1 at the top' do
11
+ label1_top = CGRectGetMinY(controller.label1.frame)
12
+ label1_top.should == 100
13
+ end
14
+
15
+ it 'should have label2 at the top' do
16
+ label2_top = CGRectGetMinY(controller.label2.frame)
17
+ label2_top.should == 100
18
+ end
19
+
20
+ it 'should have margin between label1 and label2' do
21
+ label1_right = CGRectGetMaxX(controller.label1.frame)
22
+ label2_left = CGRectGetMinX(controller.label2.frame)
23
+ (label2_left - label1_right).should == 20
24
+ end
25
+
26
+ it 'should have label2 and label3 on the right' do
27
+ label2_right = CGRectGetMaxX(controller.label2.frame)
28
+ label3_right = CGRectGetMaxX(controller.label3.frame)
29
+ label3_right.should == label2_right
30
+ end
31
+
32
+ it 'should have label3 on the left' do
33
+ label3_left = CGRectGetMinX(controller.label3.frame)
34
+ label3_left.should == 20
35
+ end
36
+
37
+ it 'should have label3 at 220' do
38
+ label3_top = CGRectGetMinY(controller.label3.frame)
39
+ label3_top.should == 220
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -194,7 +194,7 @@ describe "Teacup::Style" do
194
194
  style3 = Teacup::Style.new
195
195
  style3.stylesheet = sheet
196
196
 
197
- built = style3.build(UIInterfaceOrientationPortrait)
197
+ built = style3.build(nil, UIInterfaceOrientationPortrait)
198
198
  built[:top].should == nil
199
199
  built[:left].should == nil
200
200
  built[:width].should == nil
@@ -0,0 +1,50 @@
1
+ describe "Stylesheet - Autoresize" do
2
+
3
+ it "should return the same object" do
4
+ stylesheet1 = Teacup::Stylesheet.new
5
+ stylesheet2 = Teacup::Stylesheet.new
6
+ stylesheet1.autoresize.should == stylesheet2.autoresize
7
+ end
8
+
9
+ it "should return autoresizeMask values" do
10
+ stylesheet = Teacup::Stylesheet.new
11
+
12
+ stylesheet.autoresize.flexible_left.should == UIViewAutoresizingFlexibleLeftMargin
13
+ stylesheet.autoresize.flexible_width.should == UIViewAutoresizingFlexibleWidth
14
+ stylesheet.autoresize.flexible_right.should == UIViewAutoresizingFlexibleRightMargin
15
+ stylesheet.autoresize.flexible_top.should == UIViewAutoresizingFlexibleTopMargin
16
+ stylesheet.autoresize.flexible_height.should == UIViewAutoresizingFlexibleHeight
17
+ stylesheet.autoresize.flexible_bottom.should == UIViewAutoresizingFlexibleBottomMargin
18
+ end
19
+
20
+ it "should return autoresizeMask values" do
21
+ stylesheet = Teacup::Stylesheet.new
22
+
23
+ stylesheet.autoresize.fill.should == UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
24
+ stylesheet.autoresize.fill_top.should == UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin
25
+ stylesheet.autoresize.fill_bottom.should == UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin
26
+ stylesheet.autoresize.fill_left.should == UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin
27
+ stylesheet.autoresize.fill_right.should == UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin
28
+
29
+ stylesheet.autoresize.fixed_top_left.should == UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin
30
+ stylesheet.autoresize.fixed_top_middle.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin
31
+ stylesheet.autoresize.fixed_top_right.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin
32
+ stylesheet.autoresize.fixed_middle_left.should == UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin
33
+ stylesheet.autoresize.fixed_middle.should == UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin
34
+ stylesheet.autoresize.fixed_middle_right.should == UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin
35
+ stylesheet.autoresize.fixed_bottom_left.should == UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin
36
+ stylesheet.autoresize.fixed_bottom_middle.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin
37
+ stylesheet.autoresize.fixed_bottom_right.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin
38
+
39
+ stylesheet.autoresize.float_horizontal.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin
40
+ stylesheet.autoresize.float_vertical.should == UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin
41
+ end
42
+
43
+ it "should combine values in a block" do
44
+ stylesheet = Teacup::Stylesheet.new
45
+
46
+ stylesheet.autoresize { flexible_left | flexible_width }.should == UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth
47
+ stylesheet.autoresize { flexible_width | flexible_height }.should == UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
48
+ end
49
+
50
+ end
@@ -122,6 +122,7 @@ describe "Teacup::Stylesheet" do
122
122
  import :importedbyname
123
123
 
124
124
  style :label,
125
+ text: @imported_text,
125
126
  backgroundColor: :blue,
126
127
  layer: {
127
128
  borderWidth: 2,
@@ -129,6 +130,8 @@ describe "Teacup::Stylesheet" do
129
130
  end
130
131
 
131
132
  Teacup::Stylesheet.new(:importedbyname) do
133
+ @imported_text = 'imported text'
134
+
132
135
  style :label,
133
136
  title: "Imported by name",
134
137
  layer: {
@@ -141,6 +144,7 @@ describe "Teacup::Stylesheet" do
141
144
  import :importedbyname
142
145
 
143
146
  style :label,
147
+ text: @imported_text,
144
148
  backgroundColor: :blue
145
149
  end
146
150
 
@@ -179,6 +183,14 @@ describe "Teacup::Stylesheet" do
179
183
  @oo_name_importer.query(:label)[:layer][:borderColor].should == :red
180
184
  end
181
185
 
186
+ it 'should import instance variables' do
187
+ @name_importer.query(:label)[:text].should == 'imported text'
188
+ end
189
+
190
+ it 'should import instance variables even if defined out of order' do
191
+ @oo_name_importer.query(:label)[:text].should == 'imported text'
192
+ end
193
+
182
194
  it 'should work with a value' do
183
195
  imported_anonymously = Teacup::Stylesheet.new do
184
196
  style :label,
File without changes
@@ -1,7 +1,19 @@
1
+ class CustomLabel < UILabel
2
+ attr :partyTime
3
+
4
+ def initWithFrame(frame)
5
+ super.tap do
6
+ @partyTime = :excellent
7
+ end
8
+ end
9
+
10
+ end
11
+
12
+
1
13
  describe "Teacup::View" do
2
14
 
3
15
  before do
4
- @view = UILabel.new
16
+ @view = CustomLabel.new
5
17
 
6
18
  @stylesheet = Teacup::Stylesheet.new do
7
19
  style :label,
@@ -24,6 +36,14 @@ describe "Teacup::View" do
24
36
  end
25
37
  end
26
38
 
39
+ describe 'apply_stylename=' do
40
+ it 'should set the style when a stylesheet is there' do
41
+ @view.stylesheet = @stylesheet
42
+ @view.apply_stylename(:label)
43
+ @view.text.should == "Stylesheet1 Label1"
44
+ end
45
+ end
46
+
27
47
  describe 'stylesheet=' do
28
48
  it 'should work' do
29
49
  @view.stylesheet = @stylesheet
@@ -95,7 +115,8 @@ describe "Teacup::View" do
95
115
  end
96
116
 
97
117
  it 'should warn about unknown thingies' do
98
- @view.style(partyTime: :excellent)
118
+ @view.style(partyTime: :bogus)
119
+ @view.partyTime.should == :excellent
99
120
  end
100
121
 
101
122
  end
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: 1.3.4
4
+ version: 2.0.0
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-05-06 00:00:00.000000000 Z
12
+ date: 2013-05-09 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
@@ -36,36 +36,52 @@ files:
36
36
  - README.md
37
37
  - Rakefile
38
38
  - app/app_delegate.rb
39
+ - app/controllers/appearance_controller.rb
39
40
  - app/controllers/constraints_controller.rb
40
- - app/controllers/first_controller.rb
41
41
  - app/controllers/gradient_controller.rb
42
42
  - app/controllers/landscape_only_controller.rb
43
+ - app/controllers/main_controller.rb
44
+ - app/controllers/motion_layout_controller.rb
43
45
  - app/controllers/present_modal_controller.rb
44
46
  - app/controllers/tableview_controller.rb
45
47
  - app/custom_class.rb
48
+ - app/styles/appearance.rb
46
49
  - app/styles/main_styles.rb
47
50
  - app/views/custom_view.rb
48
- - lib/dummy.rb
51
+ - lib/teacup-ios/appearance.rb
52
+ - lib/teacup-ios/core_extensions/teacup_handlers.rb
53
+ - lib/teacup-ios/core_extensions/ui_view.rb
54
+ - lib/teacup-ios/core_extensions/ui_view_controller.rb
55
+ - lib/teacup-ios/dummy.rb
56
+ - lib/teacup-ios/handler.rb
57
+ - lib/teacup-ios/style.rb
58
+ - lib/teacup-ios/stylesheet_extensions/autoresize.rb
59
+ - lib/teacup-ios/stylesheet_extensions/device.rb
60
+ - lib/teacup-osx/core_extensions/ns_view.rb
61
+ - lib/teacup-osx/core_extensions/ns_view_controller.rb
62
+ - lib/teacup-osx/core_extensions/ns_window.rb
63
+ - lib/teacup-osx/core_extensions/ns_window_controller.rb
64
+ - lib/teacup-osx/core_extensions/teacup_handlers.rb
65
+ - lib/teacup-osx/dummy.rb
66
+ - lib/teacup-osx/handler.rb
67
+ - lib/teacup-osx/style.rb
68
+ - lib/teacup-osx/style_extensions/autoresize.rb
49
69
  - lib/teacup.rb
50
70
  - lib/teacup/calculations.rb
51
71
  - lib/teacup/constraint.rb
72
+ - lib/teacup/core_extensions/ca_layer.rb
73
+ - lib/teacup/core_extensions/view_getters.rb
52
74
  - lib/teacup/handler.rb
53
75
  - lib/teacup/layout.rb
54
76
  - lib/teacup/merge_defaults.rb
55
77
  - lib/teacup/restyle.rb
56
- - lib/teacup/style.rb
57
78
  - lib/teacup/stylesheet.rb
58
- - lib/teacup/stylesheet_extensions/autoresize.rb
59
79
  - lib/teacup/stylesheet_extensions/constraints.rb
60
- - lib/teacup/stylesheet_extensions/geometry.rb
61
- - lib/teacup/stylesheet_extensions/rotation.rb
80
+ - lib/teacup/stylesheet_extensions/transform.rb
81
+ - lib/teacup/teacup_controller.rb
62
82
  - lib/teacup/teacup_util.rb
83
+ - lib/teacup/teacup_view.rb
63
84
  - lib/teacup/version.rb
64
- - lib/teacup/z_core_extensions/ca_layer.rb
65
- - lib/teacup/z_core_extensions/ui_view.rb
66
- - lib/teacup/z_core_extensions/ui_view_controller.rb
67
- - lib/teacup/z_core_extensions/ui_view_getters.rb
68
- - lib/teacup/z_core_extensions/z_handlers.rb
69
85
  - resources/Default-568h@2x.png
70
86
  - samples/AutoLayout/Gemfile
71
87
  - samples/AutoLayout/Gemfile.lock
@@ -91,17 +107,46 @@ files:
91
107
  - samples/OnePage/resources/Default-568h@2x.png
92
108
  - samples/OnePage/spec/main_spec.rb
93
109
  - samples/README.md
94
- - spec/calculations_spec.rb
95
- - spec/constraints_spec.rb
96
- - spec/custom_class_spec.rb
97
- - spec/gradient_spec.rb
98
- - spec/main_spec.rb
99
- - spec/present_modal_spec.rb
100
- - spec/style_spec.rb
101
- - spec/stylesheet_spec.rb
102
- - spec/ui_view_getters_spec.rb
103
- - spec/uiswitch_spec.rb
104
- - spec/view_spec.rb
110
+ - samples/Tweets/Gemfile
111
+ - samples/Tweets/Gemfile.lock
112
+ - samples/Tweets/README
113
+ - samples/Tweets/Rakefile
114
+ - samples/Tweets/app/app_delegate.rb
115
+ - samples/Tweets/app/data_parser.rb
116
+ - samples/Tweets/app/json_parser.rb
117
+ - samples/Tweets/app/main_window.rb
118
+ - samples/Tweets/app/menu.rb
119
+ - samples/Tweets/app/stylesheet.rb
120
+ - samples/Tweets/app/tweet.rb
121
+ - samples/Tweets/resources/Credits.rtf
122
+ - samples/Tweets/spec/main_spec.rb
123
+ - samples/teacup-osx/.gitignore
124
+ - samples/teacup-osx/Gemfile
125
+ - samples/teacup-osx/Gemfile.lock
126
+ - samples/teacup-osx/Rakefile
127
+ - samples/teacup-osx/app/app_delegate.rb
128
+ - samples/teacup-osx/app/controller.rb
129
+ - samples/teacup-osx/app/menu.rb
130
+ - samples/teacup-osx/app/window.rb
131
+ - samples/teacup-osx/resources/Credits.rtf
132
+ - samples/teacup-osx/resources/teacup.png
133
+ - samples/teacup-osx/spec/main_spec.rb
134
+ - spec/ios/appearance_spec.rb
135
+ - spec/ios/calculations_spec.rb
136
+ - spec/ios/constraints_spec.rb
137
+ - spec/ios/custom_class_spec.rb
138
+ - spec/ios/gradient_spec.rb
139
+ - spec/ios/layout_module_spec.rb
140
+ - spec/ios/layout_spec.rb
141
+ - spec/ios/main_spec.rb
142
+ - spec/ios/motion_layout_spec.rb
143
+ - spec/ios/present_modal_spec.rb
144
+ - spec/ios/style_spec.rb
145
+ - spec/ios/stylesheet_extensions/autoresize_spec.rb
146
+ - spec/ios/stylesheet_spec.rb
147
+ - spec/ios/ui_view_getters_spec.rb
148
+ - spec/ios/uiswitch_spec.rb
149
+ - spec/ios/view_spec.rb
105
150
  - teacup.gemspec
106
151
  homepage: https://github.com/rubymotion/teacup
107
152
  licenses: []
@@ -128,14 +173,19 @@ signing_key:
128
173
  specification_version: 3
129
174
  summary: A community-driven DSL for creating user interfaces on iOS.
130
175
  test_files:
131
- - spec/calculations_spec.rb
132
- - spec/constraints_spec.rb
133
- - spec/custom_class_spec.rb
134
- - spec/gradient_spec.rb
135
- - spec/main_spec.rb
136
- - spec/present_modal_spec.rb
137
- - spec/style_spec.rb
138
- - spec/stylesheet_spec.rb
139
- - spec/ui_view_getters_spec.rb
140
- - spec/uiswitch_spec.rb
141
- - spec/view_spec.rb
176
+ - spec/ios/appearance_spec.rb
177
+ - spec/ios/calculations_spec.rb
178
+ - spec/ios/constraints_spec.rb
179
+ - spec/ios/custom_class_spec.rb
180
+ - spec/ios/gradient_spec.rb
181
+ - spec/ios/layout_module_spec.rb
182
+ - spec/ios/layout_spec.rb
183
+ - spec/ios/main_spec.rb
184
+ - spec/ios/motion_layout_spec.rb
185
+ - spec/ios/present_modal_spec.rb
186
+ - spec/ios/style_spec.rb
187
+ - spec/ios/stylesheet_extensions/autoresize_spec.rb
188
+ - spec/ios/stylesheet_spec.rb
189
+ - spec/ios/ui_view_getters_spec.rb
190
+ - spec/ios/uiswitch_spec.rb
191
+ - spec/ios/view_spec.rb
@@ -1,39 +0,0 @@
1
- # Example:
2
- # Teacup::Stylesheet.new :main do
3
- # style :root,
4
- # # stays centered and grows in height
5
- # autoresizingMask: flexible_left|flexible_right|flexible_height
6
- # end
7
- module Teacup
8
- class Stylesheet
9
-
10
- def none
11
- UIViewAutoresizingNone
12
- end
13
-
14
- def flexible_left
15
- UIViewAutoresizingFlexibleLeftMargin
16
- end
17
-
18
- def flexible_width
19
- UIViewAutoresizingFlexibleWidth
20
- end
21
-
22
- def flexible_right
23
- UIViewAutoresizingFlexibleRightMargin
24
- end
25
-
26
- def flexible_top
27
- UIViewAutoresizingFlexibleTopMargin
28
- end
29
-
30
- def flexible_height
31
- UIViewAutoresizingFlexibleHeight
32
- end
33
-
34
- def flexible_bottom
35
- UIViewAutoresizingFlexibleBottomMargin
36
- end
37
-
38
- end
39
- end
@@ -1,37 +0,0 @@
1
-
2
- module Teacup
3
- class Stylesheet
4
-
5
- def identity
6
- [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
7
- end
8
-
9
- def pi
10
- 3.1415926
11
- end
12
-
13
- # rotates the "up & down" direction. The bottom of the view will rotate
14
- # towards the user as angle increases.
15
- def flip matrix, angle
16
- CATransform3DRotate(matrix, angle, 1, 0, 0)
17
- end
18
-
19
- # rotates the "left & right" direction. The right side of the view will
20
- # rotate towards the user as angle increases.
21
- def twist matrix, angle
22
- CATransform3DRotate(matrix, angle, 0, 1, 0)
23
- end
24
-
25
- # spins, along the z axis. This is probably the one you want, for
26
- # "spinning" a view like you might a drink coaster or paper napkin.
27
- def spin matrix, angle
28
- CATransform3DRotate(matrix, angle, 0, 0, 1)
29
- end
30
-
31
- # rotates the layer arbitrarily
32
- def rotate matrix, angle, x, y, z
33
- CATransform3DRotate(matrix, angle, x, y, z)
34
- end
35
-
36
- end
37
- end