jenkinsutil 0.8.43 → 0.8.44

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
  SHA1:
3
- metadata.gz: 1d639001cf5305c5de2bb785644817f08a4d1649
4
- data.tar.gz: 40045c782ac9d76ec2211401cfa2d37a7230a963
3
+ metadata.gz: 96e02492550beae8d073d2ea124d135f2918df1a
4
+ data.tar.gz: 62b3e44e43440c42c3ddc8e14f7f25fc5b4ced65
5
5
  SHA512:
6
- metadata.gz: 02e3eb78a0af9dba36f935065abf4f8da9d3b49dcbb67094c6c11410fa64fabec372713a483e53c417ff7bec49737492b4b591ef9bedf9cbce9c55efb73ccab8
7
- data.tar.gz: 7fb17e11d29a776df774ec2505c1d6f0fcc1f4687b0d7c607f5ba3c3ed89341425b232b2cee93cd3821bc3c958cf9f9e0fc980a6b5f06937f3b66a49ada61604
6
+ metadata.gz: aad957c7472f8699e933c3a61c0dbff0de4dc508606950a47bc2bc1ba5a0849019019362c7dc2f23b4dd3d15a9f058b5d9aa4de528b421ec175501baf10cff33
7
+ data.tar.gz: 55ad3a4c63224836fbdabfc33eab1894fde9a34e19ef9f310a26b94e12be1b5eefbd731f8527f132b71032ea9cb39958ea913dce1f83cc3c3f393669f93103a1
data/.gitignore CHANGED
@@ -12,3 +12,21 @@
12
12
  /test/raw/
13
13
  .idea/.rakeTasks
14
14
  .idea/workspace.xml
15
+
16
+ build/
17
+ *.pbxuser
18
+ !default.pbxuser
19
+ *.mode1v3
20
+ !default.mode1v3
21
+ *.mode2v3
22
+ !default.mode2v3
23
+ *.perspectivev3
24
+ !default.perspectivev3
25
+ xcuserdata
26
+ *.xccheckout
27
+ *.moved-aside
28
+ DerivedData
29
+ *.hmap
30
+ *.ipa
31
+ *.xcuserstate
32
+
data/JenkinsUtil.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'open4', '~> 1.3'
23
23
  spec.add_dependency 'sys-proctable', '~> 1.0'
24
24
  spec.add_dependency 'dropbox-sdk', '~> 1.6'
25
+ spec.add_dependency 'xcodeproj', '~> 1.1'
25
26
 
26
27
  spec.add_development_dependency 'bundler', '~> 1.11'
27
28
  spec.add_development_dependency 'rake', '~> 11.1'
data/README.md CHANGED
@@ -15,5 +15,5 @@ gem install jenkinsutil-0.8.dev.gem
15
15
  rake test
16
16
 
17
17
  ## Test with results for ci
18
- rake ci:setup:testunit test
18
+ CI_CAPTURE=off rake ci:setup:testunit test
19
19
 
@@ -10,6 +10,11 @@ class ArgumentHandler
10
10
  :dropbox_flatten,
11
11
  :dropbox_root,
12
12
  :kill_simulators,
13
+ :xcode_project_path,
14
+ :xcode_target,
15
+ :xcode_build_configuration,
16
+ :xcode_bundle_identifier,
17
+ :xcode_bundle_version,
13
18
  :verbose
14
19
 
15
20
  # rubocop:disable Metrics/AbcSize
@@ -24,6 +29,11 @@ class ArgumentHandler
24
29
  @dropbox_flatten = true
25
30
  @dropbox_root = Dir.pwd
26
31
  @kill_simulators = false
32
+ @xcode_project_path = nil
33
+ @xcode_target = nil
34
+ @xcode_build_configuration = nil
35
+ @xcode_bundle_identifier = nil
36
+ @xcode_bundle_version = nil
27
37
  @verbose = false
28
38
 
29
39
  ARGV.push('-h') if ARGV.empty?
@@ -76,6 +86,30 @@ class ArgumentHandler
76
86
  @kill_simulators = true
77
87
  end
78
88
 
