jenkinsutil 1.0.49 → 1.0.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -3
- data/JenkinsUtil.gemspec +2 -2
- data/bin/console +3 -3
- data/exe/jenkinsutil +1 -1
- data/lib/jenkins_util.rb +62 -0
- data/lib/{JenkinsUtil → jenkins_util}/argument_handler.rb +2 -1
- data/lib/{JenkinsUtil → jenkins_util}/command_line_script.rb +2 -2
- data/lib/{JenkinsUtil → jenkins_util}/dropbox_util.rb +2 -2
- data/lib/{JenkinsUtil → jenkins_util}/keychain_util.rb +2 -2
- data/lib/{JenkinsUtil → jenkins_util}/logger_util.rb +0 -0
- data/lib/{JenkinsUtil → jenkins_util}/process_util.rb +1 -1
- data/lib/{JenkinsUtil → jenkins_util}/simulator_util.rb +11 -13
- data/lib/{JenkinsUtil → jenkins_util}/version.rb +0 -0
- data/lib/jenkins_util/xcode_util.rb +99 -0
- data/lib/{JenkinsUtil → jenkins_util}/zip_util.rb +3 -3
- metadata +15 -15
- data/lib/JenkinsUtil.rb +0 -61
- data/lib/JenkinsUtil/xcode_util.rb +0 -129
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc0b38fe9c80af260a2a8e7f139e7d190d961788
|
4
|
+
data.tar.gz: 038252b911e73ea0dfc4be722ba66374298641f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d02b30780a0427c6fda5c34322864a17a6434ae3a9dd67d7656bfe5579efdde1b0f910a1079cf8694b2ebc723765d9f300c7842dd9b5f5d0ab8e4c9a1d4d2878
|
7
|
+
data.tar.gz: 9739239a0bbc7b9d05a94d95f75f6ed04988fcc0ef3c3122ff83bd21cf08b32292af5339f17842e4123724784da0503b7c1f2c10f78621ce24c602778868075a
|
data/.rubocop_todo.yml
CHANGED
data/JenkinsUtil.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'jenkins_util/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'jenkinsutil'
|
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'ci_reporter_test_unit', '~> 1.0'
|
34
34
|
spec.add_development_dependency 'simplecov', '~> 0.11'
|
35
35
|
spec.add_development_dependency 'simplecov-cobertura', '~> 1.1'
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.45'
|
37
37
|
end
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'jenkins_util'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "JenkinsUtil"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/exe/jenkinsutil
CHANGED
data/lib/jenkins_util.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'jenkins_util/version'
|
2
|
+
require 'jenkins_util/command_line_script'
|
3
|
+
require 'jenkins_util/keychain_util'
|
4
|
+
require 'jenkins_util/simulator_util'
|
5
|
+
require 'jenkins_util/xcode_util'
|
6
|
+
require 'jenkins_util/argument_handler'
|
7
|
+
require 'jenkins_util/logger_util'
|
8
|
+
require 'jenkins_util/process_util'
|
9
|
+
require 'jenkins_util/dropbox_util'
|
10
|
+
require 'jenkins_util/zip_util'
|
11
|
+
|
12
|
+
module JenkinsUtil
|
13
|
+
include LoggerUtil
|
14
|
+
|
15
|
+
args = ArgumentHandler.new
|
16
|
+
|
17
|
+
LoggerUtil.verbose?(args.verbose)
|
18
|
+
|
19
|
+
# KeychainUtil
|
20
|
+
unless args.keychain.nil? && args.keychain_password.nil?
|
21
|
+
KeychainUtil.unlock_keychain(args.keychain, args.keychain_password, args.code_signing_identities)
|
22
|
+
end
|
23
|
+
|
24
|
+
# DropboxUtil
|
25
|
+
unless args.dropbox_sources.nil? || args.dropbox_sources.empty? || args.dropbox_destination.nil?
|
26
|
+
DropboxUtil.upload(args.dropbox_sources, args.dropbox_destination, args.dropbox_flatten, args.dropbox_root)
|
27
|
+
end
|
28
|
+
|
29
|
+
# XcodeUtil
|
30
|
+
SimulatorUtil.reset_all_simulators if args.kill_simulators
|
31
|
+
|
32
|
+
if !args.xcode_project_path.nil? && !args.xcode_target.nil? && !args.xcode_build_configuration.nil?
|
33
|
+
unless args.xcode_bundle_identifier.nil?
|
34
|
+
XcodeUtil.set_project_bundle_identifier(args.xcode_project_path,
|
35
|
+
args.xcode_target,
|
36
|
+
args.xcode_build_configuration,
|
37
|
+
args.xcode_bundle_identifier)
|
38
|
+
end
|
39
|
+
|
40
|
+
unless args.xcode_bundle_version.nil?
|
41
|
+
XcodeUtil.set_project_bundle_version(args.xcode_project_path,
|
42
|
+
args.xcode_target,
|
43
|
+
args.xcode_build_configuration,
|
44
|
+
args.xcode_bundle_version)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Not using LoggerUtil so there is no time stamp
|
49
|
+
puts XcodeUtil.team_id_from_plist(args.xcode_export_plist) if !args.xcode_export_plist.nil? && !args.xcode_team_id.nil?
|
50
|
+
|
51
|
+
if !args.xcode_project_path.nil? && !args.xcode_set_manual_provisioning_style.nil?
|
52
|
+
XcodeUtil.set_project_provisioning_style(args.xcode_project_path, !args.xcode_set_manual_provisioning_style)
|
53
|
+
end
|
54
|
+
|
55
|
+
if (!args.zip_sources.empty? || !args.zip_archive.nil?) && !args.zip_destination.nil?
|
56
|
+
ZipUtil.compress(*args.zip_sources, args.zip_destination) unless args.zip_sources.empty?
|
57
|
+
ZipUtil.uncompress(args.zip_archive, args.zip_destination) unless args.zip_archive.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
# Version
|
61
|
+
LoggerUtil.log.info(VERSION) if args.version
|
62
|
+
end
|
@@ -53,8 +53,9 @@ class ArgumentHandler
|
|
53
53
|
|
54
54
|
ARGV.push('-h') if ARGV.empty?
|
55
55
|
|
56
|
+
# rubocop:disable Metrics/BlockLength
|
56
57
|
parser = OptionParser.new do |opts|
|
57
|
-
opts.banner = 'Usage:
|
58
|
+
opts.banner = 'Usage: jenkins_util'
|
58
59
|
|
59
60
|
# keychain_util
|
60
61
|
opts.on('-k', '--keychain [KEYCHAIN_PATH]', 'Path to Keychain to be unlocked') do |keychain|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'open4'
|
2
|
-
require '
|
2
|
+
require 'jenkins_util/logger_util'
|
3
3
|
|
4
4
|
class CommandLineScript
|
5
5
|
include LoggerUtil
|
@@ -10,7 +10,7 @@ class CommandLineScript
|
|
10
10
|
@command = command
|
11
11
|
|
12
12
|
LoggerUtil.log.debug("Executing: \"#{@command}\"")
|
13
|
-
status = Open4
|
13
|
+
status = Open4.popen4(@command) do |pid, stdin, stdout, stderr|
|
14
14
|
@pid = pid
|
15
15
|
@stdin = stdin
|
16
16
|
@stdout = stdout.readlines
|
File without changes
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
1
|
+
require 'jenkins_util/process_util'
|
2
|
+
require 'jenkins_util/command_line_script'
|
3
|
+
require 'jenkins_util/logger_util'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
class SimulatorError
|
6
|
+
class SimulatorError
|
7
7
|
attr_reader :code, :message, :udid
|
8
8
|
|
9
9
|
def initialize(code, message, udid)
|
@@ -62,25 +62,23 @@ class SimulatorUtil
|
|
62
62
|
def self.boot_device(udid)
|
63
63
|
process = CommandLineScript.new("xcrun simctl boot #{udid}")
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
end
|
65
|
+
LoggerUtil.fatal("Could not boot up device: #{udid}") if process.exit_status.nonzero? &&
|
66
|
+
process.exit_status != DEVICE_STATE_INVALID
|
68
67
|
end
|
69
68
|
|
70
69
|
def self.shutdown_device(udid)
|
71
70
|
process = CommandLineScript.new("xcrun simctl shutdown #{udid}")
|
72
71
|
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
LoggerUtil.fatal("Could not shutdown device: #{udid}") if process.exit_status.nonzero? &&
|
73
|
+
process.exit_status != DEVICE_STATE_INVALID &&
|
74
|
+
process.exit_status != DEVICE_ALREADY_SHUTDOWN
|
76
75
|
end
|
77
76
|
|
78
77
|
def self.reset_device(udid)
|
79
78
|
process = CommandLineScript.new("xcrun simctl erase #{udid}")
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
end
|
80
|
+
LoggerUtil.fatal("Could not reset device: #{udid}") if process.exit_status.nonzero? &&
|
81
|
+
process.exit_status != DEVICE_STATE_INVALID
|
84
82
|
end
|
85
83
|
|
86
84
|
def self.reset_all_simulators
|
File without changes
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'jenkins_util/process_util'
|
2
|
+
require 'jenkins_util/command_line_script'
|
3
|
+
require 'jenkins_util/logger_util'
|
4
|
+
require 'xcodeproj'
|
5
|
+
require 'plist'
|
6
|
+
|
7
|
+
class XcodeUtil
|
8
|
+
def initialize
|
9
|
+
@xcodebuild_version_major = nil
|
10
|
+
|
11
|
+
@default_xcodebuild_path = '/usr/bin/xcodebuild'
|
12
|
+
@ios_simulator_process_name = 'Simulator'
|
13
|
+
|
14
|
+
# xcodebuild flags
|
15
|
+
@xcodebuild_version_flag = '-version'
|
16
|
+
|
17
|
+
unless File.exist?(@default_xcodebuild_path)
|
18
|
+
LoggerUtil.fatal("xcodebuild not found: #{@default_xcodebuild_path}")
|
19
|
+
abort
|
20
|
+
end
|
21
|
+
|
22
|
+
version
|
23
|
+
end
|
24
|
+
|
25
|
+
def kill_ios_simulator
|
26
|
+
ProcessUtil.kill_all_processes(@ios_simulator_process_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def version
|
30
|
+
xcode_process = CommandLineScript.new("#{@default_xcodebuild_path} #{@xcodebuild_version_flag}")
|
31
|
+
puts xcode_process.get_output
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.with_project_build_configuration(project_path, target_name, build_configuration_name)
|
35
|
+
project = Xcodeproj::Project.open(project_path)
|
36
|
+
targets = project.native_targets
|
37
|
+
targets.each do |target|
|
38
|
+
next if target.name != target_name
|
39
|
+
|
40
|
+
target.build_configuration_list.build_configurations.each do |build_configuration|
|
41
|
+
next if build_configuration.name != build_configuration_name
|
42
|
+
|
43
|
+
yield project, build_configuration
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.project_bundle_version(project_path, target_name, build_configuration_name, bundle_version = nil)
|
49
|
+
with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
50
|
+
infoplist_file = build_configuration.build_settings['INFOPLIST_FILE']
|
51
|
+
infoplist_path = File.join(File.dirname(project.path), infoplist_file)
|
52
|
+
|
53
|
+
infoplist = Xcodeproj::Plist.read_from_path(infoplist_path)
|
54
|
+
return infoplist['CFBundleVersion'] if bundle_version.nil?
|
55
|
+
|
56
|
+
infoplist['CFBundleVersion'] = bundle_version
|
57
|
+
Xcodeproj::Plist.write_to_path(infoplist, infoplist_path)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.project_bundle_identifier(project_path, target_name, build_configuration_name, bundle_identifier = nil)
|
62
|
+
with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
63
|
+
return build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] if bundle_identifier.nil?
|
64
|
+
|
65
|
+
build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_identifier
|
66
|
+
project.save
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.project_provisioning_style(project_path, is_automatic = nil)
|
71
|
+
project = Xcodeproj::Project.open(project_path)
|
72
|
+
|
73
|
+
project.root_object.attributes['TargetAttributes'].values.each do |target_value|
|
74
|
+
target_value.each do |attribute_key, attribute_value|
|
75
|
+
if is_automatic.nil?
|
76
|
+
return attribute_value if attribute_key == 'ProvisioningStyle'
|
77
|
+
else
|
78
|
+
next unless attribute_key == 'ProvisioningStyle'
|
79
|
+
target_value[attribute_key] = if is_automatic == true
|
80
|
+
'Automatic'
|
81
|
+
else
|
82
|
+
'Manual'
|
83
|
+
end
|
84
|
+
return project.save
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
LoggerUtil.fatal("'ProvisioningStyle' key not found, please check and uncheck automatic signing")
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.team_id_from_plist(plist_file)
|
93
|
+
plist_path = File.expand_path(plist_file)
|
94
|
+
plist = Plist.parse_xml(plist_path)
|
95
|
+
LoggerUtil.fatal("teamID not found in #{plist_file}") if plist.nil? || !plist.key?('teamID')
|
96
|
+
|
97
|
+
plist['teamID']
|
98
|
+
end
|
99
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'jenkins_util/command_line_script'
|
2
|
+
require 'jenkins_util/logger_util'
|
3
3
|
require 'zip'
|
4
4
|
|
5
|
-
class ZipError <
|
5
|
+
class ZipError < RuntimeError
|
6
6
|
attr_reader :code, :message
|
7
7
|
|
8
8
|
def initialize(code, message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkinsutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett McGinnis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open4
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0.
|
201
|
+
version: '0.45'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0.
|
208
|
+
version: '0.45'
|
209
209
|
description:
|
210
210
|
email:
|
211
211
|
- Brett@L4Digital.com
|
@@ -228,17 +228,17 @@ files:
|
|
228
228
|
- bin/console
|
229
229
|
- bin/setup
|
230
230
|
- exe/jenkinsutil
|
231
|
-
- lib/
|
232
|
-
- lib/
|
233
|
-
- lib/
|
234
|
-
- lib/
|
235
|
-
- lib/
|
236
|
-
- lib/
|
237
|
-
- lib/
|
238
|
-
- lib/
|
239
|
-
- lib/
|
240
|
-
- lib/
|
241
|
-
- lib/
|
231
|
+
- lib/jenkins_util.rb
|
232
|
+
- lib/jenkins_util/argument_handler.rb
|
233
|
+
- lib/jenkins_util/command_line_script.rb
|
234
|
+
- lib/jenkins_util/dropbox_util.rb
|
235
|
+
- lib/jenkins_util/keychain_util.rb
|
236
|
+
- lib/jenkins_util/logger_util.rb
|
237
|
+
- lib/jenkins_util/process_util.rb
|
238
|
+
- lib/jenkins_util/simulator_util.rb
|
239
|
+
- lib/jenkins_util/version.rb
|
240
|
+
- lib/jenkins_util/xcode_util.rb
|
241
|
+
- lib/jenkins_util/zip_util.rb
|
242
242
|
homepage: http://www.l4digital.com/
|
243
243
|
licenses:
|
244
244
|
- MIT
|
data/lib/JenkinsUtil.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'JenkinsUtil/version'
|
2
|
-
require 'JenkinsUtil/command_line_script'
|
3
|
-
require 'JenkinsUtil/keychain_util'
|
4
|
-
require 'JenkinsUtil/simulator_util'
|
5
|
-
require 'JenkinsUtil/xcode_util'
|
6
|
-
require 'JenkinsUtil/argument_handler'
|
7
|
-
require 'JenkinsUtil/logger_util'
|
8
|
-
require 'JenkinsUtil/process_util'
|
9
|
-
require 'JenkinsUtil/dropbox_util'
|
10
|
-
require 'JenkinsUtil/zip_util'
|
11
|
-
|
12
|
-
module JenkinsUtil
|
13
|
-
include LoggerUtil
|
14
|
-
|
15
|
-
args = ArgumentHandler.new
|
16
|
-
|
17
|
-
LoggerUtil.verbose?(args.verbose)
|
18
|
-
|
19
|
-
# KeychainUtil
|
20
|
-
unless args.keychain.nil? && args.keychain_password.nil?
|
21
|
-
KeychainUtil.unlock_keychain(args.keychain, args.keychain_password, args.code_signing_identities)
|
22
|
-
end
|
23
|
-
|
24
|
-
# DropboxUtil
|
25
|
-
unless args.dropbox_sources.nil? || args.dropbox_sources.empty? || args.dropbox_destination.nil?
|
26
|
-
DropboxUtil.upload(args.dropbox_sources, args.dropbox_destination, args.dropbox_flatten, args.dropbox_root)
|
27
|
-
end
|
28
|
-
|
29
|
-
# XcodeUtil
|
30
|
-
if args.kill_simulators
|
31
|
-
SimulatorUtil.reset_all_simulators
|
32
|
-
end
|
33
|
-
|
34
|
-
if !args.xcode_project_path.nil? && !args.xcode_target.nil? && !args.xcode_build_configuration.nil?
|
35
|
-
if !args.xcode_bundle_identifier.nil?
|
36
|
-
XcodeUtil.set_project_bundle_identifier(args.xcode_project_path, args.xcode_target, args.xcode_build_configuration, args.xcode_bundle_identifier)
|
37
|
-
end
|
38
|
-
|
39
|
-
if !args.xcode_bundle_version.nil?
|
40
|
-
XcodeUtil.set_project_bundle_version(args.xcode_project_path, args.xcode_target, args.xcode_build_configuration, args.xcode_bundle_version)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Not using LoggerUtil so there is no time stamp
|
45
|
-
puts XcodeUtil.team_id_from_plist(args.xcode_export_plist) if !args.xcode_export_plist.nil? && !args.xcode_team_id.nil?
|
46
|
-
|
47
|
-
XcodeUtil.set_project_provisioning_style(args.xcode_project_path, !args.xcode_set_manual_provisioning_style) if !args.xcode_project_path.nil? && !args.xcode_set_manual_provisioning_style.nil?
|
48
|
-
|
49
|
-
if (!args.zip_sources.empty? || !args.zip_archive.nil?) && !args.zip_destination.nil?
|
50
|
-
if !args.zip_sources.empty?
|
51
|
-
ZipUtil.compress(*args.zip_sources, args.zip_destination)
|
52
|
-
end
|
53
|
-
|
54
|
-
if !args.zip_archive.nil?
|
55
|
-
ZipUtil.uncompress(args.zip_archive, args.zip_destination)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Version
|
60
|
-
LoggerUtil.log.info(VERSION) if args.version
|
61
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
require 'JenkinsUtil/process_util'
|
2
|
-
require 'JenkinsUtil/command_line_script'
|
3
|
-
require 'JenkinsUtil/logger_util'
|
4
|
-
require 'xcodeproj'
|
5
|
-
require 'plist'
|
6
|
-
|
7
|
-
class XcodeUtil
|
8
|
-
def initialize
|
9
|
-
@xcodebuild_version_major = nil
|
10
|
-
|
11
|
-
@default_xcodebuild_path = '/usr/bin/xcodebuild'
|
12
|
-
@ios_simulator_process_name = 'Simulator'
|
13
|
-
|
14
|
-
#xcodebuild flags
|
15
|
-
@xcodebuild_version_flag = '-version'
|
16
|
-
|
17
|
-
unless File.exist?(@default_xcodebuild_path)
|
18
|
-
LoggerUtil.fatal("xcodebuild not found: #{@default_xcodebuild_path}")
|
19
|
-
abort
|
20
|
-
end
|
21
|
-
|
22
|
-
get_version
|
23
|
-
end
|
24
|
-
|
25
|
-
def kill_ios_simulator
|
26
|
-
ProcessUtil.kill_all_processes(@ios_simulator_process_name)
|
27
|
-
end
|
28
|
-
|
29
|
-
def get_version
|
30
|
-
xcode_process = CommandLineScript.new("#{@default_xcodebuild_path} #{@xcodebuild_version_flag}")
|
31
|
-
@xcodebuild_version_major
|
32
|
-
puts xcode_process.get_output
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.with_project_build_configuration(project_path, target_name, build_configuration_name)
|
36
|
-
project = Xcodeproj::Project.open(project_path)
|
37
|
-
targets = project.native_targets
|
38
|
-
targets.each do |target|
|
39
|
-
if target.name != target_name
|
40
|
-
next
|
41
|
-
end
|
42
|
-
|
43
|
-
target.build_configuration_list.build_configurations.each do |build_configuration|
|
44
|
-
if build_configuration.name != build_configuration_name
|
45
|
-
next
|
46
|
-
end
|
47
|
-
|
48
|
-
yield project, build_configuration
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.get_project_bundle_version(project_path, target_name, build_configuration_name)
|
54
|
-
self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
55
|
-
infoplist_file = build_configuration.build_settings['INFOPLIST_FILE']
|
56
|
-
infoplist_path = File.join(File.dirname(project.path), infoplist_file)
|
57
|
-
|
58
|
-
infoplist = Xcodeproj::Plist.read_from_path(infoplist_path)
|
59
|
-
return infoplist['CFBundleVersion']
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.set_project_bundle_version(project_path, target_name, build_configuration_name, bundle_version)
|
64
|
-
self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
65
|
-
infoplist_file = build_configuration.build_settings['INFOPLIST_FILE']
|
66
|
-
infoplist_path = File.join(File.dirname(project.path), infoplist_file)
|
67
|
-
|
68
|
-
infoplist = Xcodeproj::Plist.read_from_path(infoplist_path)
|
69
|
-
infoplist['CFBundleVersion'] = bundle_version
|
70
|
-
Xcodeproj::Plist.write_to_path(infoplist, infoplist_path)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.get_project_bundle_identifier(project_path, target_name, build_configuration_name)
|
75
|
-
self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
76
|
-
return build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def self.set_project_bundle_identifier(project_path, target_name, build_configuration_name, bundle_identifier)
|
81
|
-
self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
|
82
|
-
build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_identifier
|
83
|
-
project.save
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.get_project_provisioning_style(project_path)
|
88
|
-
project = Xcodeproj::Project.open(project_path)
|
89
|
-
|
90
|
-
project.root_object.attributes['TargetAttributes'].values.each do |target_value|
|
91
|
-
target_value.each do |attribute_key, attribute_value|
|
92
|
-
if attribute_key == 'ProvisioningStyle'
|
93
|
-
return attribute_value
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
LoggerUtil.fatal("'ProvisioningStyle' key not found, please check and uncheck automatic signing")
|
99
|
-
end
|
100
|
-
|
101
|
-
def self.set_project_provisioning_style(project_path, is_automatic)
|
102
|
-
project = Xcodeproj::Project.open(project_path)
|
103
|
-
|
104
|
-
project.root_object.attributes['TargetAttributes'].values.each do |target_value|
|
105
|
-
target_value.keys.each do |attribute_key|
|
106
|
-
if attribute_key == 'ProvisioningStyle'
|
107
|
-
if is_automatic == true
|
108
|
-
target_value[attribute_key] = 'Automatic'
|
109
|
-
else
|
110
|
-
target_value[attribute_key] = 'Manual'
|
111
|
-
end
|
112
|
-
|
113
|
-
project.save
|
114
|
-
return
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
LoggerUtil.fatal("'ProvisioningStyle' key not found, please check and uncheck automatic signing")
|
120
|
-
end
|
121
|
-
|
122
|
-
def self.team_id_from_plist(plist_file)
|
123
|
-
plist_path = File.expand_path(plist_file)
|
124
|
-
plist = Plist::parse_xml(plist_path)
|
125
|
-
LoggerUtil.fatal("teamID not found in #{plist_file}") if plist.nil? || !plist.key?('teamID')
|
126
|
-
|
127
|
-
return plist['teamID']
|
128
|
-
end
|
129
|
-
end
|