redbreast 1.1.1 → 1.2.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: 55140102c283d2812b099b0ec63dc475d12faef4beac0cc12d39cca5b87c2f61
4
- data.tar.gz: 70704e2afa3b62adc8693d87cdf47891e255abdaf0b416cc11ae4190acd9d634
3
+ metadata.gz: '08211f43d2d63e1357a2b75e016ddd0d0998f3399309ffc1164a9604b2376185'
4
+ data.tar.gz: 3ff926cfb618faa177a063a7347a98e38fe37a248f6115e7a427583d70862d72
5
5
  SHA512:
6
- metadata.gz: b7945675763fad73af01dcdd6018dbd032d782449f028f0e0d7d289cf028c4b7ce6d4ae5f129a2b47755e14a31b93cbc9bf1f6b6fe33e544558145635d5c6a78
7
- data.tar.gz: 51d20e13ab388b0e2bd71a696bda633eed452f4d2be7b6e0179ffd0d6b7f2dffe056e7f0f144c6fdf47272c0168e0b7e95afb369f269c493c8c52531b74546eb
6
+ metadata.gz: 1c21dd2541a7775af6fe830050e1e4a494908f1e93b96e6eb9f900331de0156a1ca620cb770e6e9010b7fa3247436d7cb196fa53710b52241834a035b33b3f13
7
+ data.tar.gz: 2ac81fb3c47b9dbb2d285b0efb7259f97268b5756b03b85f39df6f55950e19295f298c158c05f857cf9235b23dd46503cd063afc07c32578f5d5e95ef25b255b
data/.gitignore CHANGED
@@ -10,3 +10,37 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ # Created by https://www.toptal.com/developers/gitignore/api/macos
15
+ # Edit at https://www.toptal.com/developers/gitignore?templates=macos
16
+
17
+ ### macOS ###
18
+ # General
19
+ .DS_Store
20
+ .AppleDouble
21
+ .LSOverride
22
+
23
+ # Icon must end with two \r
24
+ Icon
25
+
26
+
27
+ # Thumbnails
28
+ ._*
29
+
30
+ # Files that might appear in the root of a volume
31
+ .DocumentRevisions-V100
32
+ .fseventsd
33
+ .Spotlight-V100
34
+ .TemporaryItems
35
+ .Trashes
36
+ .VolumeIcon.icns
37
+ .com.apple.timemachine.donotpresent
38
+
39
+ # Directories potentially created on remote AFP share
40
+ .AppleDB
41
+ .AppleDesktop
42
+ Network Trash Folder
43
+ Temporary Items
44
+ .apdisk
45
+
46
+ # End of https://www.toptal.com/developers/gitignore/api/macos
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.0
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.14.6
4
+ - 2.7.0
5
+ before_install: gem install bundler -v 2.3.4
@@ -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
@@ -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
@@ -5,6 +5,7 @@ module Redbreast
5
5
  # Used to save swift files
6
6
  class Swift < Base
7
7
  include Helper::General
8
+ SPACER = " "
8
9
 
9
10
  def save(output_source_path:, template_generator:, generate_colors:)
10
11
  directory = File.dirname(output_source_path)
@@ -14,7 +15,7 @@ module Redbreast
14
15
  File.write(output_source_path, file)
15
16
  end
16
17
 
17
- def generate_file_swift(names:, spacing: "\t", indentation: '', variable:, bundle:)
18
+ def generate_file_swift(names:, spacing: SPACER, indentation: '', variable:, bundle:)
18
19
  return if names.empty?
19
20
 
20
21
  text = ''
@@ -22,25 +23,25 @@ module Redbreast
22
23
 
23
24
  vars, arr = generate_variables(names: names, spacing: spacing, indentation: indentation, variable: variable, bundle: bundle, text: text, array: arr)
24
25
 
25
- arr = arr.uniq
26
- #text += indentation.empty? && text.empty? ? "\n" : ''
26
+ arr = arr.uniq.sort_by(&:downcase)
27
+
27
28
  arr.each do |enum_name|
28
29
  names_new = []
29
30
  names_new_enum = []
30
31
  new_enum_name = enum_name
31
32
 
32
- text += "\n" + spacing + 'enum ' + enum_name + ' {'
33
+ text += "\n" + spacing + 'enum ' + upper_camel_case(enum_name) + ' {'
33
34
  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
 
35
36
  if !names_new_enum.empty? && new_enum_name == enum_name
36
37
  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
+ text += "\n" + generate_file_swift(names: names_new_enum, spacing: spacing + SPACER, indentation: indentation + enum_name, variable: variable, bundle: bundle)
38
39
  end
