xcode-utils 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xcutils/uitest.rb +40 -28
- data/lib/xcutils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '078c1054432a4dfb2ccd967637b74aa4cbc2aabdb67c80d000361c2407987694'
|
4
|
+
data.tar.gz: 3bd681d4b310c1f961bb9f85263965c44e73185f41cfa2a24310d987b7babb90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654da996344614593d38fab2a17f90abd2e1a7342fcdf74b55aa1defbf2f7315005c7ea501d00a78cc12400d2a9eaa2992be3c924dff143de88332584359b211
|
7
|
+
data.tar.gz: 449501e3a2db25ede86c450c0437eec792893c4bf5a82ccd7595bb7f2a158a7f59aa1fdfab7b6af82dbe0ac04519bebe668698e197834df57df33cadde9e1341
|
data/lib/xcutils/uitest.rb
CHANGED
@@ -45,21 +45,24 @@ module XcodeUtils
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def run
|
48
|
-
puts "
|
48
|
+
puts "🤖 Run: project_name: #{@project_name}, target_config: #{@taget_config}, target_scheme: #{@target_scheme}".green
|
49
49
|
open_project
|
50
50
|
generate_project_configuration
|
51
|
-
|
52
|
-
|
51
|
+
generate_build_configurations
|
52
|
+
generate_scheme_files
|
53
53
|
copy_template_files
|
54
54
|
|
55
55
|
if !@project.nil?
|
56
|
+
puts "Save project".green
|
56
57
|
@project.save()
|
57
|
-
puts "
|
58
|
+
puts "🤩 Finished".green
|
59
|
+
else
|
60
|
+
puts "😡 Aborted".red
|
58
61
|
end
|
59
62
|
end
|
60
63
|
|
61
64
|
def open_project
|
62
|
-
puts "
|
65
|
+
puts "Open project #{@project_name}"
|
63
66
|
|
64
67
|
if !Dir.exist?(@project_path)
|
65
68
|
abort "😭 Abort to install. Project #{project_name} does not exist".red
|
@@ -73,7 +76,7 @@ module XcodeUtils
|
|
73
76
|
configuration_list = @project.root_object.build_configuration_list
|
74
77
|
|
75
78
|
if configuration_list.build_settings(@uitest_name) != nil
|
76
|
-
puts "
|
79
|
+
puts "\tSkip to generate project configuration for #{@uitest_name}. It is already installed in the project #{@project_name}".gray
|
77
80
|
return
|
78
81
|
end
|
79
82
|
|
@@ -83,7 +86,9 @@ module XcodeUtils
|
|
83
86
|
configuration_list.build_configurations << configuration
|
84
87
|
end
|
85
88
|
|
86
|
-
def
|
89
|
+
def generate_build_configurations
|
90
|
+
puts "Generating build configurations"
|
91
|
+
|
87
92
|
@project.targets.each { |target|
|
88
93
|
target_config = target.build_configurations.select { |e| e.name == @taget_config }.first
|
89
94
|
target_main_sb = nil
|
@@ -91,7 +96,7 @@ module XcodeUtils
|
|
91
96
|
target.build_configurations.each { |e|
|
92
97
|
break if e.name == @uitest_name
|
93
98
|
|
94
|
-
puts "
|
99
|
+
puts "\tConfigure build configuration #{e.name} in #{target.name}"
|
95
100
|
|
96
101
|
path = e.build_settings['INFOPLIST_FILE']
|
97
102
|
plist = Plist.parse_xml(path)
|
@@ -121,13 +126,13 @@ module XcodeUtils
|
|
121
126
|
test_config = target.build_configurations.select { |e| e.name == @uitest_name }.first
|
122
127
|
|
123
128
|
if test_config.nil?
|
124
|
-
puts "
|
129
|
+
puts "\tGenerating build configuration #{@uitest_name} into #{target.name}"
|
125
130
|
new_config = @project.new(Xcodeproj::Project::Object::XCBuildConfiguration)
|
126
131
|
new_config.name = @uitest_name
|
127
132
|
new_config.base_configuration_reference = target_config.base_configuration_reference
|
128
133
|
target.build_configurations << new_config
|
129
134
|
else
|
130
|
-
puts "
|
135
|
+
puts "\tConfigure build configuration #{@uitest_name} in #{target.name}"
|
131
136
|
new_config = test_config
|
132
137
|
end
|
133
138
|
|
@@ -137,40 +142,45 @@ module XcodeUtils
|
|
137
142
|
}
|
138
143
|
end
|
139
144
|
|
140
|
-
def
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
def generate_scheme_files
|
146
|
+
puts "Generating scheme files"
|
147
|
+
|
148
|
+
@project.targets.each { |target|
|
149
|
+
scheme_name = "#{target.name} #{@uitest_name}"
|
150
|
+
|
151
|
+
if File.exist?(scheme_path(scheme_name))
|
152
|
+
puts "\tSkip to generate. A scheme file is already exsit, #{scheme_name}".gray
|
153
|
+
next
|
154
|
+
end
|
155
|
+
|
156
|
+
puts "\tGenerating scheme file #{scheme_path(scheme_name)}"
|
149
157
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
158
|
+
FileUtils.copy_file(scheme_path(@target_scheme), scheme_path(scheme_name))
|
159
|
+
|
160
|
+
scheme = Xcodeproj::XCScheme.new(scheme_path(scheme_name))
|
161
|
+
scheme.launch_action.build_configuration = @uitest_name
|
162
|
+
scheme.save_as(@project_path, scheme_name)
|
163
|
+
}
|
155
164
|
end
|
156
165
|
|
157
166
|
def copy_template_files
|
158
|
-
puts "
|
159
|
-
|
167
|
+
puts "Copy template files"
|
168
|
+
|
160
169
|
@project.targets.each { |target|
|
161
170
|
template_path = "./#{target.name}/#{@uitest_name}"
|
162
171
|
|
163
172
|
if !Dir.exist?(template_path)
|
164
|
-
puts "
|
173
|
+
puts "\tCopying template files into target #{target.name}"
|
165
174
|
path = File.expand_path('../../../templates', __FILE__)
|
166
175
|
FileUtils.copy_entry path, "./#{target.name}"
|
167
176
|
else
|
168
|
-
puts "
|
177
|
+
puts "\tSkip to copy template files. Files are already exsit".gray
|
169
178
|
end
|
170
179
|
|
171
180
|
target_group = @project.groups.select { |e| e.path == target.name }.first
|
172
181
|
|
173
182
|
if target_group.groups.select { |e| e.path == @uitest_name }.first.nil?
|
183
|
+
puts "\tAdding references for files and resources into target #{target.name}"
|
174
184
|
template_group = target_group.new_group(nil, @uitest_name)
|
175
185
|
add_files("#{template_path}/*", template_group, target)
|
176
186
|
end
|
@@ -200,6 +210,8 @@ module XcodeUtils
|
|
200
210
|
if item.include? ".storyboard" or item.include? ".xib"
|
201
211
|
set_custom_module(item)
|
202
212
|
main_target.add_resources([i])
|
213
|
+
else
|
214
|
+
main_target.add_resources([i])
|
203
215
|
end
|
204
216
|
end
|
205
217
|
end
|
data/lib/xcutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcode-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|