xcode-utils 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae6a88462f11625079d48f69db98fc5300fbdf733598fa2b2bfef97946d628e2
4
- data.tar.gz: cf5857085391c9b590ea301f5bb63d9e9feeed83f35d99c40d0c32ca7f058dc8
3
+ metadata.gz: '078c1054432a4dfb2ccd967637b74aa4cbc2aabdb67c80d000361c2407987694'
4
+ data.tar.gz: 3bd681d4b310c1f961bb9f85263965c44e73185f41cfa2a24310d987b7babb90
5
5
  SHA512:
6
- metadata.gz: 804232e58a8061b39d83f1db06a7afa9d8b73ce0d576d8991e45c7f3abd8fb9df9e75661425f5358907dc95f5d34e88b52bfe6eae8810db5508c1f28c144f3da
7
- data.tar.gz: b268b7a14c2d79eb96fd923e91bf1888b241c1d706b023397b66452b92a0d65be4a10cdfda36785f32a67a13b0a5ccdf1a799664ca1bf8f21cae578e1ccb5472
6
+ metadata.gz: 654da996344614593d38fab2a17f90abd2e1a7342fcdf74b55aa1defbf2f7315005c7ea501d00a78cc12400d2a9eaa2992be3c924dff143de88332584359b211
7
+ data.tar.gz: 449501e3a2db25ede86c450c0437eec792893c4bf5a82ccd7595bb7f2a158a7f59aa1fdfab7b6af82dbe0ac04519bebe668698e197834df57df33cadde9e1341
@@ -45,21 +45,24 @@ module XcodeUtils
45
45
  end
46
46
 
47
47
  def run
48
- puts "Input: project_name: #{@project_name}, target_config: #{@taget_config}, target_scheme: #{@target_scheme}"
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
- generate_build_configuration
52
- generate_scheme_file
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 "🦾 Installing Completed".green
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 "🤖 Installing #{@uitest_name} into #{@project_name}".green
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 "Skip to generate project configuration for #{@uitest_name}. It is already installed in the project #{@project_name}".gray
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 generate_build_configuration
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 "Configure build configuration #{e.name} in #{target.name}"
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 "Generating build configuration #{@uitest_name} into #{target.name}"
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 "Configure build configuration #{@uitest_name} in #{target.name}"
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 generate_scheme_file
141
- scheme_name = "#{@project_name} #{@uitest_name}"
142
-
143
- if File.exist?(scheme_path(scheme_name))
144
- puts "Skip to generate. A scheme file is already exsit, #{scheme_name}".gray
145
- return
146
- end
147
-
148
- puts "Generating scheme file #{scheme_path(scheme_name)}"
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
- FileUtils.copy_file(scheme_path(@target_scheme), scheme_path(scheme_name))
151
-
152
- scheme = Xcodeproj::XCScheme.new(scheme_path(scheme_name))
153
- scheme.launch_action.build_configuration = @uitest_name
154
- scheme.save_as(@project_path, scheme_name)
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 "Adding references for files and resources into project #{@project_name}"
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 "Copying template files into target #{target.name}"
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 "Skip to copy template files. Files are already exsit".gray
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
@@ -1,3 +1,3 @@
1
1
  module XcodeUtils
2
- VERSION = '1.0.5'.freeze
2
+ VERSION = '1.0.6'.freeze
3
3
  end
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.5
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-20 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide