ib 0.4.0 → 0.4.1

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: 1eea4e011091e08436b55716cc61bb6f9bb6fa1b
4
- data.tar.gz: 5295da9a7c934346ec69f3af30cfcab2fd81b70c
3
+ metadata.gz: 7b752f7f0c21e08af52130f46871d317f331eddf
4
+ data.tar.gz: 852fbda61f72e63f5c149cf0781c882db013099c
5
5
  SHA512:
6
- metadata.gz: a1c760308f730307b0be44476244016190da663eacac8d5811cb64e351b7dc1ced20cfd85f86c3c2de7a54972548072eff7726cab9d0defe67b5bca5359cfbf6
7
- data.tar.gz: 74d07a792b9a2ae8d3ea8a4e672604598048206c64e28112173e81c89fc2923c37ac63cc040dd1060a8be44212c70e63bfb54d223eb04970a1fb870868883841
6
+ metadata.gz: 3ec9c8ebd0f1f41db37f27da4cc3c97d697d01dc4f03415a7ad6df4d4b20aa7dcfa5d73dcff46628027b0d17cf00ef57c4af6c349f798bb61f198c5262e1bf61
7
+ data.tar.gz: 3d74f7834a96440c976d20e26bc7bb4d1655e8f824e9c8fd20fa1158981eb77b9cad6f801b5a6567f9cbf807467b897c032b79513125c5df705b4c8cec3f2ab7
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  RubyMotion interface builder support (yes, with outlets)
4
4
 
5
5
  <a href='http://spellhub.com/projects/project/7'><img src="http://spellhub.com/projects/status/7" height="18"></a>
