vsvipergen 0.1.10 → 0.1.11
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 +2 -0
- data/Gemfile.lock +9 -3
- data/bin/console +24 -21
- data/exe/vsvipergen +27 -22
- data/lib/templates/VS<$$>Contracts.h +4 -4
- data/lib/templates/VS<$$>Contracts.java +1 -1
- data/lib/templates/VS<$$>Contracts.swift +3 -3
- data/lib/templates/architecturalDecisionRecordFile/VS<$$>_adr.md +32 -0
- data/lib/templates/interactor/VS<$$>Interactor.h +3 -3
- data/lib/templates/interactor/VS<$$>Interactor.java +1 -1
- data/lib/templates/interactor/VS<$$>Interactor.m +3 -3
- data/lib/templates/interactor/VS<$$>Interactor.swift +5 -5
- data/lib/templates/model/VS<$$>VO.h +4 -4
- data/lib/templates/model/VS<$$>VO.java +2 -2
- data/lib/templates/model/VS<$$>VO.m +6 -6
- data/lib/templates/model/VS<$$>VO.swift +4 -4
- data/lib/templates/presenter/VS<$$>Presenter.h +2 -2
- data/lib/templates/presenter/VS<$$>Presenter.java +1 -1
- data/lib/templates/presenter/VS<$$>Presenter.m +4 -4
- data/lib/templates/presenter/VS<$$>Presenter.swift +3 -3
- data/lib/templates/router/VS<$$>Router.h +3 -3
- data/lib/templates/router/VS<$$>Router.java +1 -1
- data/lib/templates/router/VS<$$>Router.m +3 -3
- data/lib/templates/router/VS<$$>Router.swift +3 -3
- data/lib/templates/view/VS<$$>Page.java +1 -1
- data/lib/templates/view/VS<$$>ViewController.h +3 -3
- data/lib/templates/view/VS<$$>ViewController.m +2 -2
- data/lib/templates/view/VS<$$>ViewController.swift +2 -2
- data/lib/vsvipergen.rb +35 -23
- data/lib/vsvipergen/version.rb +1 -1
- data/lib/vsvipergen_adr.rb +29 -0
- data/lib/vsvipergen_contracts.rb +6 -7
- data/lib/vsvipergen_interactor.rb +8 -8
- data/lib/vsvipergen_model.rb +16 -12
- data/lib/vsvipergen_presenter.rb +8 -8
- data/lib/vsvipergen_router.rb +8 -8
- data/lib/vsvipergen_view.rb +8 -8
- data/vsvipergen.gemspec +3 -2
- metadata +21 -5
@@ -1,18 +1,18 @@
|
|
1
1
|
//
|
2
|
-
// VS<$
|
3
|
-
//
|
2
|
+
// VS<$prefix$>VO.h
|
3
|
+
// <$projectName$>
|
4
4
|
//
|
5
|
-
// Created by
|
5
|
+
// Created by <$orgName$> on <$now$>..
|
6
6
|
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
7
|
//
|
8
8
|
|
9
|
-
#import "VS<$
|
9
|
+
#import "VS<$prefix$>VO.h"
|
10
10
|
|
11
11
|
/**
|
12
12
|
class category
|
13
13
|
*/
|
14
|
-
@interface VS<$
|
14
|
+
@interface VS<$prefix$>VO ()
|
15
15
|
@end
|
16
16
|
|
17
|
-
@implementation VS<$
|
17
|
+
@implementation VS<$prefix$>VO
|
18
18
|
@end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
//
|
2
|
-
// VS<$
|
3
|
-
//
|
2
|
+
// VS<$prefix$>VO.swift
|
3
|
+
// <$projectName$>
|
4
4
|
//
|
5
|
-
// Created by
|
5
|
+
// Created by <$orgName$> on <$now$>..
|
6
6
|
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
7
|
//
|
8
8
|
|
9
9
|
import Foundation
|
10
10
|
|
11
|
-
class VS<$
|
11
|
+
class VS<$prefix$>VO {
|
12
12
|
var <$properties$>
|
13
13
|
|
14
14
|
init(<$properties$>) {
|
@@ -1,13 +1,13 @@
|
|
1
1
|
//
|
2
|
-
// VS<$
|
3
|
-
//
|
2
|
+
// VS<$prefix$>VO.h
|
3
|
+
// <$projectName$>
|
4
4
|
//
|
5
|
-
// Created by
|
5
|
+
// Created by <$orgName$> on <$now$>..
|
6
6
|
// Copyright © <$year$>년 Vendys. All rights reserved.
|
7
7
|
//
|
8
8
|
|
9
9
|
#import "VS<$prefix$>Presenter.h"
|
10
|
-
#import "VS<$
|
10
|
+
#import "VS<$prefix$>VO.h"
|
11
11
|
|
12
12
|
/**
|
13
13
|
class category
|
data/lib/vsvipergen.rb
CHANGED
@@ -8,13 +8,17 @@ module Vsvipergen
|
|
8
8
|
attr_accessor :now
|
9
9
|
attr_accessor :year
|
10
10
|
attr_accessor :generatedFilePaths
|
11
|
+
attr_accessor :projectName
|
12
|
+
attr_accessor :orgName
|
11
13
|
|
12
|
-
def init(prefix, now, year)
|
14
|
+
def init(prefix, now, year, projectName, orgName)
|
13
15
|
@prefix = prefix
|
14
16
|
@currPath = Dir.pwd + "/#{prefix.strip.downcase}"
|
15
17
|
@now = now
|
16
18
|
@year = year
|
17
19
|
@generatedFilePaths = []
|
20
|
+
@projectName = projectName
|
21
|
+
@orgName = orgName
|
18
22
|
Dir.mkdir(currPath) unless File.exist?(currPath)
|
19
23
|
end
|
20
24
|
|
@@ -44,49 +48,51 @@ module Vsvipergen
|
|
44
48
|
end
|
45
49
|
|
46
50
|
class ViperGeneratorFactory
|
47
|
-
attr_accessor :
|
48
|
-
attr_accessor :modelPrefix
|
51
|
+
attr_accessor :prefix
|
49
52
|
attr_accessor :now
|
50
53
|
attr_accessor :year
|
51
54
|
attr_accessor :fileGenerators
|
55
|
+
attr_accessor :projectName
|
56
|
+
attr_accessor :orgName
|
52
57
|
|
53
|
-
def init(
|
54
|
-
@
|
55
|
-
@modelPrefix = modelPrefix
|
58
|
+
def init(prefix, now, year, projectName, orgName)
|
59
|
+
@prefix = prefix
|
56
60
|
@now = now
|
57
61
|
@year = year
|
58
62
|
@fileGenerators = []
|
63
|
+
@projectName = projectName
|
64
|
+
@orgName = orgName
|
59
65
|
end
|
60
66
|
|
61
67
|
def createObjcGenerator
|
62
68
|
# generating model files
|
63
69
|
objcModelFileGenerator = Vsvipergen::ViperObjcModelFileGenerator.new
|
64
|
-
objcModelFileGenerator.init(
|
70
|
+
objcModelFileGenerator.init(prefix, now, year, projectName, orgName)
|
65
71
|
fileGenerators.push(objcModelFileGenerator)
|
66
72
|
|
67
73
|
# generating contracts file
|
68
74
|
objcContractFileGenerator = Vsvipergen::ViperObjcContractsFileGenerator.new
|
69
|
-
objcContractFileGenerator.init(
|
75
|
+
objcContractFileGenerator.init(prefix, now, year, projectName, orgName)
|
70
76
|
fileGenerators.push(objcContractFileGenerator)
|
71
77
|
|
72
78
|
# generating interactor file
|
73
79
|
objcInteractorFileGenerator = Vsvipergen::ViperObjcInteractorFileGenerator.new
|
74
|
-
objcInteractorFileGenerator.init(
|
80
|
+
objcInteractorFileGenerator.init(prefix, now, year, projectName, orgName)
|
75
81
|
fileGenerators.push(objcInteractorFileGenerator)
|
76
82
|
|
77
83
|
# generating presenter file
|
78
84
|
objcPresenterFileGenerator = Vsvipergen::ViperObjcPresenterFileGenerator.new
|
79
|
-
objcPresenterFileGenerator.init(
|
85
|
+
objcPresenterFileGenerator.init(prefix, now, year, projectName, orgName)
|
80
86
|
fileGenerators.push(objcPresenterFileGenerator)
|
81
87
|
|
82
88
|
# generating view file
|
83
89
|
objcViewControllerFileGenerator = Vsvipergen::ViperObjcViewControllerFileGenerator.new
|
84
|
-
objcViewControllerFileGenerator.init(
|
90
|
+
objcViewControllerFileGenerator.init(prefix, now, year, projectName, orgName)
|
85
91
|
fileGenerators.push(objcViewControllerFileGenerator)
|
86
92
|
|
87
93
|
# generating router file
|
88
94
|
objcViewRouterFileGenerator = Vsvipergen::ViperObjcRouterFileGenerator.new
|
89
|
-
objcViewRouterFileGenerator.init(
|
95
|
+
objcViewRouterFileGenerator.init(prefix, now, year, projectName, orgName)
|
90
96
|
fileGenerators.push(objcViewRouterFileGenerator)
|
91
97
|
|
92
98
|
return fileGenerators
|
@@ -95,32 +101,32 @@ module Vsvipergen
|
|
95
101
|
def createSwiftGenerator
|
96
102
|
# generating model files
|
97
103
|
swiftModelFileGenerator = Vsvipergen::ViperSwiftModelFileGenerator.new
|
98
|
-
swiftModelFileGenerator.init(
|
104
|
+
swiftModelFileGenerator.init(prefix, now, year, projectName, orgName)
|
99
105
|
fileGenerators.push(swiftModelFileGenerator)
|
100
106
|
|
101
107
|
# generating contracts file
|
102
108
|
swiftContractFileGenerator = Vsvipergen::ViperSwiftContractsFileGenerator.new
|
103
|
-
swiftContractFileGenerator.init(
|
109
|
+
swiftContractFileGenerator.init(prefix, now, year, projectName, orgName)
|
104
110
|
fileGenerators.push(swiftContractFileGenerator)
|
105
111
|
|
106
112
|
# generating interactor file
|
107
113
|
swiftInteractorFileGenerator = Vsvipergen::ViperSwiftInteractorFileGenerator.new
|
108
|
-
swiftInteractorFileGenerator.init(
|
114
|
+
swiftInteractorFileGenerator.init(prefix, now, year, projectName, orgName)
|
109
115
|
fileGenerators.push(swiftInteractorFileGenerator)
|
110
116
|
|
111
117
|
# generating presenter file
|
112
118
|
swiftPresenterFileGenerator = Vsvipergen::ViperSwiftPresenterFileGenerator.new
|
113
|
-
swiftPresenterFileGenerator.init(
|
119
|
+
swiftPresenterFileGenerator.init(prefix, now, year, projectName, orgName)
|
114
120
|
fileGenerators.push(swiftPresenterFileGenerator)
|
115
121
|
|
116
122
|
# generating view file
|
117
123
|
swiftViewControllerFileGenerator = Vsvipergen::ViperSwiftViewControllerFileGenerator.new
|
118
|
-
swiftViewControllerFileGenerator.init(
|
124
|
+
swiftViewControllerFileGenerator.init(prefix, now, year, projectName, orgName)
|
119
125
|
fileGenerators.push(swiftViewControllerFileGenerator)
|
120
126
|
|
121
127
|
# generating router file
|
122
128
|
swiftViewRouterFileGenerator = Vsvipergen::ViperSwiftRouterFileGenerator.new
|
123
|
-
swiftViewRouterFileGenerator.init(
|
129
|
+
swiftViewRouterFileGenerator.init(prefix, now, year, projectName, orgName)
|
124
130
|
fileGenerators.push(swiftViewRouterFileGenerator)
|
125
131
|
|
126
132
|
return fileGenerators
|
@@ -135,31 +141,37 @@ module Vsvipergen
|
|
135
141
|
|
136
142
|
# generating contracts file
|
137
143
|
androidContractFileGenerator = Vsvipergen::ViperAndroidContractsFileGenerator.new
|
138
|
-
androidContractFileGenerator.init(
|
144
|
+
androidContractFileGenerator.init(prefix, now, year, projectName, orgName)
|
139
145
|
fileGenerators.push(androidContractFileGenerator)
|
140
146
|
|
141
147
|
# generating interactor file
|
142
148
|
androidInteractorFileGenerator = Vsvipergen::ViperAndroidInteractorFileGenerator.new
|
143
|
-
androidInteractorFileGenerator.init(
|
149
|
+
androidInteractorFileGenerator.init(prefix, now, year, projectName, orgName)
|
144
150
|
fileGenerators.push(androidInteractorFileGenerator)
|
145
151
|
|
146
152
|
# generating presenter file
|
147
153
|
androidPresenterFileGenerator = Vsvipergen::ViperAndroidPresenterFileGenerator.new
|
148
|
-
androidPresenterFileGenerator.init(
|
154
|
+
androidPresenterFileGenerator.init(prefix, now, year, projectName, orgName)
|
149
155
|
fileGenerators.push(androidPresenterFileGenerator)
|
150
156
|
|
151
157
|
# generating view file
|
152
158
|
androidViewControllerFileGenerator = Vsvipergen::ViperAndroidPageFileGenerator.new
|
153
|
-
androidViewControllerFileGenerator.init(
|
159
|
+
androidViewControllerFileGenerator.init(prefix, now, year, projectName, orgName)
|
154
160
|
fileGenerators.push(androidViewControllerFileGenerator)
|
155
161
|
|
156
162
|
# generating router file
|
157
163
|
androidViewRouterFileGenerator = Vsvipergen::ViperAndroidRouterFileGenerator.new
|
158
|
-
androidViewRouterFileGenerator.init(
|
164
|
+
androidViewRouterFileGenerator.init(prefix, now, year, projectName, orgName)
|
159
165
|
fileGenerators.push(androidViewRouterFileGenerator)
|
160
166
|
|
161
167
|
return fileGenerators
|
162
168
|
end
|
169
|
+
|
170
|
+
def createAdrFileGenerator
|
171
|
+
adrFileGenerator = Vsvipergen::ViperAdrFileGenerator.new
|
172
|
+
adrFileGenerator.init(prefix, now, year, projectName, orgName)
|
173
|
+
fileGenerators.push(adrFileGenerator)
|
174
|
+
end
|
163
175
|
end
|
164
176
|
|
165
177
|
# class ViperApiCaller
|
data/lib/vsvipergen/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "vsvipergen/version"
|
2
|
+
require 'vsvipergen'
|
3
|
+
|
4
|
+
module Vsvipergen
|
5
|
+
# concrete class for VS<$filePrefix$>_adr.md
|
6
|
+
class ViperAdrFileGenerator < Generator
|
7
|
+
def init(prefix, now, year, projectName, orgName)
|
8
|
+
super(prefix, now, year, projectName, orgName)
|
9
|
+
end
|
10
|
+
|
11
|
+
def makeFiles
|
12
|
+
super
|
13
|
+
|
14
|
+
subPath = currPath + "/adrs"
|
15
|
+
Dir.mkdir(subPath) unless File.exist?(subPath)
|
16
|
+
|
17
|
+
newHeaderFilePath = subPath + "/VS#{prefix.strip}_adr.md"
|
18
|
+
generatedFilePaths.push(newHeaderFilePath)
|
19
|
+
|
20
|
+
templateHeaderFilePath = File.expand_path '../lib/templates/architecturalDecisionRecordFile/VS<$$>_adr.md', File.dirname(__FILE__)
|
21
|
+
|
22
|
+
templateHeaderFileContents = ViperFileReader.new.readFile(templateHeaderFilePath)
|
23
|
+
|
24
|
+
ViperFileWriter.new.writeFile(newHeaderFilePath, templateHeaderFileContents)
|
25
|
+
|
26
|
+
return generatedFilePaths
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/vsvipergen_contracts.rb
CHANGED
@@ -4,11 +4,9 @@ require 'vsvipergen'
|
|
4
4
|
module Vsvipergen
|
5
5
|
# concrete class for VS<$filePrefix$>Contracts.h
|
6
6
|
class ViperObjcContractsFileGenerator < Generator
|
7
|
-
attr_accessor :modelPrefix
|
8
7
|
|
9
|
-
def init(
|
10
|
-
super(
|
11
|
-
@modelPrefix = modelPrefix
|
8
|
+
def init(prefix, now, year, projectName, orgName)
|
9
|
+
super(prefix, now, year, projectName, orgName)
|
12
10
|
end
|
13
11
|
|
14
12
|
def makeFiles
|
@@ -29,7 +27,8 @@ module Vsvipergen
|
|
29
27
|
templateHeaderFilePath = File.expand_path '../lib/templates/VS<$$>Contracts.h', File.dirname(__FILE__)
|
30
28
|
|
31
29
|
templateHeaderFileContents = ViperFileReader.new.readFile(templateHeaderFilePath)
|
32
|
-
templateHeaderFileContents.gsub! "<$
|
30
|
+
templateHeaderFileContents.gsub! "<$projectName$>", projectName.strip
|
31
|
+
templateHeaderFileContents.gsub! "<$orgName$>", orgName.strip
|
33
32
|
templateHeaderFileContents.gsub! "<$now$>", now.strip
|
34
33
|
templateHeaderFileContents.gsub! "<$year$>", year.strip
|
35
34
|
templateHeaderFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -55,7 +54,8 @@ module Vsvipergen
|
|
55
54
|
templateSwiftFilePath = File.expand_path '../lib/templates/VS<$$>Contracts.swift', File.dirname(__FILE__)
|
56
55
|
|
57
56
|
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
58
|
-
templateSwiftFileContents.gsub! "<$
|
57
|
+
templateSwiftFileContents.gsub! "<$projectName$>", projectName.strip
|
58
|
+
templateSwiftFileContents.gsub! "<$orgName$>", orgName.strip
|
59
59
|
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
60
60
|
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
61
61
|
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -78,7 +78,6 @@ module Vsvipergen
|
|
78
78
|
templateJavaFilePath = File.expand_path '../lib/templates/VS<$$>Contracts.java', File.dirname(__FILE__)
|
79
79
|
|
80
80
|
templateJavaFileContents = ViperFileReader.new.readFile(templateJavaFilePath)
|
81
|
-
templateJavaFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
82
81
|
templateJavaFileContents.gsub! "<$now$>", now.strip
|
83
82
|
templateJavaFileContents.gsub! "<$year$>", year.strip
|
84
83
|
templateJavaFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -4,10 +4,8 @@ require 'vsvipergen'
|
|
4
4
|
module Vsvipergen
|
5
5
|
# concrete class for VS<$filePrefix$>Interactor.h, VS<$filePrefix$>Interactor.m
|
6
6
|
class ViperObjcInteractorFileGenerator < Generator
|
7
|
-
|
8
|
-
|
9
|
-
super(filePrefix, now, year)
|
10
|
-
@modelPrefix = modelPrefix
|
7
|
+
def init(prefix, now, year, projectName, orgName)
|
8
|
+
super(prefix, now, year, projectName, orgName)
|
11
9
|
end
|
12
10
|
|
13
11
|
def makeFiles
|
@@ -29,7 +27,8 @@ module Vsvipergen
|
|
29
27
|
templateHeaderFilePath = File.expand_path '../lib/templates/interactor/VS<$$>Interactor.h', File.dirname(__FILE__)
|
30
28
|
|
31
29
|
templateHeaderFileContents = ViperFileReader.new.readFile(templateHeaderFilePath)
|
32
|
-
templateHeaderFileContents.gsub! "<$
|
30
|
+
templateHeaderFileContents.gsub! "<$projectName$>", projectName.strip
|
31
|
+
templateHeaderFileContents.gsub! "<$orgName$>", orgName.strip
|
33
32
|
templateHeaderFileContents.gsub! "<$now$>", now.strip
|
34
33
|
templateHeaderFileContents.gsub! "<$year$>", year.strip
|
35
34
|
templateHeaderFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -47,7 +46,8 @@ module Vsvipergen
|
|
47
46
|
templateImplementFilePath = File.expand_path '../lib/templates/interactor/VS<$$>Interactor.m', File.dirname(__FILE__)
|
48
47
|
|
49
48
|
templateImplementFileContents = ViperFileReader.new.readFile(templateImplementFilePath)
|
50
|
-
templateImplementFileContents.gsub! "<$
|
49
|
+
templateImplementFileContents.gsub! "<$projectName$>", projectName.strip
|
50
|
+
templateImplementFileContents.gsub! "<$orgName$>", orgName.strip
|
51
51
|
templateImplementFileContents.gsub! "<$now$>", now.strip
|
52
52
|
templateImplementFileContents.gsub! "<$year$>", year.strip
|
53
53
|
templateImplementFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -73,7 +73,8 @@ module Vsvipergen
|
|
73
73
|
templateSwiftFilePath = File.expand_path '../lib/templates/interactor/VS<$$>Interactor.swift', File.dirname(__FILE__)
|
74
74
|
|
75
75
|
templateSwiftFileContents = ViperFileReader.new.readFile(templateSwiftFilePath)
|
76
|
-
templateSwiftFileContents.gsub! "<$
|
76
|
+
templateSwiftFileContents.gsub! "<$projectName$>", projectName.strip
|
77
|
+
templateSwiftFileContents.gsub! "<$orgName$>", orgName.strip
|
77
78
|
templateSwiftFileContents.gsub! "<$now$>", now.strip
|
78
79
|
templateSwiftFileContents.gsub! "<$year$>", year.strip
|
79
80
|
templateSwiftFileContents.gsub! "<$prefix$>", prefix.strip
|
@@ -96,7 +97,6 @@ module Vsvipergen
|
|
96
97
|
templateJavaFilePath = File.expand_path '../lib/templates/interactor/VS<$$>Interactor.java', File.dirname(__FILE__)
|
97
98
|
|
98
99
|
templateJavaFileContents = ViperFileReader.new.readFile(templateJavaFilePath)
|
99
|
-
templateJavaFileContents.gsub! "<$modelPrefix$>", modelPrefix.strip
|
100
100
|
templateJavaFileContents.gsub! "<$now$>", now.strip
|
101
101
|
templateJavaFileContents.gsub! "<$year$>", year.strip
|
102
102
|
templateJavaFileContents.gsub! "<$prefix$>", prefix.strip
|