shellboxCLI 0.1.3 → 0.1.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c03368f91951882de24739edc34a93de48c825b91023e5e4b759e6bc9577950
|
4
|
+
data.tar.gz: 48addff9e4f682d3552ea5d299ce72006e403e50902943b6fbbe304fc48e93f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64384e81cfe33c724d1336c6d4cc75cd7f1e905aad276a8886288256773c987791bda0c07a8dd3f7e4e442771d0eeae83cf04911685a6842a7a51a08b34d5017
|
7
|
+
data.tar.gz: d635795f34143ae2e6c5ccbf431159f49526a10c8837836a7e97b87722a8bd7c057517986495f232846aea9af40332a0bfa325405a67e7af6b581156b29b1441
|
@@ -13,11 +13,24 @@ module IOS
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def perform
|
16
|
-
hasInterface = configurator.ask_with_answers("Criar módulo de interfaces", ["Yes", "No"]).to_sym
|
17
|
-
hasTest = configurator.ask_with_answers("Criar pasta de teste", ["Yes", "No"]).to_sym
|
18
16
|
moduleType = configurator.ask_with_answers("Qual o tipo do módulo", ["Core", "Feature"]).to_sym
|
19
|
-
|
20
|
-
|
17
|
+
|
18
|
+
|
19
|
+
if moduleType == :feature
|
20
|
+
hasInterface = "yes".to_sym
|
21
|
+
hasSwiftgen = "yes".to_sym
|
22
|
+
hasTest = "yes".to_sym
|
23
|
+
else
|
24
|
+
hasInterface = configurator.ask_with_answers("Criar módulo de interfaces", ["Yes", "No"]).to_sym
|
25
|
+
hasTest = configurator.ask_with_answers("Criar pasta de teste", ["Yes", "No"]).to_sym
|
26
|
+
hasSwiftgen = configurator.ask_with_answers("Criar Swiftgen", ["Yes", "No"]).to_sym
|
27
|
+
mockNetwork = "no".to_sym
|
28
|
+
end
|
29
|
+
|
30
|
+
keepDemo = configurator.ask_with_answers("Criar projeto exemplo", ["Yes", "No"]).to_sym
|
31
|
+
if keepDemo == :yes && moduleType == :feature
|
32
|
+
mockNetwork = configurator.ask_with_answers("Criar mocks de network para o projeto exemplo", ["Yes", "No"]).to_sym
|
33
|
+
end
|
21
34
|
|
22
35
|
ProjectManipulator.new({
|
23
36
|
:configurator => @configurator,
|
@@ -25,9 +38,10 @@ module IOS
|
|
25
38
|
:module_type => moduleType,
|
26
39
|
:has_swiftgen => hasSwiftgen,
|
27
40
|
:has_interface => hasInterface,
|
28
|
-
:has_test => hasTest
|
41
|
+
:has_test => hasTest,
|
42
|
+
:mock_network => mockNetwork
|
29
43
|
}).run
|
30
44
|
end
|
31
45
|
|
32
46
|
end
|
33
|
-
end
|
47
|
+
end
|
@@ -1,289 +1,306 @@
|
|
1
1
|
require 'xcodeproj'
|
2
2
|
|
3
3
|
module IOS
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
4
|
+
class ProjectManipulator
|
5
|
+
attr_reader :configurator, :keep_demo, :module_type, :module_root_path, :module_path, :has_swiftgen, :has_interface, :has_test, :mock_network
|
6
|
+
|
7
|
+
def self.perform(options)
|
8
|
+
new(options).perform
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(options)
|
12
|
+
@configurator = options.fetch(:configurator)
|
13
|
+
@keep_demo = options.fetch(:keep_demo)
|
14
|
+
@module_type = options.fetch(:module_type)
|
15
|
+
@has_swiftgen = options.fetch(:has_swiftgen)
|
16
|
+
@has_interface = options.fetch(:has_interface)
|
17
|
+
@has_test = options.fetch(:has_test)
|
18
|
+
@mock_network = options.fetch(:mock_network)
|
19
|
+
@module_root_path = ""
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
createModulePath
|
24
|
+
|
25
|
+
createModuleImplFolder
|
26
|
+
createModuleDummies
|
27
|
+
createPodspec
|
28
|
+
|
29
|
+
if @has_interface == :yes
|
30
|
+
createModuleInterfaceFolder
|
31
|
+
createModuleInterfaceDummies
|
32
|
+
createPodspecInterface
|
33
|
+
end
|
34
|
+
|
35
|
+
if @has_test == :yes
|
36
|
+
createTests
|
37
|
+
end
|
38
|
+
|
39
|
+
createSwiftgen if @has_swiftgen == :yes
|
40
|
+
createExampleProject if @keep_demo == :yes
|
41
|
+
end
|
42
|
+
|
43
|
+
def project_folder
|
44
|
+
$basePath = `git rev-parse --show-toplevel`.chomp
|
45
|
+
raise "Para rodar a rotina, você deve estar na raiz do projeto" if $basePath == "."
|
46
|
+
return $basePath
|
47
|
+
end
|
48
|
+
|
49
|
+
def module_folder
|
50
|
+
return "FeatureModules" if @module_type == :feature
|
51
|
+
"CoreModules"
|
52
|
+
end
|
53
|
+
|
54
|
+
def createModulePath
|
55
|
+
@configurator.printMessage("Criando estrutura do módulo")
|
56
|
+
@module_root_path = File.join(project_folder, [module_folder, @configurator.pod_name])
|
57
|
+
@module_path = File.join(@module_root_path, @configurator.pod_name)
|
58
|
+
|
59
|
+
# Create a new folder with pod name
|
60
|
+
FileUtils.mkdir_p @module_path
|
61
|
+
|
62
|
+
# Create a new folder with pod name interface
|
63
|
+
if @has_interface == :yes
|
64
|
+
FileUtils.mkdir_p @module_path + "Interface"
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create a new folder with pod name test
|
68
|
+
if @has_test == :yes
|
69
|
+
FileUtils.mkdir_p @module_path + "Tests"
|
70
|
+
end
|
71
|
+
|
72
|
+
Dir.chdir @module_root_path
|
73
|
+
@configurator.printDone
|
74
|
+
end
|
75
|
+
|
76
|
+
def createExampleProject
|
77
|
+
@configurator.printMessage("Criando projeto Exemplo")
|
78
|
+
projectFileName = File.join(@module_root_path, "Example")
|
79
|
+
FileUtils.cp_r(File.join(@configurator.template_path, "/Example/Example"), @module_root_path)
|
80
|
+
|
81
|
+
podDevInjection = "pod '${POD_NAME}', path: '../'"
|
82
|
+
|
83
|
+
if @has_test == :yes
|
84
|
+
podDevInjection = "pod '${POD_NAME}', path: '../', :testspecs => ['Tests']"
|
85
|
+
end
|
86
|
+
|
87
|
+
if @has_interface == :yes
|
88
|
+
podDevInjection += "\n pod '${POD_NAME}Interface', path: '../'"
|
89
|
+
end
|
90
|
+
|
91
|
+
podDevInjection += "\n"
|
92
|
+
podDevInjection += "\n pod 'SBFoundation', path: '../../../CoreModules/SBFoundation'"
|
93
|
+
if @module_type == :feature
|
94
|
+
podDevInjection += "\n pod 'SBUIKit', path: '../../../CoreModules/SBUIKit'"
|
95
|
+
podDevInjection += "\n pod 'SBRouterService', path: '../../../CoreModules/SBRouterService'"
|
96
|
+
podDevInjection += "\n pod 'SBRouterServiceInterface', path: '../../../CoreModules/SBRouterService'"
|
97
|
+
podDevInjection += "\n pod 'SBDependency', path: '../../../CoreModules/SBDependency'"
|
98
|
+
podDevInjection += "\n pod 'SBDependencyInterface', path: '../../../CoreModules/SBDependency'"
|
99
|
+
podDevInjection += "\n pod 'SBAnalyticsInterface', path: '../../../CoreModules/SBAnalytics'"
|
100
|
+
podDevInjection += "\n pod 'SBLoggerInterface', path: '../../../CoreModules/SBLogger'"
|
101
|
+
if @mock_network == :yes
|
102
|
+
podDevInjection += "\n pod 'SBUserSessionInterface', path: '../../../CoreModules/SBUserSession'"
|
103
|
+
podDevInjection += "\n pod 'SBNetwork', path: '../../../CoreModules/SBNetwork'"
|
104
|
+
podDevInjection += "\n pod 'Fetcher', path: '../../../CoreModules/Fetcher'"
|
105
|
+
podDevInjection += "\n pod 'Flow', path: '../../../CoreModules/Flow'"
|
106
|
+
podDevInjection += "\n pod 'SBSecurity', path: '../../../CoreModules/SBSecurity'"
|
107
|
+
podDevInjection += "\n pod 'SBSecurityInterface', path: '../../../CoreModules/SBSecurity'"
|
108
|
+
podDevInjection += "\n pod 'SBFeatureTogglesKitInterface', path: '../../../CoreModules/SBFeatureTogglesKit'"
|
109
|
+
end
|
110
|
+
podDevInjection += "\n pod 'SBAssets', :git => 'git@bitbucket.org:acelera/ios-ds-assets.git', :tag => '1.0.0'"
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
text = File.read projectFileName + "/Podfile"
|
115
|
+
text.gsub!("${DEV_PODS}", podDevInjection)
|
116
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
117
|
+
File.open(projectFileName + "/Podfile", "w") { |file| file.puts text}
|
118
|
+
@configurator.printDone
|
119
|
+
end
|
120
|
+
|
121
|
+
def createModuleImplFolder
|
122
|
+
@configurator.printMessage("Gerando pastas base")
|
123
|
+
FileUtils.mkdir_p File.join(@module_path, "Sources")
|
124
|
+
if @module_type == :feature
|
125
|
+
FileUtils.mkdir_p File.join(@module_path, "Sources", "Features")
|
126
|
+
end
|
127
|
+
|
128
|
+
if @has_swiftgen == :yes
|
129
|
+
FileUtils.mkdir_p File.join(@module_path, "Sources", "ModuleConfiguration")
|
130
|
+
end
|
131
|
+
|
132
|
+
FileUtils.mkdir_p File.join(@module_path, "Resources")
|
133
|
+
@configurator.printDone
|
134
|
+
end
|
135
|
+
|
136
|
+
def createModuleInterfaceFolder
|
137
|
+
@configurator.printMessage("Gerando pastas de interface")
|
138
|
+
FileUtils.mkdir_p File.join(@module_path + "Interface" , "Sources")
|
139
|
+
FileUtils.mkdir_p File.join(@module_path + "Interface", "Resources")
|
140
|
+
@configurator.printDone
|
141
|
+
end
|
142
|
+
|
143
|
+
def createModuleDummies
|
144
|
+
@configurator.printMessage("Gerando arquivos de exemplo")
|
145
|
+
|
146
|
+
if @module_type == :feature
|
147
|
+
FileUtils.touch File.join(@module_path, "Sources", "Features", "Dummy.swift")
|
148
|
+
else
|
149
|
+
FileUtils.touch File.join(@module_path, "Sources", "DummySource.swift")
|
150
|
+
end
|
151
|
+
|
152
|
+
# Header.h
|
153
|
+
headerFilename = File.join(@module_path, "Resources", @configurator.pod_name + ".h")
|
154
|
+
FileUtils.cp(
|
155
|
+
File.join(@configurator.template_path, "Feature", "Header_template"),
|
156
|
+
headerFilename
|
157
|
+
)
|
158
|
+
text = File.read(headerFilename)
|
159
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
160
|
+
File.open(headerFilename, "w") { |file| file.puts text}
|
161
|
+
|
162
|
+
# Info.plist
|
163
|
+
FileUtils.cp(
|
164
|
+
File.join(@configurator.template_path, "Feature", "Info_template"),
|
165
|
+
File.join(@module_path, "Resources", "Info.plist")
|
166
|
+
)
|
167
|
+
|
168
|
+
if @has_swiftgen == :yes
|
169
|
+
# Bundle
|
170
|
+
bundleFilename = File.join(@module_path, "Sources", "ModuleConfiguration", "Bundle.swift")
|
171
|
+
FileUtils.cp(
|
172
|
+
File.join(@configurator.template_path, "Feature", "bundle_template"),
|
173
|
+
bundleFilename
|
174
|
+
)
|
175
|
+
|
176
|
+
text = File.read(bundleFilename)
|
177
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
178
|
+
File.open(bundleFilename, "w") { |file| file.puts text}
|
179
|
+
|
180
|
+
# Strings
|
181
|
+
FileUtils.touch File.join(@module_path, "Resources", "Localizable.strings")
|
182
|
+
File.open(File.join(@module_path, "Resources", "Localizable.strings"), "w") { |file|
|
183
|
+
file.puts "\"example.title.text\" = \"EXAMPLE\";"
|
184
|
+
}
|
185
|
+
|
186
|
+
# Assets
|
187
|
+
FileUtils.mkdir_p(File.join(@module_path, "Resources", "Assets.xcassets"))
|
188
|
+
end
|
189
|
+
|
190
|
+
@configurator.printDone
|
191
|
+
end
|
192
|
+
|
193
|
+
def createModuleInterfaceDummies
|
194
|
+
@configurator.printMessage("Gerando arquivos de exemplo na Interface")
|
195
|
+
FileUtils.touch File.join(@module_path + "Interface", "Sources", "DummyInterface.swift")
|
196
|
+
|
197
|
+
# Info.plist
|
198
|
+
FileUtils.cp(
|
199
|
+
File.join(@configurator.template_path, "Feature", "Info_template"),
|
200
|
+
File.join(@module_path + "Interface", "Resources", "Info.plist")
|
201
|
+
)
|
202
|
+
|
203
|
+
# Header.h
|
204
|
+
headerFilename = File.join(@module_path + "Interface", "Resources", @configurator.pod_name + ".h")
|
205
|
+
FileUtils.cp(
|
206
|
+
File.join(@configurator.template_path, "Feature", "Header_template"),
|
207
|
+
headerFilename
|
208
|
+
)
|
209
|
+
text = File.read(headerFilename)
|
210
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
211
|
+
File.open(headerFilename, "w") { |file| file.puts text}
|
212
|
+
|
213
|
+
@configurator.printDone
|
214
|
+
end
|
215
|
+
|
216
|
+
def createSwiftgen
|
217
|
+
@configurator.printMessage("Criando arquivo swiftgen")
|
218
|
+
fileName = File.join(@module_root_path, "swiftgen.yml")
|
219
|
+
FileUtils.cp(
|
220
|
+
File.join(@configurator.template_path, "swiftgen.yml"),
|
221
|
+
fileName
|
222
|
+
)
|
223
|
+
|
224
|
+
text = File.read(fileName)
|
225
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
226
|
+
|
227
|
+
File.open(fileName, "w") { |file| file.puts text}
|
228
|
+
@configurator.printDone
|
229
|
+
end
|
230
|
+
|
231
|
+
def createPodspec
|
232
|
+
@configurator.printMessage("Configurando arquivo Podspec")
|
233
|
+
podspecFilename = "#{module_root_path}/#{@configurator.pod_name}.podspec"
|
234
|
+
FileUtils.cp(File.join(@configurator.template_path, "NAME.podspec"), podspecFilename)
|
235
|
+
text = File.read podspecFilename
|
236
|
+
|
237
|
+
podTests = ""
|
238
|
+
if @has_test == :yes
|
239
|
+
podTests = "# TESTS"
|
240
|
+
podTests += "\n s.test_spec 'Tests' do |test_spec|"
|
241
|
+
podTests += "\n test_spec.source_files = '${POD_NAME}Tests/**/*'"
|
242
|
+
podTests += "\n test_spec.exclude_files = '${POD_NAME}Tests/Resources/*.plist'"
|
243
|
+
podTests += "\n end"
|
244
|
+
end
|
245
|
+
|
246
|
+
podInternal = "s.dependency 'SBFoundation'"
|
247
|
+
|
248
|
+
if @module_type == :feature
|
249
|
+
podInternal += "\n s.dependency 'SBUIKit'"
|
250
|
+
podInternal += "\n s.dependency 'SBDependencyInterface'"
|
251
|
+
end
|
252
|
+
|
253
|
+
if @has_interface == :yes
|
254
|
+
podInternal += "\n s.dependency '${POD_NAME}Interface'"
|
255
|
+
end
|
256
|
+
|
257
|
+
text.gsub!("${FEATURE_INTERNAL}", podInternal)
|
258
|
+
text.gsub!("${FEATURE_TEST}", podTests)
|
259
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
260
|
+
text.gsub!("${USER_NAME}", @configurator.user_name)
|
261
|
+
text.gsub!("${USER_EMAIL}", @configurator.user_email)
|
262
|
+
File.open(podspecFilename, "w") { |file| file.puts text}
|
263
|
+
@configurator.printDone
|
264
|
+
end
|
265
|
+
|
266
|
+
def createPodspecInterface
|
267
|
+
@configurator.printMessage("Configurando arquivo Podspec Interface")
|
268
|
+
podspecFilename = "#{module_root_path}/#{@configurator.pod_name}Interface.podspec"
|
269
|
+
FileUtils.cp(File.join(@configurator.template_path, "NAMEInterface.podspec"), podspecFilename)
|
270
|
+
text = File.read podspecFilename
|
271
|
+
|
272
|
+
podInternal = ""
|
273
|
+
if @module_type == :feature
|
274
|
+
podInternal += "\n s.dependency 'SBRouterServiceInterface'"
|
275
|
+
end
|
276
|
+
|
277
|
+
text.gsub!("${FEATURE_INTERNAL}", podInternal)
|
278
|
+
text.gsub!("${POD_NAME}", @configurator.pod_name)
|
279
|
+
text.gsub!("${USER_NAME}", @configurator.user_name)
|
280
|
+
text.gsub!("${USER_EMAIL}", @configurator.user_email)
|
281
|
+
File.open(podspecFilename, "w") { |file| file.puts text}
|
282
|
+
@configurator.printDone
|
283
|
+
end
|
284
|
+
|
285
|
+
def createTests
|
286
|
+
@configurator.printMessage("Gerando pastas de testes")
|
287
|
+
# Folders
|
288
|
+
FileUtils.mkdir_p File.join(@module_path + "Tests" , "Resources")
|
289
|
+
FileUtils.mkdir_p File.join(@module_path + "Tests" , "Sources")
|
290
|
+
FileUtils.mkdir_p File.join(@module_path + "Tests" , "Tests")
|
291
|
+
|
292
|
+
# Dummies
|
293
|
+
FileUtils.touch File.join(@module_path + "Tests", "Sources", "DummyModel.swift")
|
294
|
+
FileUtils.touch File.join(@module_path + "Tests", "Tests", "DummyTest.swift")
|
295
|
+
|
296
|
+
# Info.plist
|
297
|
+
FileUtils.cp(
|
298
|
+
File.join(@configurator.template_path, "Feature", "Info_template"),
|
299
|
+
File.join(@module_path + "Tests", "Resources", "Info.plist")
|
300
|
+
)
|
301
|
+
|
302
|
+
@configurator.printDone
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
306
|
+
end
|
@@ -1,11 +1,31 @@
|
|
1
1
|
import UIKit
|
2
|
+
import SBRouterService
|
3
|
+
import SBDependency
|
4
|
+
import SBDependencyInterface
|
5
|
+
import SBAnalyticsInterface
|
6
|
+
import SBLoggerInterface
|
7
|
+
/*
|
8
|
+
Caso seja utilizado os mocks de Network, descomentar:
|
9
|
+
- Imports abaixo
|
10
|
+
- Linha 41
|
11
|
+
- Mocks a partir da linha 97
|
12
|
+
import SBNetwork
|
13
|
+
import Fetcher
|
14
|
+
import SBSecurityInterface
|
15
|
+
import SBUserSessionInterface
|
16
|
+
*/
|
2
17
|
|
3
18
|
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
4
19
|
|
5
20
|
var window: UIWindow?
|
21
|
+
let container = Container()
|
22
|
+
lazy var routerService = RouterService(store: container)
|
6
23
|
|
7
24
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
8
25
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
26
|
+
registerDependency()
|
27
|
+
registerHandler()
|
28
|
+
injectDependencies()
|
9
29
|
setupRootViewController(windowScene: windowScene)
|
10
30
|
}
|
11
31
|
}
|
@@ -16,4 +36,151 @@ extension SceneDelegate {
|
|
16
36
|
window?.rootViewController = ViewController()
|
17
37
|
window?.makeKeyAndVisible()
|
18
38
|
}
|
39
|
+
|
40
|
+
func registerDependency(){
|
41
|
+
// SBNetwork.configure(shellBoxService: ServiceInjection())
|
42
|
+
}
|
43
|
+
|
44
|
+
func registerHandler(){
|
45
|
+
// TODO: Implementar routerHandler
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
// ###########################
|
50
|
+
// MOCK
|
51
|
+
// ###########################
|
52
|
+
|
53
|
+
extension SceneDelegate {
|
54
|
+
|
55
|
+
private func injectDependencies() {
|
56
|
+
|
57
|
+
__registerDependencies {[
|
58
|
+
AnalyticsDependency.self,
|
59
|
+
LoggerDependency.self
|
60
|
+
]}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
public struct LoggerDependency: Assembly {
|
65
|
+
|
66
|
+
public init(){}
|
67
|
+
|
68
|
+
public func assemble(registry: Registry) {
|
69
|
+
registry.register(LoggerProtocol.self) { _ in
|
70
|
+
LoggerAssembler()
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
final class LoggerAssembler: LoggerProtocol {
|
76
|
+
|
77
|
+
func log(level: LogLevel, rawMessage: Message, error: Error?, file: String, function: String, line: Int) {
|
78
|
+
print(rawMessage)
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
public struct AnalyticsDependency: Assembly {
|
83
|
+
|
84
|
+
public init(){}
|
85
|
+
|
86
|
+
public func assemble(registry: Registry) {
|
87
|
+
registry.register(AnalyticsLoggerProtocol.self) { _ in
|
88
|
+
AnalyticsLoggerAssembler()
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
class AnalyticsLoggerAssembler: AnalyticsLoggerProtocol {
|
94
|
+
func logEvent(_ event: SBAnalyticsInterface.AnalyticsEvent) {}
|
95
|
+
}
|
96
|
+
|
97
|
+
/*
|
98
|
+
public struct SecurityDependency: Assembly {
|
99
|
+
public init(){}
|
100
|
+
|
101
|
+
public func assemble(registry: Registry) {
|
102
|
+
registry.register(SecurityStoreManaging.self) { _ in
|
103
|
+
SecurityAssembler()
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
class SecurityAssembler: SecurityStoreManaging {
|
109
|
+
func delete(service: String, account: String) {}
|
110
|
+
|
111
|
+
func delete(_ metadata: SBSecurityInterface.StorableMetadata) {}
|
112
|
+
|
113
|
+
func save<T>(_ item: T, service: String, account: String) throws where T : Decodable, T : Encodable {}
|
114
|
+
|
115
|
+
func save<T>(item: T, _ metadata: SBSecurityInterface.StorableMetadata) throws where T : Decodable, T : Encodable {}
|
116
|
+
|
117
|
+
func read<T>(service: String, account: String, type: T.Type) throws -> T? where T : Decodable, T : Encodable {
|
118
|
+
nil
|
119
|
+
}
|
120
|
+
|
121
|
+
func read(_ metadata: SBSecurityInterface.StorableMetadata) -> String? {
|
122
|
+
nil
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
class SecurityUtils: SecurityUtilsProtocol {
|
127
|
+
func uuidString() -> String? {
|
128
|
+
UUID().uuidString
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
public struct UserSessionDependency: Assembly {
|
133
|
+
|
134
|
+
public init(){}
|
135
|
+
|
136
|
+
public func assemble(registry: Registry) {
|
137
|
+
registry.register(UserSessionProvider.self, name: "SessionTokenProvider") { _ in
|
138
|
+
UserSessionAssembler()
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
class UserSessionAssembler: UserSessionProvider {
|
144
|
+
func getIdentifier() -> String? {
|
145
|
+
UUID().uuidString
|
146
|
+
}
|
147
|
+
|
148
|
+
func getToken() -> String? {
|
149
|
+
"TESTE"
|
150
|
+
}
|
19
151
|
}
|
152
|
+
|
153
|
+
class ServiceInjection: ShellBoxServiceProtocol {
|
154
|
+
func shellBoxServiceAtomantBaseURL() -> SBNetwork.AtomantEnvironment {
|
155
|
+
return .development
|
156
|
+
}
|
157
|
+
|
158
|
+
func shellBoxServiceRufusBaseURL() -> SBNetwork.RufusEnvironment {
|
159
|
+
return .development
|
160
|
+
}
|
161
|
+
|
162
|
+
func shellBoxServiceBFFBaseURL() -> SBNetwork.BFFEnvironment {
|
163
|
+
return .unit
|
164
|
+
}
|
165
|
+
|
166
|
+
func shellBoxServiceUseCredential(trust: SecTrust, session: URLSession, completion: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
|
167
|
+
completion(.useCredential, nil)
|
168
|
+
}
|
169
|
+
|
170
|
+
func shellBoxServiceGetInterceptors() -> [Interceptor] {
|
171
|
+
return []
|
172
|
+
}
|
173
|
+
|
174
|
+
func shellBoxServiceDidCreate(sessionConfiguration: URLSessionConfiguration) {
|
175
|
+
|
176
|
+
}
|
177
|
+
|
178
|
+
func shellBoxServiceHandleRequestError(request: URLRequest,
|
179
|
+
response: URLResponse,
|
180
|
+
error: ShellBoxError,
|
181
|
+
completion: @escaping (URLRequest?) -> Void) {
|
182
|
+
completion(nil)
|
183
|
+
}
|
184
|
+
}
|
185
|
+
*/
|
186
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shellboxCLI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShellBox App
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|