39
40
 
40
41
  unless names_new.empty?
41
42
 
42
43
  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
+ text += generate_file_swift(names: names_new, spacing: spacing + SPACER, indentation: indentation + enum_name, variable: variable, bundle: bundle)
44
45
  end
45
46
 
46
47
  text += "\n" + spacing + '}' + "\n"
@@ -49,11 +50,11 @@ module Redbreast
49
50
  end
50
51
 
51
52
  def generate_extension(extended_class, app_name)
52
- text = 'extension ' + extended_class + " {\n"
53
+ text = 'public extension ' + extended_class + " {\n"
53
54
 
54
55
  return text if app_name.nil? || app_name.empty?
55
56
 
56
- text + "\tenum " + app_name + " {}\n}\n\nextension " + extended_class + '.' + app_name + " {"
57
+ text + SPACER + "enum " + app_name + " {}\n}\n\npublic extension " + extended_class + '.' + app_name + " {"
57
58
  end
58
59
 
59
60
  def create_swift_test_cases(names:, declaration:, app_name:)
@@ -64,7 +65,8 @@ module Redbreast
64
65
  temp_array = name.split('/')
65
66
  variable = temp_array.pop
66
67
  additional_text = temp_array.count.zero? ? '' : '.'
67
- text += "\t\t" + declaration + app_name_text + temp_array.join('.') + additional_text + clean_variable_name(variable)
68
+
69
+ text += SPACER + SPACER + declaration + app_name_text + temp_array.map { |enum| upper_camel_case(enum) }.join('.') + additional_text + clean_variable_name(variable)
68
70
  text += name == names.last ? '' : "\n"
69
71
  end
70
72
 
@@ -72,7 +74,7 @@ module Redbreast
72
74
  end
73
75
 
74
76
  def generate_variables(names:, spacing:, indentation:, bundle:, variable:, text:, array:)
75
- names.each do |name|
77
+ names.sort_by(&:downcase).each do |name|
76
78
  temp_arr = name.split('/')
77
79
 
78
80
  if temp_arr.length != 1
@@ -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
- #text += indentation.empty? && text.empty? ? "\n" : ''
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
@@ -1,3 +1,3 @@
1
1
  module Redbreast
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.1'
3
3
  end
data/redbreast.gemspec CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.add_development_dependency 'bundler', '~> 1.14'
32
- spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'bundler', '~> 2.3'
32
+ spec.add_development_dependency 'rake', '~> 13.0'
33
33
  spec.add_development_dependency 'rspec', '~> 3.0'
34
34
  spec.add_development_dependency 'rubocop', '~> 0.77'
35
35
 
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.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maroje
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-22 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -130,10 +130,10 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - ".DS_Store"
134
133
  - ".gitignore"
135
134
  - ".rspec"
136
135
  - ".rubocop.yml"
136
+ - ".ruby-version"
137
137
  - ".travis.yml"
138
138
  - CODE_OF_CONDUCT.md
139
139
  - Gemfile
@@ -143,9 +143,7 @@ files:
143
143
  - bin/console
144
144
  - bin/setup
145
145
  - exe/redbreast
146
- - lib/.DS_Store
147
146
  - lib/redbreast.rb
148
- - lib/redbreast/.DS_Store
149
147
  - lib/redbreast/commands/color_generator.rb
150
148
  - lib/redbreast/commands/color_test_generator.rb
151
149
  - lib/redbreast/commands/configuration_installer.rb
@@ -163,7 +161,6 @@ files:
163
161
  - lib/redbreast/serializers/serializer.rb
164
162
  - lib/redbreast/serializers/swift_serializer.rb
165
163
  - lib/redbreast/serializers/swiftui_serializer.rb
166
- - lib/redbreast/template_generators/.DS_Store
167
164
  - lib/redbreast/template_generators/colors/objc_colors_template_generator.rb
168
165
  - lib/redbreast/template_generators/colors/swift_colors_template_generator.rb
169
166
  - lib/redbreast/template_generators/colors/swiftui_colors_template_generator.rb
@@ -201,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
198
  - !ruby/object:Gem::Version
202
199
  version: '0'
203
200
  requirements: []
204
- rubygems_version: 3.0.6
201
+ rubygems_version: 3.1.2
205
202
  signing_key:
206
203
  specification_version: 4
207
204
  summary: A CLI for safe and strongly typed resources
data/.DS_Store DELETED
Binary file
data/lib/.DS_Store DELETED
Binary file
Binary file