6
- [![Build Status](https://travis-ci.org/yury/ib.png)](https://travis-ci.org/yury/ib)
6
+ [![Build Status](https://travis-ci.org/yury/ib.png?branch=master)](https://travis-ci.org/yury/ib)
7
7
 
8
8
  [**Change Log**](https://github.com/yury/ib/wiki/Change-Log)
9
9
 
@@ -13,24 +13,56 @@ module IB
13
13
  end
14
14
  end
15
15
 
16
- attr_reader :class_nodes, :files
16
+ module TSortable
17
+ def to_node
18
+ sub_class_dependencies_nodes = sub_class_dependencies.inject({}) do |sum, i|
19
+ sum.merge!({ i => [] })
20
+ end
21
+
22
+ (super_class ? node_with_super_class : node_without_super_class).
23
+ merge(sub_class_dependencies_nodes)
24
+ end
25
+
26
+ def node_with_super_class
27
+ {
28
+ sub_class => sub_class_dependencies,
29
+ super_class => [],
30
+ }
31
+ end
32
+
33
+ def node_without_super_class
34
+ { sub_class => sub_class_dependencies }
35
+ end
36
+
37
+ def merge!(a, b)
38
+ b.each do |k, v|
39
+ if a.key?(k)
40
+ a[k].concat(v)
41
+ else
42
+ a[k] = v
43
+ end
44
+ end
45
+ a
46
+ end
47
+ module_function :merge!
48
+ end
49
+
50
+ attr_reader :dependency_graph, :files
17
51
 
18
52
  def initialize(files)
19
53
  @files = files
20
- @class_nodes = struct_class_node
54
+ @dependency_graph = struct_class_dependency_graph
21
55
  end
22
56
 
23
57
  def sort_classes
24
- @class_nodes.tsort
58
+ @dependency_graph.tsort
25
59
  end
26
60
 
27
61
  def sort_files
28
62
  sort_classes.map do |klass|
29
- files.select do |file, class_definitions|
30
- has_class_in_file?(klass, class_definitions)
31
- end.first
32
- end.map do |file, _|
33
- file
63
+ files.select do |file, interfaces|
64
+ interfaces.any? {|i| i.has_sub_class?(klass) }
65
+ end.keys[0]
34
66
  end.uniq.compact
35
67
  end
36
68
 
@@ -43,41 +75,11 @@ module IB
43
75
  end
44
76
 
45
77
  private
46
- def has_class_in_file?(klass, class_definitions)
47
- !class_definitions.select do |x|
48
- x[:class][0][0] == klass
49
- end.empty?
50
- end
51
-
52
- def has_super_class?(class_definition)
53
- class_definition[:class][0].size == 2
54
- end
55
-
56
- def struct_class_node
57
- list_of_hash = @files.map do |file, class_definitions|
58
- class_definitions.map do |class_definition| create_node(class_definition) end
59
- end.flatten
60
-
61
- list_of_hash.inject(TSortHash.new) do |sum, x|
62
- sum.merge!(x)
78
+ def struct_class_dependency_graph
79
+ nodes = @files.values.flatten.map {|i| i.extend TSortable }.map(&:to_node)
80
+ nodes.inject(TSortHash.new) do |sum, x|
81
+ TSortable.merge!(sum, x)
63
82
  end
64
83
  end
65
-
66
- def create_node(class_definition)
67
- has_super_class?(class_definition) ?
68
- node_with_super_class(class_definition):
69
- node_without_super_class(class_definition)
70
- end
71
-
72
- def node_with_super_class(class_definition)
73
- {
74
- class_definition[:class][0][0] => [class_definition[:class][0][1]],
75
- class_definition[:class][0][1] => [],
76
- }
77
- end
78
-
79
- def node_without_super_class(class_definition)
80
- { class_definition[:class][0][0] => [] }
81
- end
82
84
  end
83
85
  end
@@ -6,7 +6,7 @@ class IB::Generator
6
6
  def initialize motion_template_type
7
7
  # NOTE: motion_template_type equal to Motion::Project::App.template
8
8
  # but, this class use its value for judging build platform.
9
- @build_platform = motion_template_type
9
+ @build_platform = motion_template_type
10
10
  end
11
11
 
12
12
  def absolute_template_path path
@@ -20,7 +20,7 @@ class IB::Generator
20
20
 
21
21
  def write files, dest
22
22
  files = IB::Parser.new.find_all(files)
23
-
23
+
24
24
  FileUtils.mkpath dest
25
25
 
26
26
  File.open("#{dest}/Stubs.h", 'w') do |f|
@@ -19,14 +19,6 @@ module IB
19
19
  @build_platform == :osx
20
20
  end
21
21
 
22
- def generate_type type
23
- type == "id" ? type : "#{type} *"
24
- end
25
-
26
- def generate_action action
27
- action[1] ? "#{action[0]}:(#{action[2] ? "#{action[2]}*" : 'id'}) #{action[1]}" : "#{action[0]}"
28
- end
29
-
30
22
  end
31
23
  end
32
24
  end
@@ -9,22 +9,22 @@
9
9
  #import <Cocoa/Cocoa.h>
10
10
  <% end %>
11
11
 
12
- <% @files.map do |path, infos| %>
13
- <% infos.each do |info| %>
14
- @interface <%= info[:class][0][0] + (info[:class][0][1] ? ": #{info[:class][0][1]}" : "")%>
15
- <% unless info[:outlets].empty? %><%= "\n"%><% end %>
16
- <% info[:outlets].map do |name, type| %>
17
- @property IBOutlet <%= generate_type(type)%> <%= name %>;
12
+ <% @files.each do |path, interfaces| %>
13
+ <% interfaces.each do |interface| %>
14
+ @interface <%= interface.sub_class + ": " + interface.super_class %>
15
+ <% unless interface.outlets.empty? %><%= "\n"%><% end %>
16
+ <% interface.outlets.each do |outlet| %>
17
+ @property IBOutlet <%= outlet.formated_type %> <%= outlet.variable %>;
18
18
  <% end %>
19
- <% unless info[:outlets].empty? %><%= "\n"%><% end %>
20
- <% info[:outlet_collections].map do|name, type| %>
21
- @property IBOutletCollection(<%= type %>) NSArray * <%= name %>;
19
+ <% unless interface.outlets.empty? %><%= "\n"%><% end %>
20
+ <% interface.outlet_collections.each do|outlet_collection| %>
21
+ @property IBOutletCollection(<%= outlet_collection.type %>) NSArray * <%= outlet_collection.variable %>;
22
22
  <% end %>
23
- <% unless info[:outlet_collections].empty? %><%= "\n"%><% end %>
24
- <% info[:actions].map do |action| %>
25
- -(IBAction) <%= generate_action(action) %>;
23
+ <% unless interface.outlet_collections.empty? %><%= "\n"%><% end %>
24
+ <% interface.actions.each do |action| %>
25
+ -(IBAction) <%= action.to_declare %>;
26
26
  <% end %>
27
- <% unless info[:actions].empty? %><%= "\n"%><% end %>
27
+ <% unless interface.actions.empty? %><%= "\n"%><% end %>
28
28
  @end
29
29
 
30
30
  <% end; end %>
@@ -3,9 +3,9 @@
3
3
 
4
4
  #import "Stubs.h"
5
5
 
6
- <% @files.map do |path, infos| %>
7
- <% infos.each do |info| %>
8
- @implementation <%= info[:class][0][0] %>
6
+ <% @files.map do |path, interfaces| %>
7
+ <% interfaces.each do |interface| %>
8
+ @implementation <%= interface[:class][0][0] %>
9
9
  @end
10
10
 
11
11
  <% end; end; %>
@@ -0,0 +1,63 @@
1
+ class IB::OCInterface
2
+ attr_reader :sub_class, :super_class, :outlets,
3
+ :outlet_collections, :actions, :path
4
+
5
+ class Outlet < Struct.new(:variable, :type);
6
+ def formated_type
7
+ type == "id" ? type : "#{type} *"
8
+ end
9
+ end
10
+
11
+ class OutletCollection < Struct.new(:variable, :type); end
12
+
13
+ class Action < Struct.new(:variable, :arg, :return_type)
14
+ def to_declare
15
+ arg ? "#{variable}:(#{return_type ? "#{return_type}*" : 'id'}) #{arg}" : "#{variable}"
16
+ end
17
+ end
18
+
19
+ def initialize(params)
20
+ @params = params
21
+ @sub_class = params[:class][0][0]
22
+ @super_class = params[:class][0][1]
23
+ @outlets = create_instances(Outlet, params[:outlets])
24
+ @outlet_collections = create_instances(OutletCollection, params[:outlet_collections])
25
+ @actions = create_instances(Action, params[:actions])
26
+ @path = params[:path]
27
+ end
28
+
29
+ def [](key)
30
+ @params[key]
31
+ end
32
+
33
+ def super_class
34
+ @super_class ||
35
+ ((@sub_class == 'AppDelegate') ? 'UIResponder <UIApplicationDelegate>' : 'NSObject')
36
+ end
37
+
38
+ def sub_class_dependencies
39
+ [
40
+ @super_class,
41
+ extract_types(@outlets),
42
+ extract_types(@outlet_collections)
43
+ ].flatten.uniq.compact.select { |klass| klass != 'id' }
44
+ end
45
+
46
+ def has_class?(klass)
47
+ [sub_class, *sub_class_dependencies].any? { |k| k == klass }
48
+ end
49
+
50
+ def has_sub_class?(klass)
51
+ sub_class == klass
52
+ end
53
+
54
+ private
55
+ def create_instances(klass, array)
56
+ Array(array).map { |x| klass.new(*x) }
57
+ end
58
+
59
+ def extract_types(array)
60
+ Array(array).map { |x| x.type }.compact
61
+ end
62
+
63
+ end
@@ -1,4 +1,5 @@
1
1
  require 'ib/dependency_resolver'
2
+ require 'ib/oc_interface'
2
3
 
3
4
  class IB::Parser
4
5
  NAME_REGEX = /[a-zA-Z][_a-zA-Z0-9]*/
@@ -51,14 +52,7 @@ class IB::Parser
51
52
 
52
53
  info[:path] = path
53
54
 
54
- # skip empty classes
55
- if info[:outlets].empty? &&
56
- info[:outlet_collections].empty? &&
57
- info[:actions].empty? && info[:class][0][1].nil?
58
- next
59
- end
60
-
61
- infos << info
55
+ infos << IB::OCInterface.new(info)
62
56
  end
63
57
 
64
58
  infos
@@ -1,3 +1,3 @@
1
1
  module IB
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -0,0 +1,2 @@
1
+ class AddButton < BaseView
2
+ end
@@ -0,0 +1,5 @@
1
+ class AppDelegate
2
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
3
+ true
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class BaseView
2
+ end
@@ -1,2 +1,3 @@
1
1
  class SubClass2 < SuperClass
2
+ outlet :banner, SubView1
2
3
  end
@@ -0,0 +1,6 @@
1
+ class SubView1 < UIView
2
+ extend IB
3
+
4
+ ib_outlet :button, AddButton
5
+ ib_action :action_test
6
+ end
@@ -0,0 +1,2 @@
1
+ class UIMyWebView < UIWebView
2
+ end
@@ -5,15 +5,15 @@ describe IB::DependencyResolver do
5
5
  context 'init with simple dependency' do
6
6
  before do
7
7
  @files = {
8
- 'aaa.rb' => [{
8
+ 'aaa.rb' => [IB::OCInterface.new({
9
9
  class: [['SubClass1', 'SubClass2']],
10
- }],
11
- 'bbb.rb' => [{
10
+ })],
11
+ 'bbb.rb' => [IB::OCInterface.new({
12
12
  class: [['SubClass2', 'SuperClass']],
13
- }],
14
- 'ccc.rb' => [{
13
+ })],
14
+ 'ccc.rb' => [IB::OCInterface.new({
15
15
  class: [['SuperClass', 'UIViewController']],
16
- }],
16
+ })],
17
17
  }
18
18
  end
19
19
 
@@ -21,7 +21,7 @@ describe IB::DependencyResolver do
21
21
  it 'create a instance IB::DependencyResolver' do
22
22
  resolver = IB::DependencyResolver.new(@files)
23
23
  expect(
24
- resolver.class_nodes.kind_of?(IB::DependencyResolver::TSortHash)
24
+ resolver.dependency_graph.kind_of?(IB::DependencyResolver::TSortHash)
25
25
  ).to be_true
26
26
  end
27
27
  end
@@ -48,15 +48,20 @@ describe IB::DependencyResolver do
48
48
  context 'init with no dependencies' do
49
49
  before do
50
50
  @files = {
51
- 'aaa.rb' => [{
52
- class: [['SubClass1']],
53
- }],
54
- 'bbb.rb' => [{
51
+ 'aaa.rb' => [
52
+ IB::OCInterface.new({
53
+ class: [['SubClass1']],
54
+ }
55
+ )
56
+ ],
57
+ 'bbb.rb' => [IB::OCInterface.new({
55
58
  class: [['SubClass2']],
56
- }],
57
- 'ccc.rb' => [{
59
+ })
60
+ ],
61
+ 'ccc.rb' => [IB::OCInterface.new({
58
62
  class: [['SuperClass']],
59
- }],
63
+ })
64
+ ],
60
65
  }
61
66
  end
62
67
 
@@ -65,7 +70,7 @@ describe IB::DependencyResolver do
65
70
  resolver = IB::DependencyResolver.new(@files)
66
71
  expect(
67
72
  resolver.sort_classes
68
- ).to eq(['SubClass1', 'SubClass2', 'SuperClass'])
73
+ ).to eq(['SubClass1', 'NSObject','SubClass2', 'SuperClass'])
69
74
  end
70
75
  end
71
76
 
@@ -82,13 +87,20 @@ describe IB::DependencyResolver do
82
87
  context 'init with dependency in one file' do
83
88
  before do
84
89
  @files = {
85
- 'aaa.rb' => [{
86
- class: [['SubClass1', 'SubClass2']],
87
- },{
88
- class: [['SubClass2', 'SuperClass']],
89
- },{
90
- class: [['SuperClass']],
91
- }]
90
+ 'aaa.rb' => [
91
+ IB::OCInterface.new({
92
+ class: [['SubClass1', 'SubClass2']],
93
+ }
94
+ ),
95
+ IB::OCInterface.new({
96
+ class: [['SubClass2', 'SuperClass']],
97
+ }
98
+ ),
99
+ IB::OCInterface.new({
100
+ class: [['SuperClass']],
101
+ }
102
+ ),
103
+ ],
92
104
  }
93
105
  end
94
106
 
@@ -97,7 +109,7 @@ describe IB::DependencyResolver do
97
109
  resolver = IB::DependencyResolver.new(@files)
98
110
  expect(
99
111
  resolver.sort_classes
100
- ).to eq(['SuperClass', 'SubClass2', 'SubClass1'])
112
+ ).to eq(['SuperClass', 'SubClass2', 'SubClass1', 'NSObject'])
101
113
  end
102
114
  end
103
115
 
@@ -110,4 +122,66 @@ describe IB::DependencyResolver do
110
122
  end
111
123
  end
112
124
  end
125
+
126
+ context 'init with complex dependencies' do
127
+ before do
128
+ @files = {
129
+ 'aaa.rb' => [
130
+ IB::OCInterface.new({
131
+ class: [['SubClass1', 'SubClass2']],
132
+ outlets: [
133
+ ["greenLabel", "UIGreenLabel"],
134
+ ],
135
+ }
136
+ )
137
+ ],
138
+ 'bbb.rb' => [
139
+ IB::OCInterface.new({
140
+ class: [['SubClass2', 'SuperClass']],
141
+ }
142
+ )
143
+ ],
144
+ 'ccc.rb' => [
145
+ IB::OCInterface.new({
146
+ class: [['SuperClass', 'UIViewController']],
147
+ }
148
+ )
149
+ ],
150
+ 'ddd.rb' => [
151
+ IB::OCInterface.new({
152
+ class: [['UIGreenLabel', 'UIView']],
153
+ }
154
+ )
155
+ ],
156
+ }
157
+ end
158
+
159
+ describe 'new' do
160
+ it 'create a instance IB::DependencyResolver' do
161
+ resolver = IB::DependencyResolver.new(@files)
162
+ expect(
163
+ resolver.dependency_graph.kind_of?(IB::DependencyResolver::TSortHash)
164
+ ).to be_true
165
+ end
166
+ end
167
+
168
+ describe 'sort_classes' do
169
+ it 'create a instance IB::DependencyResolver' do
170
+ resolver = IB::DependencyResolver.new(@files)
171
+ expect(
172
+ resolver.sort_classes
173
+ ).to eq(['UIViewController', 'SuperClass', 'SubClass2', 'UIView', 'UIGreenLabel', 'SubClass1'])
174
+ end
175
+ end
176
+
177
+ describe 'sort_files' do
178
+ it 'create a instance IB::DependencyResolver' do
179
+ resolver = IB::DependencyResolver.new(@files)
180
+ expect(
181
+ resolver.sort_files
182
+ ).to eq(['ccc.rb', 'bbb.rb', 'ddd.rb', 'aaa.rb'])
183
+ end
184
+ end
185
+ end
186
+
113
187
  end
@@ -15,7 +15,7 @@ describe IB::Generator do
15
15
  #import <CoreData/CoreData.h>
16
16
  #import <UIKit/UIKit.h>
17
17
 
18
- @interface AppDelegate
18
+ @interface AppDelegate: UIResponder <UIApplicationDelegate>
19
19
 
20
20
  @property IBOutlet UIWindow * window;
21
21
  @property IBOutlet UINavigationController * navigationController;
@@ -50,6 +50,9 @@ describe IB::Generator do
50
50
  @interface AnotherView: EmptyView
51
51
  @end
52
52
 
53
+ @interface SimpleClass: NSObject
54
+ @end
55
+
53
56
  OBJC
54
57
  end
55
58
 
@@ -65,7 +68,7 @@ OBJC
65
68
  #import <CoreData/CoreData.h>
66
69
  #import <Cocoa/Cocoa.h>
67
70
 
68
- @interface AppDelegate
71
+ @interface AppDelegate: UIResponder <UIApplicationDelegate>
69
72
 
70
73
  @property IBOutlet UIWindow * window;
71
74
  @property IBOutlet UINavigationController * navigationController;
@@ -100,6 +103,9 @@ OBJC
100
103
  @interface AnotherView: EmptyView
101
104
  @end
102
105
 
106
+ @interface SimpleClass: NSObject
107
+ @end
108
+
103
109
  OBJC
104
110
  end
105
111
 
@@ -126,6 +132,57 @@ OBJC
126
132
  @implementation AnotherView
127
133
  @end
128
134
 
135
+ @implementation SimpleClass
136
+ @end
137
+
129
138
  OBJC
130
139
  end
140
+
141
+ it "generates stubs header with ios platform of dependency_test fixtures" do
142
+ files = IB::Parser.new.find_all("spec/fixtures/dependency_test")
143
+ stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.h.erb', files)
144
+
145
+ stubs.should == <<-OBJC
146
+ // Generated by IB v#{IB::VERSION} gem. Do not edit it manually
147
+ // Run `rake ib:open` to refresh
148
+
149
+ #import <Foundation/Foundation.h>
150
+ #import <CoreData/CoreData.h>
151
+ #import <UIKit/UIKit.h>
152
+
153
+ @interface BaseView: NSObject
154
+ @end
155
+
156
+ @interface AddButton: BaseView
157
+ @end
158
+
159
+ @interface AppDelegate: UIResponder <UIApplicationDelegate>
160
+ @end
161
+
162
+ @interface SuperClass: UIViewController
163
+ @end
164
+
165
+ @interface SubView1: UIView
166
+
167
+ @property IBOutlet AddButton * button;
168
+
169
+ -(IBAction) action_test:(id) sender;
170
+
171
+ @end
172
+
173
+ @interface SubClass2: SuperClass
174
+
175
+ @property IBOutlet SubView1 * banner;
176
+
177
+ @end
178
+
179
+ @interface SubClass1: SubClass2
180
+ @end
181
+
182
+ @interface UIMyWebView: UIWebView
183
+ @end
184
+
185
+ OBJC
186
+ end
187
+
131
188
  end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+ require 'ib/oc_interface'
3
+
4
+ describe IB::OCInterface do
5
+ context 'instantiate' do
6
+ before do
7
+ @params = {
8
+ class: [["CustomView", "UIView"]],
9
+ outlets: [
10
+ ["greenLabel", "UIGreenLabel"],
11
+ ["redLabel", "UILabel"],
12
+ ["untyped_label", "id"],
13
+ ["yellowLabel", "id"]
14
+ ],
15
+ outlet_collections: [
16
+ ["greenLabelCollection", "UIGreenLabel"],
17
+ ["redLabelCollection", "UILabel"],
18
+ ["untyped_label_collection", "id"],
19
+ ["yellowLabelCollection", "id"]
20
+ ],
21
+ actions: [
22
+ ["someAction", "sender", nil],
23
+ ["segueAction", "sender", "UIStoryboardSegue"],
24
+ ["anotherAction", "button", nil],
25
+ ["actionWithComment", "sender", nil],
26
+ ["actionWithBrackets", "sender", nil],
27
+ ["actionWithoutArgs", nil, nil],
28
+ ["actionWithDefaultedArgs", "sender", nil]
29
+ ]
30
+ }
31
+ end
32
+
33
+ let(:subject) { IB::OCInterface.new(@params) }
34
+ describe '#new' do
35
+ it 'should return object' do
36
+ should be_kind_of(IB::OCInterface)
37
+ end
38
+ end
39
+
40
+ describe '#[]' do
41
+ it 'should be able to access original params' do
42
+ expect(subject[:class][0][0]).to eq('CustomView')
43
+ expect(subject[:class][0][1]).to eq('UIView')
44
+ expect(subject[:outlets]).to be_kind_of(Array)
45
+ end
46
+ end
47
+
48
+ describe '#super_class' do
49
+ it 'should return super class' do
50
+ expect(subject.super_class).to eq('UIView')
51
+ end
52
+ end
53
+
54
+ describe '#dependency_classes' do
55
+ it 'should return super class' do
56
+ expect(subject.sub_class_dependencies).to be_kind_of(Array)
57
+ expect(subject.sub_class_dependencies).to eq(%w{
58
+ UIView UIGreenLabel UILabel
59
+ })
60
+ end
61
+ end
62
+
63
+ describe '#has_class?' do
64
+ it 'should return super class' do
65
+ expect(subject.has_class?('UIView')).to be_true
66
+ expect(subject.has_class?('FooBarDummyView')).to be_false
67
+ end
68
+ end
69
+ end
70
+ end
@@ -29,17 +29,17 @@ describe IB::Parser do
29
29
  ]
30
30
  end
31
31
 
32
- it "detects simple classes" do
33
- IB::Parser.new.find("spec/fixtures/common/simple_class.rb").length.should == 0
32
+ it "can output simple classes" do
33
+ IB::Parser.new.find("spec/fixtures/common/simple_class.rb").length.should == 1
34
34
  end
35
35
 
36
36
  it "finds all infos" do
37
37
  infos = IB::Parser.new.find_all("spec/fixtures/dependency_test")
38
- expect(infos.size).to eq 3
38
+ infos.values.each do |vals|
39
+ vals.each do |v|
40
+ expect(v).to be_kind_of(IB::OCInterface)
41
+ end
42
+ end
39
43
  end
40
44
 
41
- it "finds all sorted infos" do
42
- infos = IB::Parser.new.find_all("spec/fixtures/dependency_test")
43
- expect(infos.size).to eq 3
44
- end
45
45
  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.0
4
+ version: 0.4.1
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-07 00:00:00.000000000 Z
12
+ date: 2013-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcodeproj
@@ -105,6 +105,7 @@ files:
105
105
  - lib/ib/generator/rendering_helper.rb
106
106
  - lib/ib/generator/templates/Stubs.h.erb
107
107
  - lib/ib/generator/templates/Stubs.m.erb
108
+ - lib/ib/oc_interface.rb
108
109
  - lib/ib/outlets.rb
109
110
  - lib/ib/parser.rb
110
111
  - lib/ib/project.rb
@@ -114,11 +115,17 @@ files:
114
115
  - spec/fixtures/common/custom_view.rb
115
116
  - spec/fixtures/common/empty_view.rb
116
117
  - spec/fixtures/common/simple_class.rb
118
+ - spec/fixtures/dependency_test/add_button.rb
119
+ - spec/fixtures/dependency_test/app_delegate.rb
120
+ - spec/fixtures/dependency_test/base_view.rb
117
121
  - spec/fixtures/dependency_test/sub_class_1.rb
118
122
  - spec/fixtures/dependency_test/sub_class_2.rb
123
+ - spec/fixtures/dependency_test/sub_view_1.rb
119
124
  - spec/fixtures/dependency_test/super_class.rb
125
+ - spec/fixtures/dependency_test/ui_my_web_view.rb
120
126
  - spec/lib/ib/dependency_resolver_spec.rb
121
127
  - spec/lib/ib/generator_spec.rb
128
+ - spec/lib/ib/oc_interface_spec.rb
122
129
  - spec/lib/ib/parser_spec.rb
123
130
  - spec/lib/ib/project_spec.rb
124
131
  - spec/spec_helper.rb
@@ -153,11 +160,17 @@ test_files:
153
160
  - spec/fixtures/common/custom_view.rb
154
161
  - spec/fixtures/common/empty_view.rb
155
162
  - spec/fixtures/common/simple_class.rb
163
+ - spec/fixtures/dependency_test/add_button.rb
164
+ - spec/fixtures/dependency_test/app_delegate.rb
165
+ - spec/fixtures/dependency_test/base_view.rb
156
166
  - spec/fixtures/dependency_test/sub_class_1.rb
157
167
  - spec/fixtures/dependency_test/sub_class_2.rb
168
+ - spec/fixtures/dependency_test/sub_view_1.rb
158
169
  - spec/fixtures/dependency_test/super_class.rb
170
+ - spec/fixtures/dependency_test/ui_my_web_view.rb
159
171
  - spec/lib/ib/dependency_resolver_spec.rb
160
172
  - spec/lib/ib/generator_spec.rb
173
+ - spec/lib/ib/oc_interface_spec.rb
161
174
  - spec/lib/ib/parser_spec.rb
162
175
  - spec/lib/ib/project_spec.rb
163
176
  - spec/spec_helper.rb