ib 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b752f7f0c21e08af52130f46871d317f331eddf
4
- data.tar.gz: 852fbda61f72e63f5c149cf0781c882db013099c
3
+ metadata.gz: e02f312f8c0a9d30a2ddf6c53d3a9a05e51c68fc
4
+ data.tar.gz: 25824ab39b5b19c3ff47aa127d69d51fb132fae2
5
5
  SHA512:
6
- metadata.gz: 3ec9c8ebd0f1f41db37f27da4cc3c97d697d01dc4f03415a7ad6df4d4b20aa7dcfa5d73dcff46628027b0d17cf00ef57c4af6c349f798bb61f198c5262e1bf61
7
- data.tar.gz: 3d74f7834a96440c976d20e26bc7bb4d1655e8f824e9c8fd20fa1158981eb77b9cad6f801b5a6567f9cbf807467b897c032b79513125c5df705b4c8cec3f2ab7
6
+ metadata.gz: ca67898ee5dc3f76aa79b04c9e5a749a9cc63f9e3a785adc493b8f612310deae2ede172c3db74ca70f3ee361f65e03394f9a0fc64918791d336e531d219bf5b4
7
+ data.tar.gz: da6dc3102a28ee95a8d5f4c338a00d8ce260cd2f9ed154bbb417867cd1e05b5ad1ebef5a3b90b0eb55f06c58dae4782dd34839d4427960bc40facc7b8ec834de
@@ -11,7 +11,7 @@
11
11
 
12
12
  <% @files.each do |path, interfaces| %>
13
13
  <% interfaces.each do |interface| %>
14
- @interface <%= interface.sub_class + ": " + interface.super_class %>
14
+ @interface <%= interface.sub_class + ": " + (interface.super_class.start_with?("PM::", "ProMotion::") ? "UIViewController" : interface.super_class) %>
15
15
  <% unless interface.outlets.empty? %><%= "\n"%><% end %>
16
16
  <% interface.outlets.each do |outlet| %>
17
17
  @property IBOutlet <%= outlet.formated_type %> <%= outlet.variable %>;
data/lib/ib/parser.rb CHANGED
@@ -3,7 +3,8 @@ require 'ib/oc_interface'
3
3
 
4
4
  class IB::Parser
5
5
  NAME_REGEX = /[a-zA-Z][_a-zA-Z0-9]*/
