lanekit 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +107 -20
- data/lib/lanekit/generate/model.rb +137 -0
- data/lib/lanekit/generate/provider.rb +82 -0
- data/lib/lanekit/generate.rb +24 -0
- data/lib/lanekit/version.rb +1 -1
- data/lib/lanekit.rb +21 -138
- data/lib/template/model.h.erb +5 -14
- data/lib/template/model.m.erb +19 -43
- data/lib/template/model_base.h.erb +23 -0
- data/lib/template/model_base.m.erb +77 -0
- data/lib/template/model_fixture.h.erb +4 -1
- data/lib/template/model_fixture.m.erb +4 -1
- data/lib/template/model_test.h.erb +4 -1
- data/lib/template/model_test.m.erb +4 -1
- data/lib/template/provider.h.erb +15 -0
- data/lib/template/provider.m.erb +31 -0
- data/lib/template/provider_base.h.erb +23 -0
- data/lib/template/provider_base.m.erb +55 -0
- metadata +26 -8
- checksums.yaml +0 -15
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## LaneKit
|
2
2
|
|
3
|
-
LaneKit is
|
3
|
+
LaneKit is an iOS Objective-C code generator of models and resource providers for integration with RestKit. It includes support
|
4
4
|
for unit testing with SenTestingKit including fixtures and tests. LaneKit is a command line app written
|
5
5
|
in Ruby and packaged as a Ruby Gem.
|
6
6
|
|
@@ -8,13 +8,13 @@ in Ruby and packaged as a Ruby Gem.
|
|
8
8
|
- Questions? [Stack Overflow](http://stackoverflow.com/questions/tagged/lanekit) is the best place to find answers.
|
9
9
|
|
10
10
|
## Benefits
|
11
|
-
* properly implemented models
|
11
|
+
* properly implemented models and resource providers
|
12
|
+
* easy integration with RestKit
|
12
13
|
* consistent Objective-C code
|
13
14
|
* unit tests
|
14
15
|
* test fixtures in JSON and Objective-C
|
15
16
|
* tested code
|
16
17
|
* rapid development
|
17
|
-
* easy integration with RestKit
|
18
18
|
* enhanced productivity of junior developers
|
19
19
|
* reduces dependency on senior developers
|
20
20
|
|
@@ -31,17 +31,21 @@ in Ruby and packaged as a Ruby Gem.
|
|
31
31
|
|
32
32
|
### Add a new model called Video to an existing Xcode project.
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
34
|
+
$ lanekit generate model Video duration:string headline:string id:integer image:string location:string
|
35
|
+
|
36
|
+
create Classes/Models
|
37
|
+
create Classes/Tests/Fixtures
|
38
|
+
create Classes/Tests/Models
|
39
|
+
create Classes/Models/Contents.h
|
40
|
+
create Classes/Models/Contents.m
|
41
|
+
create Classes/Tests/Fixtures/ContentsFixtures.h
|
42
|
+
create Classes/Tests/Fixtures/ContentsFixtures.m
|
43
|
+
create Classes/Tests/Fixtures/ContentsFixtures.one.json
|
44
|
+
create Classes/Tests/Fixtures/ContentsFixtures.two.json
|
45
|
+
create Classes/Tests/Models/ContentsTest.h
|
46
|
+
create Classes/Tests/Models/ContentsTest.m
|
47
|
+
create Classes/Models/LKModel.h
|
48
|
+
create Classes/Models/LKModel.m
|
45
49
|
|
46
50
|
and here is the Objective-C header file that was generated by LaneKit:
|
47
51
|
|
@@ -124,17 +128,100 @@ and here is the Objective-C .m file that was generated by LaneKit:
|
|
124
128
|
@end
|
125
129
|
```
|
126
130
|
|
131
|
+
and here is the unit test fixtures file that was generated by LaneKit:
|
127
132
|
|
128
|
-
|
133
|
+
```objective-c
|
134
|
+
//
|
135
|
+
// VideoFixtures.m
|
136
|
+
//
|
137
|
+
// This model fixture was created on 2013-08-11 by LaneKit v0.2.0.
|
138
|
+
//
|
139
|
+
|
140
|
+
#import "VideoFixtures.h"
|
141
|
+
|
142
|
+
@implementation VideoFixtures
|
143
|
+
|
144
|
+
+ (Video *)one
|
145
|
+
{
|
146
|
+
Video *video = Video.new;
|
147
|
+
|
148
|
+
video.duration = @"MyString";
|
149
|
+
video.headline = @"MyString";
|
150
|
+
video.id = [NSNumber numberWithInteger:1];
|
151
|
+
video.image = @"MyString";
|
152
|
+
video.itemDate = NSDate.new;
|
153
|
+
video.location = @"MyString";
|
154
|
+
|
155
|
+
return video;
|
156
|
+
}
|
157
|
+
|
158
|
+
+ (Video *)two
|
159
|
+
{
|
160
|
+
Video *video = Video.new;
|
161
|
+
|
162
|
+
video.duration = @"MyString";
|
163
|
+
video.headline = @"MyString";
|
164
|
+
video.id = [NSNumber numberWithInteger:1];
|
165
|
+
video.image = @"MyString";
|
166
|
+
video.itemDate = NSDate.new;
|
167
|
+
video.location = @"MyString";
|
168
|
+
|
169
|
+
return video;
|
170
|
+
}
|
171
|
+
|
172
|
+
@end
|
129
173
|
```
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
174
|
+
|
175
|
+
and here is the RestKit compatible JSON fixture file that was generated by LaneKit:
|
176
|
+
|
177
|
+
```json
|
178
|
+
{
|
179
|
+
"video": {
|
180
|
+
"duration": "MyString",
|
181
|
+
"headline": "MyString",
|
182
|
+
"id": "1",
|
183
|
+
"image": "MyString",
|
184
|
+
"itemDate": "03/01/2012",
|
185
|
+
"location": "MyString"
|
186
|
+
}
|
187
|
+
}
|
134
188
|
```
|
135
189
|
|
190
|
+
and here is a unit test that was generated in Models/VideoTest.m by LaneKit:
|
191
|
+
|
192
|
+
```objective-c
|
193
|
+
- (void)testVideoNewOne
|
194
|
+
{
|
195
|
+
Video *video = VideoFixtures.one;
|
196
|
+
STAssertNotNil(video, @"video is nil");
|
197
|
+
|
198
|
+
STAssertTrue([video.duration isEqualToString:@"MyString"], @"duration not correct value");
|
199
|
+
STAssertTrue([video.headline isEqualToString:@"MyString"], @"headline not correct value");
|
200
|
+
STAssertTrue(video.id.integerValue == [NSNumber numberWithInteger:1].integerValue, @"id not [NSNumber numberWithInteger:1]");
|
201
|
+
STAssertTrue([video.image isEqualToString:@"MyString"], @"image not correct value");
|
202
|
+
STAssertNotNil(video.itemDate, @"itemDate is nil");
|
203
|
+
}
|
204
|
+
```
|
205
|
+
|
206
|
+
### Add a new model called Contents that contains a list of Videos and uses a relationship mapping.
|
207
|
+
|
208
|
+
$ lanekit generate model contents contents:array:Video
|
209
|
+
exist Classes/model
|
210
|
+
create Classes/model/Contents.h
|
211
|
+
create Classes/model/Contents.m
|
212
|
+
|
213
|
+
### Add a new resource provider called Contents.
|
214
|
+
|
215
|
+
$ lanekit generate provider Contents Contents http://scores.espn.go.com/allsports/scorecenter/v2/videos/build?sport=top
|
216
|
+
create Classes/Controllers
|
217
|
+
create Classes/Controllers/LKResourceProvider.h
|
218
|
+
create Classes/Controllers/LKResourceProvider.m
|
219
|
+
create Classes/Controllers/ContentsProvider.h
|
220
|
+
create Classes/Controllers/ContentsProvider.m
|
221
|
+
|
136
222
|
### Sample App
|
137
|
-
The SportsFrames app is a fully functional sample app created to demonstrate the use of LaneKit in a real world app.
|
223
|
+
The SportsFrames app is a fully functional sample app using RestKit created to demonstrate the use of LaneKit in a real world app. It
|
224
|
+
has models and resource providers that are generated from LaneKit.
|
138
225
|
Download the code from [GitHub](https://github.com/larryaasen/SportsFrames).
|
139
226
|
|
140
227
|
## Credits
|
@@ -0,0 +1,137 @@
|
|
1
|
+
module LaneKit
|
2
|
+
class Generate < Thor
|
3
|
+
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
desc "model [options] NAME [attributes]", "Generates an Objective-C model for RestKit including unit tests"
|
7
|
+
long_desc <<-LONGDESC
|
8
|
+
Generates the Objective-C code for a model that is compatible with RestKit. It also generates test fixtures and unit tests.\n
|
9
|
+
NAME: the name of the model\n
|
10
|
+
[attributes] name:type:relationship, name:type:relationship, ...\n
|
11
|
+
where type is [date|integer|string|<class_name>] and relationship (optional) is the name of another class.
|
12
|
+
LONGDESC
|
13
|
+
|
14
|
+
def model(model_name, *attributes)
|
15
|
+
@using_core_data = options[:use_core_data]
|
16
|
+
#puts " using Core Data: #{@using_core_data}"
|
17
|
+
#puts " name: #{model_name}"
|
18
|
+
|
19
|
+
@model_name = LaneKit.derive_model_name(model_name)
|
20
|
+
|
21
|
+
@model_file_name = LaneKit.derive_file_name(@model_name)
|
22
|
+
@model_fixtures_file_name = "#{@model_file_name}Fixtures"
|
23
|
+
@model_tests_file_name = "#{@model_file_name}Test"
|
24
|
+
|
25
|
+
@class_name = LaneKit.derive_class_name(@model_name)
|
26
|
+
|
27
|
+
@attributes = []
|
28
|
+
@any_relationships = false
|
29
|
+
|
30
|
+
attributes.each {|attribute|
|
31
|
+
name, type, relationship = attribute.split(":")
|
32
|
+
objective_c_type = LaneKit.objective_c_type(type)
|
33
|
+
@attributes << {
|
34
|
+
:type => type,
|
35
|
+
:name => name,
|
36
|
+
:objective_c_type => objective_c_type,
|
37
|
+
:relationship => relationship,
|
38
|
+
:relationship_fixtures_file_name => "#{relationship}Fixtures",
|
39
|
+
:fixture_json => LaneKit.objective_c_type_fixture_json(type),
|
40
|
+
:fixture_value => LaneKit.objective_c_type_fixture_value(type),
|
41
|
+
:unit_test_assert => LaneKit.objective_c_type_unit_test_assert(@model_name, name, type)
|
42
|
+
}
|
43
|
+
@any_relationships = relationship ? true : @any_relationships
|
44
|
+
}
|
45
|
+
|
46
|
+
self.initialize_model
|
47
|
+
self.create_model_folders
|
48
|
+
self.create_model_files
|
49
|
+
self.update_xcode_project
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.source_root
|
53
|
+
File.dirname('./')
|
54
|
+
end
|
55
|
+
|
56
|
+
no_tasks {
|
57
|
+
def initialize_model
|
58
|
+
# Model Base Class
|
59
|
+
@model_base_name = "LKModel"
|
60
|
+
@model_base_class_name = "LKModel"
|
61
|
+
@model_base_file_name = "LKModel"
|
62
|
+
|
63
|
+
@models_folder = "Classes/Models"
|
64
|
+
@tests_fixtures_folder = "Classes/Tests/Fixtures"
|
65
|
+
@tests_models_folder = "Classes/Tests/Models"
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def source_paths
|
70
|
+
[@@template_folder]
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_model_folders
|
74
|
+
empty_directory @models_folder
|
75
|
+
empty_directory @tests_fixtures_folder
|
76
|
+
empty_directory @tests_models_folder
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_model_files
|
80
|
+
# 1) Create the Models
|
81
|
+
# Create the .h file
|
82
|
+
source = "model.h.erb"
|
83
|
+
target = File.join(@models_folder, "#{@model_file_name}.h")
|
84
|
+
template(source, target, @@template_opts)
|
85
|
+
|
86
|
+
# Create the .m file
|
87
|
+
source = "model.m.erb"
|
88
|
+
target = File.join(@models_folder, "#{@model_file_name}.m")
|
89
|
+
template(source, target, @@template_opts)
|
90
|
+
|
91
|
+
# 2) Create the Model Test Fixtures
|
92
|
+
# Create the .h file
|
93
|
+
source = "model_fixture.h.erb"
|
94
|
+
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.h")
|
95
|
+
template(source, target, @@template_opts)
|
96
|
+
|
97
|
+
# Create the .m file
|
98
|
+
source = "model_fixture.m.erb"
|
99
|
+
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.m")
|
100
|
+
template(source, target, @@template_opts)
|
101
|
+
|
102
|
+
# Create the one json file
|
103
|
+
source = "model_fixture.json.erb"
|
104
|
+
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.one.json")
|
105
|
+
template(source, target, @@template_opts)
|
106
|
+
|
107
|
+
# Create the two json file
|
108
|
+
source = "model_fixture.json.erb"
|
109
|
+
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.two.json")
|
110
|
+
template(source, target, @@template_opts)
|
111
|
+
|
112
|
+
# 3) Create the Model Tests
|
113
|
+
# Create the .h file
|
114
|
+
source = "model_test.h.erb"
|
115
|
+
target = File.join(@tests_models_folder, "#{@model_tests_file_name}.h")
|
116
|
+
template(source, target, @@template_opts)
|
117
|
+
|
118
|
+
# Create the .m file
|
119
|
+
source = "model_test.m.erb"
|
120
|
+
target = File.join(@tests_models_folder, "#{@model_tests_file_name}.m")
|
121
|
+
template(source, target, @@template_opts)
|
122
|
+
|
123
|
+
# 4) Create the base model
|
124
|
+
# Create the .h file
|
125
|
+
source = "model_base.h.erb"
|
126
|
+
target = File.join(@models_folder, "#{@model_base_file_name}.h")
|
127
|
+
template(source, target, @@template_opts)
|
128
|
+
|
129
|
+
# Create the .m file
|
130
|
+
source = "model_base.m.erb"
|
131
|
+
target = File.join(@models_folder, "#{@model_base_file_name}.m")
|
132
|
+
template(source, target, @@template_opts)
|
133
|
+
end
|
134
|
+
}
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module LaneKit
|
2
|
+
class Generate
|
3
|
+
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
desc "provider [options] NAME MODEL_NAME URL", "Generates an Objective-C resource provider for RestKit including unit tests"
|
7
|
+
long_desc <<-LONGDESC
|
8
|
+
Generates the Objective-C code for a resource provider that is compatible with RestKit. It also generates test fixtures and unit tests.\n
|
9
|
+
NAME: the name of the provider\n
|
10
|
+
MODEL_NAME: the name of the model\n
|
11
|
+
URL: the HTTP URL to the data\n
|
12
|
+
LONGDESC
|
13
|
+
|
14
|
+
def provider(name, model_name, url)
|
15
|
+
@using_core_data = options[:use_core_data]
|
16
|
+
#puts " using Core Data: #{@using_core_data}"
|
17
|
+
#puts " name: #{name}"
|
18
|
+
#puts " model_name: #{model_name}"
|
19
|
+
#puts " url: #{url}"
|
20
|
+
|
21
|
+
@provider_name = "#{LaneKit.derive_class_name(name)}Provider"
|
22
|
+
@model_name = LaneKit.derive_model_name(model_name)
|
23
|
+
@model_class_name = LaneKit.derive_class_name(@model_name)
|
24
|
+
@model_file_name = LaneKit.derive_file_name(@model_name)
|
25
|
+
@provider_url = url
|
26
|
+
|
27
|
+
self.initialize_provider
|
28
|
+
self.create_provider_folders
|
29
|
+
self.create_provider_files
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.source_root
|
33
|
+
File.dirname('./')
|
34
|
+
end
|
35
|
+
|
36
|
+
no_commands do
|
37
|
+
|
38
|
+
def initialize_provider
|
39
|
+
@providers_folder = "Classes/Controllers"
|
40
|
+
|
41
|
+
# Resource Provider Base Class
|
42
|
+
@provider_base_name = "LKResourceProvider"
|
43
|
+
@provider_base_class_name = "LKResourceProvider"
|
44
|
+
@provider_base_file_name = "LKResourceProvider"
|
45
|
+
|
46
|
+
@provider_file_name = @provider_name
|
47
|
+
end
|
48
|
+
|
49
|
+
def source_paths
|
50
|
+
[@@template_folder]
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_provider_folders
|
54
|
+
empty_directory @providers_folder
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_provider_files
|
58
|
+
# 1) Create the base resource provider
|
59
|
+
# Create the .h file
|
60
|
+
source = "provider_base.h.erb"
|
61
|
+
target = File.join(@providers_folder, "#{@provider_base_file_name}.h")
|
62
|
+
template(source, target, @@template_opts)
|
63
|
+
|
64
|
+
# Create the .m file
|
65
|
+
source = "provider_base.m.erb"
|
66
|
+
target = File.join(@providers_folder, "#{@provider_base_file_name}.m")
|
67
|
+
template(source, target, @@template_opts)
|
68
|
+
|
69
|
+
# 2) Create the resource provider
|
70
|
+
# Create the .h file
|
71
|
+
source = "provider.h.erb"
|
72
|
+
target = File.join(@providers_folder, "#{@provider_file_name}.h")
|
73
|
+
template(source, target, @@template_opts)
|
74
|
+
|
75
|
+
# Create the .m file
|
76
|
+
source = "provider.m.erb"
|
77
|
+
target = File.join(@providers_folder, "#{@provider_file_name}.m")
|
78
|
+
template(source, target, @@template_opts)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class LaneKit::Generate < Thor
|
2
|
+
|
3
|
+
@@lanekit_version = LaneKit::VERSION;
|
4
|
+
@@template_folder = File.expand_path('../../template', __FILE__)
|
5
|
+
@@generate_date = Date.today.to_s
|
6
|
+
|
7
|
+
no_tasks do
|
8
|
+
def update_xcode_project
|
9
|
+
xcworkspace_path = ""
|
10
|
+
Xcodeproj::Workspace.new_from_xcworkspace(xcworkspace_path)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
@@template_opts = {
|
15
|
+
:command => LaneKit::CLI.command,
|
16
|
+
:generate_date => @@generate_date,
|
17
|
+
:lanekit_version => @@lanekit_version
|
18
|
+
}
|
19
|
+
|
20
|
+
require 'lanekit/generate/model'
|
21
|
+
require 'lanekit/generate/provider'
|
22
|
+
|
23
|
+
class_option :use_core_data, :type => :boolean, :default => false, :banner => "generate code compatible with Core Data (the default is false)", :aliases => "-c" # option --use_core_data=true
|
24
|
+
end
|
data/lib/lanekit/version.rb
CHANGED
data/lib/lanekit.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'thor'
|
3
3
|
require 'xcodeproj'
|
4
|
-
require 'lanekit/version'
|
5
4
|
require 'active_support'
|
6
5
|
require 'active_support/inflector'
|
6
|
+
require 'lanekit/version'
|
7
7
|
|
8
8
|
module LaneKit
|
9
9
|
@@objc_types = {
|
@@ -101,152 +101,35 @@ module LaneKit
|
|
101
101
|
assert
|
102
102
|
end
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
class Generate < Thor
|
107
|
-
include Thor::Actions
|
108
|
-
|
109
|
-
desc "model NAME [attributes]", "Generates an Objective-C model for RestKit including unit tests"
|
110
|
-
long_desc <<-LONGDESC
|
111
|
-
Generates the Objective-C code for a model that is compatible with RestKit. It also generates test fixtures and unit tests.\n
|
112
|
-
NAME: the name of the model\n
|
113
|
-
[attributes] name:type:relationship, name:type:relationship, ...\n
|
114
|
-
where type is [date|integer|string|<class_name>] and relationship (optional) is the name of another class.
|
115
|
-
LONGDESC
|
116
|
-
|
117
|
-
option :use_core_data, :type => :boolean, :default => false, :banner => "generate code compatible with Core Data", :aliases => :c # option --use_core_data=true
|
118
|
-
def model(model_name, *attributes)
|
119
|
-
@using_core_data = options[:use_core_data]
|
120
|
-
puts " using Core Data: #{@using_core_data}"
|
121
|
-
|
122
|
-
@model_name = LaneKit.derive_model_name(model_name)
|
123
|
-
|
124
|
-
@model_file_name = LaneKit.derive_file_name(@model_name)
|
125
|
-
@model_fixtures_file_name = "#{@model_file_name}Fixtures"
|
126
|
-
@model_tests_file_name = "#{@model_file_name}Test"
|
104
|
+
end
|
127
105
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
@attributes = []
|
132
|
-
@any_relationships = false
|
133
|
-
|
134
|
-
attributes.each {|attribute|
|
135
|
-
name, type, relationship = attribute.split(":")
|
136
|
-
objective_c_type = LaneKit.objective_c_type(type)
|
137
|
-
@attributes << {
|
138
|
-
:type => type,
|
139
|
-
:name => name,
|
140
|
-
:objective_c_type => objective_c_type,
|
141
|
-
:relationship => relationship,
|
142
|
-
:relationship_fixtures_file_name => "#{relationship}Fixtures",
|
143
|
-
:fixture_json => LaneKit.objective_c_type_fixture_json(type),
|
144
|
-
:fixture_value => LaneKit.objective_c_type_fixture_value(type),
|
145
|
-
:unit_test_assert => LaneKit.objective_c_type_unit_test_assert(@model_name, name, type)
|
146
|
-
}
|
147
|
-
@any_relationships = relationship ? true : @any_relationships
|
148
|
-
}
|
149
|
-
|
150
|
-
script_name = File.basename($0)
|
151
|
-
script_args = ARGV.join(' ')
|
106
|
+
module LaneKit
|
107
|
+
class CLI < Thor
|
152
108
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
self.create_model_files @model_name
|
158
|
-
self.update_xcode_project @model_name
|
159
|
-
end
|
109
|
+
script_name = File.basename($0)
|
110
|
+
script_args = ARGV.join(' ')
|
111
|
+
|
112
|
+
@command = "#{script_name} #{script_args}"
|
160
113
|
|
161
|
-
|
162
|
-
|
114
|
+
no_commands do
|
115
|
+
def self.command
|
116
|
+
@command
|
163
117
|
end
|
164
|
-
|
165
|
-
no_commands {
|
166
|
-
def initialize_stuff
|
167
|
-
@model_date = Date.today.to_s
|
168
|
-
|
169
|
-
@models_folder = "Classes/Models"
|
170
|
-
@tests_fixtures_folder = "Classes/Tests/Fixtures"
|
171
|
-
@tests_models_folder = "Classes/Tests/Models"
|
172
|
-
|
173
|
-
@template_folder = File.expand_path('../template', __FILE__)
|
174
|
-
end
|
175
|
-
|
176
|
-
def source_paths
|
177
|
-
[@template_folder]
|
178
|
-
end
|
179
|
-
|
180
|
-
def create_model_folders
|
181
|
-
empty_directory @models_folder
|
182
|
-
empty_directory @tests_fixtures_folder
|
183
|
-
empty_directory @tests_models_folder
|
184
|
-
end
|
185
|
-
|
186
|
-
def create_model_files(model_name)
|
187
|
-
# Files are created lowercase
|
188
|
-
# Class names are camel case, videodata => VideoData
|
189
|
-
|
190
|
-
# 1) Create the Models
|
191
|
-
# Create the .h file
|
192
|
-
source = "model.h.erb"
|
193
|
-
target = File.join(@models_folder, "#{@model_file_name}.h")
|
194
|
-
template(source,target)
|
195
|
-
|
196
|
-
# Create the .m file
|
197
|
-
source = "model.m.erb"
|
198
|
-
target = File.join(@models_folder, "#{@model_file_name}.m")
|
199
|
-
template(source,target)
|
200
|
-
|
201
|
-
# 2) Create the Model Test Fixtures
|
202
|
-
# Create the .h file
|
203
|
-
source = "model_fixture.h.erb"
|
204
|
-
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.h")
|
205
|
-
template(source,target)
|
206
|
-
|
207
|
-
# Create the .m file
|
208
|
-
source = "model_fixture.m.erb"
|
209
|
-
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.m")
|
210
|
-
template(source,target)
|
211
|
-
|
212
|
-
# Create the json file
|
213
|
-
source = "model_fixture.json.erb"
|
214
|
-
target = File.join(@tests_fixtures_folder, "#{@model_fixtures_file_name}.json")
|
215
|
-
template(source,target)
|
216
|
-
|
217
|
-
# 3) Create the Model Tests
|
218
|
-
# Create the .h file
|
219
|
-
source = "model_test.h.erb"
|
220
|
-
target = File.join(@tests_models_folder, "#{@model_tests_file_name}.h")
|
221
|
-
template(source,target)
|
222
|
-
|
223
|
-
# Create the .m file
|
224
|
-
source = "model_test.m.erb"
|
225
|
-
target = File.join(@tests_models_folder, "#{@model_tests_file_name}.m")
|
226
|
-
template(source,target)
|
227
|
-
end
|
228
|
-
|
229
|
-
def update_xcode_project(model_name)
|
230
|
-
xcworkspace_path = ""
|
231
|
-
Xcodeproj::Workspace.new_from_xcworkspace(xcworkspace_path)
|
232
|
-
end
|
233
|
-
}
|
234
118
|
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
module LaneKit
|
239
|
-
class CLI < Thor
|
240
119
|
|
241
|
-
|
242
|
-
long_desc "Invoke a code generator. There is only one generator so far: 'model' that generates Objective-C code compatible with RestKit that includes unit tests"
|
243
|
-
subcommand "generate", LaneKit::Generators::Generate
|
120
|
+
map ["-v", "--version"] => :version
|
244
121
|
|
245
|
-
|
246
|
-
|
122
|
+
desc "generate", "Invoke a code generator"
|
123
|
+
long_desc <<-LONGDESC
|
124
|
+
Invoke a code generator:\n
|
125
|
+
-'model' that generates Objective-C code compatible with RestKit that includes unit tests\n
|
126
|
+
-'provider' that generates Objective-C code compatible with RestKit
|
127
|
+
LONGDESC
|
247
128
|
|
248
|
-
|
129
|
+
require 'lanekit/generate'
|
130
|
+
subcommand "generate", LaneKit::Generate
|
249
131
|
|
132
|
+
desc "version", "Display the LaneKit version"
|
250
133
|
def version
|
251
134
|
puts "LaneKit #{VERSION}"
|
252
135
|
end
|
data/lib/template/model.h.erb
CHANGED
@@ -1,25 +1,16 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_file_name%>.h
|
3
3
|
//
|
4
|
-
// This model was created on
|
4
|
+
// This model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
5
|
//
|
6
|
-
// The following LaneKit command was used to generate this
|
7
|
-
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
8
|
//
|
9
9
|
|
10
|
-
|
10
|
+
#import "<%=@model_base_file_name%>.h"
|
11
11
|
|
12
|
-
@
|
13
|
-
|
14
|
-
@interface <%=@class_name%> : <% if @using_core_data %>NSManagedObject<% else %>NSObject<% end %>
|
12
|
+
@interface <%=@class_name%> : <%=@model_base_class_name%>
|
15
13
|
<% @attributes.each do |attribute| %>
|
16
14
|
@property (nonatomic,strong) <%=attribute[:objective_c_type]%><%=attribute[:name]%>;<% if attribute[:relationship] %> // relates to: <%=attribute[:relationship]%><% end %><% end %>
|
17
|
-
<% if @using_core_data %>
|
18
|
-
+ (NSString *)entityName;
|
19
|
-
+ (<%=@class_name%> *)create:(NSManagedObjectContext *)moc;<% end %>
|
20
|
-
+ (NSString *)keyPath; // Used by providers. The subset of the parsed response for which the mapping is to be used.
|
21
|
-
+ (NSString *)pathPattern; // Used by providers. The pattern that matches against URLs for which the mapping should be used.
|
22
|
-
+ (RKObjectMapping *)requestMapping; // Used by providers. Returns the request RKObjectMapping
|
23
|
-
+ (RKObjectMapping *)responseMapping; // Used by providers. Returns the response RKObjectMapping
|
24
15
|
|
25
16
|
@end
|
data/lib/template/model.m.erb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_file_name%>.m
|
3
3
|
//
|
4
|
-
// This model was created on
|
4
|
+
// This model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
5
8
|
//
|
6
9
|
|
7
|
-
#import "<%=@model_file_name%>.h"
|
8
|
-
#import "RestKit.h"<% @attributes.each do |attribute| %><% if attribute[:relationship] %>
|
10
|
+
#import "<%=@model_file_name%>.h"<% @attributes.each do |attribute| %><% if attribute[:relationship] %>
|
9
11
|
#import "<%=attribute[:relationship]%>.h"<%end%><%end%>
|
10
12
|
|
11
13
|
@implementation <%=@class_name%><% if @using_core_data %>
|
@@ -13,62 +15,36 @@
|
|
13
15
|
// All properties in this NSManagedObject need to be defined with @dynamic<% @attributes.each do |attribute| %>
|
14
16
|
@dynamic <%=attribute[:name]%>;<% end %><% end %>
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
if (self == [<%=@class_name%> class])
|
19
|
-
{
|
20
|
-
}
|
21
|
-
}<% if @using_core_data %>
|
22
|
-
|
23
|
-
+ (NSString *)entityName
|
18
|
+
// Dictionary to convert self to JSON
|
19
|
+
+ (NSDictionary *)dictionaryForRequestMappings
|
24
20
|
{
|
25
|
-
return
|
21
|
+
return @{
|
22
|
+
// source key path : destination attribute name
|
23
|
+
<% @attributes.each_with_index do |attribute, index| %><% if !attribute[:relationship] %> @"<%=attribute[:name]%>": @"<%=attribute[:name]%>"<% if index != @attributes.size-1 %>,<% end %>
|
24
|
+
<% end %><% end %> };
|
26
25
|
}
|
27
26
|
|
28
|
-
|
27
|
+
// Dictionary to convert JSON to self
|
28
|
+
+ (NSDictionary *)dictionaryForResponseMappings
|
29
29
|
{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
@catch (NSException *exception) {
|
35
|
-
NSLog(@"[%@ %@] %@", [self description], NSStringFromSelector(_cmd), exception);
|
36
|
-
@throw exception;
|
37
|
-
}
|
38
|
-
return entity;
|
39
|
-
}<% end %>
|
40
|
-
|
41
|
-
+ (NSDictionary *)dictionaryForMappings
|
42
|
-
{
|
43
|
-
return @{
|
44
|
-
<% @attributes.each_with_index do |attribute, index| %><% if !attribute[:relationship] %> @"<%=attribute[:name]%>": @"<%=attribute[:name]%>"<% if index != @attributes.size-1 %>,<% end %>
|
30
|
+
return @{
|
31
|
+
// source key path : destination attribute name
|
32
|
+
<% @attributes.each_with_index do |attribute, index| %><% if !attribute[:relationship] %> @"<%=attribute[:name]%>": @"<%=attribute[:name]%>"<% if index != @attributes.size-1 %>,<% end %>
|
45
33
|
<% end %><% end %> };
|
46
34
|
}
|
47
35
|
|
48
36
|
+ (NSString *)keyPath
|
49
37
|
{
|
50
38
|
return @"<%=@model_name%>";
|
51
|
-
}
|
52
|
-
|
53
|
-
+ (NSString *)pathPattern
|
54
|
-
{
|
55
|
-
return nil;
|
56
|
-
}
|
57
|
-
|
58
|
-
+ (RKObjectMapping *)requestMapping
|
59
|
-
{
|
60
|
-
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping];
|
61
|
-
[requestMapping addAttributeMappingsFromDictionary:[self dictionaryForMappings]];
|
62
|
-
return requestMapping;
|
63
|
-
}
|
39
|
+
}<% if @any_relationships %>
|
64
40
|
|
65
41
|
+ (RKObjectMapping *)responseMapping
|
66
42
|
{
|
67
43
|
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[<%=@class_name%> class]];
|
68
|
-
[mapping addAttributeMappingsFromDictionary:[self
|
44
|
+
[mapping addAttributeMappingsFromDictionary:[self dictionaryForResponseMappings]];
|
69
45
|
<% @attributes.each_with_index do |attribute, index| %><% if attribute[:relationship] %>
|
70
46
|
[mapping addRelationshipMappingWithSourceKeyPath:@"<%=attribute[:name]%>" mapping:[<%=attribute[:relationship]%> responseMapping]];
|
71
47
|
<% end %><% end %> return mapping;
|
72
|
-
}
|
48
|
+
}<% end %>
|
73
49
|
|
74
50
|
@end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// <%=@model_base_file_name%>.h
|
3
|
+
//
|
4
|
+
// This base model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "RestKit.h"
|
11
|
+
|
12
|
+
@interface <%=@model_base_class_name%> : <% if @using_core_data %>NSManagedObject<% else %>NSObject<% end %>
|
13
|
+
|
14
|
+
+ (NSDictionary *)dictionaryForRequestMappings; // Used by providers.
|
15
|
+
+ (NSDictionary *)dictionaryForResponseMappings; // Used by providers.
|
16
|
+
+ (NSString *)keyPath; // Used by providers. The subset of the parsed response for which the mapping is to be used.
|
17
|
+
+ (NSString *)pathPattern; // Used by providers. The pattern that matches against URLs for which the mapping should be used.
|
18
|
+
+ (RKObjectMapping *)requestMapping; // Used by providers. Returns the request RKObjectMapping
|
19
|
+
+ (RKObjectMapping *)responseMapping; // Used by providers. Returns the response RKObjectMapping
|
20
|
+
<% if @using_core_data %>
|
21
|
+
+ (NSString *)entityName;
|
22
|
+
+ (<%=@class_name%> *)create:(NSManagedObjectContext *)moc;<% end %>
|
23
|
+
@end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
//
|
2
|
+
// <%=@model_base_file_name%>.m
|
3
|
+
//
|
4
|
+
// This base model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "<%=@model_base_file_name%>.h"
|
11
|
+
|
12
|
+
@implementation <%=@model_base_class_name%><% if @using_core_data %>
|
13
|
+
|
14
|
+
+ (NSString *)entityName
|
15
|
+
{
|
16
|
+
return NSStringFromClass([self class]);
|
17
|
+
}
|
18
|
+
|
19
|
+
+ (<%=@class_name%> *)create:(NSManagedObjectContext *)moc
|
20
|
+
{
|
21
|
+
<%=@class_name%> *entity = nil;
|
22
|
+
@try {
|
23
|
+
entity = [NSEntityDescription insertNewObjectForEntityForName:self.entityName inManagedObjectContext:moc];
|
24
|
+
}
|
25
|
+
@catch (NSException *exception) {
|
26
|
+
NSLog(@"[%@ %@] %@", [self description], NSStringFromSelector(_cmd), exception);
|
27
|
+
@throw exception;
|
28
|
+
}
|
29
|
+
return entity;
|
30
|
+
}<% end %>
|
31
|
+
|
32
|
+
// Dictionary to convert self to JSON
|
33
|
+
// Subclasses may need to override this method
|
34
|
+
+ (NSDictionary *)dictionaryForRequestMappings
|
35
|
+
{
|
36
|
+
return @{
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
// Dictionary to convert JSON to self
|
41
|
+
// Subclasses may need to override this method
|
42
|
+
+ (NSDictionary *)dictionaryForResponseMappings
|
43
|
+
{
|
44
|
+
return @{
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
// Subclasses should override this method
|
49
|
+
+ (NSString *)keyPath
|
50
|
+
{
|
51
|
+
return nil;
|
52
|
+
}
|
53
|
+
|
54
|
+
// Subclasses may need to override this method
|
55
|
+
+ (NSString *)pathPattern
|
56
|
+
{
|
57
|
+
return nil;
|
58
|
+
}
|
59
|
+
|
60
|
+
// Returns the request RKObjectMapping for this class
|
61
|
+
+ (RKObjectMapping *)requestMapping
|
62
|
+
{
|
63
|
+
RKObjectMapping *mapping = [RKObjectMapping requestMapping];
|
64
|
+
[mapping addAttributeMappingsFromDictionary:[self dictionaryForRequestMappings]];
|
65
|
+
return mapping;
|
66
|
+
}
|
67
|
+
|
68
|
+
// Returns the response RKObjectMapping for this class
|
69
|
+
// Subclasses may need to override this method
|
70
|
+
+ (RKObjectMapping *)responseMapping
|
71
|
+
{
|
72
|
+
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:self.class];
|
73
|
+
[mapping addAttributeMappingsFromDictionary:[self dictionaryForResponseMappings]];
|
74
|
+
return mapping;
|
75
|
+
}
|
76
|
+
|
77
|
+
@end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_fixtures_file_name%>.h
|
3
3
|
//
|
4
|
-
// This model fixture was created on
|
4
|
+
// This model fixture was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
5
8
|
//
|
6
9
|
|
7
10
|
#import <Foundation/Foundation.h>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_fixtures_file_name%>.m
|
3
3
|
//
|
4
|
-
// This model fixture was created on
|
4
|
+
// This model fixture was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
5
8
|
//
|
6
9
|
|
7
10
|
#import "<%=@model_fixtures_file_name%>.h"<% @attributes.each do |attribute| %><% if attribute[:relationship] %>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_tests_file_name%>.h
|
3
3
|
//
|
4
|
-
// This model test was created on
|
4
|
+
// This model test was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
5
8
|
//
|
6
9
|
|
7
10
|
#import <SenTestingKit/SenTestingKit.h>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
//
|
2
2
|
// <%=@model_tests_file_name%>.m
|
3
3
|
//
|
4
|
-
// This model test was created on
|
4
|
+
// This model test was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
5
8
|
//
|
6
9
|
|
7
10
|
#import "<%=@model_tests_file_name%>.h"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// <%=@provider_file_name%>.h
|
3
|
+
//
|
4
|
+
// This provider was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "<%=@provider_base_file_name%>.h"
|
11
|
+
#import "<%=@model_file_name%>.h"
|
12
|
+
|
13
|
+
@interface <%=@provider_name%> : <%=@provider_base_class_name%>
|
14
|
+
|
15
|
+
@end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
//
|
2
|
+
// <%=@provider_file_name%>.m
|
3
|
+
//
|
4
|
+
// This provider was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "<%=@provider_file_name%>.h"
|
11
|
+
|
12
|
+
@implementation <%=@provider_name%>
|
13
|
+
|
14
|
+
- (NSString *)baseURL
|
15
|
+
{
|
16
|
+
return @"<%=@provider_url%>";
|
17
|
+
}
|
18
|
+
|
19
|
+
- (Class)modelClass
|
20
|
+
{
|
21
|
+
return [<%=@model_class_name%> class];
|
22
|
+
}
|
23
|
+
|
24
|
+
- (id)processResult:(RKMappingResult *)mappingResult withError:(NSError **)error
|
25
|
+
{
|
26
|
+
<%=@model_class_name%> *results = [mappingResult firstObject];
|
27
|
+
id result = results;
|
28
|
+
return result;
|
29
|
+
}
|
30
|
+
|
31
|
+
@end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// <%=@provider_base_file_name%>.h
|
3
|
+
//
|
4
|
+
// This base provider was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "RestKit.h"
|
11
|
+
|
12
|
+
typedef void(^<%=@provider_base_class_name%>CallbackBlock)(NSError *error, id result);
|
13
|
+
|
14
|
+
@interface <%=@provider_base_class_name%> : NSObject
|
15
|
+
|
16
|
+
@property (nonatomic,strong) NSString *baseURL;
|
17
|
+
|
18
|
+
- (void)downloadWithCompletionBlock:(LKResourceProviderCallbackBlock)completionBlock;
|
19
|
+
- (Class)modelClass;
|
20
|
+
- (id)processResult:(RKMappingResult *)mappingResult withError:(NSError **)error;
|
21
|
+
- (RKResponseDescriptor *)responseDescriptor;
|
22
|
+
|
23
|
+
@end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
//
|
2
|
+
// <%=@provider_base_file_name%>.m
|
3
|
+
//
|
4
|
+
// This base provider was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "<%=@provider_base_file_name%>.h"
|
11
|
+
#import "LKModel.h"
|
12
|
+
|
13
|
+
@implementation <%=@provider_base_class_name%>
|
14
|
+
|
15
|
+
- (void)downloadWithCompletionBlock:(LKResourceProviderCallbackBlock)completionBlock
|
16
|
+
{
|
17
|
+
NSString *baseURL = self.baseURL;
|
18
|
+
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:baseURL]];
|
19
|
+
RKResponseDescriptor *responseDescriptor = [self responseDescriptor];
|
20
|
+
RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];
|
21
|
+
|
22
|
+
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
|
23
|
+
NSError *error = nil;
|
24
|
+
id result = [self processResult:mappingResult withError:&error];
|
25
|
+
completionBlock(nil, result);
|
26
|
+
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
|
27
|
+
completionBlock(error, nil);
|
28
|
+
}];
|
29
|
+
[operation start];
|
30
|
+
}
|
31
|
+
|
32
|
+
// Subclasses should override this method
|
33
|
+
- (Class)modelClass
|
34
|
+
{
|
35
|
+
return [LKModel class];
|
36
|
+
}
|
37
|
+
|
38
|
+
// Subclasses should override this method
|
39
|
+
- (id)processResult:(RKMappingResult *)mappingResult withError:(NSError **)error
|
40
|
+
{
|
41
|
+
return nil;
|
42
|
+
}
|
43
|
+
|
44
|
+
// Subclasses may need to override this method
|
45
|
+
- (RKResponseDescriptor *)responseDescriptor
|
46
|
+
{
|
47
|
+
NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful);
|
48
|
+
return [RKResponseDescriptor responseDescriptorWithMapping:[self.modelClass responseMapping]
|
49
|
+
method:RKRequestMethodGET
|
50
|
+
pathPattern:[self.modelClass pathPattern]
|
51
|
+
keyPath:[self.modelClass keyPath]
|
52
|
+
statusCodes:statusCodes];
|
53
|
+
}
|
54
|
+
|
55
|
+
@end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lanekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Larry Aasen
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: thor
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: xcodeproj
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,11 +38,13 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: 0.5.5
|
41
|
-
description:
|
46
|
+
description: an iOS Objective-C code generator for models and resource providers for
|
47
|
+
integration with RestKit.
|
42
48
|
email:
|
43
49
|
- larryaasen@gmail.com
|
44
50
|
executables:
|
@@ -46,41 +52,53 @@ executables:
|
|
46
52
|
extensions: []
|
47
53
|
extra_rdoc_files: []
|
48
54
|
files:
|
55
|
+
- lib/lanekit/generate/model.rb
|
56
|
+
- lib/lanekit/generate/provider.rb
|
57
|
+
- lib/lanekit/generate.rb
|
49
58
|
- lib/lanekit/version.rb
|
50
59
|
- lib/lanekit.rb
|
51
60
|
- lib/template/model.h.erb
|
52
61
|
- lib/template/model.m.erb
|
62
|
+
- lib/template/model_base.h.erb
|
63
|
+
- lib/template/model_base.m.erb
|
53
64
|
- lib/template/model_fixture.h.erb
|
54
65
|
- lib/template/model_fixture.json.erb
|
55
66
|
- lib/template/model_fixture.m.erb
|
56
67
|
- lib/template/model_test.h.erb
|
57
68
|
- lib/template/model_test.m.erb
|
69
|
+
- lib/template/provider.h.erb
|
70
|
+
- lib/template/provider.m.erb
|
71
|
+
- lib/template/provider_base.h.erb
|
72
|
+
- lib/template/provider_base.m.erb
|
58
73
|
- bin/lanekit
|
59
74
|
- README.md
|
60
75
|
- LICENSE
|
61
76
|
homepage: https://github.com/LarryAasen/LaneKit
|
62
77
|
licenses:
|
63
78
|
- MIT
|
64
|
-
metadata: {}
|
65
79
|
post_install_message:
|
66
80
|
rdoc_options: []
|
67
81
|
require_paths:
|
68
82
|
- lib
|
69
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
70
85
|
requirements:
|
71
86
|
- - ! '>='
|
72
87
|
- !ruby/object:Gem::Version
|
73
88
|
version: 1.8.7
|
74
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
75
91
|
requirements:
|
76
92
|
- - ! '>='
|
77
93
|
- !ruby/object:Gem::Version
|
78
94
|
version: '0'
|
79
95
|
requirements: []
|
80
96
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
97
|
+
rubygems_version: 1.8.23
|
82
98
|
signing_key:
|
83
|
-
specification_version:
|
84
|
-
summary: LaneKit is
|
85
|
-
RestKit.
|
99
|
+
specification_version: 3
|
100
|
+
summary: LaneKit is an iOS Objective-C code generator of models and resource providers
|
101
|
+
for integration with RestKit. It includes support for unit testing with SenTestingKit
|
102
|
+
including fixtures and tests. LaneKit is a command line app written in Ruby and
|
103
|
+
packaged as a Ruby Gem.
|
86
104
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
M2ZkNjM1Yjk4OGNhNGQ2OWNhNTM1ZDY4Y2FhZGY1ZDE4ZThjMDA2YQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MDNhY2RiNDIwMzk5ZWY5NzBlMDM4ODgxNjlhMDAxM2MyYzg0NWZhZQ==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NGVhOWRlMjg2YTNiMTQ3NDZiYzU5NGE3MDUzNmIwNzRlMTMxYTViM2E3YjM1
|
10
|
-
ZGUxOTA5YjRhNWMxMmY3ZjBlZWFiMDkyYmI0NjQ3YTk5ZmEzZGJhODAwMDcx
|
11
|
-
ZDI0OWVlMmIwOGQzMzJkM2U2ZWYyMTAxODRiYTE2NWY0YmVhMmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
N2FkYmExMzRhZmQ4OTJhMjY4NmE0YTFkYzYxNmE2NGUwNmMyZGY2YWFkZGJh
|
14
|
-
NjVhODE3YTc4Y2E3M2M1MmRlNmRkNTFhMmI1Y2RiMTZmZjM0OTkzMTliYWE4
|
15
|
-
ZDk4YzJiOWY5NWQ0ZjUwZWQ3YmQ0MTMwOGM1OTdmNjRhMGVlNTE=
|