change_bundleid 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77b2a0f9609d37795925c6a880258491fcb1d7d4
4
+ data.tar.gz: 08a3d5dc9d4554a56bf5eba012c349d30725b6be
5
+ SHA512:
6
+ metadata.gz: 1c81c8ce5fbc39350c0b2bcedeabe031b672e7f4f760dedcd763177a742ad015d06d21df383acf18a2730085519fcf61b8921a3536fcad22a50719ea01692e2a
7
+ data.tar.gz: 940ecd8c907403a4fd3283da71f378ecf8f9dbe89ccc41a87a9d480f3dc16041892d2323b414d13b9e5e654ef20a3d0630a7ad845273dcb01ca5c6ef54c2519b
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ ChangeBundleID
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in change_bundleid.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Fabio Gallonetto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ChangeBundleid
2
+
3
+ A tool to change the bundle identifier of an Xcode project.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'change_bundleid'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install change_bundleid
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ Usage: change_bundleid [options]
25
+ -p, --path PATH [REQUIRED] Path to the Xcode project (xcproject, not xcworkspace)
26
+ -t, --target NAME [REQUIRED] Project target
27
+ -c, --conf NAME PProject configuration (default = Release)
28
+ -i, --bundleid NAME [REQUIRED] New bundle ID
29
+ -s, --skip-plist Don't modify the info.plist file
30
+ -v, --verbose Verbose mode
31
+ -h, --help Show this message
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/FutureWorkshops/ChangeBundleID.
37
+
38
+
39
+ ## License
40
+
41
+ The gem is available under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'change_bundleid'
4
+ require 'optparse'
5
+ require 'ostruct'
6
+
7
+ options = OpenStruct.new
8
+ options.skip_plist = false
9
+ options.verbose = false
10
+ options.conf = 'Release'
11
+
12
+ opt_parser = OptionParser.new do |opt|
13
+ opt.banner = "Usage: change_bundleid [options]"
14
+ opt.on('-p', '--path PATH', "[REQUIRED] Path to the Xcode project (xcproject, not xcworkspace)") { |o| options.path = o }
15
+ opt.on('-t', '--target NAME', "[REQUIRED] Project target") { |o| options.target = o }
16
+ opt.on('-c', '--conf NAME', "PProject configuration (default = Release)") { |o| options.conf = o }
17
+ opt.on('-i', '--bundleid NAME', "[REQUIRED] New bundle ID") { |o| options.bundleid = o }
18
+ opt.on('-s', '--skip-plist', "Don't modify the info.plist file") { options.skip_plist = true }
19
+ opt.on('-v', '--verbose', "Verbose mode") { options.verbose = true }
20
+ opt.on_tail("-h", "--help", "Show this message") { puts opt; exit }
21
+ end
22
+
23
+ opt_parser.parse!(ARGV)
24
+ mandatory = [:path, :target, :conf, :bundleid]
25
+ missing = mandatory.select { |p| options[p].nil? }
26
+ unless missing.empty?
27
+ raise OptionParser::MissingArgument.new(missing.join(', '))
28
+ end
29
+ #puts options
30
+
31
+
32
+ ChangeBundleID.change_bundle_id(options.path, options.target, options.conf, options.bundleid, options.verbose, options.skip_plist)
33
+
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'change_bundleid/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "change_bundleid"
8
+ spec.version = ChangeBundleid::VERSION
9
+ spec.authors = ["Fabio Gallonetto"]
10
+ spec.email = ["fabio@futureworkshops.com"]
11
+
12
+ spec.summary = "A tool to change the bundle identifier of an Xcode project"
13
+ spec.description = "A tool to change the bundle identifier of an Xcode project"
14
+ spec.homepage = "http://www.github.com/FutureWorkshops/ChangeBundleID"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "xcodeproj", "~> 1.4.2"
25
+ spec.add_dependency "plist", "~> 3.2.0"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.14"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
@@ -0,0 +1,3 @@
1
+ module ChangeBundleid
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,69 @@
1
+ require "change_bundleid/version"
2
+ require 'xcodeproj'
3
+ require 'plist'
4
+
5
+ module ChangeBundleID
6
+ def self.change_bundle_id(project_filepath, target_name, project_configuration, new_bundle_ID, verbose, skip_plist)
7
+
8
+ project_directory=File.dirname project_filepath
9
+ unless File.directory?(project_directory)
10
+ puts "ERROR: The project folder '#{project_directory}' doesn't exist."
11
+ exit -12
12
+ end
13
+
14
+ unless File.exists?(project_filepath)
15
+ puts "ERROR: The project file '#{project_filepath}' doesn't exist."
16
+ exit -12
17
+ end
18
+
19
+ puts "*** Parsing project at '#{project_filepath}'" if verbose == true
20
+ project = Xcodeproj::Project.open(project_filepath)
21
+ target = project.targets.find { |t| t.name == target_name }
22
+ if target.nil?
23
+ puts "ERROR: Unable to find target '#{target_name}'!"
24
+ exit -12
25
+ end
26
+
27
+ configuration = target.build_configurations.find { |c| c.name == project_configuration }
28
+ if configuration.nil?
29
+ puts "ERROR: Unable to find configuration '#{project_configuration}'!"
30
+ exit -12
31
+ end
32
+
33
+ puts "*** Setting Xcode Project's PRODUCT_BUNDLE_IDENTIFIER to '#{new_bundle_ID}' on target '#{target_name}' for configuration '#{project_configuration}'" if verbose == true
34
+
35
+ configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = new_bundle_ID
36
+ project.save
37
+
38
+
39
+ if skip_plist == true then
40
+ puts "*** Skipping info_plist" if verbose == true
41
+ return 0
42
+ end
43
+
44
+ puts "*** Looking for Info.plist location" if verbose == true
45
+ relative_plist_path = configuration.build_settings['INFOPLIST_FILE']
46
+ relative_plist_path ||= project.build_settings(project_configuration)['INFOPLIST_FILE']
47
+ if relative_plist_path.nil?
48
+ puts "ERROR: Unable to find info.plist path within the project!"
49
+ exit -13
50
+ end
51
+
52
+ info_plist_file = File.join project_directory, relative_plist_path
53
+
54
+ # weak attempt to sanitize the file path
55
+ info_plist_file.slice! "$(SRCROOT)"
56
+
57
+ unless File.exists? info_plist_file
58
+ puts "ERROR: Unable to find info.plist file at path '#{info_plist_file}'!"
59
+ exit -15
60
+ end
61
+
62
+ puts "*** Found Info.plist file at path #{info_plist_file}" if verbose == true
63
+ puts "*** Resetting Info.plist's Bundle Identifier to '$(PRODUCT_BUNDLE_IDENTIFIER)'" if verbose == true
64
+ result = Plist::parse_xml(info_plist_file)
65
+ result['CFBundleIdentifier'] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
66
+
67
+ File.open(info_plist_file, 'w') { |file| file.write(result.to_plist) }
68
+ end
69
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: change_bundleid
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Gallonetto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcodeproj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: plist
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: A tool to change the bundle identifier of an Xcode project
84
+ email:
85
+ - fabio@futureworkshops.com
86
+ executables:
87
+ - change_bundleid
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/change_bundleid
101
+ - change_bundleid.gemspec
102
+ - lib/change_bundleid.rb
103
+ - lib/change_bundleid/version.rb
104
+ homepage: http://www.github.com/FutureWorkshops/ChangeBundleID
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.6.10
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: A tool to change the bundle identifier of an Xcode project
128
+ test_files: []