ib 0.4.2 → 0.4.3
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/lib/ib/generator/rendering_helper.rb +18 -0
- data/lib/ib/generator/templates/Stubs.h.erb +2 -8
- data/lib/ib/oc_interface.rb +2 -0
- data/lib/ib/version.rb +1 -1
- data/spec/fixtures/{dependency_test → for_promotion}/promotion_class.rb +0 -0
- data/spec/lib/ib/generator_spec.rb +41 -17
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e997666e49289ad97accdb6f4d31ef242b218e0f
|
4
|
+
data.tar.gz: 165ff843dae466cfb48a70f34285ef2c99e5de2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e297f161676af5797387959c4a2e38d888935fce801df5521bc04927434c259733621a534cbe57f8d9a531f11545642dd22e974904ac08af0013a9c48fb8bb0
|
7
|
+
data.tar.gz: 915d382d1e7fcd9208c3e4477f63312306d179e8ab7437e75fb0676a4980550c3a185df7204fb714f14e3f30485b660645c352b6dca432979af34e46a1b5ee93
|
data/.travis.yml
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
# cite from https://github.com/CocoaPods/Xcodeproj/blob/master/.travis.yml
|
2
2
|
language: objective-c
|
3
|
-
|
4
|
-
- RVM_RUBY_VERSION=ruby-1.9.3-p392 NOEXEC_DISABLE=1 CI=true RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem
|
5
|
-
before_install: source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
|
6
|
-
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
|
3
|
+
install: rake bootstrap[use_bundle_dir]
|
7
4
|
script: bundle exec rake spec
|
@@ -19,6 +19,24 @@ module IB
|
|
19
19
|
@build_platform == :osx
|
20
20
|
end
|
21
21
|
|
22
|
+
def framework_headers
|
23
|
+
headers = ''
|
24
|
+
if defined?(Motion::Project::App.config.frameworks)
|
25
|
+
Motion::Project::App.config.frameworks.each do |framework|
|
26
|
+
headers << "\#import <#{framework}/#{framework}.h>\n"
|
27
|
+
end
|
28
|
+
else
|
29
|
+
headers << "#import <Foundation/Foundation.h>\n"
|
30
|
+
headers << "#import <CoreData/CoreData.h>\n"
|
31
|
+
if ios_project?
|
32
|
+
headers << "#import <UIKit/UIKit.h>\n"
|
33
|
+
elsif osx_project?
|
34
|
+
headers << "#import <Cocoa/Cocoa.h>\n"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
headers
|
38
|
+
end
|
39
|
+
|
22
40
|
end
|
23
41
|
end
|
24
42
|
end
|
@@ -1,17 +1,11 @@
|
|
1
1
|
// Generated by IB v<%= ib_version %> gem. Do not edit it manually
|
2
2
|
// Run `rake ib:open` to refresh
|
3
3
|
|
4
|
-
|
5
|
-
#import <CoreData/CoreData.h>
|
6
|
-
<% if ios_project? %>
|
7
|
-
#import <UIKit/UIKit.h>
|
8
|
-
<% elsif osx_project? %>
|
9
|
-
#import <Cocoa/Cocoa.h>
|
10
|
-
<% end %>
|
4
|
+
<%= framework_headers %>
|
11
5
|
|
12
6
|
<% @files.each do |path, interfaces| %>
|
13
7
|
<% interfaces.each do |interface| %>
|
14
|
-
@interface <%= interface.sub_class + ": " +
|
8
|
+
@interface <%= interface.sub_class + ": " + interface.super_class %>
|
15
9
|
<% unless interface.outlets.empty? %><%= "\n"%><% end %>
|
16
10
|
<% interface.outlets.each do |outlet| %>
|
17
11
|
@property IBOutlet <%= outlet.formated_type %> <%= outlet.variable %>;
|
data/lib/ib/oc_interface.rb
CHANGED
@@ -31,6 +31,8 @@ class IB::OCInterface
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def super_class
|
34
|
+
# for support `ProMotion` gem https://github.com/yury/ib/pull/45
|
35
|
+
return 'UIViewController' if @super_class =~ /^(?:PM::|ProMotion::)/
|
34
36
|
@super_class ||
|
35
37
|
((@sub_class == 'AppDelegate') ? 'UIResponder <UIApplicationDelegate>' : 'NSObject')
|
36
38
|
end
|
data/lib/ib/version.rb
CHANGED
File without changes
|
@@ -3,11 +3,12 @@ require "spec_helper"
|
|
3
3
|
require "ib/generator"
|
4
4
|
|
5
5
|
describe IB::Generator do
|
6
|
-
|
6
|
+
describe "generates stubs header with ios platform" do
|
7
7
|
files = IB::Parser.new.find_all("spec/fixtures/common")
|
8
8
|
stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.h.erb', files)
|
9
9
|
|
10
|
-
|
10
|
+
it 'should output valid values from IB::Generator::RenderingHelpers and template file' do
|
11
|
+
stubs.should == <<-OBJC
|
11
12
|
// Generated by IB v#{IB::VERSION} gem. Do not edit it manually
|
12
13
|
// Run `rake ib:open` to refresh
|
13
14
|
|
@@ -60,13 +61,15 @@ describe IB::Generator do
|
|
60
61
|
@end
|
61
62
|
|
62
63
|
OBJC
|
64
|
+
end
|
63
65
|
end
|
64
66
|
|
65
|
-
|
67
|
+
describe "generates stubs header with osx platform" do
|
66
68
|
files = IB::Parser.new.find_all("spec/fixtures/common")
|
67
69
|
stubs = IB::Generator.new(:osx).render_stub_file('generator/templates/Stubs.h.erb', files)
|
68
70
|
|
69
|
-
|
71
|
+
it 'should output valid values from IB::Generator::RenderingHelpers and template file' do
|
72
|
+
stubs.should == <<-OBJC
|
70
73
|
// Generated by IB v#{IB::VERSION} gem. Do not edit it manually
|
71
74
|
// Run `rake ib:open` to refresh
|
72
75
|
|
@@ -119,14 +122,15 @@ OBJC
|
|
119
122
|
@end
|
120
123
|
|
121
124
|
OBJC
|
125
|
+
end
|
122
126
|
end
|
123
127
|
|
124
|
-
|
128
|
+
describe "generates stubs implement" do
|
125
129
|
files = IB::Parser.new.find_all("spec/fixtures/common")
|
126
|
-
|
127
130
|
stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.m.erb', files)
|
128
131
|
|
129
|
-
|
132
|
+
it 'should output valid values from IB::Generator::RenderingHelpers and template file' do
|
133
|
+
stubs.should == <<-OBJC
|
130
134
|
// Generated by IB v#{IB::VERSION} gem. Do not edit it manually
|
131
135
|
// Run `rake ib:open` to refresh
|
132
136
|
|
@@ -154,13 +158,15 @@ OBJC
|
|
154
158
|
@end
|
155
159
|
|
156
160
|
OBJC
|
161
|
+
end
|
157
162
|
end
|
158
163
|
|
159
|
-
|
160
|
-
|
161
|
-
|
164
|
+
describe "generates stubs header with ios platform of dependency_test fixtures" do
|
165
|
+
it 'should output definitions which sorterd by its own dependencies' do
|
166
|
+
files = IB::Parser.new.find_all("spec/fixtures/dependency_test")
|
167
|
+
stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.h.erb', files)
|
162
168
|
|
163
|
-
|
169
|
+
stubs.should == <<-OBJC
|
164
170
|
// Generated by IB v#{IB::VERSION} gem. Do not edit it manually
|
165
171
|
// Run `rake ib:open` to refresh
|
166
172
|
|
@@ -177,12 +183,6 @@ OBJC
|
|
177
183
|
@interface AppDelegate: UIResponder <UIApplicationDelegate>
|
178
184
|
@end
|
179
185
|
|
180
|
-
@interface PromotionScreen: UIViewController
|
181
|
-
@end
|
182
|
-
|
183
|
-
@interface PromotionMapScreen: UIViewController
|
184
|
-
@end
|
185
|
-
|
186
186
|
@interface SuperClass: UIViewController
|
187
187
|
@end
|
188
188
|
|
@@ -207,6 +207,30 @@ OBJC
|
|
207
207
|
@end
|
208
208
|
|
209
209
|
OBJC
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "generates stubs header with ios platform of ProMotion's fixtures" do
|
214
|
+
it 'should replace super_class from PM::* or ProMotion::* to UIViewController' do
|
215
|
+
files = IB::Parser.new.find_all("spec/fixtures/for_promotion")
|
216
|
+
stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.h.erb', files)
|
217
|
+
|
218
|
+
stubs.should == <<-OBJC
|
219
|
+
// Generated by IB v#{IB::VERSION} gem. Do not edit it manually
|
220
|
+
// Run `rake ib:open` to refresh
|
221
|
+
|
222
|
+
#import <Foundation/Foundation.h>
|
223
|
+
#import <CoreData/CoreData.h>
|
224
|
+
#import <UIKit/UIKit.h>
|
225
|
+
|
226
|
+
@interface PromotionScreen: UIViewController
|
227
|
+
@end
|
228
|
+
|
229
|
+
@interface PromotionMapScreen: UIViewController
|
230
|
+
@end
|
231
|
+
|
232
|
+
OBJC
|
233
|
+
end
|
210
234
|
end
|
211
235
|
|
212
236
|
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.
|
4
|
+
version: 0.4.3
|
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-
|
12
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xcodeproj
|
@@ -119,12 +119,12 @@ files:
|
|
119
119
|
- spec/fixtures/dependency_test/add_button.rb
|
120
120
|
- spec/fixtures/dependency_test/app_delegate.rb
|
121
121
|
- spec/fixtures/dependency_test/base_view.rb
|
122
|
-
- spec/fixtures/dependency_test/promotion_class.rb
|
123
122
|
- spec/fixtures/dependency_test/sub_class_1.rb
|
124
123
|
- spec/fixtures/dependency_test/sub_class_2.rb
|
125
124
|
- spec/fixtures/dependency_test/sub_view_1.rb
|
126
125
|
- spec/fixtures/dependency_test/super_class.rb
|
127
126
|
- spec/fixtures/dependency_test/ui_my_web_view.rb
|
127
|
+
- spec/fixtures/for_promotion/promotion_class.rb
|
128
128
|
- spec/lib/ib/dependency_resolver_spec.rb
|
129
129
|
- spec/lib/ib/generator_spec.rb
|
130
130
|
- spec/lib/ib/oc_interface_spec.rb
|
@@ -166,12 +166,12 @@ test_files:
|
|
166
166
|
- spec/fixtures/dependency_test/add_button.rb
|
167
167
|
- spec/fixtures/dependency_test/app_delegate.rb
|
168
168
|
- spec/fixtures/dependency_test/base_view.rb
|
169
|
-
- spec/fixtures/dependency_test/promotion_class.rb
|
170
169
|
- spec/fixtures/dependency_test/sub_class_1.rb
|
171
170
|
- spec/fixtures/dependency_test/sub_class_2.rb
|
172
171
|
- spec/fixtures/dependency_test/sub_view_1.rb
|
173
172
|
- spec/fixtures/dependency_test/super_class.rb
|
174
173
|
- spec/fixtures/dependency_test/ui_my_web_view.rb
|
174
|
+
- spec/fixtures/for_promotion/promotion_class.rb
|
175
175
|
- spec/lib/ib/dependency_resolver_spec.rb
|
176
176
|
- spec/lib/ib/generator_spec.rb
|
177
177
|
- spec/lib/ib/oc_interface_spec.rb
|