6
- CLASS_REGEX = /^[ \t]*class[ \t]+(#{NAME_REGEX})([ \t]*<[ \t]*(#{NAME_REGEX}))?/
6
+ SUPERCLASS_REGEX = /(#{NAME_REGEX}):{0,2}(#{NAME_REGEX})/
7
+ CLASS_REGEX = /^[ \t]*class[ \t]+(#{NAME_REGEX})([ \t]*<[ \t]*(#{SUPERCLASS_REGEX}))?/
7
8
  OUTLET_REGEX = /^[ \t]+(ib_)?outlet(_accessor)?[ \t]+:(#{NAME_REGEX})[ \t]*?(,[ \t]*['"]?(#{NAME_REGEX}))?/
8
9
  OUTLET_COLLECTION_REGEX = /^[ \t]+(ib_)?outlet_collection(_accessor)?[ \t]+:(#{NAME_REGEX})[ \t]*?(,[ \t]*['"]?(#{NAME_REGEX}))?/
9
10
  METHOD_ARGUMENT_REGEX = /(#{NAME_REGEX})(?:[ \t]*=[^,#)]*)?/
data/lib/ib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IB
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -0,0 +1,5 @@
1
+ class HasComplexSuperClass < Complex::SuperClass
2
+ end
3
+
4
+ class HasLessComplexSuperClass < PM::Screen
5
+ end
@@ -0,0 +1,5 @@
1
+ class PromotionScreen < PM::Screen
2
+ end
3
+
4
+ class PromotionMapScreen < PM::MapScreen
5
+ end
@@ -22,6 +22,12 @@ describe IB::Generator do
22
22
 
23
23
  @end
24
24
 
25
+ @interface HasComplexSuperClass: Complex::SuperClass
26
+ @end
27
+
28
+ @interface HasLessComplexSuperClass: UIViewController
29
+ @end
30
+
25
31
  @interface CustomView: UIView
26
32
 
27
33
  @property IBOutlet UIGreenLabel * greenLabel;
@@ -75,6 +81,12 @@ OBJC
75
81
 
76
82
  @end
77
83
 
84
+ @interface HasComplexSuperClass: Complex::SuperClass
85
+ @end
86
+
87
+ @interface HasLessComplexSuperClass: UIViewController
88
+ @end
89
+
78
90
  @interface CustomView: UIView
79
91
 
80
92
  @property IBOutlet UIGreenLabel * greenLabel;
@@ -123,6 +135,12 @@ OBJC
123
135
  @implementation AppDelegate
124
136
  @end
125
137
 
138
+ @implementation HasComplexSuperClass
139
+ @end
140
+
141
+ @implementation HasLessComplexSuperClass
142
+ @end
143
+
126
144
  @implementation CustomView
127
145
  @end
128
146
 
@@ -159,6 +177,12 @@ OBJC
159
177
  @interface AppDelegate: UIResponder <UIApplicationDelegate>
160
178
  @end
161
179
 
180
+ @interface PromotionScreen: UIViewController
181
+ @end
182
+
183
+ @interface PromotionMapScreen: UIViewController
184
+ @end
185
+
162
186
  @interface SuperClass: UIViewController
163
187
  @end
164
188
 
@@ -29,13 +29,19 @@ describe IB::Parser do
29
29
  ]
30
30
  end
31
31
 
32
+ it "can parse complex superclasses" do
33
+ info = IB::Parser.new.find("spec/fixtures/common/complex_superclass.rb")
34
+ info.first[:class].should == [["HasComplexSuperClass", "Complex::SuperClass"]]
35
+ info.last[:class].should == [["HasLessComplexSuperClass", "PM::Screen"]]
36
+ end
37
+
32
38
  it "can output simple classes" do
33
39
  IB::Parser.new.find("spec/fixtures/common/simple_class.rb").length.should == 1
34
40
  end
35
41
 
36
42
  it "finds all infos" do
37
43
  infos = IB::Parser.new.find_all("spec/fixtures/dependency_test")
38
- infos.values.each do |vals|
44
+ infos.values.each do |vals|
39
45
  vals.each do |v|
40
46
  expect(v).to be_kind_of(IB::OCInterface)
41
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-13 00:00:00.000000000 Z
12
+ date: 2013-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcodeproj
@@ -112,12 +112,14 @@ files:
112
112
  - lib/ib/tasks.rb
113
113
  - lib/ib/version.rb
114
114
  - spec/fixtures/common/app_delegate.rb
115
+ - spec/fixtures/common/complex_superclass.rb
115
116
  - spec/fixtures/common/custom_view.rb
116
117
  - spec/fixtures/common/empty_view.rb
117
118
  - spec/fixtures/common/simple_class.rb
118
119
  - spec/fixtures/dependency_test/add_button.rb
119
120
  - spec/fixtures/dependency_test/app_delegate.rb
120
121
  - spec/fixtures/dependency_test/base_view.rb
122
+ - spec/fixtures/dependency_test/promotion_class.rb
121
123
  - spec/fixtures/dependency_test/sub_class_1.rb
122
124
  - spec/fixtures/dependency_test/sub_class_2.rb
123
125
  - spec/fixtures/dependency_test/sub_view_1.rb
@@ -157,12 +159,14 @@ specification_version: 4
157
159
  summary: Small portion of love to interface builder with rubymotion
158
160
  test_files:
159
161
  - spec/fixtures/common/app_delegate.rb
162
+ - spec/fixtures/common/complex_superclass.rb
160
163
  - spec/fixtures/common/custom_view.rb
161
164
  - spec/fixtures/common/empty_view.rb
162
165
  - spec/fixtures/common/simple_class.rb
163
166
  - spec/fixtures/dependency_test/add_button.rb
164
167
  - spec/fixtures/dependency_test/app_delegate.rb
165
168
  - spec/fixtures/dependency_test/base_view.rb
169
+ - spec/fixtures/dependency_test/promotion_class.rb
166
170
  - spec/fixtures/dependency_test/sub_class_1.rb
167
171
  - spec/fixtures/dependency_test/sub_class_2.rb
168
172
  - spec/fixtures/dependency_test/sub_view_1.rb