redbreast 1.3.1 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7ce16fccb9741bca97a4f08ef76c0bb64ce67686aa48edbe8a7a426aca2951c
4
- data.tar.gz: 4ee49fe8fa9a16e0f6a8c1631b59fc8bd3b23d1bad9de3e706949777d8648104
3
+ metadata.gz: c480f664a7236aa040c135bbb0ac9ab3b0094079def7706d52e622f8761e50fe
4
+ data.tar.gz: 7d0c140bd021d378e57c10bc83bd46bef2c18cf47df4805d82b2f45a970fcbe0
5
5
  SHA512:
6
- metadata.gz: 7db01230335e6eca956d71cdebc2611d7af0855fe4183b472dcfd45c08263c1e65b3b0c074cd8df12d1d0997620d570503e5ad9527a0fcb401f21c3663480fb7
7
- data.tar.gz: 4779524e2b16d31b3d056334d2233a0bb70fd0c65863dd8769f049da8d40973bf76f20c18105289bee8b53a326d1751cc0479ace42ded5c9fb1a8b1bf775c91b
6
+ metadata.gz: 4e189fc86aa4bb2908217306485a6a1a42d79347934f46b132e32b97111084508799363c6e4b23528b229778227a13f44ce1fb90ca9c344c5ee2ff778679784d
7
+ data.tar.gz: e44abf29a209555d579a51d8cbbf9651f5c41b77d4a348c933b612992423aa8b83fb6631ff6b26f432ae74c0fba77c23a65e625034cadd33e5ddca41e3800e6d
@@ -10,19 +10,21 @@ module Redbreast
10
10
  end
11
11
 
12
12
  def call
13
- return if bundles.first[:outputSourcePathColors].nil?
13
+ filtered_bundles = bundles.select { |bundle| bundle[:outputSourcePathColors] }
14
+ return if filtered_bundles.empty?
14
15
 
15
16
  prompt.say('Generating color resources...')
16
- generate_color_sources(bundles, programming_language, app_name)
17
+ generate_color_sources(filtered_bundles, app_name)
17
18
  success('Color resources generated!')
18
19
  end
19
20
 
20
21
  private
21
22
 
22
- def generate_color_sources(bundles, programming_language, app_name)
23
+ def generate_color_sources(bundles, app_name)
23
24
  bundles.each do |bundle|
24
25
  color_names = pull_asset_names(bundle[:assetsSearchPath])
25
- write_colors(color_names, bundle, programming_language, app_name)
26
+ bundle_language = bundle[:language] || programming_language
27
+ write_colors(color_names, bundle, bundle_language, app_name)
26
28
  end
27
29
  end
28
30
 
@@ -14,16 +14,17 @@ module Redbreast
14
14
  return if filtered_bundles.empty?
15
15
 
16
16
  prompt.say('Generating color test resources...')
17
- generate_test_sources(bundles, programming_language, app_name)
17
+ generate_test_sources(bundles, app_name)
18
18
  success('Color test resources generated!')
19
19
  end
20
20
 
21
21
  private
22
22
 
23
- def generate_test_sources(bundles, programming_language, app_name)
23
+ def generate_test_sources(bundles, app_name)
24
24
  bundles.each do |bundle|
25
25
  color_names = pull_asset_names(bundle[:assetsSearchPath])
26
- write_tests(color_names, bundle, programming_language, app_name)
26
+ bundle_language = bundle[:language] || programming_language
27
+ write_tests(color_names, bundle, bundle_language, app_name)
27
28
  end
28
29
  end
29
30
 
@@ -10,19 +10,21 @@ module Redbreast
10
10
  end
11
11
 
12
12
  def call
13
- return if bundles.first[:outputSourcePathImages].nil?
13
+ filtered_bundles = bundles.select { |bundle| bundle[:outputSourcePathImages] }
14
+ return if filtered_bundles.empty?
14
15
 
15
16
  prompt.say('Generating image resources...')
16
- generate_image_sources(bundles, programming_language, app_name)
17
+ generate_image_sources(filtered_bundles, app_name)
17
18
  success('Image resources generated!')
18
19
  end
19
20
 
20
21
  private
21
22
 
22
- def generate_image_sources(bundles, programming_language, app_name)
23
+ def generate_image_sources(bundles, app_name)
23
24
  bundles.each do |bundle|
24
25
  image_names = pull_asset_names(bundle[:assetsSearchPath])
25
- write_images(image_names, bundle, programming_language, app_name)
26
+ bundle_language = bundle[:language] || programming_language
27
+ write_images(image_names, bundle, bundle_language, app_name)
26
28
  end
27
29
  end
28
30
 
@@ -14,16 +14,17 @@ module Redbreast
14
14
  return if filtered_bundles.empty?
15
15
 
16
16
  prompt.say('Generating images test resources...')
17
- generate_test_sources(bundles, programming_language, app_name)
17
+ generate_test_sources(bundles, app_name)
18
18
  success('Images test resources generated!')
19
19
  end
20
20
 
21
21
  private
22
22
 
23
- def generate_test_sources(bundles, programming_language, app_name)
23
+ def generate_test_sources(bundles, app_name)
24
24
  bundles.each do |bundle|
25
25
  image_names = pull_asset_names(bundle[:assetsSearchPath])
26
- write_tests(image_names, bundle, programming_language, app_name)
26
+ bundle_language = bundle[:language] || programming_language
27
+ write_tests(image_names, bundle, bundle_language, app_name)
27
28
  end
28
29
  end
29
30
 
@@ -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(language).split(' ')
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('Choose a language: ', languages)
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(language)
73
- prompt_text = 'Please enter bundle names that you use separated by spaces'
74
- case language
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 images resources files for bundle #{bundle}?"
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 colors resources files for bundle #{bundle}?"
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('Choose a type: ', types)
167
+ prompt.select("Choose a type for bundle #{bundle}: ", types)
175
168
  end
176
169
  end
177
170
  end
@@ -1,3 +1,3 @@
1
1
  module Redbreast
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.1'
3
3
  end
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.3.1
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maroje
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-21 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler