yk_command 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.YKModuleFilesConfig.yml +5 -0
- data/.idea/vcs.xml +2 -0
- data/.idea/yk_command.iml +13 -5
- data/Gemfile +3 -2
- data/Gemfile.lock +18 -1
- data/README.md +39 -10
- data/Rakefile +1 -1
- data/bin/console +3 -3
- data/bin/yk_command +0 -1
- data/lib/yk_command/commands.rb +107 -106
- data/lib/yk_command/template/objc/RouterDefine.h +14 -0
- data/lib/yk_command/template/objc/RouterRegister.m +19 -0
- data/lib/yk_command/template/objc/ServiceProtocol.h +15 -0
- data/lib/yk_command/template/objc/ServiceRegister.h +1 -1
- data/lib/yk_command/template/objc/ServiceRegister.m +12 -0
- data/lib/yk_command/template/objc/demo/DemoViewController.h +17 -0
- data/lib/yk_command/template/objc/demo/DemoViewController.m +28 -0
- data/lib/yk_command/template/objc/demo/DemoViewModel.h +14 -0
- data/lib/yk_command/template/objc/demo/DemoViewModel.m +19 -0
- data/lib/yk_command/version.rb +1 -1
- data/lib/yk_command.rb +0 -1
- data/yk_command.gemspec +20 -22
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09f298ea39bbf5583da6754e78bd75ba35bd9eb427bfcc1fbcaa4e8081f64684'
|
4
|
+
data.tar.gz: 495609aec6ee33450a5e176cea96766263e7b0257fec891171ae39be05f57bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f889ff17f4b84cba81fc5749ad432c60a6c160595b1caad6f80ba4c34a5b95e62a03fd53b6279dd2c133a02ebe2ab3128dfc03e88b526bc99787cd2afbfa6ef2
|
7
|
+
data.tar.gz: d193874649d597236bc5e07e795bb543d61b30fa12f4b6152240d1ccfda9c7ba203b9ef0147562ea89f20cb157f0d4dcef31d3457bca2d0a27c29f537a67b797
|
data/.idea/vcs.xml
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5
5
|
<mapping directory="$PROJECT_DIR$/CXFApp" vcs="Git" />
|
6
6
|
<mapping directory="$PROJECT_DIR$/CXFAppHome" vcs="Git" />
|
7
|
+
<mapping directory="$PROJECT_DIR$/MerchantHome" vcs="Git" />
|
7
8
|
<mapping directory="$PROJECT_DIR$/SUHome3" vcs="Git" />
|
9
|
+
<mapping directory="$PROJECT_DIR$/SYTHomeModule" vcs="Git" />
|
8
10
|
</component>
|
9
11
|
</project>
|
data/.idea/yk_command.iml
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.7, RVM: ruby-2.7.2) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="algoliasearch (v1.27.5, RVM: ruby-2.7.2) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
18
19
|
<orderEntry type="library" scope="PROVIDED" name="atomos (v0.1.3, RVM: ruby-2.7.2) [gem]" level="application" />
|
19
20
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.33, RVM: ruby-2.7.2) [gem]" level="application" />
|
20
21
|
<orderEntry type="library" scope="PROVIDED" name="claide (v1.1.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
@@ -44,7 +45,11 @@
|
|
44
45
|
<orderEntry type="library" scope="PROVIDED" name="nanaimo (v0.3.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
45
46
|
<orderEntry type="library" scope="PROVIDED" name="nap (v1.1.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
46
47
|
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v2.7.2.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.1.3, RVM: ruby-2.7.2) [gem]" level="application" />
|
47
51
|
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.2) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.2.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
48
53
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.2) [gem]" level="application" />
|
49
54
|
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.2) [gem]" level="application" />
|
50
55
|
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
@@ -52,32 +57,35 @@
|
|
52
57
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
53
58
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
54
59
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.50.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
55
61
|
<orderEntry type="library" scope="PROVIDED" name="ruby-macho (v2.5.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
56
63
|
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
57
64
|
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.7.2) [gem]" level="application" />
|
58
65
|
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
59
66
|
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.9, RVM: ruby-2.7.2) [gem]" level="application" />
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.8.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
60
68
|
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
61
69
|
</component>
|
62
70
|
<component name="RakeTasksCache">
|
63
71
|
<option name="myRootTask">
|
64
72
|
<RakeTaskImpl id="rake">
|
65
73
|
<subtasks>
|
66
|
-
<RakeTaskImpl description="Build yk_command-0.
|
74
|
+
<RakeTaskImpl description="Build yk_command-0.2.1.gem into the pkg directory" fullCommand="build" id="build" />
|
67
75
|
<RakeTaskImpl id="build">
|
68
76
|
<subtasks>
|
69
|
-
<RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.
|
77
|
+
<RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.2.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
70
78
|
</subtasks>
|
71
79
|
</RakeTaskImpl>
|
72
80
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
73
81
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
74
|
-
<RakeTaskImpl description="Build and install yk_command-0.
|
82
|
+
<RakeTaskImpl description="Build and install yk_command-0.2.1.gem into system gems" fullCommand="install" id="install" />
|
75
83
|
<RakeTaskImpl id="install">
|
76
84
|
<subtasks>
|
77
|
-
<RakeTaskImpl description="Build and install yk_command-0.
|
85
|
+
<RakeTaskImpl description="Build and install yk_command-0.2.1.gem into system gems without network access" fullCommand="install:local" id="local" />
|
78
86
|
</subtasks>
|
79
87
|
</RakeTaskImpl>
|
80
|
-
<RakeTaskImpl description="Create tag v0.
|
88
|
+
<RakeTaskImpl description="Create tag v0.2.1 and build and push yk_command-0.2.1.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
81
89
|
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
82
90
|
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
83
91
|
<RakeTaskImpl id="release">
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yk_command (0.
|
4
|
+
yk_command (0.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -18,6 +18,7 @@ GEM
|
|
18
18
|
algoliasearch (1.27.5)
|
19
19
|
httpclient (~> 2.8, >= 2.8.3)
|
20
20
|
json (>= 1.5.1)
|
21
|
+
ast (2.4.2)
|
21
22
|
atomos (0.1.3)
|
22
23
|
claide (1.1.0)
|
23
24
|
cocoapods (1.11.3)
|
@@ -77,7 +78,13 @@ GEM
|
|
77
78
|
nanaimo (0.3.0)
|
78
79
|
nap (1.1.0)
|
79
80
|
netrc (0.11.0)
|
81
|
+
parallel (1.21.0)
|
82
|
+
parser (2.7.2.0)
|
83
|
+
ast (~> 2.4.1)
|
84
|
+
powerpack (0.1.3)
|
80
85
|
public_suffix (4.0.6)
|
86
|
+
rainbow (2.2.2)
|
87
|
+
rake
|
81
88
|
rake (13.0.6)
|
82
89
|
rexml (3.2.5)
|
83
90
|
rspec (3.11.0)
|
@@ -93,13 +100,22 @@ GEM
|
|
93
100
|
diff-lcs (>= 1.2.0, < 2.0)
|
94
101
|
rspec-support (~> 3.11.0)
|
95
102
|
rspec-support (3.11.0)
|
103
|
+
rubocop (0.50.0)
|
104
|
+
parallel (~> 1.10)
|
105
|
+
parser (>= 2.3.3.1, < 3.0)
|
106
|
+
powerpack (~> 0.1)
|
107
|
+
rainbow (>= 2.2.2, < 3.0)
|
108
|
+
ruby-progressbar (~> 1.7)
|
109
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
96
110
|
ruby-macho (2.5.1)
|
111
|
+
ruby-progressbar (1.11.0)
|
97
112
|
thor (1.2.1)
|
98
113
|
thread_safe (0.3.6)
|
99
114
|
typhoeus (1.4.0)
|
100
115
|
ethon (>= 0.9.0)
|
101
116
|
tzinfo (1.2.9)
|
102
117
|
thread_safe (~> 0.1)
|
118
|
+
unicode-display_width (1.8.0)
|
103
119
|
xcodeproj (1.21.0)
|
104
120
|
CFPropertyList (>= 2.3.3, < 4.0)
|
105
121
|
atomos (~> 0.1.3)
|
@@ -119,6 +135,7 @@ DEPENDENCIES
|
|
119
135
|
colored2
|
120
136
|
rake (~> 13.0)
|
121
137
|
rspec (~> 3.2)
|
138
|
+
rubocop
|
122
139
|
thor
|
123
140
|
xcodeproj
|
124
141
|
yk_command!
|
data/README.md
CHANGED
@@ -1,12 +1,39 @@
|
|
1
1
|
# YkCommand
|
2
2
|
|
3
|
-
|
3
|
+
## Pre install
|
4
|
+
|
5
|
+
准备好Ruby环境 ,依赖于RVM做ruby环境管理
|
6
|
+
|
7
|
+
```shell
|
8
|
+
\curl -sSL https://get.rvm.io | bash -s stable
|
9
|
+
```
|
10
|
+
|
11
|
+
```shell
|
12
|
+
source ~/.zshrc
|
13
|
+
```
|
14
|
+
|
15
|
+
```shell
|
16
|
+
rvm install 2.7.2
|
17
|
+
```
|
18
|
+
|
19
|
+
```shell
|
20
|
+
rvm gemset create rails23
|
21
|
+
```
|
22
|
+
|
23
|
+
```shell
|
24
|
+
rvm use 2.7.2@tom
|
25
|
+
```
|
4
26
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
27
|
|
7
28
|
## Installation
|
8
29
|
|
9
|
-
|
30
|
+
$ gem install cocoapods thor colored2
|
31
|
+
|
32
|
+
install it yourself as:
|
33
|
+
|
34
|
+
$ gem install yk_command
|
35
|
+
|
36
|
+
Or Add this line to your application's Gemfile:
|
10
37
|
|
11
38
|
```ruby
|
12
39
|
gem 'yk_command'
|
@@ -16,13 +43,17 @@ And then execute:
|
|
16
43
|
|
17
44
|
$ bundle install
|
18
45
|
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install yk_command
|
22
46
|
|
23
47
|
## Usage
|
24
48
|
|
25
|
-
|
49
|
+
```shell
|
50
|
+
cd < you folder >
|
51
|
+
```
|
52
|
+
|
53
|
+
```shell
|
54
|
+
yk_command create
|
55
|
+
```
|
56
|
+
|
26
57
|
|
27
58
|
## Development
|
28
59
|
|
@@ -30,6 +61,4 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
30
61
|
|
31
62
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
63
|
|
33
|
-
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yk_command.
|
64
|
+
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'yk_command'
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require "yk_command"
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require 'irb'
|
15
15
|
IRB.start(__FILE__)
|
data/bin/yk_command
CHANGED
data/lib/yk_command/commands.rb
CHANGED
@@ -8,70 +8,21 @@ module YkCommand
|
|
8
8
|
class CLI < Thor
|
9
9
|
include Thor::Actions
|
10
10
|
|
11
|
-
|
12
|
-
method_option :name, aliases: '-n'
|
13
|
-
def hello_world(name)
|
14
|
-
say "hello world #{name}", :yellow
|
15
|
-
end
|
16
|
-
|
17
|
-
CONFIG_FILE = '.YKModuleFilesConfig.yml'
|
18
|
-
|
19
|
-
desc 'read_config', '读取配置'
|
20
|
-
def read_config(path)
|
21
|
-
config_file_path = "#{path}/#{CONFIG_FILE}"
|
22
|
-
config = File.exists?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
23
|
-
|
24
|
-
project = @name
|
25
|
-
say "语言:",:green
|
26
|
-
language = ask("Project language [#{config[:language]}] ?", :limited_to => ["objc", "swift", ""])
|
27
|
-
say "类名前缀:",:green
|
28
|
-
class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
|
29
|
-
say "文件作者:",:green
|
30
|
-
author = ask("Author [#{config[:author]}] ?")
|
31
|
-
|
32
|
-
config[:project] = project.empty? ? config[:project] || '' : project
|
33
|
-
config[:language] = language.empty? ? config[:language] || 'objc' : language
|
34
|
-
config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
|
35
|
-
config[:author] = author.empty? ? config[:author] || '' : author
|
36
|
-
|
37
|
-
File.open(config_file_path, 'w') do |f|
|
38
|
-
f.write config.to_yaml
|
39
|
-
# f.write YAML.to_yaml(config)
|
40
|
-
end
|
41
|
-
|
42
|
-
@module = @name
|
43
|
-
@class_prefix = config[:class_prefix]
|
44
|
-
@prefixed_module = config[:class_prefix] + @module
|
45
|
-
@project = config[:project]
|
46
|
-
@author = config[:author]
|
47
|
-
@date = Time.now.strftime('%d/%m/%y')
|
48
|
-
@lang = config[:language]
|
49
|
-
@prefixed_module = "YK#{@name}"
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
|
11
|
+
CONFIG_FILE = '.YKModuleFilesConfig.yml'.freeze
|
54
12
|
|
55
13
|
desc 'create', '开始配置'
|
56
14
|
method_option :create, aliases: '-c'
|
57
|
-
def create(path=nil)
|
58
|
-
|
59
|
-
if path == nil
|
60
|
-
path = Dir.pwd
|
61
|
-
end
|
62
|
-
|
63
|
-
say "模块名:",:green
|
15
|
+
def create(path = nil)
|
16
|
+
path = Dir.pwd if path.nil?
|
64
17
|
|
18
|
+
say '模块名:', :green
|
65
19
|
config_file_path = "#{path}/#{CONFIG_FILE}"
|
20
|
+
config = File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
21
|
+
input_name = ask("Project name [#{config[:project]}] ?")
|
66
22
|
|
67
|
-
|
68
|
-
|
69
|
-
input_name = ask("Project name [#{config[:project]}] ?")
|
70
|
-
if input_name != ""
|
23
|
+
if input_name != ''
|
71
24
|
@name = input_name
|
72
|
-
if input_name != config[:project]
|
73
|
-
config[:project] = input_name
|
74
|
-
end
|
25
|
+
config[:project] = input_name if input_name != config[:project]
|
75
26
|
else
|
76
27
|
@name = config[:project]
|
77
28
|
end
|
@@ -82,91 +33,141 @@ module YkCommand
|
|
82
33
|
|
83
34
|
@final_path = "#{path}/#{@name}"
|
84
35
|
|
85
|
-
if File.exist?(
|
86
|
-
say "#{@final_path} 已存在:"
|
36
|
+
if File.exist?(@final_path.to_s)
|
37
|
+
say "#{@final_path} 已存在:", :red
|
87
38
|
else
|
88
39
|
prepare_folder
|
89
40
|
read_config(path)
|
90
41
|
|
91
42
|
if File.exist?("#{@final_path}/configure")
|
92
|
-
system("#{@final_path}/configure", @name, @lang
|
43
|
+
system("#{@final_path}/configure", @name, @lang, @class_prefix, *@additional_args)
|
93
44
|
else
|
94
|
-
say
|
45
|
+
say 'Template does not have a configure file', :red
|
95
46
|
end
|
96
47
|
|
97
48
|
yk_module_folders
|
98
49
|
yk_template_files
|
99
50
|
|
100
51
|
end
|
52
|
+
end
|
101
53
|
|
54
|
+
no_commands do
|
55
|
+
def read_config(path)
|
56
|
+
config_file_path = "#{path}/#{CONFIG_FILE}"
|
57
|
+
config = File.exist?(config_file_path) ? YAML.load_file(config_file_path) : {}
|
58
|
+
|
59
|
+
project = @name
|
60
|
+
say '语言:', :green
|
61
|
+
language = ask("Project language [#{config[:language]}] ?", limited_to: ['objc', 'swift', ''])
|
62
|
+
say '类名前缀:', :green
|
63
|
+
class_prefix = ask("Class prefix [#{config[:class_prefix]}] ?")
|
64
|
+
say '文件作者:', :green
|
65
|
+
author = ask("Author [#{config[:author]}] ?")
|
66
|
+
|
67
|
+
config[:project] = project.empty? ? config[:project] || '' : project
|
68
|
+
config[:language] = language.empty? ? config[:language] || 'objc' : language
|
69
|
+
config[:class_prefix] = class_prefix.empty? ? config[:class_prefix] || '' : class_prefix
|
70
|
+
config[:author] = author.empty? ? config[:author] || '' : author
|
71
|
+
|
72
|
+
File.open(config_file_path, 'w') do |f|
|
73
|
+
f.write config.to_yaml
|
74
|
+
# f.write YAML.to_yaml(config)
|
75
|
+
end
|
102
76
|
|
77
|
+
@module = @name
|
78
|
+
@class_prefix = config[:class_prefix]
|
79
|
+
@prefixed_module = config[:class_prefix] + @module
|
80
|
+
@project = config[:project]
|
81
|
+
@author = config[:author]
|
82
|
+
@date = Time.now.strftime('%d/%m/%y')
|
83
|
+
@lang = config[:language]
|
84
|
+
@prefixed_module = "YK#{@name}"
|
85
|
+
end
|
103
86
|
|
104
|
-
|
87
|
+
def prepare_folder
|
88
|
+
host_a = 'yeah'
|
89
|
+
host_b = 'ka'
|
90
|
+
template_repo_url = "http://gitlab.#{host_a}#{host_b}.com/App/iOS/YKComponents/YKProjectTemplate.git"
|
91
|
+
system("git clone #{template_repo_url} #{@final_path}")
|
105
92
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
system("git clone #{template_repo_url} #{@final_path}")
|
93
|
+
# FileUtils.remove_dir(@final_path, true)
|
94
|
+
# FileUtils.cp_r('/Users/imacn24/Documents/dev/YKProjectTemplate', @final_path)
|
95
|
+
# FileUtils.remove_dir("#{@final_path}/.git", true)
|
96
|
+
end
|
111
97
|
|
112
|
-
|
113
|
-
|
114
|
-
# FileUtils.remove_dir("#{@final_path}/.git", true)
|
98
|
+
def yk_module_folders
|
99
|
+
class_folder_path = "#{@final_path}/#{@name}/Classes"
|
115
100
|
|
101
|
+
first_level_folders = %w[Public Private]
|
102
|
+
public_level_folders = ['Register']
|
103
|
+
private_level_folders = %w[Business Category Vendor Tools]
|
116
104
|
|
117
|
-
|
105
|
+
first_level_folders.each do |folder|
|
106
|
+
path = "#{class_folder_path}/#{folder}"
|
107
|
+
empty_directory path
|
108
|
+
end
|
118
109
|
|
119
|
-
|
110
|
+
public_level_folders.each do |folder|
|
111
|
+
path = "#{class_folder_path}/Public/#{folder}"
|
112
|
+
empty_directory path
|
113
|
+
end
|
120
114
|
|
121
|
-
|
115
|
+
private_level_folders.each do |folder|
|
116
|
+
path = "#{class_folder_path}/Private/#{folder}"
|
117
|
+
empty_directory path
|
118
|
+
if folder == 'Business'
|
122
119
|
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
else
|
121
|
+
system "touch \"#{path}/EmptyFile.m\""
|
122
|
+
end
|
126
123
|
|
127
124
|
|
128
|
-
|
129
|
-
path = "#{class_folder_path}/#{folder}"
|
130
|
-
empty_directory path
|
125
|
+
end
|
131
126
|
end
|
132
127
|
|
133
|
-
|
134
|
-
path = "#{class_folder_path}/Public/#{folder}"
|
135
|
-
empty_directory path
|
136
|
-
end
|
128
|
+
CLI.source_root(File.dirname(__FILE__))
|
137
129
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
130
|
+
def yk_template_files
|
131
|
+
register_path = "#{@final_path}/#{@name}/Classes/Public/Register"
|
132
|
+
registger = {
|
133
|
+
'RouterRegister.h' => 'RouterRegister',
|
134
|
+
'RouterRegister.m' => 'RouterRegister',
|
135
|
+
'ServiceRegister.h' => 'ServiceRegister',
|
136
|
+
'ServiceRegister.m' => 'ServiceRegister'
|
137
|
+
}
|
143
138
|
|
144
|
-
|
139
|
+
registger.each do |file_name, _folder|
|
140
|
+
final_file = "#{register_path}/#{@prefixed_module}#{file_name}"
|
141
|
+
template "#{__dir__}/template/objc/#{file_name}", final_file
|
142
|
+
end
|
145
143
|
|
146
|
-
|
144
|
+
template_code_filename = ['ServiceProtocol.h','RouterDefine.h']
|
145
|
+
public_folder_path = "#{@final_path}/#{@name}/Classes/Public"
|
146
|
+
template_code_filename.each do |file_name|
|
147
|
+
final_file = "#{public_folder_path}/#{@prefixed_module}#{file_name}"
|
148
|
+
source = "#{__dir__}/template/objc/#{file_name}"
|
149
|
+
template source, final_file
|
150
|
+
end
|
147
151
|
|
148
|
-
def yk_template_files
|
149
|
-
register_path = "#{@final_path}/#{@name}/Classes/Public/Register"
|
150
|
-
registger = {
|
151
|
-
'RouterRegister.h' => 'RouterRegister',
|
152
|
-
'RouterRegister.m' => 'RouterRegister',
|
153
|
-
'ServiceRegister.h' => 'ServiceRegister',
|
154
|
-
'ServiceRegister.m' => 'ServiceRegister',
|
155
|
-
}
|
156
152
|
|
153
|
+
business_demo_path = "#{@final_path}/#{@name}/Classes/Private/Business"
|
154
|
+
demo_replace_file = ['DemoViewController.h','DemoViewController.m','DemoViewModel.h','DemoViewModel.m']
|
155
|
+
demo_replace_file.each do |file_name|
|
156
|
+
final_file = "#{business_demo_path}/#{@prefixed_module}#{file_name}"
|
157
|
+
source = "#{__dir__}/template/objc/demo/#{file_name}"
|
158
|
+
template source, final_file
|
159
|
+
end
|
157
160
|
|
158
|
-
registger.each do |file_name, folder|
|
159
|
-
final_file = "#{register_path}/#{@prefixed_module}#{file_name}"
|
160
|
-
template "#{__dir__}/template/objc/#{file_name}",final_file
|
161
|
-
end
|
162
161
|
|
163
|
-
Dir.chdir("#{@final_path}/Example") do
|
164
|
-
system "pod install --silent"
|
165
|
-
system "open './#{@name}.xcworkspace'"
|
166
162
|
|
163
|
+
Dir.chdir("#{@final_path}/Example") do
|
164
|
+
system 'pod install --silent'
|
165
|
+
system "open './#{@name}.xcworkspace'"
|
166
|
+
end
|
167
167
|
end
|
168
168
|
|
169
169
|
end
|
170
170
|
|
171
|
+
|
171
172
|
end
|
172
|
-
end
|
173
|
+
end
|
@@ -0,0 +1,14 @@
|
|
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 */
|
@@ -8,6 +8,25 @@
|
|
8
8
|
|
9
9
|
#import "<%= @prefixed_module %>RouterRegister.h"
|
10
10
|
|
11
|
+
#import <YKRouterComponent/YKRouterComponentHeader.h>
|
12
|
+
#import <YKCategoryComponent/YKCategoriesComponentHeader.h>
|
13
|
+
|
14
|
+
#import "<%= @prefixed_module %>RouterDefine.h"
|
15
|
+
|
16
|
+
#import "<%= @prefixed_module %>DemoViewController.h"
|
17
|
+
|
18
|
+
|
11
19
|
@implementation <%= @prefixed_module %>RouterRegister
|
12
20
|
|
21
|
+
@YKRouterRegister() {
|
22
|
+
|
23
|
+
[[YKRouterComponent shareInstance] ykRegisterUrlPartterns:kDemoRouterString error:nil action:^(YKRouterUrlRequest * _Nonnull urlRequest, YKRouterUrlCompletion _Nonnull completetion) {
|
24
|
+
|
25
|
+
<%= @prefixed_module %>DemoViewController *vc = [[<%= @prefixed_module %>DemoViewController alloc] init];
|
26
|
+
[[UIViewController yk_topViewController].navigationController pushViewController:vc animated:YES];
|
27
|
+
|
28
|
+
}];
|
29
|
+
|
30
|
+
}
|
31
|
+
|
13
32
|
@end
|
@@ -0,0 +1,15 @@
|
|
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
|
@@ -7,7 +7,19 @@
|
|
7
7
|
//
|
8
8
|
|
9
9
|
#import "<%= @prefixed_module %>ServiceRegister.h"
|
10
|
+
#import <YKModuleServiceComponent/YKModuleServiceComponentHeader.h>
|
11
|
+
|
12
|
+
#import "<%= @prefixed_module %>ServiceProtocol.h"
|
13
|
+
|
14
|
+
|
15
|
+
#import "<%= @prefixed_module %>DemoViewModel.h"
|
16
|
+
|
10
17
|
|
11
18
|
@implementation <%= @prefixed_module %>ServiceRegister
|
12
19
|
|
20
|
+
@YKModuleServiceRegister(){
|
21
|
+
YKModuleServiceRegisterExecute(<%= @prefixed_module %>DemoViewModel.class, @protocol(<%= @prefixed_module %>ServiceProtocol), nil);
|
22
|
+
}
|
23
|
+
|
24
|
+
|
13
25
|
@end
|
@@ -0,0 +1,17 @@
|
|
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
|
@@ -0,0 +1,28 @@
|
|
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
|
@@ -0,0 +1,14 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
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
|
data/lib/yk_command/version.rb
CHANGED
data/lib/yk_command.rb
CHANGED
data/yk_command.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/yk_command/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'yk_command'
|
7
7
|
spec.version = YkCommand::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['Major Tom']
|
9
|
+
spec.email = ['v2top1@163.com']
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = 'a short summary, because RubyGems requires one.'
|
12
|
+
spec.description = 'a longer description or delete this line.'
|
13
|
+
spec.homepage = 'https://github.com/lyleLH'
|
14
|
+
spec.required_ruby_version = '>= 2.6.0'
|
15
15
|
|
16
16
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
17
17
|
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/lyleLH/yk_command'
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -25,23 +25,21 @@ Gem::Specification.new do |spec|
|
|
25
25
|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
26
|
end
|
27
27
|
end
|
28
|
-
spec.bindir =
|
28
|
+
spec.bindir = 'bin'
|
29
29
|
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = [
|
30
|
+
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
33
|
# spec.add_dependency "example-gem", "~> 1.0"
|
34
34
|
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
42
|
-
spec.add_development_dependency
|
43
|
-
|
44
|
-
|
35
|
+
spec.add_development_dependency 'bundler', '~> 2.2.5'
|
36
|
+
spec.add_development_dependency 'thor'
|
37
|
+
spec.add_development_dependency 'colored'
|
38
|
+
spec.add_development_dependency 'colored2'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
40
|
+
spec.add_development_dependency 'xcodeproj'
|
41
|
+
spec.add_development_dependency 'cocoapods'
|
42
|
+
spec.add_development_dependency 'cocoapods-core'
|
45
43
|
|
46
44
|
# For more information and examples about making a new gem, checkout our
|
47
45
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yk_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Major Tom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,6 +132,7 @@ executables:
|
|
132
132
|
extensions: []
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
|
+
- ".YKModuleFilesConfig.yml"
|
135
136
|
- ".idea/.gitignore"
|
136
137
|
- ".idea/misc.xml"
|
137
138
|
- ".idea/modules.xml"
|
@@ -146,10 +147,16 @@ files:
|
|
146
147
|
- bin/yk_command
|
147
148
|
- lib/yk_command.rb
|
148
149
|
- lib/yk_command/commands.rb
|
150
|
+
- lib/yk_command/template/objc/RouterDefine.h
|
149
151
|
- lib/yk_command/template/objc/RouterRegister.h
|
150
152
|
- lib/yk_command/template/objc/RouterRegister.m
|
153
|
+
- lib/yk_command/template/objc/ServiceProtocol.h
|
151
154
|
- lib/yk_command/template/objc/ServiceRegister.h
|
152
155
|
- lib/yk_command/template/objc/ServiceRegister.m
|
156
|
+
- lib/yk_command/template/objc/demo/DemoViewController.h
|
157
|
+
- lib/yk_command/template/objc/demo/DemoViewController.m
|
158
|
+
- lib/yk_command/template/objc/demo/DemoViewModel.h
|
159
|
+
- lib/yk_command/template/objc/demo/DemoViewModel.m
|
153
160
|
- lib/yk_command/version.rb
|
154
161
|
- sig/yk_command.rbs
|
155
162
|
- yk_command.gemspec
|