redbreast 1.0.3 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redbreast/commands/color_generator.rb +3 -0
- data/lib/redbreast/commands/color_test_generator.rb +3 -0
- data/lib/redbreast/commands/image_generator.rb +3 -0
- data/lib/redbreast/commands/image_test_generator.rb +3 -0
- data/lib/redbreast/commands/setup.rb +15 -1
- data/lib/redbreast/helpers/general.rb +11 -0
- data/lib/redbreast/io/config.rb +1 -1
- data/lib/redbreast/serializers/objc_serializer.rb +2 -2
- data/lib/redbreast/serializers/swift_serializer.rb +4 -3
- data/lib/redbreast/serializers/swiftui_serializer.rb +107 -0
- data/lib/redbreast/template_generators/.DS_Store +0 -0
- data/lib/redbreast/template_generators/colors/swift_colors_template_generator.rb +2 -1
- data/lib/redbreast/template_generators/colors/swiftui_colors_template_generator.rb +23 -0
- data/lib/redbreast/template_generators/images/swift_images_template_generator.rb +2 -1
- data/lib/redbreast/template_generators/images/swiftui_images_template_generator.rb +24 -0
- data/lib/redbreast/template_generators/swiftui_template_generator.rb +11 -0
- data/lib/redbreast/template_generators/tests/colors/swift_colors_tests_template_generator.rb +1 -1
- data/lib/redbreast/template_generators/tests/colors/swiftui_colors_tests_template_generator.rb +27 -0
- data/lib/redbreast/template_generators/tests/images/swift_images_tests_template_generator.rb +1 -1
- data/lib/redbreast/template_generators/tests/images/swiftui_images_tests_template_generator.rb +27 -0
- data/lib/redbreast/version.rb +1 -1
- data/lib/redbreast.rb +6 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4333c7695d94182141a09737fe4d5c298f2c7f48ef2b0235170436cb1746f41d
|
4
|
+
data.tar.gz: b2616e3e40e1958b58cae329046e25c3619903dd90b93af89c59da8242d34205
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac62100673841d410911b49bb8dfa6c2d2992ecaec3b0fac8371a8af3c6f592e907809abfbc54d6673f8e450976017ec1d47f23dae352efa69011d3cac560885
|
7
|
+
data.tar.gz: fdccea173c982b8969ee4d5cfcf4377ec615cf84b7137503a3120bcf2bd9a66541eb13a7925da21a1a215dc40b9ae631f287c238f01a9bc7331bdb9b6049e9dc
|
@@ -39,6 +39,9 @@ module Redbreast
|
|
39
39
|
when 'swift'
|
40
40
|
serializer = Redbreast::Serializer::Swift
|
41
41
|
template_generator = Redbreast::TemplateGenerator::Color::Swift
|
42
|
+
when 'swiftui'
|
43
|
+
serializer = Redbreast::Serializer::SwiftUI
|
44
|
+
template_generator = Redbreast::TemplateGenerator::Color::SwiftUI
|
42
45
|
end
|
43
46
|
serializer.new(color_names, bundle, app_name).save(output_source_path: output_path, template_generator: template_generator.new, generate_colors: true)
|
44
47
|
end
|
@@ -41,6 +41,9 @@ module Redbreast
|
|
41
41
|
when 'swift'
|
42
42
|
serializer = Redbreast::Serializer::Swift
|
43
43
|
template_generator = Redbreast::TemplateGenerator::ColorTest::Swift
|
44
|
+
when 'swiftui'
|
45
|
+
serializer = Redbreast::Serializer::SwiftUI
|
46
|
+
template_generator = Redbreast::TemplateGenerator::ColorTest::SwiftUI
|
44
47
|
end
|
45
48
|
serializer.new(color_names, bundle, app_name).save(output_source_path: output_path, template_generator: template_generator.new, generate_colors: true)
|
46
49
|
|
@@ -39,6 +39,9 @@ module Redbreast
|
|
39
39
|
when 'swift'
|
40
40
|
serializer = Redbreast::Serializer::Swift
|
41
41
|
template_generator = Redbreast::TemplateGenerator::Image::Swift
|
42
|
+
when 'swiftui'
|
43
|
+
serializer = Redbreast::Serializer::SwiftUI
|
44
|
+
template_generator = Redbreast::TemplateGenerator::Image::SwiftUI
|
42
45
|
end
|
43
46
|
serializer.new(image_names, bundle, app_name).save(output_source_path: output_path, template_generator: template_generator.new, generate_colors: false)
|
44
47
|
|
@@ -41,6 +41,9 @@ module Redbreast
|
|
41
41
|
when 'swift'
|
42
42
|
serializer = Redbreast::Serializer::Swift
|
43
43
|
template_generator = Redbreast::TemplateGenerator::ImageTest::Swift
|
44
|
+
when 'swiftui'
|
45
|
+
serializer = Redbreast::Serializer::SwiftUI
|
46
|
+
template_generator = Redbreast::TemplateGenerator::ImageTest::SwiftUI
|
44
47
|
end
|
45
48
|
serializer.new(image_names, bundle, app_name).save(output_source_path: output_path, template_generator: template_generator.new, generate_colors: false)
|
46
49
|
|
@@ -56,7 +56,7 @@ module Redbreast
|
|
56
56
|
# Language
|
57
57
|
|
58
58
|
def language_prompt
|
59
|
-
languages = { 'Swift' => 'swift', 'Objective-C' => 'objc' }
|
59
|
+
languages = { 'Swift' => 'swift', 'SwiftUI' => 'swiftui', 'Objective-C' => 'objc', }
|
60
60
|
prompt.select('Choose a language: ', languages)
|
61
61
|
end
|
62
62
|
|
@@ -76,6 +76,8 @@ module Redbreast
|
|
76
76
|
prompt.ask(prompt_text, default: 'mainBundle')
|
77
77
|
when 'swift'
|
78
78
|
prompt.ask(prompt_text, default: 'main')
|
79
|
+
when 'swiftui'
|
80
|
+
prompt.ask(prompt_text, default: 'main')
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
@@ -85,6 +87,8 @@ module Redbreast
|
|
85
87
|
"[NSBundle #{bundle_name}]"
|
86
88
|
when 'swift'
|
87
89
|
".#{bundle_name}"
|
90
|
+
when 'swiftui'
|
91
|
+
".#{bundle_name}"
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
@@ -97,6 +101,8 @@ module Redbreast
|
|
97
101
|
prompt.ask(prompt_text, default: './Common/Categories/Images')
|
98
102
|
when 'swift'
|
99
103
|
prompt.ask(prompt_text, default: './Common/Extensions/UIImageExtension.swift')
|
104
|
+
when 'swiftui'
|
105
|
+
prompt.ask(prompt_text, default: './Common/Extensions/ImageExtension.swift')
|
100
106
|
end
|
101
107
|
end
|
102
108
|
|
@@ -109,6 +115,8 @@ module Redbreast
|
|
109
115
|
prompt.ask(prompt_text, default: './Common/Categories/Colors')
|
110
116
|
when 'swift'
|
111
117
|
prompt.ask(prompt_text, default: './Common/Extensions/UIColorExtension.swift')
|
118
|
+
when 'swiftui'
|
119
|
+
prompt.ask(prompt_text, default: './Common/Extensions/ColorExtension.swift')
|
112
120
|
end
|
113
121
|
end
|
114
122
|
|
@@ -125,6 +133,8 @@ module Redbreast
|
|
125
133
|
prompt.ask(prompt_text, default: './Common/Categories/ImagesTest')
|
126
134
|
when 'swift'
|
127
135
|
prompt.ask(prompt_text, default: './Common/Extensions/UIImageExtensionTest.swift')
|
136
|
+
when 'swiftui'
|
137
|
+
prompt.ask(prompt_text, default: './Common/Extensions/ImageExtensionTest.swift')
|
128
138
|
end
|
129
139
|
end
|
130
140
|
|
@@ -135,6 +145,8 @@ module Redbreast
|
|
135
145
|
prompt.ask(prompt_text, default: './Common/Categories/ColorsTest')
|
136
146
|
when 'swift'
|
137
147
|
prompt.ask(prompt_text, default: './Common/Extensions/UIColorExtensionTest.swift')
|
148
|
+
when 'swiftui'
|
149
|
+
prompt.ask(prompt_text, default: './Common/Extensions/ColorExtensionTest.swift')
|
138
150
|
end
|
139
151
|
end
|
140
152
|
|
@@ -144,6 +156,8 @@ module Redbreast
|
|
144
156
|
nil
|
145
157
|
when 'swift'
|
146
158
|
prompt.ask("Please enter a name that will be used for testable import in #{bundle} bundle?", default: "#{app_name}", required: true)
|
159
|
+
when 'swiftui'
|
160
|
+
prompt.ask("Please enter a name that will be used for testable import in #{bundle} bundle?", default: "#{app_name}", required: true)
|
147
161
|
end
|
148
162
|
end
|
149
163
|
|
@@ -45,6 +45,17 @@ module Redbreast
|
|
45
45
|
escape_with_underscore_if_needed(clean_name)
|
46
46
|
end
|
47
47
|
|
48
|
+
def upper_camel_case(name)
|
49
|
+
clean_name = name
|
50
|
+
.split(/[^0-9a-zA-Z]/)
|
51
|
+
.reject(&:empty?)
|
52
|
+
.each_with_index
|
53
|
+
.map { |v, i| i.zero? ? v.tap { |char| char[0] = char[0].upcase } : v.capitalize }
|
54
|
+
.join
|
55
|
+
|
56
|
+
escape_with_underscore_if_needed(clean_name)
|
57
|
+
end
|
58
|
+
|
48
59
|
def clean_case_name(name)
|
49
60
|
clean_variable_name(name)
|
50
61
|
end
|
data/lib/redbreast/io/config.rb
CHANGED
@@ -40,7 +40,7 @@ module Redbreast
|
|
40
40
|
text = ''
|
41
41
|
|
42
42
|
names.each do |name|
|
43
|
-
temp_arr = name.split('/')
|
43
|
+
temp_arr = name.split('/').map { |folder| upper_camel_case(folder) }
|
44
44
|
|
45
45
|
variable_name = temp_arr.length == 1 ? clean_variable_name(name) : temp_arr.unshift(temp_arr.shift.downcase).join('')
|
46
46
|
text += variable_declaration % variable_name + variable_implementation % [name, bundle_name[:reference]]
|
@@ -54,7 +54,7 @@ module Redbreast
|
|
54
54
|
text = ''
|
55
55
|
|
56
56
|
names.each do |name|
|
57
|
-
temp_arr = name.split('/')
|
57
|
+
temp_arr = name.split('/').map { |folder| upper_camel_case(folder) }
|
58
58
|
variable_name = temp_arr.length == 1 ? clean_variable_name(name) : temp_arr.unshift(temp_arr.shift.downcase).join('')
|
59
59
|
text += variable % variable_name
|
60
60
|
end
|
@@ -23,13 +23,13 @@ module Redbreast
|
|
23
23
|
vars, arr = generate_variables(names: names, spacing: spacing, indentation: indentation, variable: variable, bundle: bundle, text: text, array: arr)
|
24
24
|
|
25
25
|
arr = arr.uniq
|
26
|
-
|
26
|
+
|
27
27
|
arr.each do |enum_name|
|
28
28
|
names_new = []
|
29
29
|
names_new_enum = []
|
30
30
|
new_enum_name = enum_name
|
31
31
|
|
32
|
-
text += "\n" + spacing + 'enum ' + enum_name + ' {'
|
32
|
+
text += "\n" + spacing + 'enum ' + upper_camel_case(enum_name) + ' {'
|
33
33
|
names_new, names_new_enum = separate_variables_from_folders(names: names, enum_name: enum_name, new_enum_name: new_enum_name, names_new_enum: names_new_enum, names_new: names_new)
|
34
34
|
|
35
35
|
if !names_new_enum.empty? && new_enum_name == enum_name
|
@@ -64,7 +64,8 @@ module Redbreast
|
|
64
64
|
temp_array = name.split('/')
|
65
65
|
variable = temp_array.pop
|
66
66
|
additional_text = temp_array.count.zero? ? '' : '.'
|
67
|
-
|
67
|
+
|
68
|
+
text += "\t\t" + declaration + app_name_text + temp_array.map { |enum| upper_camel_case(enum) }.join('.') + additional_text + clean_variable_name(variable)
|
68
69
|
text += name == names.last ? '' : "\n"
|
69
70
|
end
|
70
71
|
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require_relative 'serializer'
|
2
|
+
|
3
|
+
module Redbreast
|
4
|
+
module Serializer
|
5
|
+
# Used to save swift files
|
6
|
+
class SwiftUI < Base
|
7
|
+
include Helper::General
|
8
|
+
|
9
|
+
def save(output_source_path:, template_generator:, generate_colors:)
|
10
|
+
directory = File.dirname(output_source_path)
|
11
|
+
FileUtils.mkdir_p directory unless File.exist? directory
|
12
|
+
|
13
|
+
file = ERB.new(template_generator.template, nil, '-').result(binding)
|
14
|
+
File.write(output_source_path, file)
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_file_swift(names:, spacing: "\t", indentation: '', variable:, bundle:)
|
18
|
+
return if names.empty?
|
19
|
+
|
20
|
+
text = ''
|
21
|
+
arr = []
|
22
|
+
|
23
|
+
vars, arr = generate_variables(names: names, spacing: spacing, indentation: indentation, variable: variable, bundle: bundle, text: text, array: arr)
|
24
|
+
|
25
|
+
arr = arr.uniq
|
26
|
+
|
27
|
+
arr.each do |enum_name|
|
28
|
+
names_new = []
|
29
|
+
names_new_enum = []
|
30
|
+
new_enum_name = enum_name
|
31
|
+
|
32
|
+
text += "\n" + spacing + 'enum ' + upper_camel_case(enum_name) + ' {'
|
33
|
+
names_new, names_new_enum = separate_variables_from_folders(names: names, enum_name: enum_name, new_enum_name: new_enum_name, names_new_enum: names_new_enum, names_new: names_new)
|
34
|
+
|
35
|
+
if !names_new_enum.empty? && new_enum_name == enum_name
|
36
|
+
indentation += indentation.empty? || indentation[-1] == '/' ? '' : '/'
|
37
|
+
text += "\n" + generate_file_swift(names: names_new_enum, spacing: spacing + "\t", indentation: indentation + enum_name, variable: variable, bundle: bundle)
|
38
|
+
end
|
39
|
+
|
40
|
+
unless names_new.empty?
|
41
|
+
|
42
|
+
indentation += indentation.empty? || indentation[-1] == '/' ? '' : '/'
|
43
|
+
text += generate_file_swift(names: names_new, spacing: spacing + "\t", indentation: indentation + enum_name, variable: variable, bundle: bundle)
|
44
|
+
end
|
45
|
+
|
46
|
+
text += "\n" + spacing + '}' + "\n"
|
47
|
+
end
|
48
|
+
text + vars
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_extension(extended_class, app_name)
|
52
|
+
text = 'extension ' + extended_class + " {\n"
|
53
|
+
|
54
|
+
return text if app_name.nil? || app_name.empty?
|
55
|
+
|
56
|
+
text + "\tenum " + app_name + " {}\n}\n\nextension " + extended_class + '.' + app_name + " {"
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_swift_test_cases(names:, declaration:, app_name:)
|
60
|
+
text = ''
|
61
|
+
app_name_text = app_name.nil? || app_name.empty? ? '' : app_name + '.'
|
62
|
+
|
63
|
+
names.each do |name|
|
64
|
+
temp_array = name.split('/')
|
65
|
+
variable = temp_array.pop
|
66
|
+
additional_text = temp_array.count.zero? ? '' : '.'
|
67
|
+
text += "\t\t" + declaration + app_name_text + temp_array.join('.') + additional_text + clean_variable_name(variable)
|
68
|
+
text += name == names.last ? '' : "\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
text
|
72
|
+
end
|
73
|
+
|
74
|
+
def generate_variables(names:, spacing:, indentation:, bundle:, variable:, text:, array:)
|
75
|
+
names.each do |name|
|
76
|
+
temp_arr = name.split('/')
|
77
|
+
|
78
|
+
if temp_arr.length != 1
|
79
|
+
array.push(temp_arr.first)
|
80
|
+
else
|
81
|
+
name_prefix = indentation.empty? ? '' : '/'
|
82
|
+
text += "\n" + spacing + variable % [clean_variable_name(name), indentation + name_prefix + name, bundle[:reference]]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
[text, array]
|
87
|
+
end
|
88
|
+
|
89
|
+
def separate_variables_from_folders(names:, enum_name:, new_enum_name:, names_new_enum:, names_new:)
|
90
|
+
names.each do |name|
|
91
|
+
temp_arr = name.split('/')
|
92
|
+
|
93
|
+
next if temp_arr.length == 1
|
94
|
+
|
95
|
+
if temp_arr.length > 2
|
96
|
+
names_new_enum.push(temp_arr.drop(1).join('/')) if temp_arr.first == new_enum_name
|
97
|
+
next
|
98
|
+
end
|
99
|
+
|
100
|
+
names_new.push(temp_arr.drop(1).join('/')) if temp_arr[0] == enum_name
|
101
|
+
end
|
102
|
+
|
103
|
+
[names_new, names_new_enum]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
Binary file
|
@@ -10,7 +10,8 @@ module Redbreast
|
|
10
10
|
<<~TEMPLATE
|
11
11
|
import UIKit
|
12
12
|
|
13
|
-
//THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
13
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
14
|
+
// swiftlint:disable file_length type_body_length line_length superfluous_disable_command
|
14
15
|
<%= generate_extension('UIColor', app_name) %>
|
15
16
|
<%= generate_file_swift(names: asset_names, variable: 'static var %s: UIColor { return UIColor(named: "%s", in: %s, compatibleWith: nil)! }', bundle: bundle) %>
|
16
17
|
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../swiftui_template_generator'
|
2
|
+
|
3
|
+
module Redbreast
|
4
|
+
module TemplateGenerator
|
5
|
+
module Color
|
6
|
+
# Used for creating colors in swift.
|
7
|
+
class SwiftUI < TemplateGenerator::SwiftUI
|
8
|
+
include ERB::Util
|
9
|
+
def template
|
10
|
+
<<~TEMPLATE
|
11
|
+
import SwiftUI
|
12
|
+
|
13
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
14
|
+
// swiftlint:disable file_length type_body_length line_length superfluous_disable_command
|
15
|
+
<%= generate_extension('Color', app_name) %>
|
16
|
+
<%= generate_file_swift(names: asset_names, variable: 'static var %s: Color { Color("%s", bundle: %s) }', bundle: bundle) %>
|
17
|
+
}
|
18
|
+
TEMPLATE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -11,7 +11,8 @@ module Redbreast
|
|
11
11
|
<<~TEMPLATE
|
12
12
|
import UIKit
|
13
13
|
|
14
|
-
//THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
14
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
15
|
+
// swiftlint:disable file_length type_body_length line_length superfluous_disable_command
|
15
16
|
<%= generate_extension('UIImage', app_name) %>
|
16
17
|
<%= generate_file_swift(names: asset_names, variable: 'static var %s: UIImage { return UIImage(named: "%s", in: %s, compatibleWith: nil)! }', bundle: bundle) %>
|
17
18
|
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative '../swiftui_template_generator'
|
2
|
+
|
3
|
+
module Redbreast
|
4
|
+
module TemplateGenerator
|
5
|
+
module Image
|
6
|
+
# Used for creating images in swift.
|
7
|
+
class SwiftUI < TemplateGenerator::SwiftUI
|
8
|
+
include ERB::Util
|
9
|
+
|
10
|
+
def template
|
11
|
+
<<~TEMPLATE
|
12
|
+
import SwiftUI
|
13
|
+
|
14
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
15
|
+
// swiftlint:disable file_length type_body_length line_length superfluous_disable_command
|
16
|
+
<%= generate_extension('Image', app_name) %>
|
17
|
+
<%= generate_file_swift(names: asset_names, variable: 'static var %s: Image { Image("%s", bundle: %s) }', bundle: bundle) %>
|
18
|
+
}
|
19
|
+
TEMPLATE
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/redbreast/template_generators/tests/colors/swift_colors_tests_template_generator.rb
CHANGED
@@ -12,7 +12,7 @@ module Redbreast
|
|
12
12
|
import XCTest
|
13
13
|
@testable import <%= bundle[:testableImport] %>
|
14
14
|
|
15
|
-
//THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
15
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
16
16
|
class <%= File.basename(bundle[:outputTestPathColors], ".*") %>: XCTestCase {
|
17
17
|
|
18
18
|
func testIfColorsArePresent() {
|
data/lib/redbreast/template_generators/tests/colors/swiftui_colors_tests_template_generator.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'redbreast/template_generators/swiftui_template_generator'
|
2
|
+
|
3
|
+
module Redbreast
|
4
|
+
module TemplateGenerator
|
5
|
+
module ColorTest
|
6
|
+
# Used for creating color tests in swift.
|
7
|
+
class SwiftUI < TemplateGenerator::SwiftUI
|
8
|
+
include ERB::Util
|
9
|
+
def template
|
10
|
+
<<~TEMPLATE
|
11
|
+
import SwiftUI
|
12
|
+
import XCTest
|
13
|
+
@testable import <%= bundle[:testableImport] %>
|
14
|
+
|
15
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
16
|
+
class <%= File.basename(bundle[:outputTestPathColors], ".*") %>: XCTestCase {
|
17
|
+
|
18
|
+
func testIfColorsArePresent() {
|
19
|
+
<%= create_swift_test_cases(names: asset_names, declaration: '_ = Color.', app_name: app_name) %>
|
20
|
+
}
|
21
|
+
}
|
22
|
+
TEMPLATE
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/redbreast/template_generators/tests/images/swift_images_tests_template_generator.rb
CHANGED
@@ -12,7 +12,7 @@ module Redbreast
|
|
12
12
|
import XCTest
|
13
13
|
@testable import <%= bundle[:testableImport] %>
|
14
14
|
|
15
|
-
//THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
15
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
16
16
|
class <%= File.basename(bundle[:outputTestPathImages], ".*") %>: XCTestCase {
|
17
17
|
|
18
18
|
func testIfImagesArePresent() {
|
data/lib/redbreast/template_generators/tests/images/swiftui_images_tests_template_generator.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'redbreast/template_generators/swiftui_template_generator'
|
2
|
+
|
3
|
+
module Redbreast
|
4
|
+
module TemplateGenerator
|
5
|
+
module ImageTest
|
6
|
+
# Used for creating image tests in swift.
|
7
|
+
class SwiftUI < TemplateGenerator::SwiftUI
|
8
|
+
include ERB::Util
|
9
|
+
def template
|
10
|
+
<<~TEMPLATE
|
11
|
+
import SwiftUI
|
12
|
+
import XCTest
|
13
|
+
@testable import <%= bundle[:testableImport] %>
|
14
|
+
|
15
|
+
// THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
16
|
+
class <%= File.basename(bundle[:outputTestPathImages], ".*") %>: XCTestCase {
|
17
|
+
|
18
|
+
func testIfImagesArePresent() {
|
19
|
+
<%= create_swift_test_cases(names: asset_names, declaration: '_ = Image.', app_name: app_name) %>
|
20
|
+
}
|
21
|
+
}
|
22
|
+
TEMPLATE
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/redbreast/version.rb
CHANGED
data/lib/redbreast.rb
CHANGED
@@ -27,18 +27,24 @@ require 'redbreast/crawlers/color_crawler'
|
|
27
27
|
require 'redbreast/serializers/serializer'
|
28
28
|
require 'redbreast/serializers/objc_serializer'
|
29
29
|
require 'redbreast/serializers/swift_serializer'
|
30
|
+
require 'redbreast/serializers/swiftui_serializer'
|
30
31
|
|
31
32
|
# Template generators
|
32
33
|
require 'redbreast/template_generators/objc_template_generator'
|
33
34
|
require 'redbreast/template_generators/swift_template_generator'
|
35
|
+
require 'redbreast/template_generators/swiftui_template_generator'
|
34
36
|
require 'redbreast/template_generators/images/objc_images_template_generator'
|
35
37
|
require 'redbreast/template_generators/images/swift_images_template_generator'
|
38
|
+
require 'redbreast/template_generators/images/swiftui_images_template_generator'
|
36
39
|
require 'redbreast/template_generators/colors/objc_colors_template_generator'
|
37
40
|
require 'redbreast/template_generators/colors/swift_colors_template_generator'
|
41
|
+
require 'redbreast/template_generators/colors/swiftui_colors_template_generator'
|
38
42
|
require 'redbreast/template_generators/tests/colors/objc_colors_tests_template_generator'
|
39
43
|
require 'redbreast/template_generators/tests/colors/swift_colors_tests_template_generator'
|
44
|
+
require 'redbreast/template_generators/tests/colors/swiftui_colors_tests_template_generator'
|
40
45
|
require 'redbreast/template_generators/tests/images/objc_images_tests_template_generator'
|
41
46
|
require 'redbreast/template_generators/tests/images/swift_images_tests_template_generator'
|
47
|
+
require 'redbreast/template_generators/tests/images/swiftui_images_tests_template_generator'
|
42
48
|
|
43
49
|
# Error Handler
|
44
50
|
require 'redbreast/error_handler'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redbreast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maroje
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,17 +162,23 @@ files:
|
|
162
162
|
- lib/redbreast/serializers/objc_serializer.rb
|
163
163
|
- lib/redbreast/serializers/serializer.rb
|
164
164
|
- lib/redbreast/serializers/swift_serializer.rb
|
165
|
+
- lib/redbreast/serializers/swiftui_serializer.rb
|
165
166
|
- lib/redbreast/template_generators/.DS_Store
|
166
167
|
- lib/redbreast/template_generators/colors/objc_colors_template_generator.rb
|
167
168
|
- lib/redbreast/template_generators/colors/swift_colors_template_generator.rb
|
169
|
+
- lib/redbreast/template_generators/colors/swiftui_colors_template_generator.rb
|
168
170
|
- lib/redbreast/template_generators/images/objc_images_template_generator.rb
|
169
171
|
- lib/redbreast/template_generators/images/swift_images_template_generator.rb
|
172
|
+
- lib/redbreast/template_generators/images/swiftui_images_template_generator.rb
|
170
173
|
- lib/redbreast/template_generators/objc_template_generator.rb
|
171
174
|
- lib/redbreast/template_generators/swift_template_generator.rb
|
175
|
+
- lib/redbreast/template_generators/swiftui_template_generator.rb
|
172
176
|
- lib/redbreast/template_generators/tests/colors/objc_colors_tests_template_generator.rb
|
173
177
|
- lib/redbreast/template_generators/tests/colors/swift_colors_tests_template_generator.rb
|
178
|
+
- lib/redbreast/template_generators/tests/colors/swiftui_colors_tests_template_generator.rb
|
174
179
|
- lib/redbreast/template_generators/tests/images/objc_images_tests_template_generator.rb
|
175
180
|
- lib/redbreast/template_generators/tests/images/swift_images_tests_template_generator.rb
|
181
|
+
- lib/redbreast/template_generators/tests/images/swiftui_images_tests_template_generator.rb
|
176
182
|
- lib/redbreast/version.rb
|
177
183
|
- redbreast.gemspec
|
178
184
|
homepage: https://github.com/infinum/redbreast
|