mt_tool 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/mt_tool.iml +81 -49
- 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 +13 -0
- data/Gemfile.lock +7 -3
- data/README.md +18 -7
- data/img/69786f8e2a527b8c26f2c1311e230e5f.webp.png +0 -0
- data/img/SCR-20240619-msnz.png +0 -0
- data/lib/mt_tool/commands.rb +27 -214
- data/lib/mt_tool/module/module.rb +275 -0
- data/lib/mt_tool/module/template/objc/Bundle.h +21 -0
- data/lib/mt_tool/module/template/objc/Bundle.m +28 -0
- data/lib/mt_tool/{template → module/template}/objc/CategoryHeader.h +1 -0
- data/lib/mt_tool/{template → module/template}/objc/PrefixHeader.pch +6 -0
- data/lib/mt_tool/{template → module/template}/objc/ToolsHeader.h +1 -1
- data/lib/mt_tool/module/template/swift/Entity.swift +15 -0
- data/lib/mt_tool/module/template/swift/Interactor.swift +16 -0
- data/lib/mt_tool/module/template/swift/Presenter.swift +28 -0
- data/lib/mt_tool/module/template/swift/Router.swift +50 -0
- data/lib/mt_tool/module/template/swift/ViewController.swift +97 -0
- data/lib/mt_tool/oc_model/main.rb +112 -0
- data/lib/mt_tool/oc_model/oc_model.rb +235 -0
- data/lib/mt_tool/oc_model/sample.json +11 -0
- data/lib/mt_tool/short_hand/objc_generate_from_shorthand.rb +182 -0
- data/lib/mt_tool/short_hand/objc_header.mustache +41 -0
- data/lib/mt_tool/short_hand/objc_implementation.mustache +99 -0
- data/lib/mt_tool/short_hand/objc_shorthand.rb +64 -0
- data/lib/mt_tool/version.rb +1 -1
- data/mt_tool.gemspec +3 -1
- metadata +84 -19
- data/lib/mt_tool/analyze.rb +0 -126
- /data/lib/mt_tool/{template → module/template}/objc/RouterDefine.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/RouterRegister.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/RouterRegister.m +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/ServiceProtocol.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/ServiceRegister.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/ServiceRegister.m +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/VendorHeader.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/demo/DemoViewController.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/demo/DemoViewController.m +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/demo/DemoViewModel.h +0 -0
- /data/lib/mt_tool/{template → module/template}/objc/demo/DemoViewModel.m +0 -0
- /data/lib/mt_tool/{template → module/template}/swift/RouterDefine.swift +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eeca6fee7bb5bc02cf6b281ce04c8da18558905941f1a7513d6856e95b32196
|
4
|
+
data.tar.gz: 24c54d8d84e44111c10c59c6c4fa6b8dc310d4d7476f783f7cf4ffcaa2081af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3f3a03a6164a4741ad8287063855f8f660dfc51d7cbe688a3123d36f52c3880ab7c6ed1894aa08b2fd9ad386ea39b114758cb16cffd659dbcde2ba307edc6f
|
7
|
+
data.tar.gz: dc821d39412af58a762319d7e1aa378f58a478a09a440cc4b8d4ec7cd353694e6b23c911d1938d4304e95c39562039c76d730aac892d20b62cea8584970936bd
|
data/.idea/mt_tool.iml
CHANGED
@@ -9,55 +9,87 @@
|
|
9
9
|
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
10
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
11
|
</content>
|
12
|
-
<orderEntry type="
|
12
|
+
<orderEntry type="jdk" jdkName="ruby-3.1.0-p0" jdkType="RUBY_SDK" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v3.0.5,
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0,
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="algoliasearch (v1.27.5,
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="atomos (v0.1.3,
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.11,
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="claide (v1.1.0,
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods (v1.11.3,
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-core (v1.11.3,
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-deintegrate (v1.0.5,
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v1.6.3,
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-plugins (v1.0.0,
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-search (v1.0.1,
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-trunk (v1.6.0,
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-try (v1.2.0,
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="colored (v1.2,
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="colored2 (v3.1.2,
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10,
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0,
|
33
|
-
<orderEntry type="library" scope="PROVIDED" name="escape (v0.0.4,
|
34
|
-
<orderEntry type="library" scope="PROVIDED" name="ethon (v0.15.0,
|
35
|
-
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5,
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="fourflusher (v2.3.1,
|
37
|
-
<orderEntry type="library" scope="PROVIDED" name="fuzzy_match (v2.0.4,
|
38
|
-
<orderEntry type="library" scope="PROVIDED" name="gh_inspector (v1.1.3,
|
39
|
-
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3,
|
40
|
-
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0,
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.
|
42
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0,
|
43
|
-
<orderEntry type="library" scope="PROVIDED" name="molinillo (v0.8.0,
|
44
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
45
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
46
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
47
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
48
|
-
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.7,
|
49
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6,
|
50
|
-
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5,
|
51
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0,
|
52
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0,
|
53
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0,
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1,
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0,
|
56
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-macho (v2.5.1,
|
57
|
-
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1,
|
58
|
-
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0,
|
59
|
-
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4,
|
60
|
-
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0,
|
61
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4,
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v3.0.5, ruby-3.1.0-p0) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.6, ruby-3.1.0-p0) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, ruby-3.1.0-p0) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="algoliasearch (v1.27.5, ruby-3.1.0-p0) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="atomos (v0.1.3, ruby-3.1.0-p0) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.11, ruby-3.1.0-p0) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="claide (v1.1.0, ruby-3.1.0-p0) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods (v1.11.3, ruby-3.1.0-p0) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-core (v1.11.3, ruby-3.1.0-p0) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-deintegrate (v1.0.5, ruby-3.1.0-p0) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v1.6.3, ruby-3.1.0-p0) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-plugins (v1.0.0, ruby-3.1.0-p0) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-search (v1.0.1, ruby-3.1.0-p0) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-trunk (v1.6.0, ruby-3.1.0-p0) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-try (v1.2.0, ruby-3.1.0-p0) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="colored (v1.2, ruby-3.1.0-p0) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="colored2 (v3.1.2, ruby-3.1.0-p0) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, ruby-3.1.0-p0) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, ruby-3.1.0-p0) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="escape (v0.0.4, ruby-3.1.0-p0) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="ethon (v0.15.0, ruby-3.1.0-p0) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5, ruby-3.1.0-p0) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="fourflusher (v2.3.1, ruby-3.1.0-p0) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="fuzzy_match (v2.0.4, ruby-3.1.0-p0) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="gh_inspector (v1.1.3, ruby-3.1.0-p0) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, ruby-3.1.0-p0) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, ruby-3.1.0-p0) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, ruby-3.1.0-p0) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, ruby-3.1.0-p0) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="molinillo (v0.8.0, ruby-3.1.0-p0) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="mustache (v1.1.1, ruby-3.1.0-p0) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="nanaimo (v0.3.0, ruby-3.1.0-p0) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="nap (v1.1.0, ruby-3.1.0-p0) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, ruby-3.1.0-p0) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.7, ruby-3.1.0-p0) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, ruby-3.1.0-p0) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, ruby-3.1.0-p0) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, ruby-3.1.0-p0) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, ruby-3.1.0-p0) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, ruby-3.1.0-p0) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, ruby-3.1.0-p0) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, ruby-3.1.0-p0) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-macho (v2.5.1, ruby-3.1.0-p0) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, ruby-3.1.0-p0) [gem]" level="application" />
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0, ruby-3.1.0-p0) [gem]" level="application" />
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, ruby-3.1.0-p0) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0, ruby-3.1.0-p0) [gem]" level="application" />
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, ruby-3.1.0-p0) [gem]" level="application" />
|
62
|
+
</component>
|
63
|
+
<component name="RakeTasksCache">
|
64
|
+
<option name="myRootTask">
|
65
|
+
<RakeTaskImpl id="rake">
|
66
|
+
<subtasks>
|
67
|
+
<RakeTaskImpl description="Build mt_tool-0.1.4.gem into the pkg directory" fullCommand="build" id="build" />
|
68
|
+
<RakeTaskImpl id="build">
|
69
|
+
<subtasks>
|
70
|
+
<RakeTaskImpl description="Generate SHA512 checksum if mt_tool-0.1.4.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
71
|
+
</subtasks>
|
72
|
+
</RakeTaskImpl>
|
73
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
74
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
75
|
+
<RakeTaskImpl description="Build and install mt_tool-0.1.4.gem into system gems" fullCommand="install" id="install" />
|
76
|
+
<RakeTaskImpl id="install">
|
77
|
+
<subtasks>
|
78
|
+
<RakeTaskImpl description="Build and install mt_tool-0.1.4.gem into system gems without network access" fullCommand="install:local" id="local" />
|
79
|
+
</subtasks>
|
80
|
+
</RakeTaskImpl>
|
81
|
+
<RakeTaskImpl description="Create tag v0.1.4 and build and push mt_tool-0.1.4.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
82
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
83
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
84
|
+
<RakeTaskImpl id="release">
|
85
|
+
<subtasks>
|
86
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
87
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
88
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
89
|
+
</subtasks>
|
90
|
+
</RakeTaskImpl>
|
91
|
+
</subtasks>
|
92
|
+
</RakeTaskImpl>
|
93
|
+
</option>
|
62
94
|
</component>
|
63
95
|
</module>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
>
|
3
|
+
lib/mt_tool.rb,b/5/b53eec12e0ab8df9876dbc7fe65915bb985c4f72
|
4
|
+
c
|
5
|
+
3lib/mt_tool/short_hand/objc_implementation.mustache,5/2/5283f86f6adbda087dceb47c69b64e141dfb1e93
|
6
|
+
Y
|
7
|
+
)lib/mt_tool/module/template/objc/Bundle.h,f/8/f80e2edcdaf9ddf9362d26f7fa5d19df422f29c7
|
8
|
+
L
|
9
|
+
lib/mt_tool/module/module.rb,e/8/e84cc700d4480c1d3ca7dcc158063e40a25cee12
|
10
|
+
Y
|
11
|
+
)lib/mt_tool/module/template/objc/Bundle.m,7/0/70213f721c971c9a12d0f46060f7ee2a087b4a96
|
12
|
+
F
|
13
|
+
lib/mt_tool/version.rb,4/7/4745e92ab1b53af3e65026337909045741e13bea
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mt_tool (0.1.
|
4
|
+
mt_tool (0.1.4)
|
5
|
+
activesupport
|
5
6
|
bundler
|
6
7
|
colored
|
8
|
+
colored2
|
9
|
+
mustache
|
7
10
|
pathname
|
8
11
|
thor
|
9
12
|
xcodeproj
|
@@ -13,7 +16,7 @@ GEM
|
|
13
16
|
specs:
|
14
17
|
CFPropertyList (3.0.5)
|
15
18
|
rexml
|
16
|
-
activesupport (6.1.
|
19
|
+
activesupport (6.1.6)
|
17
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
21
|
i18n (>= 1.6, < 2)
|
19
22
|
minitest (>= 5.1)
|
@@ -77,9 +80,10 @@ GEM
|
|
77
80
|
httpclient (2.8.3)
|
78
81
|
i18n (1.10.0)
|
79
82
|
concurrent-ruby (~> 1.0)
|
80
|
-
json (2.6.
|
83
|
+
json (2.6.2)
|
81
84
|
minitest (5.15.0)
|
82
85
|
molinillo (0.8.0)
|
86
|
+
mustache (1.1.1)
|
83
87
|
nanaimo (0.3.0)
|
84
88
|
nap (1.1.0)
|
85
89
|
netrc (0.11.0)
|
data/README.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
1
|
# MtTool
|
2
2
|
|
3
|
-
|
3
|
+
Generate OC/Swift files for project or module.
|
4
4
|
|
5
|
-
|
5
|
+
<img src="img/69786f8e2a527b8c26f2c1311e230e5f.webp.png" alt="Module File Generator" height="150" width="150">
|
6
|
+
|
7
|
+
|
8
|
+
Free your time, focus on real coding things.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
For viper module
|
13
|
+
|
14
|
+
`mt_tool generateViperModule Canvas Tom.Liu ./`
|
15
|
+
|
16
|
+
<img src="img/SCR-20240619-msnz.png" alt="Module File Generator">
|
17
|
+
|
18
|
+
## Debug
|
19
|
+
|
20
|
+
![config](https://github.com/lyleLH/image-repo/blob/master/images/SCR-20240619-mpdx.png?raw=true)
|
6
21
|
|
7
22
|
## Installation
|
8
23
|
|
@@ -14,10 +29,6 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
14
29
|
|
15
30
|
$ gem install mt_tool
|
16
31
|
|
17
|
-
## Usage
|
18
|
-
|
19
|
-
TODO: Write usage instructions here
|
20
|
-
|
21
32
|
## Development
|
22
33
|
|
23
34
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -26,4 +37,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
37
|
|
27
38
|
## Contributing
|
28
39
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lylelh/mt_tool.
|
Binary file
|
Binary file
|
data/lib/mt_tool/commands.rb
CHANGED
@@ -1,237 +1,50 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
require 'thor'
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
|
6
|
-
require 'mt_tool/analyze'
|
3
|
+
require 'mt_tool/module/module'
|
4
|
+
require 'mt_tool/oc_model/oc_model'
|
5
|
+
|
7
6
|
module MtTool
|
8
7
|
class CLI < Thor
|
9
8
|
include Thor::Actions
|
10
9
|
|
11
|
-
CONFIG_FILE = '.MTModuleFilesConfig.yml'.freeze
|
12
10
|
|
13
11
|
desc 'generate <Path> <Module Name> <Language> <Prefix - 前缀> <Author - 作者>', '直接生成项目 例子: yk_command generate . HomeModule oc MT Tom.Liu '
|
14
12
|
method_option :generate, aliases: '-g'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@lang = lang
|
19
|
-
@class_prefix = class_prefix
|
20
|
-
@final_path = "#{path}/#{@name}"
|
21
|
-
@author = author
|
22
|
-
@prefixed_module = @class_prefix + @module
|
23
|
-
|
24
|
-
say "generating file in path:#{@final_path}", :green
|
25
|
-
|
26
|
-
if File.exist?(@final_path.to_s)
|
27
|
-
say "#{@final_path} 已存在:", :red
|
28
|
-
else
|
29
|
-
prepare_folder
|
30
|
-
if File.exist?("#{@final_path}/configure")
|
31
|
-
system("#{@final_path}/configure", @name, @lang, @class_prefix, *@additional_args)
|
32
|
-
else
|
33
|
-
say 'Template does not have a configure file', :red
|
34
|
-
end
|
35
|
-
yk_module_folders
|
36
|
-
yk_template_files
|
37
|
-
end
|
13
|
+
|
14
|
+
def generate(path = nil, name, lang, class_prefix, author)
|
15
|
+
Module.new(self .args,self .options).generate(path, name, lang, class_prefix, author)
|
38
16
|
end
|
39
17
|
|
40
18
|
desc 'create <Path>', '在某个路径下交互式生成项目'
|
41
19
|
method_option :create, aliases: '-c'
|
20
|
+
|
42
21
|
def create(path = nil)
|
43
|
-
|
44
|
-
|
45
|
-
say '模块名:', :green
|
46
|
-
config_file_path = "#{path}/#{CONFIG_FILE}"
|
47
|
-
config = File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
48
|
-
input_name = ask("Project name [#{config[:project]}] ?")
|
49
|
-
|
50
|
-
if input_name != ''
|
51
|
-
@name = input_name
|
52
|
-
config[:project] = input_name if input_name != config[:project]
|
53
|
-
else
|
54
|
-
@name = config[:project]
|
55
|
-
end
|
56
|
-
|
57
|
-
File.open(config_file_path, 'w') do |f|
|
58
|
-
f.write config.to_yaml
|
59
|
-
end
|
60
|
-
|
61
|
-
@final_path = "#{path}/#{@name}"
|
62
|
-
|
63
|
-
if File.exist?(@final_path.to_s)
|
64
|
-
say "#{@final_path} 已存在:", :red
|
65
|
-
else
|
66
|
-
prepare_folder
|
67
|
-
read_config(path)
|
68
|
-
|
69
|
-
if File.exist?("#{@final_path}/configure")
|
70
|
-
system("#{@final_path}/configure", @name, @lang, @class_prefix, *@additional_args)
|
71
|
-
else
|
72
|
-
say 'Template does not have a configure file', :red
|
73
|
-
end
|
74
|
-
|
75
|
-
yk_module_folders
|
76
|
-
yk_template_files
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
no_commands do
|
82
|
-
def read_config(path)
|
83
|
-
config_file_path = "#{path}/#{CONFIG_FILE}"
|
84
|
-
config = File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
85
|
-
|
86
|
-
project = @name
|
87
|
-
say '语言:', :green
|
88
|
-
language = ask("Project language [#{config[:language]}] ?", limited_to: ['objc', 'swift', ''])
|
89
|
-
say '类名前缀:', :green
|
90
|
-
class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
|
91
|
-
say '文件作者:', :green
|
92
|
-
author = ask("Author [#{config[:author]}] ?")
|
93
|
-
|
94
|
-
config[:project] = project.empty? ? config[:project] || '' : project
|
95
|
-
config[:language] = language.empty? ? config[:language] || 'objc' : language
|
96
|
-
config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
|
97
|
-
config[:author] = author.empty? ? config[:author] || '' : author
|
98
|
-
|
99
|
-
File.open(config_file_path, 'w') do |f|
|
100
|
-
f.write config.to_yaml
|
101
|
-
# f.write YAML.to_yaml(config)
|
102
|
-
end
|
103
|
-
|
104
|
-
@module = @name
|
105
|
-
@class_prefix = config[:class_prefix]
|
106
|
-
@prefixed_module = config[:class_prefix] + @module
|
107
|
-
@project = config[:project]
|
108
|
-
@author = config[:author]
|
109
|
-
@date = Time.now.strftime('%d/%m/%y')
|
110
|
-
@lang = config[:language]
|
111
|
-
end
|
112
|
-
|
113
|
-
def prepare_folder
|
114
|
-
|
115
|
-
template_repo_url = 'https://github.com/lyleLH/MTTemplate.git'
|
116
|
-
system("git clone #{template_repo_url} #{@final_path}")
|
117
|
-
|
118
|
-
# FileUtils.remove_dir(@final_path, true)
|
119
|
-
# FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
|
120
|
-
# FileUtils.remove_dir("#{@final_path}/.git", true)
|
121
|
-
end
|
122
|
-
|
123
|
-
def yk_module_folders
|
124
|
-
class_folder_path = "#{@final_path}/#{@name}/Classes"
|
125
|
-
|
126
|
-
first_level_folders = %w[Public Private]
|
127
|
-
|
128
|
-
# public_level_folders = ['Register']
|
129
|
-
# public_level_folders.each do |folder|
|
130
|
-
# path = "#{class_folder_path}/Public/#{folder}"
|
131
|
-
# empty_directory path
|
132
|
-
# end
|
133
|
-
|
134
|
-
private_level_folders = %w[Business Category Vendor Tools]
|
135
|
-
|
136
|
-
first_level_folders.each do |folder|
|
137
|
-
path = "#{class_folder_path}/#{folder}"
|
138
|
-
empty_directory path
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
private_level_folders.each do |folder|
|
144
|
-
path = "#{class_folder_path}/Private/#{folder}"
|
145
|
-
empty_directory path
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
CLI.source_root(File.dirname(__FILE__))
|
150
|
-
|
151
|
-
def yk_template_files
|
152
|
-
register_path = "#{@final_path}/#{@name}/Classes/Private/Register"
|
153
|
-
registger = {
|
154
|
-
'RouterRegister.h' => 'RouterRegister',
|
155
|
-
'RouterRegister.m' => 'RouterRegister',
|
156
|
-
'ServiceRegister.h' => 'ServiceRegister',
|
157
|
-
'ServiceRegister.m' => 'ServiceRegister'
|
158
|
-
}
|
159
|
-
|
160
|
-
registger.each do |file_name, _folder|
|
161
|
-
final_file = "#{register_path}/#{@prefixed_module}#{file_name}"
|
162
|
-
template "#{__dir__}/template/objc/#{file_name}", final_file
|
163
|
-
end
|
164
|
-
|
165
|
-
public_folder_path = "#{@final_path}/#{@name}/Classes/Public"
|
166
|
-
|
167
|
-
template_code_filename = ['ServiceProtocol.h','RouterDefine.h']
|
168
|
-
template_code_filename.each do |file_name|
|
169
|
-
final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
|
170
|
-
source = "#{__dir__}/template/objc/#{file_name}"
|
171
|
-
template source, final_file
|
172
|
-
end
|
173
|
-
|
174
|
-
swift_template_code_filename = ['RouterDefine.swift']
|
175
|
-
swift_template_code_filename.each do |file_name|
|
176
|
-
final_file = "#{public_folder_path}/#{@prefixed_module}_Swift_#{file_name}"
|
177
|
-
source = "#{__dir__}/template/swift/#{file_name}"
|
178
|
-
template source, final_file
|
179
|
-
end
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
private_folder_path = "#{@final_path}/#{@name}/Classes/Private"
|
184
|
-
#pch file
|
185
|
-
# pch_file_name = "PrefixHeader.pch"
|
186
|
-
# final_file = "#{private_folder_path}/#{@prefixed_module}#{pch_file_name}"
|
187
|
-
# source = "#{__dir__}/template/objc/#{pch_file_name}"
|
188
|
-
# template source, final_file
|
189
|
-
|
190
|
-
private_level_folder_files = {
|
191
|
-
'PrefixHeader.pch' => 'Business',
|
192
|
-
'CategoryHeader.h' => 'Category',
|
193
|
-
'ToolsHeader.h' => 'Tools',
|
194
|
-
'vendorHeader.h' => 'Vendor'
|
195
|
-
}
|
196
|
-
|
197
|
-
private_level_folder_files.each do |file_name, folder|
|
198
|
-
final_prefix = @prefixed_module
|
199
|
-
if file_name == 'PrefixHeader.pch'
|
200
|
-
final_prefix = @module
|
201
|
-
end
|
202
|
-
|
203
|
-
final_file = "#{private_folder_path}/#{folder}/#{final_prefix}#{file_name}"
|
204
|
-
source = "#{__dir__}/template/objc/#{file_name}"
|
205
|
-
template source, final_file
|
206
|
-
end
|
207
|
-
|
208
|
-
business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business"
|
209
|
-
demo_replace_file = ['DemoViewController.h','DemoViewController.m','DemoViewModel.h','DemoViewModel.m']
|
210
|
-
demo_replace_file.each do |file_name|
|
211
|
-
final_file = "#{business_demo_path}/Demo/#{@prefixed_module}#{file_name}"
|
212
|
-
source = "#{__dir__}/template/objc/demo/#{file_name}"
|
213
|
-
template source, final_file
|
214
|
-
end
|
215
|
-
|
22
|
+
Module.new(self .args,self .options ).create(path)
|
216
23
|
|
24
|
+
end
|
217
25
|
|
218
|
-
Dir.chdir("#{@final_path}/Example") do
|
219
|
-
system 'pod install'
|
220
|
-
system "open './#{@name}.xcworkspace'"
|
221
|
-
end
|
222
|
-
end
|
223
26
|
|
27
|
+
desc 'vmod <module name > <author> <path> ', '生成viper模块文件'
|
28
|
+
method_option :vmod, aliases: '-v'
|
29
|
+
def generateViperModule(name,author, path )
|
30
|
+
Module.new(self .args,self .options).create_viper_module(path, name, "swift","", author)
|
224
31
|
end
|
225
32
|
|
226
|
-
desc '
|
227
|
-
method_option :
|
228
|
-
def
|
229
|
-
|
33
|
+
desc 'model_class <prefix> <class name > <json file path> <output path>', '根据json文件生成模型类'
|
34
|
+
method_option :create, aliases: '-c'
|
35
|
+
def model_class(prefix,name, path ,output_path)
|
36
|
+
OcModel.new(self .args,self .options ).create(prefix,name ,path,output_path)
|
230
37
|
|
231
|
-
|
232
|
-
|
233
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'qt_model_class <prefix> <class name > <json file path> <output path>', '使用quicktype根据json文件生成模型类'
|
41
|
+
method_option :create, aliases: '-c'
|
42
|
+
def qt_model_class(prefix,name, path ,output_path)
|
43
|
+
OcModel.new(self .args,self .options ).qt_create(prefix,name ,path,output_path)
|
234
44
|
|
235
45
|
end
|
46
|
+
|
47
|
+
|
48
|
+
|
236
49
|
end
|
237
50
|
end
|