vsvipergen 0.1.8 → 0.1.9
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.lock +2 -2
- data/bin/console +119 -113
- data/bin/setup +1 -1
- data/exe/vsvipergen +117 -111
- data/lib/templates/VS<$$>Contracts.swift +36 -0
- data/lib/templates/interactor/VS<$$>Interactor.h +2 -2
- data/lib/templates/interactor/VS<$$>Interactor.swift +22 -0
- data/lib/templates/model/VS<$$>VO.swift +17 -0
- data/lib/templates/presenter/VS<$$>Presenter.h +3 -3
- data/lib/templates/presenter/VS<$$>Presenter.swift +23 -0
- data/lib/templates/router/VS<$$>Router.m +1 -1
- data/lib/templates/router/VS<$$>Router.swift +20 -0
- data/lib/templates/view/VS<$$>ViewController.h +1 -1
- data/lib/templates/view/VS<$$>ViewController.swift +18 -0
- data/lib/vsvipergen/version.rb +1 -1
- data/lib/vsvipergen.rb +35 -1
- data/lib/vsvipergen_contracts.rb +27 -1
- data/lib/vsvipergen_interactor.rb +28 -2
- data/lib/vsvipergen_model.rb +28 -2
- data/lib/vsvipergen_presenter.rb +28 -2
- data/lib/vsvipergen_router.rb +28 -2
- data/lib/vsvipergen_view.rb +28 -2
- data/vsvipergen.gemspec +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b40cc2755fc187e28514b1a0e87512be9cd793342bdefde360256a6019b3bafd
|
4
|
+
data.tar.gz: b54acbe61bbde7e247056736c9f72b5d4e59343f89a4a15a6bf86392d165b1a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc6729aec5e42d95a0e78ec123e20378c5a14ca732d090fc67eff341e3112a2ef11427c2b9de230389721895d7ca3465d0109fac0398a33a934f1339167f247
|
7
|
+
data.tar.gz: 886dfa39b295aad6b6070ed42a776d77a10974d5a7815466cbb8a057e79ddfe14be3d6882b35fbe52b045a2fb43737427678a342a8f5a65ac073f298ce7fc25c
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
@@ -11,139 +11,145 @@ require "vsvipergen_router"
|
|
11
11
|
require "xcodeproj"
|
12
12
|
require "colorize"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
|
32
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
33
|
-
puts "input xcode project file name [ex:VLunch] :"
|
34
|
-
while true
|
35
|
-
projectName = gets
|
36
|
-
|
37
|
-
break if (projectName.strip != "")
|
14
|
+
begin
|
15
|
+
#################################################
|
16
|
+
############ handle user input start ############
|
17
|
+
projectName = ""
|
18
|
+
lang = ""
|
19
|
+
filePrefix = ""
|
20
|
+
modelPrefix = ""
|
21
|
+
now = Time.now.strftime("%Y/%m/%d")
|
22
|
+
year = Time.now.strftime("%Y")
|
23
|
+
|
24
|
+
# 프로그래밍 언어 입력 요구
|
25
|
+
while true
|
26
|
+
puts "input language [o:objc, a:android, s:swift] : "
|
27
|
+
lang = gets
|
28
|
+
|
29
|
+
break if (lang.strip == "objc" || lang.strip == "o" || lang.strip == "android" || lang.strip == "a" || lang.strip == "swift" || lang.strip == "s")
|
38
30
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts "input file
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
# objective-c 선택일 경우 모델 prefix 입력 요구
|
50
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
51
|
-
puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
|
52
|
-
modelPrefix = gets
|
53
|
-
|
54
|
-
if modelPrefix == "" then
|
55
|
-
modelPrefix = "Default"
|
31
|
+
|
32
|
+
# objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
|
33
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
34
|
+
puts "input xcode project file name [ex:VLunch] :"
|
35
|
+
while true
|
36
|
+
projectName = gets
|
37
|
+
|
38
|
+
break if (projectName.strip != "")
|
39
|
+
end
|
56
40
|
end
|
57
|
-
end
|
58
41
|
|
59
|
-
|
60
|
-
|
42
|
+
# 파일 prefix 입력 요구
|
43
|
+
puts "input file prefix [ex:type" + " Login".yellow + " for VS" + "Login".yellow + "ViewController(or VS" + "Login".yellow + "Page), ...] : "
|
44
|
+
filePrefix = gets
|
61
45
|
|
46
|
+
if filePrefix == "" then
|
47
|
+
filePrefix = "Default"
|
48
|
+
end
|
62
49
|
|
50
|
+
# objective-c 또는 swift 선택일 경우 모델 prefix 입력 요구
|
51
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
52
|
+
puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
|
53
|
+
modelPrefix = gets
|
54
|
+
|
55
|
+
if modelPrefix == "" then
|
56
|
+
modelPrefix = "Default"
|
57
|
+
end
|
58
|
+
end
|
63
59
|
|
60
|
+
############# handle user input end #############
|
61
|
+
#################################################
|
64
62
|
|
65
|
-
#################################################
|
66
|
-
############# create file generator #############
|
67
|
-
fileGenerators = []
|
68
|
-
generatedFilePaths = []
|
69
|
-
subPathAndFilePathHashes = []
|
70
63
|
|
71
|
-
generatorFactory = Vsvipergen::ViperGeneratorFactory.new
|
72
|
-
generatorFactory.init(filePrefix, modelPrefix, now, year)
|
73
64
|
|
74
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
75
|
-
fileGenerators = generatorFactory.createObjcGenerator
|
76
|
-
else
|
77
|
-
fileGenerators = generatorFactory.createAndroidGenerator
|
78
|
-
end
|
79
|
-
############# create file generator #############
|
80
|
-
#################################################
|
81
65
|
|
66
|
+
#################################################
|
67
|
+
############# create file generator #############
|
68
|
+
fileGenerators = []
|
69
|
+
generatedFilePaths = []
|
70
|
+
subPathAndFilePathHashes = []
|
71
|
+
|
72
|
+
generatorFactory = Vsvipergen::ViperGeneratorFactory.new
|
73
|
+
generatorFactory.init(filePrefix, modelPrefix, now, year)
|
74
|
+
|
75
|
+
if lang.strip == "objc" || lang.strip == "o" then
|
76
|
+
fileGenerators = generatorFactory.createObjcGenerator
|
77
|
+
elsif lang.strip == "swift" || lang.strip == "s" then
|
78
|
+
fileGenerators = generatorFactory.createSwiftGenerator
|
79
|
+
else
|
80
|
+
fileGenerators = generatorFactory.createAndroidGenerator
|
81
|
+
end
|
82
|
+
############# create file generator #############
|
83
|
+
#################################################
|
82
84
|
|
83
85
|
|
84
|
-
#################################################
|
85
|
-
################## make file ###################
|
86
|
-
for generator in fileGenerators
|
87
|
-
files = generator.makeFiles
|
88
86
|
|
89
|
-
|
87
|
+
#################################################
|
88
|
+
################## make file ###################
|
89
|
+
for generator in fileGenerators
|
90
|
+
files = generator.makeFiles
|
90
91
|
|
91
|
-
|
92
|
-
|
92
|
+
for file in files
|
93
|
+
generatedFilePaths.push(file)
|
94
|
+
end
|
93
95
|
end
|
94
|
-
|
95
|
-
################## make file ###################
|
96
|
-
#################################################
|
97
|
-
|
98
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
96
|
+
################## make file ###################
|
99
97
|
#################################################
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
#
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
98
|
+
|
99
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
100
|
+
#################################################
|
101
|
+
############# add file to project ##############
|
102
|
+
# Open the existing Xcode project
|
103
|
+
xcodeProjectFile = projectName.strip + ".xcodeproj".strip
|
104
|
+
project = Xcodeproj::Project.open(xcodeProjectFile.strip)
|
105
|
+
targets = project.targets
|
106
|
+
mainTarget = project.targets.first
|
107
|
+
newGroup = project.new_group(filePrefix.strip.downcase)
|
108
|
+
|
109
|
+
# Add files, groups to the project in the main group
|
110
|
+
for filePath in generatedFilePaths
|
111
|
+
puts "filePath : #{filePath}"
|
112
|
+
|
113
|
+
# extract child group name from file path
|
114
|
+
pathArr = filePath.split("/")
|
115
|
+
childGroupName = pathArr[pathArr.count - 2]
|
116
|
+
puts "childGroupName : #{childGroupName}"
|
117
|
+
childGroup = nil
|
118
|
+
|
119
|
+
if childGroupName != "" then
|
120
|
+
# check same child group added to newGroup
|
121
|
+
addChildGroupAlready = false
|
122
|
+
newGroup.groups.each { |group|
|
123
|
+
if group.name == childGroupName then
|
124
|
+
addChildGroupAlready = true
|
125
|
+
childGroup = group
|
126
|
+
end
|
127
|
+
}
|
128
|
+
|
129
|
+
# add child group to newGroup
|
130
|
+
if addChildGroupAlready == false then
|
131
|
+
puts "add child group : #{childGroupName}"
|
132
|
+
childGroup = newGroup.new_group(childGroupName)
|
123
133
|
end
|
124
|
-
}
|
125
134
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
135
|
+
# Add file to child group
|
136
|
+
file = childGroup.new_file(filePath.strip)
|
137
|
+
else
|
138
|
+
puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
|
139
|
+
# Add file to new group
|
140
|
+
file = newGroup.new_file(filePath.strip)
|
130
141
|
end
|
131
142
|
|
132
|
-
# Add file to
|
133
|
-
|
134
|
-
else
|
135
|
-
puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
|
136
|
-
# Add file to new group
|
137
|
-
file = newGroup.new_file(filePath.strip)
|
143
|
+
# Add the file to the main target
|
144
|
+
mainTarget.add_file_references([file])
|
138
145
|
end
|
139
146
|
|
140
|
-
#
|
141
|
-
|
147
|
+
# Save the project file
|
148
|
+
project.save(xcodeProjectFile)
|
149
|
+
puts "all files added to xcode project."
|
150
|
+
############# add file to project ##############
|
151
|
+
#################################################
|
142
152
|
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
puts "all files added to xcode project."
|
147
|
-
############# add file to project ##############
|
148
|
-
#################################################
|
149
|
-
end
|
153
|
+
rescue StandardError => msg
|
154
|
+
puts msg
|
155
|
+
end
|
data/bin/setup
CHANGED
data/exe/vsvipergen
CHANGED
@@ -10,136 +10,142 @@ require "vsvipergen_router"
|
|
10
10
|
require "xcodeproj"
|
11
11
|
require "colorize"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
|
31
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
32
|
-
puts "input xcode project file name [ex:VLunch] :"
|
33
|
-
while true
|
34
|
-
projectName = gets
|
35
|
-
|
36
|
-
break if (projectName.strip != "")
|
13
|
+
begin
|
14
|
+
#################################################
|
15
|
+
############ handle user input start ############
|
16
|
+
projectName = ""
|
17
|
+
lang = ""
|
18
|
+
filePrefix = ""
|
19
|
+
modelPrefix = ""
|
20
|
+
now = Time.now.strftime("%Y/%m/%d")
|
21
|
+
year = Time.now.strftime("%Y")
|
22
|
+
|
23
|
+
# 프로그래밍 언어 입력 요구
|
24
|
+
while true
|
25
|
+
puts "input language [o:objc, a:android, s:swift] : "
|
26
|
+
lang = gets
|
27
|
+
|
28
|
+
break if (lang.strip == "objc" || lang.strip == "o" || lang.strip == "android" || lang.strip == "a" || lang.strip == "swift" || lang.strip == "s")
|
37
29
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
puts "input file
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
# objective-c 선택일 경우 모델 prefix 입력 요구
|
49
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
50
|
-
puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
|
51
|
-
modelPrefix = gets
|
52
|
-
|
53
|
-
if modelPrefix == "" then
|
54
|
-
modelPrefix = "Default"
|
30
|
+
|
31
|
+
# objective-c 선택일 경우 프로젝트 파일 이름 입력 요구
|
32
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
33
|
+
puts "input xcode project file name [ex:VLunch] :"
|
34
|
+
while true
|
35
|
+
projectName = gets
|
36
|
+
|
37
|
+
break if (projectName.strip != "")
|
38
|
+
end
|
55
39
|
end
|
56
|
-
end
|
57
40
|
|
58
|
-
|
59
|
-
|
41
|
+
# 파일 prefix 입력 요구
|
42
|
+
puts "input file prefix [ex:type" + " Login".yellow + " for VS" + "Login".yellow + "ViewController(or VS" + "Login".yellow + "Page), ...] : "
|
43
|
+
filePrefix = gets
|
60
44
|
|
45
|
+
if filePrefix == "" then
|
46
|
+
filePrefix = "Default"
|
47
|
+
end
|
61
48
|
|
49
|
+
# objective-c 또는 swift 선택일 경우 모델 prefix 입력 요구
|
50
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
51
|
+
puts "input model prefix [ex:type" + " User".yellow + " for VS" + "User".yellow + "VO] : "
|
52
|
+
modelPrefix = gets
|
53
|
+
|
54
|
+
if modelPrefix == "" then
|
55
|
+
modelPrefix = "Default"
|
56
|
+
end
|
57
|
+
end
|
62
58
|
|
59
|
+
############# handle user input end #############
|
60
|
+
#################################################
|
63
61
|
|
64
|
-
#################################################
|
65
|
-
############# create file generator #############
|
66
|
-
fileGenerators = []
|
67
|
-
generatedFilePaths = []
|
68
62
|
|
69
|
-
generatorFactory = Vsvipergen::ViperGeneratorFactory.new
|
70
|
-
generatorFactory.init(filePrefix, modelPrefix, now, year)
|
71
63
|
|
72
|
-
if lang.strip == "objc" || lang.strip == "o" then
|
73
|
-
fileGenerators = generatorFactory.createObjcGenerator
|
74
|
-
else
|
75
|
-
fileGenerators = generatorFactory.createAndroidGenerator
|
76
|
-
end
|
77
|
-
############# create file generator #############
|
78
|
-
#################################################
|
79
64
|
|
65
|
+
#################################################
|
66
|
+
############# create file generator #############
|
67
|
+
fileGenerators = []
|
68
|
+
generatedFilePaths = []
|
69
|
+
|
70
|
+
generatorFactory = Vsvipergen::ViperGeneratorFactory.new
|
71
|
+
generatorFactory.init(filePrefix, modelPrefix, now, year)
|
72
|
+
|
73
|
+
if lang.strip == "objc" || lang.strip == "o" then
|
74
|
+
fileGenerators = generatorFactory.createObjcGenerator
|
75
|
+
elsif lang.strip == "swift" || lang.strip == "s" then
|
76
|
+
fileGenerators = generatorFactory.createSwiftGenerator
|
77
|
+
else
|
78
|
+
fileGenerators = generatorFactory.createAndroidGenerator
|
79
|
+
end
|
80
|
+
############# create file generator #############
|
81
|
+
#################################################
|
80
82
|
|
81
83
|
|
82
|
-
#################################################
|
83
|
-
################## make file ###################
|
84
|
-
for generator in fileGenerators
|
85
|
-
files = generator.makeFiles
|
86
84
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
################## make file ###################
|
92
|
-
#################################################
|
85
|
+
#################################################
|
86
|
+
################## make file ###################
|
87
|
+
for generator in fileGenerators
|
88
|
+
files = generator.makeFiles
|
93
89
|
|
94
|
-
|
90
|
+
for file in files
|
91
|
+
generatedFilePaths.push(file)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
################## make file ###################
|
95
95
|
#################################################
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
#
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
96
|
+
|
97
|
+
if lang.strip == "objc" || lang.strip == "o" || lang.strip == "swift" || lang.strip == "s" then
|
98
|
+
#################################################
|
99
|
+
############# add file to project ##############
|
100
|
+
# Open the existing Xcode project
|
101
|
+
xcodeProjectFile = projectName.strip + ".xcodeproj".strip
|
102
|
+
project = Xcodeproj::Project.open(xcodeProjectFile.strip)
|
103
|
+
targets = project.targets
|
104
|
+
mainTarget = project.targets.first
|
105
|
+
newGroup = project.new_group(filePrefix.strip.downcase)
|
106
|
+
|
107
|
+
# Add files, groups to the project in the main group
|
108
|
+
for filePath in generatedFilePaths
|
109
|
+
|
110
|
+
# extract child group name from file path
|
111
|
+
pathArr = filePath.split("/")
|
112
|
+
childGroupName = pathArr[pathArr.count - 2]
|
113
|
+
childGroup = nil
|
114
|
+
|
115
|
+
if childGroupName != "" then
|
116
|
+
# check same child group added to newGroup
|
117
|
+
addChildGroupAlready = false
|
118
|
+
newGroup.groups.each { |group|
|
119
|
+
if group.name == childGroupName then
|
120
|
+
addChildGroupAlready = true
|
121
|
+
childGroup = group
|
122
|
+
end
|
123
|
+
}
|
124
|
+
|
125
|
+
# add child group to newGroup
|
126
|
+
if addChildGroupAlready == false then
|
127
|
+
puts "add child group : #{childGroupName}"
|
128
|
+
childGroup = newGroup.new_group(childGroupName)
|
119
129
|
end
|
120
|
-
}
|
121
130
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
131
|
+
# Add file to child group
|
132
|
+
file = childGroup.new_file(filePath.strip)
|
133
|
+
else
|
134
|
+
puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
|
135
|
+
# Add file to new group
|
136
|
+
file = newGroup.new_file(filePath.strip)
|
126
137
|
end
|
127
138
|
|
128
|
-
# Add file to
|
129
|
-
|
130
|
-
else
|
131
|
-
puts "could not extract child group name from file path, add file to parent group(#{newGroup.name})".red
|
132
|
-
# Add file to new group
|
133
|
-
file = newGroup.new_file(filePath.strip)
|
139
|
+
# Add the file to the main target
|
140
|
+
mainTarget.add_file_references([file])
|
134
141
|
end
|
135
142
|
|
136
|
-
#
|
137
|
-
|
143
|
+
# Save the project file
|
144
|
+
project.save(xcodeProjectFile)
|
145
|
+
puts "all files added to xcode project."
|
146
|
+
############# add file to project ##############
|
147
|
+
#################################################
|
138
148
|
end
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
puts "all files added to xcode project."
|
143
|
-
############# add file to project ##############
|
144
|
-
#################################################
|
145
|
-
end
|
149
|
+
rescue StandardError => msg
|
150
|
+
puts msg
|
151
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//
|
2
|
+
// VS<$filePrefix$>Contracts.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by Vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
import UIKit
|
11
|
+
|
12
|
+
// presenter 클래스가 구현해야 할 프로토콜 : view 클래스가 호출
|
13
|
+
protocol I<$prefix$>PresenterForView: class {
|
14
|
+
|
15
|
+
}
|
16
|
+
|
17
|
+
// view 클래스가 구현해야 할 프로토콜 : presenter 클래스가 호출
|
18
|
+
protocol I<$prefix$>ViewForPresenter: class {
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
// interactor 클래스가 구현해야 할 프로토콜 : presenter 클래스가 호출
|
23
|
+
protocol I<$prefix$>InteractorForPresenter: class {
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
// presenter 클래스가 구현해야 할 프로토콜 : interactor 클래스가 호출
|
28
|
+
protocol I<$prefix$>PresenterForInteractor: class {
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
// router 클래스가 구현해야 할 프로토콜 : 외부 viper 모듈에서 호출
|
33
|
+
protocol I<$prefix$>Router: class {
|
34
|
+
static func create<$prefix$>Module() -> UIViewController?
|
35
|
+
func moveToBack(viewController: UIViewController, completionBlock:(() -> Void)?)
|
36
|
+
}
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#import <Foundation/Foundation.h>
|
10
10
|
#import "VS<$prefix$>Contracts.h"
|
11
11
|
|
12
|
-
@interface VS<$prefix$>Interactor : NSObject<I<$prefix$>InteractorForPresenter>
|
13
|
-
@property (nonatomic, weak) id<I<$prefix$>PresenterForInteractor> presenter;
|
12
|
+
@interface VS<$prefix$>Interactor : NSObject <I<$prefix$>InteractorForPresenter>
|
13
|
+
@property (nonatomic, weak) id <I<$prefix$>PresenterForInteractor> presenter;
|
14
14
|
#pragma mark - I<$prefix$>InteractorForPresenter
|
15
15
|
@end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
//
|
2
|
+
// VS<$modelPrefix$>VO.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
|
11
|
+
class VS<$prefix$>Interactor {
|
12
|
+
weak var presenter: I<$prefix$>PresenterForInteractor?
|
13
|
+
var vo: VS<$modelPrefix$>VO
|
14
|
+
|
15
|
+
init(vo: VS<$modelPrefix$>VO) {
|
16
|
+
self.vo = vo
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
extension VS<$prefix$>Interactor: I<$prefix$>InteractorForPresenter {
|
21
|
+
|
22
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// VS<$modelPrefix$>VO.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
|
11
|
+
class VS<$modelPrefix$>VO {
|
12
|
+
var <$properties$>
|
13
|
+
|
14
|
+
init(<$properties$>) {
|
15
|
+
self.<$properties$>
|
16
|
+
}
|
17
|
+
}
|
@@ -10,9 +10,9 @@
|
|
10
10
|
#import "VS<$prefix$>Contracts.h"
|
11
11
|
|
12
12
|
@interface VS<$prefix$>Presenter : NSObject <I<$prefix$>PresenterForView, I<$prefix$>PresenterForInteractor>
|
13
|
-
@property (nonatomic, weak) id<I<$prefix$>ViewForPresenter> view;
|
14
|
-
@property (nonatomic, strong) id<I<$prefix$>InteractorForPresenter> interactor;
|
15
|
-
@property (nonatomic, strong) id<I<$prefix$>Router> router;
|
13
|
+
@property (nonatomic, weak) id <I<$prefix$>ViewForPresenter> view;
|
14
|
+
@property (nonatomic, strong) id <I<$prefix$>InteractorForPresenter> interactor;
|
15
|
+
@property (nonatomic, strong) id <I<$prefix$>Router> router;
|
16
16
|
#pragma mark - I<$prefix$>PresenterForView
|
17
17
|
#pragma mark - I<$prefix$>PresenterForInteractor
|
18
18
|
@end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// VS<$modelPrefix$>VO.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
|
11
|
+
class VS<$prefix$>Presenter {
|
12
|
+
weak var view: I<$prefix$>ViewForPresenter?
|
13
|
+
var interactor: I<$prefix$>InteractorForPresenter!
|
14
|
+
var router: I<$prefix$>Router!
|
15
|
+
}
|
16
|
+
|
17
|
+
extension VS<$prefix$>Presenter: I<$prefix$>PresenterForView {
|
18
|
+
|
19
|
+
}
|
20
|
+
|
21
|
+
extension VS<$prefix$>Presenter: I<$prefix$>PresenterForInteractor {
|
22
|
+
|
23
|
+
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
#pragma mark - I<$prefix$>Router
|
22
22
|
+ (UIViewController *)create<$prefix$>Module {
|
23
23
|
// get storyboard with name
|
24
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"VS<$prefix$>
|
24
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"VS<$prefix$>" bundle:nil];
|
25
25
|
|
26
26
|
// create specific module
|
27
27
|
VS<$prefix$>ViewController * view = [storyboard instantiateViewControllerWithIdentifier:@"VS<$prefix$>ViewController"];
|
@@ -0,0 +1,20 @@
|
|
1
|
+
//
|
2
|
+
// VS<$modelPrefix$>VO.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
import UIKit
|
11
|
+
|
12
|
+
class VS<$prefix$>Router: I<$prefix$>Router {
|
13
|
+
static func create<$prefix$>Module() -> UIViewController? {
|
14
|
+
<#fill your code...#>
|
15
|
+
}
|
16
|
+
|
17
|
+
func moveToBack(viewController: UIViewController, completionBlock:(() -> Void)?) {
|
18
|
+
<#fill your code...#>
|
19
|
+
}
|
20
|
+
}
|
@@ -10,6 +10,6 @@
|
|
10
10
|
#import "VS<$prefix$>Contracts.h"
|
11
11
|
|
12
12
|
@interface VS<$prefix$>ViewController : UIViewController <I<$prefix$>ViewForPresenter>
|
13
|
-
@property (nonatomic, strong) id<I<$prefix$>PresenterForView> presenter;
|
13
|
+
@property (nonatomic, strong) id <I<$prefix$>PresenterForView> presenter;
|
14
14
|
#pragma mark - I<$prefix$>ViewForPresenter
|
15
15
|
@end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//
|
2
|
+
// VS<$modelPrefix$>VO.swift
|
3
|
+
// VLunch
|
4
|
+
//
|
5
|
+
// Created by vendys on <$now$>..
|
6
|
+
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import UIKit
|
10
|
+
|
11
|
+
class VS<$prefix$>ViewController : UIViewController {
|
12
|
+
var presenter: I<$prefix$>PresenterForView!
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
extension VS<$prefix$>ViewController: I<$prefix$>ViewForPresenter {
|
17
|
+
|
18
|
+
}
|
data/lib/vsvipergen/version.rb
CHANGED
data/lib/vsvipergen.rb
CHANGED
@@ -15,7 +15,7 @@ module Vsvipergen
|
|
15
15
|
@now = now
|
16
16
|
@year = year
|
17
17
|
@generatedFilePaths = []
|
18
|
-
Dir.mkdir(currPath) unless File.
|
18
|
+
Dir.mkdir(currPath) unless File.exist?(currPath)
|
19
19
|
end
|
20
20
|
|
21
21
|
def makeFiles
|
@@ -92,6 +92,40 @@ module Vsvipergen
|
|
92
92
|
return fileGenerators
|
93
93
|
end
|
94
94
|
|
95
|
+
def createSwiftGenerator
|
96
|
+
# generating model files
|
97
|
+
swiftModelFileGenerator = Vsvipergen::ViperSwiftModelFileGenerator.new
|
98
|
+
swiftModelFileGenerator.init(filePrefix, now, year, modelPrefix)
|
99
|
+
fileGenerators.push(swiftModelFileGenerator)
|
100
|
+
|
101
|
+
# generating contracts file
|
102
|
+
swiftContractFileGenerator = Vsvipergen::ViperSwiftContractsFileGenerator.new
|
103
|
+
swiftContractFileGenerator.init(filePrefix, now, year, modelPrefix)
|
104
|
+
fileGenerators.push(swiftContractFileGenerator)
|
105
|
+
|
106
|
+
# generating interactor file
|
107
|
+
swiftInteractorFileGenerator = Vsvipergen::ViperSwiftInteractorFileGenerator.new
|
108
|
+
swiftInteractorFileGenerator.init(filePrefix, now, year, modelPrefix)
|
109
|
+
fileGenerators.push(swiftInteractorFileGenerator)
|
110
|
+
|
111
|
+
# generating presenter file
|
112
|
+
swiftPresenterFileGenerator = Vsvipergen::ViperSwiftPresenterFileGenerator.new
|
113
|
+
swiftPresenterFileGenerator.init(filePrefix, now, year, modelPrefix)
|
114
|
+
fileGenerators.push(swiftPresenterFileGenerator)
|
115
|
+
|
116
|
+
# generating view file
|
117
|
+
swiftViewControllerFileGenerator = Vsvipergen::ViperSwiftViewControllerFileGenerator.new
|
118
|
+
swiftViewControllerFileGenerator.init(filePrefix, now, year, modelPrefix)
|
119
|
+
fileGenerators.push(swiftViewControllerFileGenerator)
|
120
|
+
|
121
|
+
# generating router file
|
122
|
+
swiftViewRouterFileGenerator = Vsvipergen::ViperSwiftRouterFileGenerator.new
|
123
|
+
swiftViewRouterFileGenerator.init(filePrefix, now, year, modelPrefix)
|
124
|
+
fileGenerators.push(swiftViewRouterFileGenerator)
|
125
|
+
|
126
|
+
return fileGenerators
|
127
|
+
end
|
128
|
+
|
95
129
|
def createAndroidGenerator
|
96
130
|
# generating model files
|
97
131
|
# 모델 생성은 하지 않는 최성식 팀장님의 요구 사항 적용
|
data/lib/vsvipergen_contracts.rb
CHANGED
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/contracts"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{prefix.strip}Contracts.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -38,6 +38,32 @@ module Vsvipergen
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
class ViperSwiftContractsFileGenerator < ViperObjcContractsFileGenerator
|
42
|
+
def makeFiles
|
43
|
+
makeSwiftFile
|
44
|
+
|
45
|
+
return generatedFilePaths
|
46
|
+
end
|
47
|
+
|
48
|
+
def makeSwiftFile
|
49
|
+
subPath = currPath + "/contracts"
|
50
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
51
|
+
|
52
|
+
newSwiftFilePath = subPath + "/VS#{prefix.strip}Contracts.swift"
|
53
|
+
generatedFilePaths.push(newSwiftFilePath)
|
54
|
+
|
55
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/VS<$$>Contracts.swift', File.dirname(__FILE__)
|
56
|
+
|
57
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
58
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
59
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
60
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
61
|
+
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
62
|
+
|
63
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
41
67
|
class ViperAndroidContractsFileGenerator < ViperObjcContractsFileGenerator
|
42
68
|
def makeFiles
|
43
69
|
makeJavaFile
|
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/interactor"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{prefix.strip}Interactor.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -39,7 +39,7 @@ module Vsvipergen
|
|
39
39
|
|
40
40
|
def makeImplementFile
|
41
41
|
subPath = currPath + "/interactor"
|
42
|
-
Dir.mkdir(subPath) unless File.
|
42
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
43
43
|
|
44
44
|
newImplementFilePath = subPath + "/VS#{prefix.strip}Interactor.m"
|
45
45
|
generatedFilePaths.push(newImplementFilePath)
|
@@ -55,6 +55,32 @@ module Vsvipergen
|
|
55
55
|
ViperFileWriter.new.writeFile(newImplementFilePath, templateImplementFileContents)
|
56
56
|
end
|
57
57
|
end
|
58
|
+
|
59
|
+
class ViperSwiftInteractorFileGenerator < ViperObjcInteractorFileGenerator
|
60
|
+
def makeFiles
|
61
|
+
makeSwiftFile
|
62
|
+
|
63
|
+
return generatedFilePaths
|
64
|
+
end
|
65
|
+
|
66
|
+
def makeSwiftFile
|
67
|
+
subPath = currPath + "/interactor"
|
68
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
69
|
+
|
70
|
+
newSwiftFilePath = subPath + "/VS#{prefix.strip}Interactor.swift"
|
71
|
+
generatedFilePaths.push(newSwiftFilePath)
|
72
|
+
|
73
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/interactor/VS<$$>Interactor.swift', File.dirname(__FILE__)
|
74
|
+
|
75
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
|
+
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
80
|
+
|
81
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
82
|
+
end
|
83
|
+
end
|
58
84
|
|
59
85
|
class ViperAndroidInteractorFileGenerator < ViperObjcInteractorFileGenerator
|
60
86
|
def makeFiles
|
data/lib/vsvipergen_model.rb
CHANGED
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/entity"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{modelPrefix.strip}VO.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -39,7 +39,7 @@ module Vsvipergen
|
|
39
39
|
|
40
40
|
def makeImplementFile
|
41
41
|
subPath = currPath + "/entity"
|
42
|
-
Dir.mkdir(subPath) unless File.
|
42
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
43
43
|
|
44
44
|
newImplementFilePath = subPath + "/VS#{modelPrefix.strip}VO.m"
|
45
45
|
generatedFilePaths.push(newImplementFilePath)
|
@@ -56,6 +56,32 @@ module Vsvipergen
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
class ViperSwiftModelFileGenerator < ViperObjcModelFileGenerator
|
60
|
+
def makeFiles
|
61
|
+
makeSwiftFile
|
62
|
+
|
63
|
+
return generatedFilePaths
|
64
|
+
end
|
65
|
+
|
66
|
+
def makeSwiftFile
|
67
|
+
subPath = currPath + "/entity"
|
68
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
69
|
+
|
70
|
+
newSwiftFilePath = subPath + "/VS#{modelPrefix.strip}VO.swift"
|
71
|
+
generatedFilePaths.push(newSwiftFilePath)
|
72
|
+
|
73
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/model/VS<$$>VO.swift', File.dirname(__FILE__)
|
74
|
+
|
75
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
|
+
templateSwiftFileContents.gsub! "<$properties$>", "<#property#>".strip
|
80
|
+
|
81
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
59
85
|
class ViperAndroidModelFileGenerator < ViperObjcModelFileGenerator
|
60
86
|
def makeFiles
|
61
87
|
makeJavaFile
|
data/lib/vsvipergen_presenter.rb
CHANGED
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/presenter"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{prefix.strip}Presenter.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -39,7 +39,7 @@ module Vsvipergen
|
|
39
39
|
|
40
40
|
def makeImplementFile
|
41
41
|
subPath = currPath + "/presenter"
|
42
|
-
Dir.mkdir(subPath) unless File.
|
42
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
43
43
|
|
44
44
|
newImplementFilePath = subPath + "/VS#{prefix.strip}Presenter.m"
|
45
45
|
generatedFilePaths.push(newImplementFilePath)
|
@@ -56,6 +56,32 @@ module Vsvipergen
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
class ViperSwiftPresenterFileGenerator < ViperObjcPresenterFileGenerator
|
60
|
+
def makeFiles
|
61
|
+
makeSwiftFile
|
62
|
+
|
63
|
+
return generatedFilePaths
|
64
|
+
end
|
65
|
+
|
66
|
+
def makeSwiftFile
|
67
|
+
subPath = currPath + "/presenter"
|
68
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
69
|
+
|
70
|
+
newSwiftFilePath = subPath + "/VS#{prefix.strip}Presenter.swift"
|
71
|
+
generatedFilePaths.push(newSwiftFilePath)
|
72
|
+
|
73
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/presenter/VS<$$>Presenter.swift', File.dirname(__FILE__)
|
74
|
+
|
75
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
|
+
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
80
|
+
|
81
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
59
85
|
class ViperAndroidPresenterFileGenerator < ViperObjcPresenterFileGenerator
|
60
86
|
def makeFiles
|
61
87
|
makeJavaFile
|
data/lib/vsvipergen_router.rb
CHANGED
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/router"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{prefix.strip}Router.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -39,7 +39,7 @@ module Vsvipergen
|
|
39
39
|
|
40
40
|
def makeImplementFile
|
41
41
|
subPath = currPath + "/router"
|
42
|
-
Dir.mkdir(subPath) unless File.
|
42
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
43
43
|
|
44
44
|
newImplementFilePath = subPath + "/VS#{prefix.strip}Router.m"
|
45
45
|
generatedFilePaths.push(newImplementFilePath)
|
@@ -56,6 +56,32 @@ module Vsvipergen
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
class ViperSwiftRouterFileGenerator < ViperObjcRouterFileGenerator
|
60
|
+
def makeFiles
|
61
|
+
makeSwiftFile
|
62
|
+
|
63
|
+
return generatedFilePaths
|
64
|
+
end
|
65
|
+
|
66
|
+
def makeSwiftFile
|
67
|
+
subPath = currPath + "/router"
|
68
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
69
|
+
|
70
|
+
newSwiftFilePath = subPath + "/VS#{prefix.strip}Router.swift"
|
71
|
+
generatedFilePaths.push(newSwiftFilePath)
|
72
|
+
|
73
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/router/VS<$$>Router.swift', File.dirname(__FILE__)
|
74
|
+
|
75
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
|
+
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
80
|
+
|
81
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
59
85
|
class ViperAndroidRouterFileGenerator < ViperObjcRouterFileGenerator
|
60
86
|
def makeFiles
|
61
87
|
makeJavaFile
|
data/lib/vsvipergen_view.rb
CHANGED
@@ -21,7 +21,7 @@ module Vsvipergen
|
|
21
21
|
|
22
22
|
def makeHeaderFile
|
23
23
|
subPath = currPath + "/view"
|
24
|
-
Dir.mkdir(subPath) unless File.
|
24
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
25
25
|
|
26
26
|
newHeaderFilePath = subPath + "/VS#{prefix.strip}ViewController.h"
|
27
27
|
generatedFilePaths.push(newHeaderFilePath)
|
@@ -39,7 +39,7 @@ module Vsvipergen
|
|
39
39
|
|
40
40
|
def makeImplementFile
|
41
41
|
subPath = currPath + "/view"
|
42
|
-
Dir.mkdir(subPath) unless File.
|
42
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
43
43
|
|
44
44
|
newImplementFilePath = subPath + "/VS#{prefix.strip}ViewController.m"
|
45
45
|
generatedFilePaths.push(newImplementFilePath)
|
@@ -56,6 +56,32 @@ module Vsvipergen
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
class ViperSwiftViewControllerFileGenerator < ViperObjcViewControllerFileGenerator
|
60
|
+
def makeFiles
|
61
|
+
makeSwiftFile
|
62
|
+
|
63
|
+
return generatedFilePaths
|
64
|
+
end
|
65
|
+
|
66
|
+
def makeSwiftFile
|
67
|
+
subPath = currPath + "/view"
|
68
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
69
|
+
|
70
|
+
newSwiftFilePath = subPath + "/VS#{prefix.strip}ViewController.swift"
|
71
|
+
generatedFilePaths.push(newSwiftFilePath)
|
72
|
+
|
73
|
+
templateSwiftFilePath = File.expand_path '../lib/templates/view/VS<$$>ViewController.swift', File.dirname(__FILE__)
|
74
|
+
|
75
|
+
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
+
templateSwiftFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
|
+
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
|
+
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
80
|
+
|
81
|
+
ViperFileWriter.new.writeFile(newSwiftFilePath, templateSwiftFileContents)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
59
85
|
class ViperAndroidPageFileGenerator < ViperObjcViewControllerFileGenerator
|
60
86
|
def makeFiles
|
61
87
|
makeJavaFile
|
data/vsvipergen.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["vendys-choohyoung"]
|
10
10
|
spec.email = ["lch@vendys.co.kr"]
|
11
11
|
|
12
|
-
spec.summary = "cli tool to generating objective-c code for viper structure"
|
12
|
+
spec.summary = "cli tool to generating objective-c, swift or java code for viper structure"
|
13
13
|
spec.description = "generating VS<$prefix$>Protocol.h, VS<$prefix$>ViewController.h, VS<$prefix$>ViewController.m, VS<$prefix$>Presenter.h, VS<$prefix$>Presenter.m, VS<$prefix$>Interactor.h, VS<$prefix$>Interactor.m, VS<$prefix$>Router.h, VS<$prefix$>Router.m"
|
14
14
|
spec.homepage = ""
|
15
15
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vsvipergen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vendys-choohyoung
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,21 +116,27 @@ files:
|
|
116
116
|
- exe/vsvipergen
|
117
117
|
- lib/templates/VS<$$>Contracts.h
|
118
118
|
- lib/templates/VS<$$>Contracts.java
|
119
|
+
- lib/templates/VS<$$>Contracts.swift
|
119
120
|
- lib/templates/interactor/VS<$$>Interactor.h
|
120
121
|
- lib/templates/interactor/VS<$$>Interactor.java
|
121
122
|
- lib/templates/interactor/VS<$$>Interactor.m
|
123
|
+
- lib/templates/interactor/VS<$$>Interactor.swift
|
122
124
|
- lib/templates/model/VS<$$>VO.h
|
123
125
|
- lib/templates/model/VS<$$>VO.java
|
124
126
|
- lib/templates/model/VS<$$>VO.m
|
127
|
+
- lib/templates/model/VS<$$>VO.swift
|
125
128
|
- lib/templates/presenter/VS<$$>Presenter.h
|
126
129
|
- lib/templates/presenter/VS<$$>Presenter.java
|
127
130
|
- lib/templates/presenter/VS<$$>Presenter.m
|
131
|
+
- lib/templates/presenter/VS<$$>Presenter.swift
|
128
132
|
- lib/templates/router/VS<$$>Router.h
|
129
133
|
- lib/templates/router/VS<$$>Router.java
|
130
134
|
- lib/templates/router/VS<$$>Router.m
|
135
|
+
- lib/templates/router/VS<$$>Router.swift
|
131
136
|
- lib/templates/view/VS<$$>Page.java
|
132
137
|
- lib/templates/view/VS<$$>ViewController.h
|
133
138
|
- lib/templates/view/VS<$$>ViewController.m
|
139
|
+
- lib/templates/view/VS<$$>ViewController.swift
|
134
140
|
- lib/vsvipergen.rb
|
135
141
|
- lib/vsvipergen/version.rb
|
136
142
|
- lib/vsvipergen_contracts.rb
|
@@ -159,9 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
165
|
- !ruby/object:Gem::Version
|
160
166
|
version: '0'
|
161
167
|
requirements: []
|
162
|
-
|
163
|
-
rubygems_version: 2.7.7
|
168
|
+
rubygems_version: 3.0.3
|
164
169
|
signing_key:
|
165
170
|
specification_version: 4
|
166
|
-
summary: cli tool to generating objective-c code for viper structure
|
171
|
+
summary: cli tool to generating objective-c, swift or java code for viper structure
|
167
172
|
test_files: []
|