redbreast 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.DS_Store +0 -0
- data/.rubocop.yml +5 -0
- data/README.md +102 -4
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/exe/redbreast +9 -7
- data/lib/.DS_Store +0 -0
- data/lib/redbreast.rb +25 -18
- data/lib/redbreast/.DS_Store +0 -0
- data/lib/redbreast/commands/color_generator.rb +54 -0
- data/lib/redbreast/commands/color_test_generator.rb +57 -0
- data/lib/redbreast/commands/configuration_installer.rb +29 -29
- data/lib/redbreast/commands/image_generator.rb +49 -47
- data/lib/redbreast/commands/image_test_generator.rb +57 -0
- data/lib/redbreast/commands/setup.rb +139 -92
- data/lib/redbreast/crawlers/color_crawler.rb +38 -0
- data/lib/redbreast/crawlers/image_crawler.rb +30 -10
- data/lib/redbreast/error_handler.rb +7 -6
- data/lib/redbreast/helpers/general.rb +73 -63
- data/lib/redbreast/helpers/hash.rb +8 -7
- data/lib/redbreast/helpers/terminal.rb +2 -3
- data/lib/redbreast/io/config.rb +14 -15
- data/lib/redbreast/serializers/objc_serializer.rb +66 -19
- data/lib/redbreast/serializers/serializer.rb +17 -16
- data/lib/redbreast/serializers/swift_serializer.rb +93 -2
- data/lib/redbreast/template_generators/.DS_Store +0 -0
- data/lib/redbreast/template_generators/colors/objc_colors_template_generator.rb +35 -0
- data/lib/redbreast/template_generators/colors/swift_colors_template_generator.rb +22 -0
- data/lib/redbreast/template_generators/images/objc_images_template_generator.rb +27 -41
- data/lib/redbreast/template_generators/images/swift_images_template_generator.rb +16 -21
- data/lib/redbreast/template_generators/objc_template_generator.rb +19 -19
- data/lib/redbreast/template_generators/swift_template_generator.rb +9 -10
- data/lib/redbreast/template_generators/tests/colors/objc_colors_tests_template_generator.rb +35 -0
- data/lib/redbreast/template_generators/tests/colors/swift_colors_tests_template_generator.rb +27 -0
- data/lib/redbreast/template_generators/tests/images/objc_images_tests_template_generator.rb +36 -0
- data/lib/redbreast/template_generators/tests/images/swift_images_tests_template_generator.rb +27 -0
- data/lib/redbreast/version.rb +1 -1
- data/redbreast.gemspec +21 -22
- metadata +35 -11
- data/lib/redbreast/commands/test_generator.rb +0 -56
- data/lib/redbreast/template_generators/tests/objc_tests_template_generator.rb +0 -39
- data/lib/redbreast/template_generators/tests/swift_tests_template_generator.rb +0 -31
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: 0.
|
4
|
+
version: 1.0.0
|
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: 2020-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,7 +53,21 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.77'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.77'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: tty-prompt
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -110,7 +124,7 @@ dependencies:
|
|
110
124
|
version: '0'
|
111
125
|
description:
|
112
126
|
email:
|
113
|
-
-
|
127
|
+
- maroje.marcelic@infinum.com
|
114
128
|
executables:
|
115
129
|
- redbreast
|
116
130
|
extensions: []
|
@@ -119,6 +133,7 @@ files:
|
|
119
133
|
- ".DS_Store"
|
120
134
|
- ".gitignore"
|
121
135
|
- ".rspec"
|
136
|
+
- ".rubocop.yml"
|
122
137
|
- ".travis.yml"
|
123
138
|
- CODE_OF_CONDUCT.md
|
124
139
|
- Gemfile
|
@@ -128,11 +143,16 @@ files:
|
|
128
143
|
- bin/console
|
129
144
|
- bin/setup
|
130
145
|
- exe/redbreast
|
146
|
+
- lib/.DS_Store
|
131
147
|
- lib/redbreast.rb
|
148
|
+
- lib/redbreast/.DS_Store
|
149
|
+
- lib/redbreast/commands/color_generator.rb
|
150
|
+
- lib/redbreast/commands/color_test_generator.rb
|
132
151
|
- lib/redbreast/commands/configuration_installer.rb
|
133
152
|
- lib/redbreast/commands/image_generator.rb
|
153
|
+
- lib/redbreast/commands/image_test_generator.rb
|
134
154
|
- lib/redbreast/commands/setup.rb
|
135
|
-
- lib/redbreast/
|
155
|
+
- lib/redbreast/crawlers/color_crawler.rb
|
136
156
|
- lib/redbreast/crawlers/image_crawler.rb
|
137
157
|
- lib/redbreast/error_handler.rb
|
138
158
|
- lib/redbreast/helpers/general.rb
|
@@ -142,12 +162,17 @@ files:
|
|
142
162
|
- lib/redbreast/serializers/objc_serializer.rb
|
143
163
|
- lib/redbreast/serializers/serializer.rb
|
144
164
|
- lib/redbreast/serializers/swift_serializer.rb
|
165
|
+
- lib/redbreast/template_generators/.DS_Store
|
166
|
+
- lib/redbreast/template_generators/colors/objc_colors_template_generator.rb
|
167
|
+
- lib/redbreast/template_generators/colors/swift_colors_template_generator.rb
|
145
168
|
- lib/redbreast/template_generators/images/objc_images_template_generator.rb
|
146
169
|
- lib/redbreast/template_generators/images/swift_images_template_generator.rb
|
147
170
|
- lib/redbreast/template_generators/objc_template_generator.rb
|
148
171
|
- lib/redbreast/template_generators/swift_template_generator.rb
|
149
|
-
- lib/redbreast/template_generators/tests/
|
150
|
-
- lib/redbreast/template_generators/tests/
|
172
|
+
- lib/redbreast/template_generators/tests/colors/objc_colors_tests_template_generator.rb
|
173
|
+
- lib/redbreast/template_generators/tests/colors/swift_colors_tests_template_generator.rb
|
174
|
+
- lib/redbreast/template_generators/tests/images/objc_images_tests_template_generator.rb
|
175
|
+
- lib/redbreast/template_generators/tests/images/swift_images_tests_template_generator.rb
|
151
176
|
- lib/redbreast/version.rb
|
152
177
|
- redbreast.gemspec
|
153
178
|
homepage: https://github.com/infinum/redbreast
|
@@ -170,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
195
|
- !ruby/object:Gem::Version
|
171
196
|
version: '0'
|
172
197
|
requirements: []
|
173
|
-
|
174
|
-
rubygems_version: 2.6.11
|
198
|
+
rubygems_version: 3.0.6
|
175
199
|
signing_key:
|
176
200
|
specification_version: 4
|
177
201
|
summary: A CLI for safe and strongly typed resources
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Redbreast
|
2
|
-
module Command
|
3
|
-
class TestGenerator
|
4
|
-
include Helper::Terminal
|
5
|
-
include Helper::General
|
6
|
-
|
7
|
-
def self.init
|
8
|
-
new.call
|
9
|
-
end
|
10
|
-
|
11
|
-
def call
|
12
|
-
filtered_bundles = bundles.select { |bundle| bundle[:outputTestPath] }
|
13
|
-
return if filtered_bundles.empty?
|
14
|
-
|
15
|
-
prompt.say("Generating test resources...")
|
16
|
-
generate_test_sources(bundles, programming_language)
|
17
|
-
success("Test resources generated!")
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def generate_test_sources(bundles, programming_language)
|
23
|
-
bundles.each do |bundle|
|
24
|
-
image_names = pull_asset_names(bundle[:assetsSearchPath])
|
25
|
-
|
26
|
-
write_tests(image_names, bundle, programming_language)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Serializing data
|
31
|
-
|
32
|
-
def write_tests(image_names, bundle, programming_language)
|
33
|
-
output_path = bundle[:outputTestPath]
|
34
|
-
return if output_path.to_s.empty?
|
35
|
-
case programming_language.downcase
|
36
|
-
when "objc"
|
37
|
-
serializer = Redbreast::Serializer::ObjC
|
38
|
-
template_generator = Redbreast::TemplateGenerator::Test::ObjC
|
39
|
-
when "swift"
|
40
|
-
serializer = Redbreast::Serializer::Swift
|
41
|
-
template_generator = Redbreast::TemplateGenerator::Test::Swift
|
42
|
-
end
|
43
|
-
serializer.new(image_names, bundle).save(output_path, template_generator.new)
|
44
|
-
end
|
45
|
-
|
46
|
-
# Pulling data
|
47
|
-
|
48
|
-
def pull_asset_names(assetsSearchPath)
|
49
|
-
Redbreast::Crawler::Image
|
50
|
-
.image_names_uniq(assetsSearchPath)
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require_relative '../objc_template_generator'
|
2
|
-
|
3
|
-
module Redbreast
|
4
|
-
module TemplateGenerator
|
5
|
-
module Test
|
6
|
-
class ObjC < TemplateGenerator::ObjC
|
7
|
-
include ERB::Util
|
8
|
-
|
9
|
-
def h_template()
|
10
|
-
nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def m_template()
|
14
|
-
<<-TEMPLATE
|
15
|
-
|
16
|
-
#import <XCTest/XCTest.h>
|
17
|
-
#import <"UIImage+<%= File.basename(bundle[:outputSourcePath]) %>.h">
|
18
|
-
|
19
|
-
@interface <%= File.basename(bundle[:outputTestPath]) %> : XCTestCase
|
20
|
-
|
21
|
-
@end
|
22
|
-
|
23
|
-
@implementation Test
|
24
|
-
|
25
|
-
- (void)testExample {
|
26
|
-
<%- image_names.each do |name| -%>
|
27
|
-
[UIImage clean_variable_name(name)];
|
28
|
-
<%- end -%>
|
29
|
-
}
|
30
|
-
|
31
|
-
@end
|
32
|
-
|
33
|
-
TEMPLATE
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative '../swift_template_generator'
|
2
|
-
|
3
|
-
module Redbreast
|
4
|
-
module TemplateGenerator
|
5
|
-
module Test
|
6
|
-
class Swift < TemplateGenerator::Swift
|
7
|
-
include ERB::Util
|
8
|
-
|
9
|
-
def template()
|
10
|
-
<<-TEMPLATE
|
11
|
-
|
12
|
-
import UIKit
|
13
|
-
@testable import <%= bundle[:testableImport] %>
|
14
|
-
|
15
|
-
//THIS FILE IS AUTOGENERATED, DO NOT EDIT BY HAND
|
16
|
-
class <%= File.basename(bundle[:outputTestPath], ".*") %>: XCTestCase {
|
17
|
-
|
18
|
-
func testIfImagesArePresent() {
|
19
|
-
<%- image_names.each do |name| -%>
|
20
|
-
_ = UIImage.<%= clean_variable_name(name) %>
|
21
|
-
<%- end -%>
|
22
|
-
}
|
23
|
-
|
24
|
-
}
|
25
|
-
|
26
|
-
TEMPLATE
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|