ccios 4.1.0 → 5.1.0
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/.ruby-version +1 -1
- data/CHANGELOG.md +35 -0
- data/Gemfile.lock +34 -15
- data/MAINTAINER.md +8 -0
- data/README.md +188 -56
- data/ccios.gemspec +2 -2
- data/lib/ccios/argument_template_parameter.rb +33 -0
- data/lib/ccios/code_templater.rb +24 -8
- data/lib/ccios/config.rb +41 -91
- data/lib/ccios/file_creator.rb +37 -24
- data/lib/ccios/file_template_definition.rb +95 -0
- data/lib/ccios/flag_template_parameter.rb +17 -0
- data/lib/ccios/group_template_definition.rb +54 -0
- data/lib/ccios/pbxproj_parser.rb +4 -55
- data/lib/ccios/snippet_template_definition.rb +27 -0
- data/lib/ccios/template_definition.rb +116 -0
- data/lib/ccios/templates/{coordinator.mustache → Coordinator/coordinator.mustache} +5 -2
- data/lib/ccios/templates/Coordinator/template.yml +19 -0
- data/lib/ccios/templates/{interactor_implementation.mustache → Interactor/interactor_implementation.mustache} +2 -2
- data/lib/ccios/templates/Interactor/template.yml +24 -0
- data/{templates_library/async → lib/ccios/templates/Presenter}/dependency_provider.mustache +6 -2
- data/lib/ccios/templates/{presenter_implementation.mustache → Presenter/presenter_implementation.mustache} +4 -1
- data/lib/ccios/templates/Presenter/template.yml +55 -0
- data/lib/ccios/templates/{view_contract.mustache → Presenter/view_contract.mustache} +2 -1
- data/lib/ccios/templates/{view_controller.mustache → Presenter/view_controller.mustache} +4 -0
- data/{templates_library/async/repository.mustache → lib/ccios/templates/Presenter/view_model.mustache} +2 -3
- data/lib/ccios/templates/Presenter/view_model_mapper.mustache +16 -0
- data/lib/ccios/templates/Repository/template.yml +25 -0
- data/lib/ccios/templates_loader.rb +31 -0
- data/lib/ccios.rb +65 -43
- data/templates_library/async/Coordinator/template.yml +20 -0
- data/{lib/ccios/templates → templates_library/async/Presenter}/presenter.mustache +2 -0
- data/templates_library/async/Presenter/template.yml +49 -0
- metadata +40 -34
- data/lib/ccios/coordinator_generator.rb +0 -18
- data/lib/ccios/interactor_generator.rb +0 -33
- data/lib/ccios/presenter_generator.rb +0 -71
- data/lib/ccios/repository_generator.rb +0 -44
- data/templates_library/async/interactor.mustache +0 -13
- data/templates_library/async/interactor_assembly.mustache +0 -5
- data/templates_library/async/interactor_implementation.mustache +0 -22
- data/templates_library/async/repository_assembly.mustache +0 -6
- data/templates_library/async/repository_implementation.mustache +0 -20
- /data/lib/ccios/templates/{interactor.mustache → Interactor/interactor.mustache} +0 -0
- /data/lib/ccios/templates/{interactor_assembly.mustache → Interactor/interactor_assembly.mustache} +0 -0
- /data/{templates_library/async → lib/ccios/templates/Presenter}/presenter.mustache +0 -0
- /data/lib/ccios/templates/{presenter_assembly.mustache → Presenter/presenter_assembly.mustache} +0 -0
- /data/lib/ccios/templates/{repository.mustache → Repository/repository.mustache} +0 -0
- /data/lib/ccios/templates/{repository_assembly.mustache → Repository/repository_assembly.mustache} +0 -0
- /data/lib/ccios/templates/{repository_implementation.mustache → Repository/repository_implementation.mustache} +0 -0
- /data/templates_library/async/{coordinator.mustache → Coordinator/coordinator.mustache} +0 -0
- /data/{lib/ccios/templates → templates_library/async/Presenter}/dependency_provider.mustache +0 -0
- /data/templates_library/async/{presenter_assembly.mustache → Presenter/presenter_assembly.mustache} +0 -0
- /data/templates_library/async/{presenter_implementation.mustache → Presenter/presenter_implementation.mustache} +0 -0
- /data/templates_library/async/{view_contract.mustache → Presenter/view_contract.mustache} +0 -0
- /data/templates_library/async/{view_controller.mustache → Presenter/view_controller.mustache} +0 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
name: "coordinator"
|
2
|
+
description: "Generate NameCoordinator"
|
3
|
+
variables:
|
4
|
+
project: "*.xcodeproj"
|
5
|
+
base_path: "Coordinator"
|
6
|
+
parameters:
|
7
|
+
- argument: "name"
|
8
|
+
removeSuffix: "Coordinator"
|
9
|
+
- flag: "delegate"
|
10
|
+
short_name: "d"
|
11
|
+
template_variable_name: "generate_delegate"
|
12
|
+
description: "Generate delegate protocols when provided"
|
13
|
+
generated_elements:
|
14
|
+
- name: "coordinator"
|
15
|
+
file: "{{ name }}Coordinator.swift"
|
16
|
+
template: "coordinator"
|
17
|
+
variables: {}
|
18
|
+
template_file_source:
|
19
|
+
coordinator: "coordinator.mustache"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: "interactor"
|
2
|
+
description: "Generate NameInteractor and NameInteractorImplementation"
|
3
|
+
parameters:
|
4
|
+
- argument: "name"
|
5
|
+
removeSuffix: "Interactor"
|
6
|
+
variables:
|
7
|
+
project: "*.xcodeproj"
|
8
|
+
base_path: "Core/Interactor"
|
9
|
+
generated_elements:
|
10
|
+
- name: "interactor"
|
11
|
+
file: "{{ name }}Interactor/{{ name }}Interactor.swift"
|
12
|
+
template: "interactor"
|
13
|
+
variables: {}
|
14
|
+
- name: "interactor_implementation"
|
15
|
+
file: "{{ name }}Interactor/{{ name }}InteractorImplementation.swift"
|
16
|
+
template: "interactor_implementation"
|
17
|
+
variables: {}
|
18
|
+
code_snippets:
|
19
|
+
- name: InteractorAssembly
|
20
|
+
template: "interactor_assembly"
|
21
|
+
template_file_source:
|
22
|
+
interactor: "interactor.mustache"
|
23
|
+
interactor_implementation: "interactor_implementation.mustache"
|
24
|
+
interactor_assembly: "interactor_assembly.mustache"
|
@@ -2,13 +2,17 @@
|
|
2
2
|
func {{lowercased_name}}Presenter(viewContract: {{name}}ViewContract, presenterDelegate: {{name}}PresenterDelegate) -> {{name}}Presenter? {
|
3
3
|
return presenterAssembler
|
4
4
|
.resolver
|
5
|
-
.resolve(
|
5
|
+
.resolve(
|
6
|
+
{{name}}Presenter.self,
|
7
|
+
arguments: viewContract as {{name}}ViewContract,
|
8
|
+
presenterDelegate as {{name}}PresenterDelegate
|
9
|
+
)
|
6
10
|
}
|
7
11
|
{{/generate_delegate}}
|
8
12
|
{{^generate_delegate}}
|
9
13
|
func {{lowercased_name}}Presenter(viewContract: {{name}}ViewContract) -> {{name}}Presenter? {
|
10
14
|
return presenterAssembler
|
11
15
|
.resolver
|
12
|
-
.resolve({{name}}Presenter.self, argument: viewContract)
|
16
|
+
.resolve({{name}}Presenter.self, argument: viewContract as {{name}}ViewContract)
|
13
17
|
}
|
14
18
|
{{/generate_delegate}}
|
@@ -15,6 +15,8 @@ class {{name}}PresenterImplementation: {{name}}Presenter {
|
|
15
15
|
private weak var delegate: {{name}}PresenterDelegate?
|
16
16
|
{{/generate_delegate}}
|
17
17
|
|
18
|
+
// MARK: - Lifecycle
|
19
|
+
|
18
20
|
{{#generate_delegate}}
|
19
21
|
init(viewContract: {{name}}ViewContract, delegate: {{name}}PresenterDelegate) {
|
20
22
|
self.viewContract = viewContract
|
@@ -30,6 +32,7 @@ class {{name}}PresenterImplementation: {{name}}Presenter {
|
|
30
32
|
// MARK: - {{name}}Presenter
|
31
33
|
|
32
34
|
func start() {
|
33
|
-
|
35
|
+
let viewModel = {{name}}ViewModelMapper().map()
|
36
|
+
viewContract?.configure(with: viewModel)
|
34
37
|
}
|
35
38
|
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: "presenter"
|
2
|
+
description: "Generate NamePresenter, NamePresenterImplementation, NameViewContract and NameViewController"
|
3
|
+
parameters:
|
4
|
+
- argument: "name"
|
5
|
+
removeSuffix: "Presenter"
|
6
|
+
lowercased_variable_name: "lowercased_name"
|
7
|
+
- flag: "delegate"
|
8
|
+
short_name: "d"
|
9
|
+
template_variable_name: "generate_delegate"
|
10
|
+
description: "Generate delegate protocols when provided"
|
11
|
+
variables:
|
12
|
+
project: "*.xcodeproj"
|
13
|
+
base_path: "App"
|
14
|
+
generated_elements:
|
15
|
+
- name: "ui_view_group"
|
16
|
+
group: "{{ name }}/UI/View"
|
17
|
+
variables: {}
|
18
|
+
- name: "view_controller"
|
19
|
+
file: "{{ name }}/UI/ViewController/{{ name }}ViewController.swift"
|
20
|
+
template: "view_controller"
|
21
|
+
variables: {}
|
22
|
+
- name: "view_contract"
|
23
|
+
file: "{{ name }}/UI/{{ name }}ViewContract.swift"
|
24
|
+
template: "view_contract"
|
25
|
+
variables: {}
|
26
|
+
- name: "presenter"
|
27
|
+
file: "{{ name }}/Presenter/{{ name }}Presenter.swift"
|
28
|
+
template: "presenter"
|
29
|
+
variables: {}
|
30
|
+
- name: "presenter_implementation"
|
31
|
+
file: "{{ name }}/Presenter/{{ name }}PresenterImplementation.swift"
|
32
|
+
template: "presenter_implementation"
|
33
|
+
variables: {}
|
34
|
+
- name: "view_model"
|
35
|
+
file: "{{ name }}/Model/{{ name }}ViewModel.swift"
|
36
|
+
template: "view_model"
|
37
|
+
variables: {}
|
38
|
+
- name: "view_model_mapper"
|
39
|
+
file: "{{ name }}/Model/Mapper/{{ name }}ViewModelMapper.swift"
|
40
|
+
template: "view_model_mapper"
|
41
|
+
variables: {}
|
42
|
+
code_snippets:
|
43
|
+
- name: DependencyProvider
|
44
|
+
template: "dependency_provider"
|
45
|
+
- name: PresenterAssembly
|
46
|
+
template: "presenter_assembly"
|
47
|
+
template_file_source:
|
48
|
+
view_controller: "view_controller.mustache"
|
49
|
+
view_contract: "view_contract.mustache"
|
50
|
+
presenter: "presenter.mustache"
|
51
|
+
presenter_implementation: "presenter_implementation.mustache"
|
52
|
+
view_model: "view_model.mustache"
|
53
|
+
view_model_mapper: "view_model_mapper.mustache"
|
54
|
+
dependency_provider: "dependency_provider.mustache"
|
55
|
+
presenter_assembly: "presenter_assembly.mustache"
|
@@ -12,6 +12,8 @@ import UIKit
|
|
12
12
|
class {{name}}ViewController: SharedViewController, {{name}}ViewContract {
|
13
13
|
var presenter: {{name}}Presenter?
|
14
14
|
|
15
|
+
// MARK: - Lifecycle
|
16
|
+
|
15
17
|
override func viewDidLoad() {
|
16
18
|
super.viewDidLoad()
|
17
19
|
presenter?.start()
|
@@ -19,4 +21,6 @@ class {{name}}ViewController: SharedViewController, {{name}}ViewContract {
|
|
19
21
|
|
20
22
|
// MARK: - {{name}}ViewContract
|
21
23
|
|
24
|
+
func configure(with viewModel: {{name}}ViewModel) {
|
25
|
+
}
|
22
26
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
//
|
2
|
-
// {{name}}
|
2
|
+
// {{name}}ViewModel.swift
|
3
3
|
// {{project_name}}
|
4
4
|
//
|
5
5
|
// Created by {{full_username}} on {{date}}.
|
@@ -8,6 +8,5 @@
|
|
8
8
|
|
9
9
|
import Foundation
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
struct {{name}}ViewModel {
|
13
12
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//
|
2
|
+
// {{name}}ViewModelMapper.swift
|
3
|
+
// {{project_name}}
|
4
|
+
//
|
5
|
+
// Created by {{full_username}} on {{date}}.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
import Foundation
|
10
|
+
|
11
|
+
struct {{name}}ViewModelMapper {
|
12
|
+
|
13
|
+
func map() -> {{name}}ViewModel {
|
14
|
+
{{name}}ViewModel()
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: "repository"
|
2
|
+
description: "Generate NameRepository and NameRepositoryImplementation"
|
3
|
+
parameters:
|
4
|
+
- argument: "name"
|
5
|
+
removeSuffix: "Repository"
|
6
|
+
variables:
|
7
|
+
project: "*.xcodeproj"
|
8
|
+
generated_elements:
|
9
|
+
- name: "repository"
|
10
|
+
file: "{{ name }}/{{ name }}Repository.swift"
|
11
|
+
template: "repository"
|
12
|
+
variables:
|
13
|
+
base_path: "Core/Data"
|
14
|
+
- name: "repository_implementation"
|
15
|
+
file: "{{ name }}/{{ name }}RepositoryImplementation.swift"
|
16
|
+
template: "repository_implementation"
|
17
|
+
variables:
|
18
|
+
base_path: "Data"
|
19
|
+
code_snippets:
|
20
|
+
- name: RepositoryAssembly
|
21
|
+
template: "repository_assembly"
|
22
|
+
template_file_source:
|
23
|
+
repository: "repository.mustache"
|
24
|
+
repository_implementation: "repository_implementation.mustache"
|
25
|
+
repository_assembly: "repository_assembly.mustache"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'config'
|
2
|
+
require_relative 'template_definition'
|
3
|
+
|
4
|
+
class TemplatesLoader
|
5
|
+
|
6
|
+
def get_templates(config)
|
7
|
+
default_template_folder = File.join(File.dirname(__FILE__), "templates")
|
8
|
+
default_templates = load_templates_from_collection(default_template_folder)
|
9
|
+
custom_templates = []
|
10
|
+
if !config.templates_collection.nil?
|
11
|
+
custom_templates = load_templates_from_collection(config.templates_collection)
|
12
|
+
end
|
13
|
+
templates = {}
|
14
|
+
all_templates = default_templates + custom_templates
|
15
|
+
all_templates.each do |template|
|
16
|
+
templates[template.name] = template
|
17
|
+
end
|
18
|
+
Hash[templates.sort_by{|k,v| k}]
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def load_templates_from_collection(collection_path)
|
24
|
+
template_paths = Dir.children(collection_path)
|
25
|
+
.map { |name| File.join(collection_path, name) }
|
26
|
+
.select { |path| File.directory? path }
|
27
|
+
template_paths
|
28
|
+
.map { |template_path| TemplateDefinition.parse(template_path) }
|
29
|
+
.compact
|
30
|
+
end
|
31
|
+
end
|
data/lib/ccios.rb
CHANGED
@@ -2,67 +2,89 @@ require 'date'
|
|
2
2
|
require 'xcodeproj'
|
3
3
|
require 'optparse'
|
4
4
|
require 'active_support'
|
5
|
-
require 'ccios/presenter_generator'
|
6
|
-
require 'ccios/coordinator_generator'
|
7
|
-
require 'ccios/interactor_generator'
|
8
|
-
require 'ccios/repository_generator'
|
9
5
|
require 'ccios/config'
|
6
|
+
require 'ccios/template_definition'
|
7
|
+
require 'ccios/templates_loader'
|
10
8
|
|
9
|
+
config = Config.parse ".ccios.yml"
|
10
|
+
source_path = Dir.pwd
|
11
|
+
|
12
|
+
templates = TemplatesLoader.new.get_templates(config)
|
13
|
+
|
14
|
+
subcommands = {}
|
11
15
|
options = {}
|
12
|
-
|
13
|
-
|
16
|
+
|
17
|
+
templates.values.each do |template|
|
18
|
+
subcommands[template.name] = OptionParser.new do |opts|
|
19
|
+
|
20
|
+
arguments = template.parameters.select { |p| p.is_a?(ArgumentTemplateParameter) }
|
21
|
+
flags = template.parameters.select { |p| p.is_a?(FlagTemplateParameter) }
|
22
|
+
|
23
|
+
arguments_line = arguments.map { |argument| "<#{argument.name}>" }.join(" ")
|
24
|
+
|
25
|
+
opts.banner = "Usage: ccios #{template.name} #{arguments_line} [options]"
|
26
|
+
|
27
|
+
flags.each do |flagParameter|
|
28
|
+
if flagParameter.short_name != nil
|
29
|
+
opts.on("-#{flagParameter.short_name}", "--#{flagParameter.name}", flagParameter.description) do |v|
|
30
|
+
options[flagParameter.template_variable_name] = v
|
31
|
+
end
|
32
|
+
else
|
33
|
+
opts.on("--#{flagParameter.name}", flagParameter.description) do |v|
|
34
|
+
options[flagParameter.template_variable_name] = v
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
global_cli = OptionParser.new do |opts|
|
42
|
+
opts.banner = "Usage: ccios <template> [options]"
|
14
43
|
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
15
44
|
options[:verbose] = v
|
16
45
|
end
|
17
|
-
opts.on("-pName", "--presenter=Name", "Generate NamePresenter, NamePresenterImplementation, NameViewContract and NameViewController") do |name|
|
18
|
-
options[:presenter] = name
|
19
|
-
end
|
20
|
-
opts.on("-cName", "--coordinator=Name", "Generate NameCoordinator") do |name|
|
21
|
-
options[:coordinator] = name
|
22
|
-
end
|
23
|
-
opts.on("-iName", "--interactor=Name", "Generate NameInteractor and NameInteractorImplementation") do |name|
|
24
|
-
options[:interactor] = name
|
25
|
-
end
|
26
|
-
opts.on("-rName", "--repository=Name", "Generate NameRepository and NameRepositoryImplementation") do |name|
|
27
|
-
options[:repository] = name
|
28
|
-
end
|
29
|
-
opts.on("-d", "--delegate", "Add delegate for curent generation") do |add_delegate|
|
30
|
-
options[:generate_delegate] = add_delegate
|
31
|
-
end
|
32
46
|
opts.on("-h", "--help", "Print this help") do
|
33
47
|
puts opts
|
48
|
+
puts "Available templates: #{subcommands.keys.sort.join(", ")}"
|
34
49
|
exit
|
35
50
|
end
|
36
|
-
end
|
51
|
+
end
|
37
52
|
|
38
|
-
|
39
|
-
|
40
|
-
parser = PBXProjParser.new(source_path, config)
|
53
|
+
global_cli.order!
|
54
|
+
template_name = ARGV.shift
|
41
55
|
|
42
|
-
if
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
presenter_generator.generate(presenter_name, generator_options)
|
56
|
+
if template_name.nil?
|
57
|
+
puts "Error: Missing template name"
|
58
|
+
puts global_cli
|
59
|
+
exit(1)
|
47
60
|
end
|
48
61
|
|
49
|
-
if
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
coordinator_generator.generate(coordinator_name, generator_options)
|
62
|
+
if subcommands[template_name].nil?
|
63
|
+
puts "Error: Unknown template \"#{template_name}\""
|
64
|
+
puts global_cli
|
65
|
+
exit(1)
|
54
66
|
end
|
55
67
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
68
|
+
template = templates[template_name]
|
69
|
+
expected_remaining_arguments = template.parameters.select { |p| p.is_a?(ArgumentTemplateParameter) }
|
70
|
+
|
71
|
+
subcommands[template_name].order! do |argument|
|
72
|
+
expected_argument = expected_remaining_arguments.shift
|
73
|
+
if expected_argument.nil?
|
74
|
+
puts "Unexpected argument: #{argument}"
|
75
|
+
exit 1
|
76
|
+
end
|
77
|
+
options[expected_argument.template_variable_name] = argument
|
60
78
|
end
|
61
79
|
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
repository_generator.generate(repository_name)
|
80
|
+
if !expected_remaining_arguments.empty?
|
81
|
+
puts "Missing arguments: #{expected_remaining_arguments.map { |p| p.name }.join(", ")}"
|
82
|
+
exit 1
|
66
83
|
end
|
67
84
|
|
85
|
+
parser = PBXProjParser.new(source_path, config)
|
86
|
+
|
87
|
+
template.validate(parser, options, config)
|
88
|
+
template.generate(parser, options, config)
|
89
|
+
|
68
90
|
parser.save
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: "coordinator"
|
2
|
+
description: "Generate NameCoordinator"
|
3
|
+
variables:
|
4
|
+
project: "*.xcodeproj"
|
5
|
+
base_path: "Coordinator"
|
6
|
+
target: ""
|
7
|
+
parameters:
|
8
|
+
- argument: "name"
|
9
|
+
removeSuffix: "Coordinator"
|
10
|
+
- flag: "delegate"
|
11
|
+
short_name: "d"
|
12
|
+
template_variable_name: "generate_delegate"
|
13
|
+
description: "Generate delegate protocols when provided"
|
14
|
+
generated_elements:
|
15
|
+
- name: "coordinator"
|
16
|
+
file: "{{ name }}Coordinator.swift"
|
17
|
+
template: "coordinator"
|
18
|
+
variables: {}
|
19
|
+
template_file_source:
|
20
|
+
coordinator: "coordinator.mustache"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: "presenter"
|
2
|
+
description: "Generate NamePresenter, NamePresenterImplementation, NameViewContract and NameViewController"
|
3
|
+
parameters:
|
4
|
+
- argument: "name"
|
5
|
+
removeSuffix: "Presenter"
|
6
|
+
lowercased_variable_name: "lowercased_name"
|
7
|
+
- flag: "delegate"
|
8
|
+
short_name: "d"
|
9
|
+
template_variable_name: "generate_delegate"
|
10
|
+
description: "Generate delegate protocols when provided"
|
11
|
+
variables:
|
12
|
+
project: "*.xcodeproj"
|
13
|
+
base_path: "App"
|
14
|
+
target: ""
|
15
|
+
generated_elements:
|
16
|
+
- name: "ui_view_group"
|
17
|
+
group: "{{ name }}/UI/View"
|
18
|
+
variables: {}
|
19
|
+
- name: "view_controller"
|
20
|
+
file: "{{ name }}/UI/ViewController/{{ name }}ViewController.swift"
|
21
|
+
template: "view_controller"
|
22
|
+
variables: {}
|
23
|
+
- name: "view_contract"
|
24
|
+
file: "{{ name }}/UI/{{ name }}ViewContract.swift"
|
25
|
+
template: "view_contract"
|
26
|
+
variables: {}
|
27
|
+
- name: "presenter"
|
28
|
+
file: "{{ name }}/Presenter/{{ name }}Presenter.swift"
|
29
|
+
template: "presenter"
|
30
|
+
variables: {}
|
31
|
+
- name: "presenter_implementation"
|
32
|
+
file: "{{ name }}/Presenter/{{ name }}PresenterImplementation.swift"
|
33
|
+
template: "presenter_implementation"
|
34
|
+
variables: {}
|
35
|
+
- name: "model_group"
|
36
|
+
group: "{{ name }}/Model"
|
37
|
+
variables: {}
|
38
|
+
code_snippets:
|
39
|
+
- name: DependencyProvider
|
40
|
+
template: "dependency_provider"
|
41
|
+
- name: PresenterAssembly
|
42
|
+
template: "presenter_assembly"
|
43
|
+
template_file_source:
|
44
|
+
view_controller: "view_controller.mustache"
|
45
|
+
view_contract: "view_contract.mustache"
|
46
|
+
presenter: "presenter.mustache"
|
47
|
+
presenter_implementation: "presenter_implementation.mustache"
|
48
|
+
dependency_provider: "dependency_provider.mustache"
|
49
|
+
presenter_assembly: "presenter_assembly.mustache"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ccios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Felgines
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,46 +93,52 @@ files:
|
|
93
93
|
- CHANGELOG.md
|
94
94
|
- Gemfile
|
95
95
|
- Gemfile.lock
|
96
|
+
- MAINTAINER.md
|
96
97
|
- Makefile
|
97
98
|
- README.md
|
98
99
|
- Rakefile
|
99
100
|
- bin/ccios
|
100
101
|
- ccios.gemspec
|
101
102
|
- lib/ccios.rb
|
103
|
+
- lib/ccios/argument_template_parameter.rb
|
102
104
|
- lib/ccios/code_templater.rb
|
103
105
|
- lib/ccios/config.rb
|
104
|
-
- lib/ccios/coordinator_generator.rb
|
105
106
|
- lib/ccios/file_creator.rb
|
106
|
-
- lib/ccios/
|
107
|
+
- lib/ccios/file_template_definition.rb
|
108
|
+
- lib/ccios/flag_template_parameter.rb
|
109
|
+
- lib/ccios/group_template_definition.rb
|
107
110
|
- lib/ccios/pbxproj_parser.rb
|
108
|
-
- lib/ccios/
|
109
|
-
- lib/ccios/
|
110
|
-
- lib/ccios/templates/coordinator.mustache
|
111
|
-
- lib/ccios/templates/
|
112
|
-
- lib/ccios/templates/interactor.mustache
|
113
|
-
- lib/ccios/templates/interactor_assembly.mustache
|
114
|
-
- lib/ccios/templates/interactor_implementation.mustache
|
115
|
-
- lib/ccios/templates/
|
116
|
-
- lib/ccios/templates/
|
117
|
-
- lib/ccios/templates/
|
118
|
-
- lib/ccios/templates/
|
119
|
-
- lib/ccios/templates/
|
120
|
-
- lib/ccios/templates/
|
121
|
-
- lib/ccios/templates/view_contract.mustache
|
122
|
-
- lib/ccios/templates/view_controller.mustache
|
123
|
-
-
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
- templates_library/async/
|
131
|
-
- templates_library/async/
|
132
|
-
- templates_library/async/
|
133
|
-
- templates_library/async/
|
134
|
-
- templates_library/async/
|
135
|
-
- templates_library/async/
|
111
|
+
- lib/ccios/snippet_template_definition.rb
|
112
|
+
- lib/ccios/template_definition.rb
|
113
|
+
- lib/ccios/templates/Coordinator/coordinator.mustache
|
114
|
+
- lib/ccios/templates/Coordinator/template.yml
|
115
|
+
- lib/ccios/templates/Interactor/interactor.mustache
|
116
|
+
- lib/ccios/templates/Interactor/interactor_assembly.mustache
|
117
|
+
- lib/ccios/templates/Interactor/interactor_implementation.mustache
|
118
|
+
- lib/ccios/templates/Interactor/template.yml
|
119
|
+
- lib/ccios/templates/Presenter/dependency_provider.mustache
|
120
|
+
- lib/ccios/templates/Presenter/presenter.mustache
|
121
|
+
- lib/ccios/templates/Presenter/presenter_assembly.mustache
|
122
|
+
- lib/ccios/templates/Presenter/presenter_implementation.mustache
|
123
|
+
- lib/ccios/templates/Presenter/template.yml
|
124
|
+
- lib/ccios/templates/Presenter/view_contract.mustache
|
125
|
+
- lib/ccios/templates/Presenter/view_controller.mustache
|
126
|
+
- lib/ccios/templates/Presenter/view_model.mustache
|
127
|
+
- lib/ccios/templates/Presenter/view_model_mapper.mustache
|
128
|
+
- lib/ccios/templates/Repository/repository.mustache
|
129
|
+
- lib/ccios/templates/Repository/repository_assembly.mustache
|
130
|
+
- lib/ccios/templates/Repository/repository_implementation.mustache
|
131
|
+
- lib/ccios/templates/Repository/template.yml
|
132
|
+
- lib/ccios/templates_loader.rb
|
133
|
+
- templates_library/async/Coordinator/coordinator.mustache
|
134
|
+
- templates_library/async/Coordinator/template.yml
|
135
|
+
- templates_library/async/Presenter/dependency_provider.mustache
|
136
|
+
- templates_library/async/Presenter/presenter.mustache
|
137
|
+
- templates_library/async/Presenter/presenter_assembly.mustache
|
138
|
+
- templates_library/async/Presenter/presenter_implementation.mustache
|
139
|
+
- templates_library/async/Presenter/template.yml
|
140
|
+
- templates_library/async/Presenter/view_contract.mustache
|
141
|
+
- templates_library/async/Presenter/view_controller.mustache
|
136
142
|
- templates_library/default/README.md
|
137
143
|
homepage: http://rubygems.org/gems/hola
|
138
144
|
licenses:
|
@@ -153,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
159
|
- !ruby/object:Gem::Version
|
154
160
|
version: '0'
|
155
161
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.5.3
|
157
163
|
signing_key:
|
158
164
|
specification_version: 4
|
159
165
|
summary: Clean Code iOS Generator
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require_relative 'file_creator'
|
2
|
-
require_relative "pbxproj_parser"
|
3
|
-
|
4
|
-
class CoordinatorGenerator
|
5
|
-
|
6
|
-
def initialize(parser, config)
|
7
|
-
@parser = parser
|
8
|
-
@config = config
|
9
|
-
end
|
10
|
-
|
11
|
-
def generate(coordinator_name, options = {})
|
12
|
-
coordinator_group = @parser.coordinator_group
|
13
|
-
file_creator = FileCreator.new(options, @config)
|
14
|
-
target = @parser.app_target
|
15
|
-
coordinator_name = coordinator_name.gsub("Coordinator", "")
|
16
|
-
file_creator.create_file(coordinator_name, 'Coordinator', coordinator_group, target)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require_relative 'file_creator'
|
2
|
-
require_relative "pbxproj_parser"
|
3
|
-
|
4
|
-
class InteractorGenerator
|
5
|
-
|
6
|
-
def initialize(parser, config)
|
7
|
-
@parser = parser
|
8
|
-
@config = config
|
9
|
-
end
|
10
|
-
|
11
|
-
def generate(interactor_name, options = {})
|
12
|
-
interactor_group = @parser.interactor_group
|
13
|
-
interactor_name = interactor_name.gsub("Interactor", "")
|
14
|
-
new_group_name = "#{interactor_name}Interactor"
|
15
|
-
|
16
|
-
associate_path_to_group = !interactor_group.path.nil?
|
17
|
-
|
18
|
-
raise "[Error] Group #{new_group_name} already exists in #{app_group.display_name}" if interactor_group[new_group_name]
|
19
|
-
new_group_path = File.join(interactor_group.real_path, new_group_name)
|
20
|
-
new_group = interactor_group.pf_new_group(
|
21
|
-
associate_path_to_group: associate_path_to_group,
|
22
|
-
name: new_group_name,
|
23
|
-
path: new_group_path
|
24
|
-
)
|
25
|
-
|
26
|
-
file_creator = FileCreator.new(options, @config)
|
27
|
-
target = @parser.core_target
|
28
|
-
file_creator.create_file(interactor_name, 'Interactor', new_group, target)
|
29
|
-
file_creator.create_file(interactor_name, 'InteractorImplementation', new_group, target)
|
30
|
-
|
31
|
-
file_creator.print_file_content(interactor_name, 'InteractorAssembly')
|
32
|
-
end
|
33
|
-
end
|