mt_tool 0.1.5 → 1.0.0
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/Gemfile +6 -1
- data/README.md +69 -16
- data/Rakefile +14 -1
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/mt_tool/commands.rb +43 -36
- data/lib/mt_tool/module/module.rb +1 -1
- data/lib/mt_tool/module/template/swift/Interactor.swift +1 -1
- data/lib/mt_tool/version.rb +1 -1
- data/mt_tool.gemspec +23 -28
- metadata +72 -165
- data/.MTModuleFilesConfig.yml +0 -5
- data/.idea/.gitignore +0 -8
- data/.idea/misc.xml +0 -4
- data/.idea/modules.xml +0 -8
- data/.idea/mt_tool.iml +0 -95
- data/.idea/sonarlint/issuestore/4/7/4745e92ab1b53af3e65026337909045741e13bea +0 -0
- data/.idea/sonarlint/issuestore/5/2/5283f86f6adbda087dceb47c69b64e141dfb1e93 +0 -0
- data/.idea/sonarlint/issuestore/7/0/70213f721c971c9a12d0f46060f7ee2a087b4a96 +0 -0
- data/.idea/sonarlint/issuestore/b/5/b53eec12e0ab8df9876dbc7fe65915bb985c4f72 +0 -0
- data/.idea/sonarlint/issuestore/e/8/e84cc700d4480c1d3ca7dcc158063e40a25cee12 +0 -0
- data/.idea/sonarlint/issuestore/f/8/f80e2edcdaf9ddf9362d26f7fa5d19df422f29c7 +0 -0
- data/.idea/sonarlint/issuestore/index.pb +0 -13
- data/.idea/vcs.xml +0 -7
- data/Gemfile.lock +0 -138
- data/img/69786f8e2a527b8c26f2c1311e230e5f.webp.png +0 -0
- data/img/SCR-20240619-msnz.png +0 -0
- data/lib/mt_tool/module/template/objc/Bundle.h +0 -21
- data/lib/mt_tool/module/template/objc/Bundle.m +0 -28
- data/lib/mt_tool/module/template/objc/CategoryHeader.h +0 -15
- data/lib/mt_tool/module/template/objc/PrefixHeader.pch +0 -36
- data/lib/mt_tool/module/template/objc/RouterDefine.h +0 -14
- data/lib/mt_tool/module/template/objc/RouterRegister.h +0 -16
- data/lib/mt_tool/module/template/objc/RouterRegister.m +0 -33
- data/lib/mt_tool/module/template/objc/ServiceProtocol.h +0 -15
- data/lib/mt_tool/module/template/objc/ServiceRegister.h +0 -16
- data/lib/mt_tool/module/template/objc/ServiceRegister.m +0 -25
- data/lib/mt_tool/module/template/objc/ToolsHeader.h +0 -13
- data/lib/mt_tool/module/template/objc/VendorHeader.h +0 -13
- data/lib/mt_tool/module/template/objc/demo/DemoViewController.h +0 -17
- data/lib/mt_tool/module/template/objc/demo/DemoViewController.m +0 -28
- data/lib/mt_tool/module/template/objc/demo/DemoViewModel.h +0 -14
- data/lib/mt_tool/module/template/objc/demo/DemoViewModel.m +0 -19
- data/lib/mt_tool/oc_model/main.rb +0 -112
- data/lib/mt_tool/oc_model/oc_model.rb +0 -235
- data/lib/mt_tool/oc_model/sample.json +0 -11
- data/lib/mt_tool/short_hand/objc_generate_from_shorthand.rb +0 -182
- data/lib/mt_tool/short_hand/objc_header.mustache +0 -41
- data/lib/mt_tool/short_hand/objc_implementation.mustache +0 -99
- data/lib/mt_tool/short_hand/objc_shorthand.rb +0 -64
- data/sig/mt_tool.rbs +0 -4
data/Gemfile.lock
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mt_tool (0.1.4)
|
5
|
-
activesupport
|
6
|
-
bundler
|
7
|
-
colored
|
8
|
-
colored2
|
9
|
-
mustache
|
10
|
-
pathname
|
11
|
-
thor
|
12
|
-
xcodeproj
|
13
|
-
|
14
|
-
GEM
|
15
|
-
remote: https://rubygems.org/
|
16
|
-
specs:
|
17
|
-
CFPropertyList (3.0.5)
|
18
|
-
rexml
|
19
|
-
activesupport (6.1.6)
|
20
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
-
i18n (>= 1.6, < 2)
|
22
|
-
minitest (>= 5.1)
|
23
|
-
tzinfo (~> 2.0)
|
24
|
-
zeitwerk (~> 2.3)
|
25
|
-
addressable (2.8.0)
|
26
|
-
public_suffix (>= 2.0.2, < 5.0)
|
27
|
-
algoliasearch (1.27.5)
|
28
|
-
httpclient (~> 2.8, >= 2.8.3)
|
29
|
-
json (>= 1.5.1)
|
30
|
-
atomos (0.1.3)
|
31
|
-
claide (1.1.0)
|
32
|
-
cocoapods (1.11.3)
|
33
|
-
addressable (~> 2.8)
|
34
|
-
claide (>= 1.0.2, < 2.0)
|
35
|
-
cocoapods-core (= 1.11.3)
|
36
|
-
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
37
|
-
cocoapods-downloader (>= 1.4.0, < 2.0)
|
38
|
-
cocoapods-plugins (>= 1.0.0, < 2.0)
|
39
|
-
cocoapods-search (>= 1.0.0, < 2.0)
|
40
|
-
cocoapods-trunk (>= 1.4.0, < 2.0)
|
41
|
-
cocoapods-try (>= 1.1.0, < 2.0)
|
42
|
-
colored2 (~> 3.1)
|
43
|
-
escape (~> 0.0.4)
|
44
|
-
fourflusher (>= 2.3.0, < 3.0)
|
45
|
-
gh_inspector (~> 1.0)
|
46
|
-
molinillo (~> 0.8.0)
|
47
|
-
nap (~> 1.0)
|
48
|
-
ruby-macho (>= 1.0, < 3.0)
|
49
|
-
xcodeproj (>= 1.21.0, < 2.0)
|
50
|
-
cocoapods-core (1.11.3)
|
51
|
-
activesupport (>= 5.0, < 7)
|
52
|
-
addressable (~> 2.8)
|
53
|
-
algoliasearch (~> 1.0)
|
54
|
-
concurrent-ruby (~> 1.1)
|
55
|
-
fuzzy_match (~> 2.0.4)
|
56
|
-
nap (~> 1.0)
|
57
|
-
netrc (~> 0.11)
|
58
|
-
public_suffix (~> 4.0)
|
59
|
-
typhoeus (~> 1.0)
|
60
|
-
cocoapods-deintegrate (1.0.5)
|
61
|
-
cocoapods-downloader (1.6.3)
|
62
|
-
cocoapods-plugins (1.0.0)
|
63
|
-
nap
|
64
|
-
cocoapods-search (1.0.1)
|
65
|
-
cocoapods-trunk (1.6.0)
|
66
|
-
nap (>= 0.8, < 2.0)
|
67
|
-
netrc (~> 0.11)
|
68
|
-
cocoapods-try (1.2.0)
|
69
|
-
colored (1.2)
|
70
|
-
colored2 (3.1.2)
|
71
|
-
concurrent-ruby (1.1.10)
|
72
|
-
diff-lcs (1.5.0)
|
73
|
-
escape (0.0.4)
|
74
|
-
ethon (0.15.0)
|
75
|
-
ffi (>= 1.15.0)
|
76
|
-
ffi (1.15.5)
|
77
|
-
fourflusher (2.3.1)
|
78
|
-
fuzzy_match (2.0.4)
|
79
|
-
gh_inspector (1.1.3)
|
80
|
-
httpclient (2.8.3)
|
81
|
-
i18n (1.10.0)
|
82
|
-
concurrent-ruby (~> 1.0)
|
83
|
-
json (2.6.2)
|
84
|
-
minitest (5.15.0)
|
85
|
-
molinillo (0.8.0)
|
86
|
-
mustache (1.1.1)
|
87
|
-
nanaimo (0.3.0)
|
88
|
-
nap (1.1.0)
|
89
|
-
netrc (0.11.0)
|
90
|
-
pathname (0.2.0)
|
91
|
-
public_suffix (4.0.7)
|
92
|
-
rake (13.0.6)
|
93
|
-
rexml (3.2.5)
|
94
|
-
rspec (3.11.0)
|
95
|
-
rspec-core (~> 3.11.0)
|
96
|
-
rspec-expectations (~> 3.11.0)
|
97
|
-
rspec-mocks (~> 3.11.0)
|
98
|
-
rspec-core (3.11.0)
|
99
|
-
rspec-support (~> 3.11.0)
|
100
|
-
rspec-expectations (3.11.0)
|
101
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
-
rspec-support (~> 3.11.0)
|
103
|
-
rspec-mocks (3.11.1)
|
104
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
105
|
-
rspec-support (~> 3.11.0)
|
106
|
-
rspec-support (3.11.0)
|
107
|
-
ruby-macho (2.5.1)
|
108
|
-
thor (1.2.1)
|
109
|
-
typhoeus (1.4.0)
|
110
|
-
ethon (>= 0.9.0)
|
111
|
-
tzinfo (2.0.4)
|
112
|
-
concurrent-ruby (~> 1.0)
|
113
|
-
xcodeproj (1.21.0)
|
114
|
-
CFPropertyList (>= 2.3.3, < 4.0)
|
115
|
-
atomos (~> 0.1.3)
|
116
|
-
claide (>= 1.0.2, < 2.0)
|
117
|
-
colored2 (~> 3.1)
|
118
|
-
nanaimo (~> 0.3.0)
|
119
|
-
rexml (~> 3.2.4)
|
120
|
-
zeitwerk (2.5.4)
|
121
|
-
|
122
|
-
PLATFORMS
|
123
|
-
x86_64-darwin-21
|
124
|
-
|
125
|
-
DEPENDENCIES
|
126
|
-
bundler
|
127
|
-
cocoapods
|
128
|
-
cocoapods-core
|
129
|
-
colored
|
130
|
-
colored2
|
131
|
-
mt_tool!
|
132
|
-
rake (~> 13.0)
|
133
|
-
rspec (~> 3.2)
|
134
|
-
thor
|
135
|
-
xcodeproj
|
136
|
-
|
137
|
-
BUNDLED WITH
|
138
|
-
2.3.11
|
Binary file
|
data/img/SCR-20240619-msnz.png
DELETED
Binary file
|
@@ -1,21 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>Bundle.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
|
10
|
-
#import <Foundation/Foundation.h>
|
11
|
-
|
12
|
-
NS_ASSUME_NONNULL_BEGIN
|
13
|
-
|
14
|
-
@interface <%= @prefixed_module %>Bundle : NSObject
|
15
|
-
|
16
|
-
+ (UINib *)bundlerNib:(NSString *)nibName ;
|
17
|
-
+ (NSBundle *)currentBundle;
|
18
|
-
|
19
|
-
@end
|
20
|
-
|
21
|
-
NS_ASSUME_NONNULL_END
|
@@ -1,28 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>Bundle.m
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import "<%= @prefixed_module %>Bundle.h"
|
10
|
-
|
11
|
-
@implementation <%= @prefixed_module %>Bundle
|
12
|
-
|
13
|
-
+ (UINib *)bundlerNib:(NSString *)nibName {
|
14
|
-
return [UINib nibWithNibName:nibName bundle:[self currentBundle]];
|
15
|
-
}
|
16
|
-
|
17
|
-
+ (NSBundle *)currentBundle {
|
18
|
-
NSString *bundleName = @"<%= @project %>";
|
19
|
-
NSURL *associateBundleURL = [[NSBundle mainBundle] URLForResource:bundleName withExtension:@"bundle"];
|
20
|
-
if (!associateBundleURL) {
|
21
|
-
NSBundle *subBundle = [NSBundle bundleForClass:self];
|
22
|
-
associateBundleURL = [subBundle URLForResource:bundleName withExtension:@"bundle"];
|
23
|
-
}
|
24
|
-
NSBundle *bundle = [NSBundle bundleWithURL:associateBundleURL];
|
25
|
-
return bundle;
|
26
|
-
}
|
27
|
-
|
28
|
-
@end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>CategoryHeader.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef <%= @prefixed_module %>CategoryHeader_h
|
10
|
-
#define <%= @prefixed_module %>CategoryHeader_h
|
11
|
-
|
12
|
-
#import <MTCategoryComponent/MTCategoryComponentHeader.h>
|
13
|
-
|
14
|
-
|
15
|
-
#endif /* <%= @prefixed_module %>CategoryHeader_h */
|
@@ -1,36 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>PrefixHeader.pch
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
|
10
|
-
#ifndef <%= @prefixed_module %>PrefixHeader_pch
|
11
|
-
#define <%= @prefixed_module %>PrefixHeader_pch
|
12
|
-
|
13
|
-
// Include any system framework and library headers here that should be included in all compilation units.
|
14
|
-
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
|
15
|
-
|
16
|
-
|
17
|
-
#ifdef __OBJC__
|
18
|
-
#import <Foundation/Foundation.h>
|
19
|
-
#import <UIKit/UIKit.h>
|
20
|
-
|
21
|
-
#import "<%= @prefixed_module %>CategoryHeader.h"
|
22
|
-
#import "<%= @prefixed_module %>VendorHeader.h"
|
23
|
-
#import "<%= @prefixed_module %>ToolsHeader.h"
|
24
|
-
|
25
|
-
#import <MTBaseKit/MTBaseKitHeader.h>
|
26
|
-
#import <MTCategoryComponent/MTCategoryComponentHeader.h>
|
27
|
-
#import <MTLayoutUtilityComponent/MTLayoutUtilityComponentHeader.h>
|
28
|
-
#import <AssetModule/MTModuleImage.h>
|
29
|
-
#import <MJExtension/MJExtension.h>
|
30
|
-
|
31
|
-
#endif
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
#endif /* <%= @prefixed_module %>PrefixHeader_pch */
|
@@ -1,14 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>RouterDefine.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef <%= @prefixed_module %>RouterDefine_h
|
10
|
-
#define <%= @prefixed_module %>RouterDefine_h
|
11
|
-
|
12
|
-
static NSString *kDemoRouterString = @"<%= @prefixed_module %>DemoPage";
|
13
|
-
|
14
|
-
#endif /* <%= @prefixed_module %>RouterDefine_h */
|
@@ -1,16 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>RouterRegister.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <Foundation/Foundation.h>
|
10
|
-
|
11
|
-
/**
|
12
|
-
Router Register for the <%= @module %> module.
|
13
|
-
*/
|
14
|
-
@interface <%= @prefixed_module %>RouterRegister : NSObject
|
15
|
-
|
16
|
-
@end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>RouterRegister.m
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import "<%= @prefixed_module %>RouterRegister.h"
|
10
|
-
|
11
|
-
#import <MTBaseKit/MTBaseKitHeader.h>
|
12
|
-
#import <MTCategoryComponent/MTCategoryComponentHeader.h>
|
13
|
-
|
14
|
-
#import "<%= @prefixed_module %>RouterDefine.h"
|
15
|
-
|
16
|
-
#import "<%= @prefixed_module %>DemoViewController.h"
|
17
|
-
|
18
|
-
#import <<%= @module %>/<%= @module %>-Swift.h>
|
19
|
-
|
20
|
-
@implementation <%= @prefixed_module %>RouterRegister
|
21
|
-
|
22
|
-
@MTRouterRegister() {
|
23
|
-
|
24
|
-
[[MTRouterComponent shareInstance] registerUrlPartterns:kDemoRouterString error:nil action:^(MTRouterUrlRequest * _Nonnull urlRequest, MTRouterUrlCompletion _Nonnull completetion) {
|
25
|
-
|
26
|
-
<%= @prefixed_module %>DemoViewController *vc = [[<%= @prefixed_module %>DemoViewController alloc] init];
|
27
|
-
[[UIViewController mt_topViewController].navigationController pushViewController:vc animated:YES];
|
28
|
-
|
29
|
-
}];
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
@end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>ServiceProtocol.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <Foundation/Foundation.h>
|
10
|
-
|
11
|
-
@protocol <%= @prefixed_module %>ServiceProtocol <NSObject>
|
12
|
-
|
13
|
-
- (void)replaceThisMethod;
|
14
|
-
|
15
|
-
@end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>ServiceRegister.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <Foundation/Foundation.h>
|
10
|
-
|
11
|
-
/**
|
12
|
-
Service Register for the <%= @module %> module.
|
13
|
-
*/
|
14
|
-
@interface <%= @prefixed_module %>ServiceRegister : NSObject
|
15
|
-
|
16
|
-
@end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>ServiceRegister.m
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import "<%= @prefixed_module %>ServiceRegister.h"
|
10
|
-
#import <MTBaseKit/MTBaseKitHeader.h>
|
11
|
-
|
12
|
-
#import "<%= @prefixed_module %>ServiceProtocol.h"
|
13
|
-
|
14
|
-
|
15
|
-
#import "<%= @prefixed_module %>DemoViewModel.h"
|
16
|
-
|
17
|
-
|
18
|
-
@implementation <%= @prefixed_module %>ServiceRegister
|
19
|
-
|
20
|
-
@MTModuleServiceRegister(){
|
21
|
-
MTModuleServiceRegisterExecute(<%= @prefixed_module %>DemoViewModel.class, @protocol(<%= @prefixed_module %>ServiceProtocol), nil);
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
@end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>ToolsHeader.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef <%= @prefixed_module %>ToolsHeader_h
|
10
|
-
#define <%= @prefixed_module %>ToolsHeader_h
|
11
|
-
|
12
|
-
#import "<%= @prefixed_module %>Bundle.h"
|
13
|
-
#endif /* <%= @prefixed_module %>ToolsHeader_h */
|
@@ -1,13 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>VendorHeader.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#ifndef <%= @prefixed_module %>VendorHeader_h
|
10
|
-
#define <%= @prefixed_module %>VendorHeader_h
|
11
|
-
|
12
|
-
|
13
|
-
#endif /* <%= @prefixed_module %>VendorHeader_h */
|
@@ -1,17 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>DemoViewController.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <UIKit/UIKit.h>
|
10
|
-
|
11
|
-
NS_ASSUME_NONNULL_BEGIN
|
12
|
-
|
13
|
-
@interface <%= @prefixed_module %>DemoViewController : UIViewController
|
14
|
-
|
15
|
-
@end
|
16
|
-
|
17
|
-
NS_ASSUME_NONNULL_END
|
@@ -1,28 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>DemoViewController.m
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
|
10
|
-
#import "<%= @prefixed_module %>DemoViewController.h"
|
11
|
-
|
12
|
-
@interface <%= @prefixed_module %>DemoViewController ()
|
13
|
-
|
14
|
-
@end
|
15
|
-
|
16
|
-
@implementation <%= @prefixed_module %>DemoViewController
|
17
|
-
|
18
|
-
- (void)viewDidLoad {
|
19
|
-
[super viewDidLoad];
|
20
|
-
// Do any additional setup after loading the view from its nib.
|
21
|
-
NSLog(@"----- viewDidLoad -----");
|
22
|
-
self.view.backgroundColor = [UIColor colorWithRed:0.3 green:0.4 blue:0.35 alpha:1.0];
|
23
|
-
self.navigationItem.title = @"<%= @prefixed_module %>DemoViewController";
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>DemoViewModel.h
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <Foundation/Foundation.h>
|
10
|
-
|
11
|
-
#import "<%= @prefixed_module %>ServiceProtocol.h"
|
12
|
-
@interface <%= @prefixed_module %>DemoViewModel : NSObject <<%= @prefixed_module %>ServiceProtocol>
|
13
|
-
|
14
|
-
@end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// <%= @prefixed_module %>DemoViewModel.m
|
3
|
-
// <%= @project %>
|
4
|
-
//
|
5
|
-
// Created by <%= @author %> on <%= @date %>.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import "<%= @prefixed_module %>DemoViewModel.h"
|
10
|
-
|
11
|
-
|
12
|
-
@implementation <%= @prefixed_module %>DemoViewModel
|
13
|
-
|
14
|
-
- (void)replaceThisMethod {
|
15
|
-
NSLog(@"----- replace me -----");
|
16
|
-
}
|
17
|
-
|
18
|
-
|
19
|
-
@end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
$class_full_name = ARGV[0]
|
4
|
-
input_file_path = ARGV[1]
|
5
|
-
|
6
|
-
input_file = File.read(input_file_path)
|
7
|
-
input_json = JSON.parse(input_file)
|
8
|
-
|
9
|
-
input_dir = File.dirname(input_file_path)
|
10
|
-
|
11
|
-
# constants
|
12
|
-
OBJC_TYPE_STRING = "NSString *"
|
13
|
-
OBJC_TYPE_NUMBER = "NSNumber *"
|
14
|
-
OBJC_TYPE_NSDIC = "NSDictionary *"
|
15
|
-
OBJC_TYPE_ID = "id"
|
16
|
-
OBJC_TYPE_ARRAY = "NSArray *"
|
17
|
-
OBJC_TYPE_BOOL = "BOOL"
|
18
|
-
OBJC_TYPE_NULL = "NSNull *"
|
19
|
-
|
20
|
-
# attributes
|
21
|
-
ATTRIBUTE_NONATOMIC = "nonatomic"
|
22
|
-
ATTRIBUTE_COPY = "copy"
|
23
|
-
$class_full_name
|
24
|
-
|
25
|
-
$type_map = {
|
26
|
-
"String" => OBJC_TYPE_STRING,
|
27
|
-
"Integer" => OBJC_TYPE_NUMBER,
|
28
|
-
"Float" => OBJC_TYPE_NUMBER,
|
29
|
-
"Hash" => OBJC_TYPE_NSDIC,
|
30
|
-
#"Hash" => OBJC_TYPE_ID,
|
31
|
-
"Array" => OBJC_TYPE_ARRAY,
|
32
|
-
"TrueClass" => OBJC_TYPE_BOOL,
|
33
|
-
"FalseClass" => OBJC_TYPE_BOOL,
|
34
|
-
"NilClass" => OBJC_TYPE_NULL,
|
35
|
-
}
|
36
|
-
|
37
|
-
$attr_map = {
|
38
|
-
OBJC_TYPE_STRING => [ATTRIBUTE_NONATOMIC, ATTRIBUTE_COPY],
|
39
|
-
OBJC_TYPE_NUMBER => [ATTRIBUTE_NONATOMIC],
|
40
|
-
OBJC_TYPE_ID => [ATTRIBUTE_NONATOMIC],
|
41
|
-
OBJC_TYPE_NSDIC => [ATTRIBUTE_NONATOMIC],
|
42
|
-
OBJC_TYPE_ARRAY => [ATTRIBUTE_NONATOMIC, ATTRIBUTE_COPY],
|
43
|
-
OBJC_TYPE_BOOL => [ATTRIBUTE_NONATOMIC],
|
44
|
-
OBJC_TYPE_NULL => [ATTRIBUTE_NONATOMIC]
|
45
|
-
}
|
46
|
-
|
47
|
-
# generate info
|
48
|
-
$prop_declare = "@property"
|
49
|
-
|
50
|
-
def attr_name_for_attr_array(attr_array)
|
51
|
-
attr_name = ""
|
52
|
-
|
53
|
-
attr_array.each_with_index do |attribute, index|
|
54
|
-
if index != 0
|
55
|
-
attr_name << ", #{attribute}"
|
56
|
-
else
|
57
|
-
attr_name << "#{attribute}"
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
return attr_name
|
63
|
-
end
|
64
|
-
|
65
|
-
def prop_for_key_value(key, value)
|
66
|
-
type = $type_map["#{value.class}"]
|
67
|
-
attribute = attr_name_for_attr_array($attr_map[type])
|
68
|
-
var_name = key
|
69
|
-
prop_ret = "#{$prop_declare} (#{attribute}) #{type}#{var_name};"
|
70
|
-
|
71
|
-
return prop_ret
|
72
|
-
end
|
73
|
-
|
74
|
-
# puts type_map
|
75
|
-
header_comment = <<comment
|
76
|
-
// #{$class_full_name}.h
|
77
|
-
//
|
78
|
-
// Created by #{ENV['USER']} on #{Time.now.strftime("%Y/%m/%d")}
|
79
|
-
// Model file Generated using objc_export https://github.com/gogozs/objc_export
|
80
|
-
comment
|
81
|
-
|
82
|
-
header_result = ""
|
83
|
-
header_result << header_comment
|
84
|
-
header_result << "\n#import <Foundation/Foundation.h>\n\n"
|
85
|
-
header_result << "@interface #{$class_full_name} : NSObject\n\n"
|
86
|
-
header_file_name = "#{$class_full_name}.h"
|
87
|
-
|
88
|
-
imp_result = ""
|
89
|
-
imp_result << "#import \"#{header_file_name}\"\n\n"
|
90
|
-
imp_result << "@interface #{$class_full_name} ()\n@end\n\n"
|
91
|
-
|
92
|
-
imp_result << "@implementation #{$class_full_name}\n"
|
93
|
-
imp_result << "@end"
|
94
|
-
|
95
|
-
imp_file_name = "#{$class_full_name}.m"
|
96
|
-
|
97
|
-
input_json.each do |key, value|
|
98
|
-
header_result << "#{prop_for_key_value(key, value)}\n"
|
99
|
-
end
|
100
|
-
header_result << "\n@end"
|
101
|
-
|
102
|
-
header_file_path = "#{input_dir}/#{header_file_name}"
|
103
|
-
imp_file_path = "#{input_dir}/#{imp_file_name}"
|
104
|
-
|
105
|
-
File.open(header_file_path, 'w') do |io|
|
106
|
-
io << header_result
|
107
|
-
end
|
108
|
-
|
109
|
-
File.open(imp_file_path, 'w') do |io|
|
110
|
-
io << imp_result
|
111
|
-
end
|
112
|
-
|