YKModuleCommand 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/YKModuleCommand.iml +56 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +12 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +113 -0
- data/YKModuleCommand.gemspec +29 -0
- data/lib/YKModuleCommand/commands.rb +1 -0
- data/lib/YKModuleCommand/module/module.rb +0 -0
- data/lib/YKModuleCommand/template/objc/RouterRegister.h +16 -0
- data/lib/YKModuleCommand/template/objc/RouterRegister.m +13 -0
- data/lib/YKModuleCommand/template/objc/ServiceRegister.h +16 -0
- data/lib/YKModuleCommand/template/objc/ServiceRegister.m +13 -0
- data/lib/YKModuleCommand/version.rb +3 -0
- data/lib/YKModuleCommand.rb +167 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c8f717ddb66b3360c3a1ec983989616047f70f9c2b4b734e412e7c9e6c9cb18c
|
4
|
+
data.tar.gz: 43ce50165c81e84ebbad9620d1516e398a0c844a8cdd73ca8ea9fe3766da2dfc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9cdb681c2973a85a824de2f2669b38df45c57ac53218fc62148cdeb825a8d9edbc1e24e37abf3fe756f917f8232510b2c0eb6355979559e564c818f0be795542
|
7
|
+
data.tar.gz: 3be8c447b2f8bb7d2b994787524e7068cee7adcc1f66e95ead5b4441b751f7be9dd2f9cf5d8def64ba3445c97f310c5fb1a0edcf421870470601bab871a5a510
|
data/.idea/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.2 [tom]" jdkType="RUBY_SDK" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v3.0.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.7, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="algoliasearch (v1.27.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="atomos (v0.1.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.8, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="claide (v1.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods (v1.11.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-core (v1.11.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-deintegrate (v1.0.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v1.6.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-plugins (v1.0.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-search (v1.0.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-trunk (v1.6.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-try (v1.2.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="colored (v1.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="colored2 (v3.1.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="escape (v0.0.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="ethon (v0.15.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="fourflusher (v2.3.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="fuzzy_match (v2.0.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="gh_inspector (v1.1.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="molinillo (v0.8.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="nanaimo (v0.3.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="nap (v1.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-macho (v2.5.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.9, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
55
|
+
</component>
|
56
|
+
</module>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/YKModuleCommand.iml" filepath="$PROJECT_DIR$/.idea/YKModuleCommand.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="VcsDirectoryMappings">
|
4
|
+
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5
|
+
<mapping directory="$PROJECT_DIR$/SUHome" vcs="Git" />
|
6
|
+
<mapping directory="$PROJECT_DIR$/SUHome2" vcs="Git" />
|
7
|
+
<mapping directory="$PROJECT_DIR$/TTApp/pod-template" vcs="Git" />
|
8
|
+
<mapping directory="$PROJECT_DIR$/final_path" vcs="Git" />
|
9
|
+
<mapping directory="$PROJECT_DIR$/lib/CXFApp/YKProjectTemplate" vcs="Git" />
|
10
|
+
<mapping directory="$PROJECT_DIR$/pod-template" vcs="Git" />
|
11
|
+
</component>
|
12
|
+
</project>
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
YKModuleCommand (0.0.1)
|
5
|
+
cocoapods-core
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
CFPropertyList (3.0.5)
|
11
|
+
rexml
|
12
|
+
activesupport (5.2.7)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
addressable (2.8.0)
|
18
|
+
public_suffix (>= 2.0.2, < 5.0)
|
19
|
+
algoliasearch (1.27.5)
|
20
|
+
httpclient (~> 2.8, >= 2.8.3)
|
21
|
+
json (>= 1.5.1)
|
22
|
+
atomos (0.1.3)
|
23
|
+
claide (1.1.0)
|
24
|
+
cocoapods (1.11.3)
|
25
|
+
addressable (~> 2.8)
|
26
|
+
claide (>= 1.0.2, < 2.0)
|
27
|
+
cocoapods-core (= 1.11.3)
|
28
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
29
|
+
cocoapods-downloader (>= 1.4.0, < 2.0)
|
30
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
31
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
32
|
+
cocoapods-trunk (>= 1.4.0, < 2.0)
|
33
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
34
|
+
colored2 (~> 3.1)
|
35
|
+
escape (~> 0.0.4)
|
36
|
+
fourflusher (>= 2.3.0, < 3.0)
|
37
|
+
gh_inspector (~> 1.0)
|
38
|
+
molinillo (~> 0.8.0)
|
39
|
+
nap (~> 1.0)
|
40
|
+
ruby-macho (>= 1.0, < 3.0)
|
41
|
+
xcodeproj (>= 1.21.0, < 2.0)
|
42
|
+
cocoapods-core (1.11.3)
|
43
|
+
activesupport (>= 5.0, < 7)
|
44
|
+
addressable (~> 2.8)
|
45
|
+
algoliasearch (~> 1.0)
|
46
|
+
concurrent-ruby (~> 1.1)
|
47
|
+
fuzzy_match (~> 2.0.4)
|
48
|
+
nap (~> 1.0)
|
49
|
+
netrc (~> 0.11)
|
50
|
+
public_suffix (~> 4.0)
|
51
|
+
typhoeus (~> 1.0)
|
52
|
+
cocoapods-deintegrate (1.0.5)
|
53
|
+
cocoapods-downloader (1.6.1)
|
54
|
+
cocoapods-plugins (1.0.0)
|
55
|
+
nap
|
56
|
+
cocoapods-search (1.0.1)
|
57
|
+
cocoapods-trunk (1.6.0)
|
58
|
+
nap (>= 0.8, < 2.0)
|
59
|
+
netrc (~> 0.11)
|
60
|
+
cocoapods-try (1.2.0)
|
61
|
+
colored (1.2)
|
62
|
+
colored2 (3.1.2)
|
63
|
+
concurrent-ruby (1.1.9)
|
64
|
+
escape (0.0.4)
|
65
|
+
ethon (0.15.0)
|
66
|
+
ffi (>= 1.15.0)
|
67
|
+
ffi (1.15.5)
|
68
|
+
fourflusher (2.3.1)
|
69
|
+
fuzzy_match (2.0.4)
|
70
|
+
gh_inspector (1.1.3)
|
71
|
+
httpclient (2.8.3)
|
72
|
+
i18n (1.10.0)
|
73
|
+
concurrent-ruby (~> 1.0)
|
74
|
+
json (2.6.1)
|
75
|
+
minitest (5.15.0)
|
76
|
+
molinillo (0.8.0)
|
77
|
+
nanaimo (0.3.0)
|
78
|
+
nap (1.1.0)
|
79
|
+
netrc (0.11.0)
|
80
|
+
public_suffix (4.0.6)
|
81
|
+
rake (13.0.6)
|
82
|
+
rexml (3.2.5)
|
83
|
+
ruby-macho (2.5.1)
|
84
|
+
thor (1.2.1)
|
85
|
+
thread_safe (0.3.6)
|
86
|
+
typhoeus (1.4.0)
|
87
|
+
ethon (>= 0.9.0)
|
88
|
+
tzinfo (1.2.9)
|
89
|
+
thread_safe (~> 0.1)
|
90
|
+
xcodeproj (1.21.0)
|
91
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
92
|
+
atomos (~> 0.1.3)
|
93
|
+
claide (>= 1.0.2, < 2.0)
|
94
|
+
colored2 (~> 3.1)
|
95
|
+
nanaimo (~> 0.3.0)
|
96
|
+
rexml (~> 3.2.4)
|
97
|
+
|
98
|
+
PLATFORMS
|
99
|
+
x86_64-darwin-21
|
100
|
+
|
101
|
+
DEPENDENCIES
|
102
|
+
YKModuleCommand!
|
103
|
+
bundler (~> 2.2.5)
|
104
|
+
claide
|
105
|
+
cocoapods
|
106
|
+
cocoapods-core
|
107
|
+
colored
|
108
|
+
rake
|
109
|
+
thor
|
110
|
+
xcodeproj
|
111
|
+
|
112
|
+
BUNDLED WITH
|
113
|
+
2.2.8
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "YKModuleCommand/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "YKModuleCommand"
|
8
|
+
spec.version = YKModuleCommand::VERSION
|
9
|
+
spec.authors = ["MTTGCC"]
|
10
|
+
spec.email = ["xbwudi20092@gmail.com"]
|
11
|
+
spec.summary = %q{Generates iOS Module Files.}
|
12
|
+
spec.description = %q{Creates iOS Module Files.}
|
13
|
+
spec.homepage = "https://github.com/lyleLH"
|
14
|
+
spec.licenses = "MIT"
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
spec.add_development_dependency "bundler", "~> 2.2.5"
|
19
|
+
spec.add_development_dependency "rake"
|
20
|
+
spec.add_development_dependency "thor"
|
21
|
+
spec.add_development_dependency "claide"
|
22
|
+
spec.add_development_dependency "colored"
|
23
|
+
spec.add_development_dependency "xcodeproj"
|
24
|
+
spec.add_development_dependency "cocoapods"
|
25
|
+
spec.add_development_dependency "cocoapods-core"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'cocoapods-core'
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
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
|
@@ -0,0 +1,13 @@
|
|
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
|
+
@implementation <%= @prefixed_module %>RouterRegister
|
12
|
+
|
13
|
+
@end
|
@@ -0,0 +1,16 @@
|
|
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
|
+
Router Register for the <%= @module %> module.
|
13
|
+
*/
|
14
|
+
@interface <%= @prefixed_module %>ServiceRegister : NSObject
|
15
|
+
|
16
|
+
@end
|
@@ -0,0 +1,13 @@
|
|
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
|
+
|
11
|
+
@implementation <%= @prefixed_module %>ServiceRegister
|
12
|
+
|
13
|
+
@end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'psych'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
class Commands < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
CONFIG_FILE = '.YKModuleFilesConfig.yml'
|
10
|
+
|
11
|
+
desc 'read_config', '读取配置'
|
12
|
+
|
13
|
+
def read_config(path)
|
14
|
+
config_file_path = "#{path}/#{CONFIG_FILE}"
|
15
|
+
config = File.exists?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
16
|
+
|
17
|
+
project = @name
|
18
|
+
say "语言:",:green
|
19
|
+
language = ask("Project language [#{config[:language]}] ?", :limited_to => ["objc", "swift", ""])
|
20
|
+
say "类名前缀:",:green
|
21
|
+
class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
|
22
|
+
say "文件作者:",:green
|
23
|
+
author = ask("Author [#{config[:author]}] ?")
|
24
|
+
|
25
|
+
config[:project] = project.empty? ? config[:project] || '' : project
|
26
|
+
config[:language] = language.empty? ? config[:language] || 'objc' : language
|
27
|
+
config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
|
28
|
+
config[:author] = author.empty? ? config[:author] || '' : author
|
29
|
+
|
30
|
+
File.open(config_file_path, 'w') do |f|
|
31
|
+
f.write config.to_yaml
|
32
|
+
# f.write YAML.to_yaml(config)
|
33
|
+
end
|
34
|
+
|
35
|
+
@module = @name
|
36
|
+
@class_prefix = config[:class_prefix]
|
37
|
+
@prefixed_module = config[:class_prefix] + @module
|
38
|
+
@project = config[:project]
|
39
|
+
@author = config[:author]
|
40
|
+
@date = Time.now.strftime('%d/%m/%y')
|
41
|
+
@lang = config[:language]
|
42
|
+
@prefixed_module = "YK#{@name}"
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
desc 'create <Module Name>', '开始配置'
|
49
|
+
def create(path=nil)
|
50
|
+
|
51
|
+
if path == nil
|
52
|
+
path = __dir__
|
53
|
+
end
|
54
|
+
|
55
|
+
say "模块名:",:green
|
56
|
+
|
57
|
+
config_file_path = "#{path}/#{CONFIG_FILE}"
|
58
|
+
|
59
|
+
config = File.exists?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
60
|
+
|
61
|
+
input_name = ask("Project name [#{config[:project]}] ?")
|
62
|
+
if input_name != ""
|
63
|
+
@name = input_name
|
64
|
+
if input_name != config[:project]
|
65
|
+
config[:project] = input_name
|
66
|
+
end
|
67
|
+
else
|
68
|
+
@name = config[:project]
|
69
|
+
end
|
70
|
+
|
71
|
+
File.open(config_file_path, 'w') do |f|
|
72
|
+
f.write config.to_yaml
|
73
|
+
end
|
74
|
+
|
75
|
+
@final_path = "#{path}/#{@name}"
|
76
|
+
|
77
|
+
if File.exist?("#{@final_path}")
|
78
|
+
say "#{@final_path} 已存在:",:red
|
79
|
+
else
|
80
|
+
prepare_folder
|
81
|
+
read_config(path)
|
82
|
+
|
83
|
+
if File.exist?("#{@final_path}/configure")
|
84
|
+
system("#{@final_path}/configure", @name, @lang ,@class_prefix , *@additional_args)
|
85
|
+
else
|
86
|
+
say "Template does not have a configure file", :red
|
87
|
+
end
|
88
|
+
|
89
|
+
yk_module_folders
|
90
|
+
yk_template_files
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def prepare_folder
|
99
|
+
host_a = "yeah"
|
100
|
+
host_b = "ka"
|
101
|
+
template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/YKProjectTemplate.git"
|
102
|
+
system("git clone #{template_repo_url} #{@final_path}")
|
103
|
+
|
104
|
+
# FileUtils.remove_dir(@final_path, true)
|
105
|
+
# FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
|
106
|
+
# FileUtils.remove_dir("#{@final_path}/.git", true)
|
107
|
+
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
def yk_module_folders
|
112
|
+
|
113
|
+
class_folder_path = "#{@final_path}/#{@name}/Classes"
|
114
|
+
|
115
|
+
first_level_folders = ["Public","Private"]
|
116
|
+
public_level_folders = ["Register"]
|
117
|
+
private_level_folders = ["Category","Vendor","Tools"]
|
118
|
+
|
119
|
+
|
120
|
+
first_level_folders.each do |folder|
|
121
|
+
path = "#{class_folder_path}/#{folder}"
|
122
|
+
empty_directory path
|
123
|
+
end
|
124
|
+
|
125
|
+
public_level_folders.each do |folder|
|
126
|
+
path = "#{class_folder_path}/Public/#{folder}"
|
127
|
+
empty_directory path
|
128
|
+
end
|
129
|
+
|
130
|
+
private_level_folders.each do |folder|
|
131
|
+
path = "#{class_folder_path}/Private/#{folder}"
|
132
|
+
empty_directory path
|
133
|
+
system "touch \"#{path}/EmptyFile.m\""
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
Commands.source_root(File.dirname(__FILE__))
|
139
|
+
|
140
|
+
def yk_template_files
|
141
|
+
|
142
|
+
register_path = "#{@final_path}/#{@name}/Classes/Public/Register"
|
143
|
+
registger = {
|
144
|
+
'RouterRegister.h' => 'RouterRegister',
|
145
|
+
'RouterRegister.m' => 'RouterRegister',
|
146
|
+
'ServiceRegister.h' => 'ServiceRegister',
|
147
|
+
'ServiceRegister.m' => 'ServiceRegister',
|
148
|
+
}
|
149
|
+
|
150
|
+
|
151
|
+
registger.each do |file_name, folder|
|
152
|
+
final_file = "#{register_path}/#{@prefixed_module}#{file_name}"
|
153
|
+
template "#{__dir__}/YKModuleCommand/template/objc/#{file_name}",final_file
|
154
|
+
end
|
155
|
+
|
156
|
+
Dir.chdir("#{@final_path}/Example") do
|
157
|
+
system "pod install --silent"
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
Commands.start(ARGV)
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: YKModuleCommand
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MTTGCC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.5
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: claide
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colored
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: xcodeproj
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: cocoapods
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: cocoapods-core
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: cocoapods-core
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Creates iOS Module Files.
|
140
|
+
email:
|
141
|
+
- xbwudi20092@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".idea/.gitignore"
|
147
|
+
- ".idea/YKModuleCommand.iml"
|
148
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
149
|
+
- ".idea/modules.xml"
|
150
|
+
- ".idea/vcs.xml"
|
151
|
+
- Gemfile
|
152
|
+
- Gemfile.lock
|
153
|
+
- YKModuleCommand.gemspec
|
154
|
+
- lib/YKModuleCommand.rb
|
155
|
+
- lib/YKModuleCommand/commands.rb
|
156
|
+
- lib/YKModuleCommand/module/module.rb
|
157
|
+
- lib/YKModuleCommand/template/objc/RouterRegister.h
|
158
|
+
- lib/YKModuleCommand/template/objc/RouterRegister.m
|
159
|
+
- lib/YKModuleCommand/template/objc/ServiceRegister.h
|
160
|
+
- lib/YKModuleCommand/template/objc/ServiceRegister.m
|
161
|
+
- lib/YKModuleCommand/version.rb
|
162
|
+
homepage: https://github.com/lyleLH
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubygems_version: 3.2.33
|
182
|
+
signing_key:
|
183
|
+
specification_version: 4
|
184
|
+
summary: Generates iOS Module Files.
|
185
|
+
test_files: []
|