lanekit 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +30 -16
- data/lib/lanekit/version.rb +1 -1
- data/lib/lanekit.rb +2 -2
- data/lib/template/model.h.erb +3 -2
- data/lib/template/model.m.erb +22 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjhjZDVkYzIyYmY4ZWM4OWQ1Y2VlOTRhZTI1N2RiNGMwNDZiOTg1Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDg1NmM1MDlmYmRkMGQ3M2ZkMTQ4ODdiZTZlZWYzN2QzYjUwN2Q4Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmRkODljYjQ5ODE4NTBhNmZhMzU2Y2I2YTA0MThkYmM2MDYxNzdlYzRmNWY0
|
10
|
+
NWE4YjdmNTkzMzgwNzlmYzFkMmY0ZWY5MjA3ZDM1NzU2MjFlMzMwOWM0MTdm
|
11
|
+
NDQ4YzA0ZWI1NmJjMTg2MjNmNzc2NmI3MGVjNGNhNDUzMjFhYjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmMxZThlYzk5NDFmODg2MGU4ZWYwM2MwMzNiNDkwODljOWE3NjZmMzViNDQx
|
14
|
+
OTc2NTZjZDJhM2IxMWNhYzVjM2U3NDlkMjYzNDQ5MmU1NDM2N2RmMTcwOTM5
|
15
|
+
MDZmMGE4NmM1MzE1YzBkMzRlNGQ5ZTQ4NDgzNzUzYjM2ZTE4ODU=
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ and here is the Objective-C header file that was generated by LaneKit:
|
|
30
30
|
//
|
31
31
|
// Video.h
|
32
32
|
//
|
33
|
-
// This model was created on 2013-
|
33
|
+
// This model was created on 2013-07-23 by LaneKit v0.1.6.
|
34
34
|
//
|
35
35
|
// The following LaneKit command was used to generate this model:
|
36
36
|
// lanekit generate model Video duration:string headline:string image:string location:string
|
@@ -44,10 +44,11 @@ and here is the Objective-C header file that was generated by LaneKit:
|
|
44
44
|
|
45
45
|
@property (nonatomic,strong) NSString *duration;
|
46
46
|
@property (nonatomic,strong) NSString *headline;
|
47
|
-
@property (nonatomic,strong) NSString *image;
|
47
|
+
@property (nonatomic,strong) NSString *image;
|
48
48
|
@property (nonatomic,strong) NSString *location;
|
49
49
|
|
50
|
-
+ (RKObjectMapping *)
|
50
|
+
+ (RKObjectMapping *)requestMapping;
|
51
|
+
+ (RKObjectMapping *)responseMapping;
|
51
52
|
|
52
53
|
@end
|
53
54
|
```
|
@@ -58,7 +59,7 @@ and here is the Objective-C .m file that was generated by LaneKit:
|
|
58
59
|
//
|
59
60
|
// Video.m
|
60
61
|
//
|
61
|
-
// This model was created on 2013-
|
62
|
+
// This model was created on 2013-07-23 by LaneKit v0.1.6.
|
62
63
|
//
|
63
64
|
//
|
64
65
|
|
@@ -67,6 +68,7 @@ and here is the Objective-C .m file that was generated by LaneKit:
|
|
67
68
|
#import "SystemConfiguration/SystemConfiguration.h"
|
68
69
|
#import "RestKit.h"
|
69
70
|
|
71
|
+
|
70
72
|
@implementation Video
|
71
73
|
|
72
74
|
+ (void)initialize
|
@@ -76,25 +78,37 @@ and here is the Objective-C .m file that was generated by LaneKit:
|
|
76
78
|
}
|
77
79
|
}
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
+
+ (NSDictionary *)dictionaryForMappings
|
82
|
+
{
|
83
|
+
return @{
|
84
|
+
@"duration": @"duration",
|
85
|
+
@"headline": @"headline",
|
86
|
+
@"image": @"image",
|
87
|
+
@"location": @"location"
|
88
|
+
};
|
89
|
+
}
|
90
|
+
|
91
|
+
// Returns the request RKObjectMapping
|
92
|
+
+ (RKObjectMapping *)requestMapping
|
93
|
+
{
|
94
|
+
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping];
|
95
|
+
[requestMapping addAttributeMappingsFromDictionary:[self dictionaryForMappings]];
|
96
|
+
return requestMapping;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Returns the response RKObjectMapping
|
100
|
+
+ (RKObjectMapping *)responseMapping
|
81
101
|
{
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
@"headline": @"headline",
|
86
|
-
@"image": @"image",
|
87
|
-
@"location": @"location"
|
88
|
-
}];
|
89
|
-
|
90
|
-
return mapping;
|
102
|
+
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Video class]];
|
103
|
+
[mapping addAttributeMappingsFromDictionary:[self dictionaryForMappings]];
|
104
|
+
return mapping;
|
91
105
|
}
|
92
106
|
|
93
107
|
@end
|
94
108
|
```
|
95
109
|
|
96
110
|
|
97
|
-
### Add a new model called Contents that contains a list of Videos.
|
111
|
+
### Add a new model called Contents that contains a list of Videos and uses a relationship mapping.
|
98
112
|
```
|
99
113
|
$ lanekit generate model contents contents:array:Video
|
100
114
|
exist Classes/model
|
data/lib/lanekit/version.rb
CHANGED
data/lib/lanekit.rb
CHANGED
@@ -55,12 +55,12 @@ module LaneKit
|
|
55
55
|
class Generate < Thor
|
56
56
|
include Thor::Actions
|
57
57
|
|
58
|
-
desc "model [name] [name:type, name:type, ...] where type is [date|integer|string|<class_name>]", "Generates an Objective-C model for RestKit"
|
59
|
-
method_options :banner => ""
|
58
|
+
desc "model [name] [name:type:relationship, name:type:relationship, ...] where type is [date|integer|string|<class_name>] and relationship (optional) is []", "Generates an Objective-C model for RestKit"
|
60
59
|
def model(model_name, *attributes)
|
61
60
|
@model_name = LaneKit.derive_model_name(model_name)
|
62
61
|
@file_name = LaneKit.derive_file_name(@model_name)
|
63
62
|
@class_name = LaneKit.derive_class_name(@model_name)
|
63
|
+
@lanekit_version = VERSION;
|
64
64
|
|
65
65
|
@attributes = []
|
66
66
|
@any_relationships = false
|
data/lib/template/model.h.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
//
|
2
2
|
// <%=@file_name%>.h
|
3
3
|
//
|
4
|
-
// This model was created on <%=@model_date%> by LaneKit
|
4
|
+
// This model was created on <%=@model_date%> by LaneKit v<%=@lanekit_version%>.
|
5
5
|
//
|
6
6
|
// The following LaneKit command was used to generate this model:
|
7
7
|
// <%=@command%>
|
@@ -16,6 +16,7 @@
|
|
16
16
|
<% @attributes.each do |attribute| %>
|
17
17
|
@property (nonatomic,strong) <%=attribute[:objective_c_type]%><%=attribute[:name]%>;<% if attribute[:relationship] %> // relates to: <%=attribute[:relationship]%><% end %><% end %>
|
18
18
|
|
19
|
-
+ (RKObjectMapping *)
|
19
|
+
+ (RKObjectMapping *)requestMapping;
|
20
|
+
+ (RKObjectMapping *)responseMapping;
|
20
21
|
|
21
22
|
@end
|
data/lib/template/model.m.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
//
|
2
2
|
// <%=@file_name%>.m
|
3
3
|
//
|
4
|
-
// This model was created on <%=@model_date%> by LaneKit
|
4
|
+
// This model was created on <%=@model_date%> by LaneKit v<%=@lanekit_version%>.
|
5
5
|
//
|
6
6
|
//
|
7
7
|
|
@@ -20,18 +20,29 @@
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
23
|
-
|
24
|
-
+ (RKObjectMapping *)modelMapping
|
23
|
+
+ (NSDictionary *)dictionaryForMappings
|
25
24
|
{
|
26
|
-
|
27
|
-
|
28
|
-
<%
|
29
|
-
|
25
|
+
return @{
|
26
|
+
<% @attributes.each_with_index do |attribute, index| %><% if !attribute[:relationship] %> @"<%=attribute[:name]%>": @"<%=attribute[:name]%>"<% if index != @attributes.size-1 %>,<% end %>
|
27
|
+
<% end %><% end %> };
|
28
|
+
}
|
29
|
+
|
30
|
+
// Returns the request RKObjectMapping
|
31
|
+
+ (RKObjectMapping *)requestMapping
|
32
|
+
{
|
33
|
+
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping];
|
34
|
+
[requestMapping addAttributeMappingsFromDictionary:[self dictionaryForMappings]];
|
35
|
+
return requestMapping;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Returns the response RKObjectMapping
|
39
|
+
+ (RKObjectMapping *)responseMapping
|
40
|
+
{
|
41
|
+
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[<%=@class_name%> class]];
|
42
|
+
[mapping addAttributeMappingsFromDictionary:[self dictionaryForMappings]];
|
30
43
|
<% @attributes.each_with_index do |attribute, index| %><% if attribute[:relationship] %>
|
31
|
-
|
32
|
-
<% end %><% end %>
|
33
|
-
|
34
|
-
return mapping;
|
44
|
+
[mapping addRelationshipMappingWithSourceKeyPath:@"<%=attribute[:name]%>" mapping:[<%=attribute[:relationship]%> modelMapping]];
|
45
|
+
<% end %><% end %> return mapping;
|
35
46
|
}
|
36
47
|
|
37
48
|
@end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lanekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Aasen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|