redbreast 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -0
- data/README.md +80 -4
- data/lib/redbreast/commands/color_generator.rb +3 -1
- data/lib/redbreast/commands/image_generator.rb +3 -1
- data/lib/redbreast/commands/setup.rb +15 -22
- data/lib/redbreast/version.rb +1 -1
- data/redbreast.svg +8 -0
- metadata +4 -3
- data/LICENSE.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58587403662d735b14fe0d4c0c1aa45acca3bfc7fa93a8c0f6c78bd604849d16
|
4
|
+
data.tar.gz: 8456066d1d95ede4fbb08fb14eae08cf78462fd241df238acf5baf31ad9ecd89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f3181555a1500ea5b9ce30d41b3d97705a06ec18761e83f3c8918010e27bca3e0ba37965a52bef04345c41935e6dc0486e010a5ab63a1c4306498952f805f6
|
7
|
+
data.tar.gz: f01695bf88db097e5eb13e72472d32f08c62b63424f2a36cb1d8f39f1b4f7e29a2e4689ef2c8e4f38f6cbbc6024cf7fcb832ab0f7f3d73dda1a0f36b4cd468e4
|
data/LICENSE.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Infinum
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Redbreast
|
2
2
|
|
3
|
-
![](https://
|
3
|
+
[![License](https://img.shields.io/cocoapods/l/SemanticVersioning.svg)](https://github.com/infinum/redbreast/blob/master/LICENSE.md)
|
4
|
+
|
5
|
+
<p align="center">
|
6
|
+
<img src="redbreast.svg" width="300" max-width="50%" alt="Japx"/>
|
7
|
+
</p>
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -103,20 +107,82 @@ For more examples checkout the sample project.
|
|
103
107
|
|
104
108
|
### Init
|
105
109
|
|
106
|
-
After installing redbreast run `redbreast init` to create
|
110
|
+
After installing redbreast run `redbreast init` to create `.redbreast.yml` file. This file is used for generating your extensions.
|
107
111
|
In the init you will be prompted to:
|
108
112
|
|
109
113
|
* Choose a language in which colors/images will be generated.
|
110
114
|
* Input the application name (optional)
|
111
115
|
* Input bundle names (default is main)
|
116
|
+
* Input whether you want to omit namespacing (optional)
|
112
117
|
* Choose whether you want to generate images, colors or both
|
113
118
|
* Input the path to assets folder
|
114
119
|
* Input the path where the files will be created
|
115
120
|
* Choose to create tests for generated assets
|
116
121
|
|
122
|
+
This is how your `.redbreast.yml` file should look after the `redbreast init` if you are using version 1.3.1 and lower:
|
123
|
+
|
124
|
+
```yml
|
125
|
+
---
|
126
|
+
:language: swift
|
127
|
+
:bundles:
|
128
|
+
- :name: main
|
129
|
+
:reference: ".main"
|
130
|
+
:shouldOmitNamespace: false
|
131
|
+
:assetsSearchPath: "MyProject/**/*.xcassets"
|
132
|
+
:outputSourcePathImages: "./MyProject/Common/Extensions/UIImage+Redbreast.swift"
|
133
|
+
:outputSourcePathColors: "./MyProject/Common/Extensions/UIColor+Redbreast.swift"
|
134
|
+
:outputTestPathImages: "./MyProject-UnitTests/Common/Extensions/UIImageExtensionTest.swift"
|
135
|
+
:outputTestPathColors: "./MyProject-UnitTests/Common/Extensions/UIColorExtensionTest.swift"
|
136
|
+
:testableImport: MyProject
|
137
|
+
:app_name: MyProject
|
138
|
+
```
|
139
|
+
|
140
|
+
Multiple language support is available from version 1.4.0. Example `.redbreast.yml` files from version 1.4.0 and higher:
|
141
|
+
|
142
|
+
If you are using only one language:
|
143
|
+
|
144
|
+
```yml
|
145
|
+
---
|
146
|
+
:bundles:
|
147
|
+
- :language: swift
|
148
|
+
:name: main
|
149
|
+
:reference: ".main"
|
150
|
+
:assetsSearchPath: "MyProject/**/*.xcassets"
|
151
|
+
:outputSourcePathImages: "./MyProject/Common/Extensions/UIImage+Redbreast.swift"
|
152
|
+
:outputSourcePathColors: "./MyProject/Common/Extensions/UIColor+Redbreast.swift"
|
153
|
+
:outputTestPathImages: "./MyProject-UnitTests/Common/Extensions/UIImageExtensionTest.swift"
|
154
|
+
:outputTestPathColors: "./MyProject-UnitTests/Common/Extensions/UIColorExtensionTest.swift"
|
155
|
+
:testableImport: MyProject
|
156
|
+
:app_name: MyProject
|
157
|
+
```
|
158
|
+
|
159
|
+
and if you are using two or more languages:
|
160
|
+
|
161
|
+
```yml
|
162
|
+
---
|
163
|
+
:bundles:
|
164
|
+
- :language: swift
|
165
|
+
:name: main
|
166
|
+
:reference: ".main"
|
167
|
+
:assetsSearchPath: "**/*.xcassets"
|
168
|
+
:outputSourcePathImages: ".MyProject/Common/Extensions/UIImageExtension.swift"
|
169
|
+
:outputTestPathImages: ".MyProject/Common/Extensions/UIImageExtensionTest.swift"
|
170
|
+
:testableImport: MyProject
|
171
|
+
- :language: swiftui
|
172
|
+
:name: MyProjectUI
|
173
|
+
:reference: ".MyProjectUI"
|
174
|
+
:assetsSearchPath: "MyProject/**/*.xcassets"
|
175
|
+
:outputSourcePathImages: ".MyProject/Common/Extensions/ImageExtension.swift"
|
176
|
+
:outputSourcePathColors: ".MyProject/Common/Extensions/ColorExtension.swift"
|
177
|
+
:outputTestPathImages: ".MyProject/Common/Extensions/ImageExtensionTest.swift"
|
178
|
+
:outputTestPathColors: ".MyProject/Common/Extensions/ColorExtensionTest.swift"
|
179
|
+
:testableImport: MyProject
|
180
|
+
:app_name: MyProject
|
181
|
+
```
|
182
|
+
|
117
183
|
### Generate
|
118
184
|
|
119
|
-
When you finish creating
|
185
|
+
When you finish creating `.redbreast.yml` file, run `redbreast generate` and all needed files will be generated.
|
120
186
|
|
121
187
|
### Install
|
122
188
|
|
@@ -130,8 +196,18 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
130
196
|
|
131
197
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
132
198
|
|
133
|
-
|
134
199
|
## License
|
135
200
|
|
136
201
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
137
202
|
|
203
|
+
## Credits
|
204
|
+
|
205
|
+
Maintained and sponsored by [Infinum](http://www.infinum.com).
|
206
|
+
<p align="center">
|
207
|
+
<a href='https://infinum.com'>
|
208
|
+
<picture>
|
209
|
+
<source srcset="https://assets.infinum.com/brand/logo/static/white.svg" media="(prefers-color-scheme: dark)">
|
210
|
+
<img src="https://assets.infinum.com/brand/logo/static/default.svg">
|
211
|
+
</picture>
|
212
|
+
</a>
|
213
|
+
</p>
|
@@ -24,7 +24,9 @@ module Redbreast
|
|
24
24
|
bundles.each do |bundle|
|
25
25
|
color_names = pull_asset_names(bundle[:assetsSearchPath])
|
26
26
|
bundle_language = bundle[:language] || programming_language
|
27
|
-
|
27
|
+
shouldOmitNamespace = bundle[:shouldOmitNamespace]
|
28
|
+
namespace = shouldOmitNamespace ? '' : app_name
|
29
|
+
write_colors(color_names, bundle, bundle_language, namespace)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
@@ -24,7 +24,9 @@ module Redbreast
|
|
24
24
|
bundles.each do |bundle|
|
25
25
|
image_names = pull_asset_names(bundle[:assetsSearchPath])
|
26
26
|
bundle_language = bundle[:language] || programming_language
|
27
|
-
|
27
|
+
shouldOmitNamespace = bundle[:shouldOmitNamespace]
|
28
|
+
namespace = shouldOmitNamespace ? '' : app_name
|
29
|
+
write_images(image_names, bundle, bundle_language, namespace)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
@@ -18,11 +18,11 @@ module Redbreast
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call
|
21
|
-
language = language_prompt
|
22
21
|
app_name = app_name_prompt
|
23
|
-
bundle_names = bundle_names_prompt(
|
24
|
-
assets_types = assets_types_prompt
|
22
|
+
bundle_names = bundle_names_prompt().split(' ')
|
25
23
|
bundles = bundle_names.map do |bundle|
|
24
|
+
language = language_prompt(bundle)
|
25
|
+
assets_types = assets_types_prompt(bundle)
|
26
26
|
reference = bundle_reference(bundle, language)
|
27
27
|
assets_search_path = assets_search_path_prompt(bundle)
|
28
28
|
output_source_path_images = assets_types == 1 ? nil : images_sources_path_prompt(bundle, language)
|
@@ -31,6 +31,7 @@ module Redbreast
|
|
31
31
|
output_test_path_images = assets_types != 1 && include_tests ? images_tests_path_prompt(bundle, language) : nil
|
32
32
|
output_test_path_colors = assets_types != 0 && include_tests ? colors_tests_path_prompt(bundle, language) : nil
|
33
33
|
fields = {
|
34
|
+
language: language,
|
34
35
|
name: bundle,
|
35
36
|
reference: reference,
|
36
37
|
assetsSearchPath: assets_search_path,
|
@@ -43,7 +44,6 @@ module Redbreast
|
|
43
44
|
compact fields
|
44
45
|
end
|
45
46
|
config = {
|
46
|
-
language: language,
|
47
47
|
bundles: bundles,
|
48
48
|
app_name: app_name
|
49
49
|
}
|
@@ -55,9 +55,9 @@ module Redbreast
|
|
55
55
|
|
56
56
|
# Language
|
57
57
|
|
58
|
-
def language_prompt
|
58
|
+
def language_prompt(bundle)
|
59
59
|
languages = { 'Swift' => 'swift', 'SwiftUI' => 'swiftui', 'Objective-C' => 'objc', }
|
60
|
-
prompt.select(
|
60
|
+
prompt.select("Choose a language for bundle #{bundle}: ", languages)
|
61
61
|
end
|
62
62
|
|
63
63
|
# Assets source path
|
@@ -69,16 +69,9 @@ module Redbreast
|
|
69
69
|
|
70
70
|
# Bundle names promt
|
71
71
|
|
72
|
-
def bundle_names_prompt(
|
73
|
-
prompt_text = 'Please enter bundle names that you use separated by spaces'
|
74
|
-
|
75
|
-
when 'objc'
|
76
|
-
prompt.ask(prompt_text, default: 'mainBundle')
|
77
|
-
when 'swift'
|
78
|
-
prompt.ask(prompt_text, default: 'main')
|
79
|
-
when 'swiftui'
|
80
|
-
prompt.ask(prompt_text, default: 'main')
|
81
|
-
end
|
72
|
+
def bundle_names_prompt()
|
73
|
+
prompt_text = 'Please enter bundle names that you use separated by spaces. For Obj-C use mainBundle.'
|
74
|
+
prompt.ask(prompt_text, default: 'main')
|
82
75
|
end
|
83
76
|
|
84
77
|
def bundle_reference(bundle_name, language)
|
@@ -95,7 +88,7 @@ module Redbreast
|
|
95
88
|
# Images source path
|
96
89
|
|
97
90
|
def images_sources_path_prompt(bundle, language)
|
98
|
-
prompt_text = "Where would you like to store
|
91
|
+
prompt_text = "Where would you like to store image resources files for bundle #{bundle}?"
|
99
92
|
case language
|
100
93
|
when 'objc'
|
101
94
|
prompt.ask(prompt_text, default: './Common/Categories/Images')
|
@@ -109,7 +102,7 @@ module Redbreast
|
|
109
102
|
# Colors source path
|
110
103
|
|
111
104
|
def colors_sources_path_prompt(bundle, language)
|
112
|
-
prompt_text = "Where would you like to store
|
105
|
+
prompt_text = "Where would you like to store color resources files for bundle #{bundle}?"
|
113
106
|
case language
|
114
107
|
when 'objc'
|
115
108
|
prompt.ask(prompt_text, default: './Common/Categories/Colors')
|
@@ -127,7 +120,7 @@ module Redbreast
|
|
127
120
|
end
|
128
121
|
|
129
122
|
def images_tests_path_prompt(bundle, language)
|
130
|
-
prompt_text = "Where would you like to store tests for bundle #{bundle}?"
|
123
|
+
prompt_text = "Where would you like to store image tests for bundle #{bundle}?"
|
131
124
|
case language
|
132
125
|
when 'objc'
|
133
126
|
prompt.ask(prompt_text, default: './Common/Categories/ImagesTest')
|
@@ -139,7 +132,7 @@ module Redbreast
|
|
139
132
|
end
|
140
133
|
|
141
134
|
def colors_tests_path_prompt(bundle, language)
|
142
|
-
prompt_text = "Where would you like to store tests for bundle #{bundle}?"
|
135
|
+
prompt_text = "Where would you like to store color tests for bundle #{bundle}?"
|
143
136
|
case language
|
144
137
|
when 'objc'
|
145
138
|
prompt.ask(prompt_text, default: './Common/Categories/ColorsTest')
|
@@ -169,9 +162,9 @@ module Redbreast
|
|
169
162
|
|
170
163
|
# Assets type prompt
|
171
164
|
|
172
|
-
def assets_types_prompt
|
165
|
+
def assets_types_prompt(bundle)
|
173
166
|
types = { 'Images' => 0, 'Colors' => 1, 'Both' => 2 }
|
174
|
-
prompt.select(
|
167
|
+
prompt.select("Choose a type for bundle #{bundle}: ", types)
|
175
168
|
end
|
176
169
|
end
|
177
170
|
end
|
data/lib/redbreast/version.rb
CHANGED
data/redbreast.svg
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M35 60.5L29.5 74.5L42 65.5L53.5 74.5L49 60.5" stroke="#D82828" stroke-width="4" stroke-linejoin="round"/>
|
3
|
+
<path d="M63 33C63 47.1199 53.3093 58 42 58C30.6907 58 21 47.1199 21 33C21 18.8801 30.6907 8 42 8C53.3093 8 63 18.8801 63 33Z" stroke="#D82828" stroke-width="4"/>
|
4
|
+
<path d="M63 34.5C63 27.5 50.5 18.5 42 30.5C38 25.5001 28.2 19.3001 21 34.5" stroke="#D82828" stroke-width="4"/>
|
5
|
+
<circle cx="36" cy="16" r="3" fill="#D82828"/>
|
6
|
+
<path d="M31 12H16L23 20.5" stroke="#D82828" stroke-width="4" stroke-linejoin="round"/>
|
7
|
+
<path d="M58.5 50H63C64.1046 50 65 50.8954 65 52V58C65 59.1046 64.1046 60 63 60H21C19.8954 60 19 59.1046 19 58V52C19 50.8954 19.8954 50 21 50H26.5" stroke="#D82828" stroke-width="4"/>
|
8
|
+
</svg>
|
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.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maroje
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
- ".travis.yml"
|
138
138
|
- CODE_OF_CONDUCT.md
|
139
139
|
- Gemfile
|
140
|
-
- LICENSE.
|
140
|
+
- LICENSE.md
|
141
141
|
- README.md
|
142
142
|
- Rakefile
|
143
143
|
- bin/console
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- lib/redbreast/template_generators/tests/images/swiftui_images_tests_template_generator.rb
|
179
179
|
- lib/redbreast/version.rb
|
180
180
|
- redbreast.gemspec
|
181
|
+
- redbreast.svg
|
181
182
|
homepage: https://github.com/infinum/redbreast
|
182
183
|
licenses:
|
183
184
|
- MIT
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 Vlaho
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|