redbreast 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redbreast.rb +6 -0
- 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 +18 -4
- data/lib/redbreast/io/config.rb +1 -1
- data/lib/redbreast/serializers/swift_serializer.rb +6 -8
- 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 +1 -1
- data/lib/redbreast/template_generators/colors/swiftui_colors_template_generator.rb +22 -0
- data/lib/redbreast/template_generators/images/swift_images_template_generator.rb +1 -1
- data/lib/redbreast/template_generators/images/swiftui_images_template_generator.rb +23 -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
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e4247b8ea9785ed5c37e2d0a46ded030dfeff01c64ceeee4d144d803b23c411
|
4
|
+
data.tar.gz: 2509327fc0ebeb80b802a5e633c4d88b1e416831f3e8ed1fba75f32914148d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 937c6973d5e526e7f516226ece7a23682fecf9f0bd24eefc59b1c13083562a623a66a422846a71d6a79e3dfbb3fea198922252ec3977258dfcf8b40c946b1c04
|
7
|
+
data.tar.gz: 6e8f426eee7cd8ec036e866f546c4f87e702143edef687fdbc6af51766f479ef2dc0d98c162b3e458696c6f53aafffc61a349ec98f624d2c02d4ef187517e45d
|
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'
|
@@ -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
|
|
@@ -38,7 +38,7 @@ module Redbreast
|
|
38
38
|
outputSourcePathColors: output_source_path_colors,
|
39
39
|
outputTestPathImages: output_test_path_images,
|
40
40
|
outputTestPathColors: output_test_path_colors,
|
41
|
-
testableImport: include_tests ? testable_import_prompt(bundle, language) : nil
|
41
|
+
testableImport: include_tests ? testable_import_prompt(bundle, app_name, language) : nil
|
42
42
|
}
|
43
43
|
compact fields
|
44
44
|
end
|
@@ -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/UIColorExtension.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,15 +145,19 @@ 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
|
|
141
|
-
def testable_import_prompt(bundle, language)
|
153
|
+
def testable_import_prompt(bundle, app_name, language)
|
142
154
|
case language
|
143
155
|
when 'objc'
|
144
156
|
nil
|
145
157
|
when 'swift'
|
146
|
-
prompt.ask("Please enter
|
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
|
|
data/lib/redbreast/io/config.rb
CHANGED
@@ -20,10 +20,10 @@ module Redbreast
|
|
20
20
|
text = ''
|
21
21
|
arr = []
|
22
22
|
|
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
|
-
text += indentation.empty? && text.empty? ? "\n" : ''
|
26
|
+
#text += indentation.empty? && text.empty? ? "\n" : ''
|
27
27
|
arr.each do |enum_name|
|
28
28
|
names_new = []
|
29
29
|
names_new_enum = []
|
@@ -40,12 +40,12 @@ module Redbreast
|
|
40
40
|
unless names_new.empty?
|
41
41
|
|
42
42
|
indentation += indentation.empty? || indentation[-1] == '/' ? '' : '/'
|
43
|
-
text +=
|
43
|
+
text += generate_file_swift(names: names_new, spacing: spacing + "\t", indentation: indentation + enum_name, variable: variable, bundle: bundle)
|
44
44
|
end
|
45
45
|
|
46
46
|
text += "\n" + spacing + '}' + "\n"
|
47
47
|
end
|
48
|
-
text
|
48
|
+
text + vars
|
49
49
|
end
|
50
50
|
|
51
51
|
def generate_extension(extended_class, app_name)
|
@@ -53,7 +53,7 @@ module Redbreast
|
|
53
53
|
|
54
54
|
return text if app_name.nil? || app_name.empty?
|
55
55
|
|
56
|
-
text + "\tenum " + app_name + " {}\n}\n\nextension " + extended_class + '.' + app_name + " {
|
56
|
+
text + "\tenum " + app_name + " {}\n}\n\nextension " + extended_class + '.' + app_name + " {"
|
57
57
|
end
|
58
58
|
|
59
59
|
def create_swift_test_cases(names:, declaration:, app_name:)
|
@@ -79,9 +79,7 @@ module Redbreast
|
|
79
79
|
array.push(temp_arr.first)
|
80
80
|
else
|
81
81
|
name_prefix = indentation.empty? ? '' : '/'
|
82
|
-
text += spacing + variable % [clean_variable_name(name), indentation + name_prefix + name, bundle[:reference]]
|
83
|
-
#text += spacing + declaration + clean_variable_name(name) + type + indentation + name_prefix + name + var_end + bundle[:reference] + line_end
|
84
|
-
text += name == names.last ? '' : "\n"
|
82
|
+
text += "\n" + spacing + variable % [clean_variable_name(name), indentation + name_prefix + name, bundle[:reference]]
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
@@ -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
|
+
#text += indentation.empty? && text.empty? ? "\n" : ''
|
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 ' + 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,7 @@ 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
14
|
<%= generate_extension('UIColor', app_name) %>
|
15
15
|
<%= generate_file_swift(names: asset_names, variable: 'static var %s: UIColor { return UIColor(named: "%s", in: %s, compatibleWith: nil)! }', bundle: bundle) %>
|
16
16
|
}
|
@@ -0,0 +1,22 @@
|
|
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
|
+
<%= generate_extension('Color', app_name) %>
|
15
|
+
<%= generate_file_swift(names: asset_names, variable: 'static var %s: Color { Color("%s", bundle: %s) }', bundle: bundle) %>
|
16
|
+
}
|
17
|
+
TEMPLATE
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -11,7 +11,7 @@ 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
15
|
<%= generate_extension('UIImage', app_name) %>
|
16
16
|
<%= generate_file_swift(names: asset_names, variable: 'static var %s: UIImage { return UIImage(named: "%s", in: %s, compatibleWith: nil)! }', bundle: bundle) %>
|
17
17
|
}
|
@@ -0,0 +1,23 @@
|
|
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
|
+
<%= generate_extension('Image', app_name) %>
|
16
|
+
<%= generate_file_swift(names: asset_names, variable: 'static var %s: Image { Image("%s", bundle: %s) }', bundle: bundle) %>
|
17
|
+
}
|
18
|
+
TEMPLATE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maroje
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- maroje.marcelic@infinum.com
|
128
128
|
executables:
|
@@ -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
|
@@ -180,7 +186,7 @@ licenses:
|
|
180
186
|
- MIT
|
181
187
|
metadata:
|
182
188
|
allowed_push_host: https://rubygems.org
|
183
|
-
post_install_message:
|
189
|
+
post_install_message:
|
184
190
|
rdoc_options: []
|
185
191
|
require_paths:
|
186
192
|
- lib
|
@@ -195,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
201
|
- !ruby/object:Gem::Version
|
196
202
|
version: '0'
|
197
203
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
199
|
-
signing_key:
|
204
|
+
rubygems_version: 3.1.4
|
205
|
+
signing_key:
|
200
206
|
specification_version: 4
|
201
207
|
summary: A CLI for safe and strongly typed resources
|
202
208
|
test_files: []
|