89
+ # xcode_util
90
+ opts.on('--xcode-project project', 'Path to an Xcode project file') do |project_path|
91
+ @xcode_project_path = project_path
92
+ end
93
+
94
+ opts.on('--xcode-target target', 'Target to update in the Xcode project specified with --xcode-project') do |target|
95
+ @xcode_target = target
96
+ end
97
+
98
+ opts.on('--xcode-build-configuration build_configuration',
99
+ 'Build configuration to update in the Xcode project specified with --xcode-project') do |build_configuration|
100
+ @xcode_build_configuration = build_configuration
101
+ end
102
+
103
+ opts.on('--xcode-bundle-identifier identifer',
104
+ 'Bundle identifier to set in the Xcode project specified with --xcode-project') do |bundle_identifier|
105
+ @xcode_bundle_identifier = bundle_identifier
106
+ end
107
+
108
+ opts.on('--xcode-bundle-version version',
109
+ 'Bundle version to set in the Xcode project specified with --xcode-project') do |bundle_version|
110
+ @xcode_bundle_version = bundle_version
111
+ end
112
+
79
113
  # logger_util
80
114
  opts.on('-v', '--verbose', 'Output more information') do
81
115
  @verbose = true
@@ -1,6 +1,7 @@
1
1
  require 'JenkinsUtil/process_util'
2
2
  require 'JenkinsUtil/command_line_script'
3
3
  require 'JenkinsUtil/logger_util'
4
+ require 'xcodeproj'
4
5
 
5
6
  class XcodeUtil
6
7
  def initialize
@@ -29,4 +30,56 @@ class XcodeUtil
29
30
  @xcodebuild_version_major
30
31
  puts xcode_process.get_output
31
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
+ if target.name != target_name
39
+ next
40
+ end
41
+
42
+ target.build_configuration_list.build_configurations.each do |build_configuration|
43
+ if build_configuration.name != build_configuration_name
44
+ next
45
+ end
46
+
47
+ yield project, build_configuration
48
+ end
49
+ end
50
+ end
51
+
52
+ def self.get_project_bundle_version(project_path, target_name, build_configuration_name)
53
+ self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
54
+ infoplist_file = build_configuration.build_settings['INFOPLIST_FILE']
55
+ infoplist_path = File.join(File.dirname(project.path), infoplist_file)
56
+
57
+ infoplist = Xcodeproj::Plist.read_from_path(infoplist_path)
58
+ return infoplist['CFBundleVersion']
59
+ end
60
+ end
61
+
62
+ def self.set_project_bundle_version(project_path, target_name, build_configuration_name, bundle_version)
63
+ self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
64
+ infoplist_file = build_configuration.build_settings['INFOPLIST_FILE']
65
+ infoplist_path = File.join(File.dirname(project.path), infoplist_file)
66
+
67
+ infoplist = Xcodeproj::Plist.read_from_path(infoplist_path)
68
+ infoplist['CFBundleVersion'] = bundle_version
69
+ Xcodeproj::Plist.write_to_path(infoplist, infoplist_path)
70
+ end
71
+ end
72
+
73
+ def self.get_project_bundle_identifier(project_path, target_name, build_configuration_name)
74
+ self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
75
+ return build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
76
+ end
77
+ end
78
+
79
+ def self.set_project_bundle_identifier(project_path, target_name, build_configuration_name, bundle_identifier)
80
+ self.with_project_build_configuration(project_path, target_name, build_configuration_name) do |project, build_configuration|
81
+ build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_identifier
82
+ project.save()
83
+ end
84
+ end
32
85
  end
data/lib/JenkinsUtil.rb CHANGED
@@ -28,4 +28,14 @@ module JenkinsUtil
28
28
  if args.kill_simulators
29
29
  SimulatorUtil.reset_all_simulators
30
30
  end
31
+
32
+ if !args.xcode_project_path.nil? && !args.xcode_target.nil? && !args.xcode_build_configuration.nil?
33
+ if !args.xcode_bundle_identifier.nil?
34
+ XcodeUtil.set_project_bundle_identifier(args.xcode_project_path, args.xcode_target, args.xcode_build_configuration, args.xcode_bundle_identifier)
35
+ end
36
+
37
+ if !args.xcode_bundle_version.nil?
38
+ XcodeUtil.set_project_bundle_version(args.xcode_project_path, args.xcode_target, args.xcode_build_configuration, args.xcode_bundle_version)
39
+ end
40
+ end
31
41
  end
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: 0.8.43
4
+ version: 0.8.44
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-06-11 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open4
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: xcodeproj
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement