xcodeproj_setting 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 97f340773cca38c862ec67f9093a55ffe51dd0f5
4
+ data.tar.gz: ac5162ee7143797a7f3003f1aa2aaa48639aaa56
5
+ SHA512:
6
+ metadata.gz: ac53c69e1c9505479f2f7663e81cd20a195f4f629f230ca3b13f2dc5068e82afc34239df3b361c0c10571646590645f4288b5b2f613fc2c55b96300e29f4d531
7
+ data.tar.gz: e045fbd4cca7b0fe054948437f61ce42d872dd2c17ad349384079c214a5698c9c00b6b2ce992d06422051336303392d1c9339eb78289b9ab1a56dbbf94e142e3
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 'xcodeproj_setting'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install xcodeproj_setting
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ Usage: xcodeproj_setting [options]
25
+ --path PATH [REQUIRED] Path to the Xcode project (xcproject, not xcworkspace)
26
+ -t, --target NAME [REQUIRED] Project target
27
+ -c, --conf NAME Project configuration (default = Release)
28
+ -i, --key NAME [REQUIRED] Key to change
29
+ -p, --print Just print the current key's value and exit
30
+ -s, --value VALUE [REQUIRED] Value to set for the key
31
+ -v, --verbose Verbose mode
32
+ -h, --help Show this message```
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/FutureWorkshops/XcodeProjSetting.
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,39 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'xcodeproj_setting'
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
+ options.print = false
12
+
13
+ opt_parser = OptionParser.new do |opt|
14
+ opt.banner = "Usage: xcodeproj_setting [options]"
15
+ opt.on('-p', '--path PATH', "[REQUIRED] Path to the Xcode project (xcproject, not xcworkspace)") { |o| options.path = o }
16
+ opt.on('-t', '--target NAME', "[REQUIRED] Project target") { |o| options.target = o }
17
+ opt.on('-c', '--conf NAME', "Project configuration (default = Release)") { |o| options.conf = o }
18
+ opt.on('-i', '--key NAME', "[REQUIRED] Key to change") { |o| options.key = o }
19
+ opt.on('-p', '--print', "Just print the current key's value and exit") { options.print = true }
20
+ opt.on('-s', '--value VALUE', "[REQUIRED] Value to set for the key") { |o| options.value = o }
21
+ opt.on('-v', '--verbose', "Verbose mode") { options.verbose = true }
22
+ opt.on_tail("-h", "--help", "Show this message") { puts opt; exit }
23
+ end
24
+
25
+ opt_parser.parse!(ARGV)
26
+ mandatory = [:path, :target, :conf, :key]
27
+ mandatory << :value unless options.print == true
28
+ missing = mandatory.select { |p| options[p].nil? }
29
+ unless missing.empty?
30
+ raise OptionParser::MissingArgument.new(missing.join(', '))
31
+ end
32
+ #puts options
33
+
34
+ if options.print == false
35
+ XcodeProjSetting.change_setting(options.path, options.target, options.conf, options.key, options.value, options.verbose)
36
+ else
37
+ XcodeProjSetting.print_setting(options.path, options.target, options.conf, options.key)
38
+ end
39
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcodeproj_setting/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xcodeproj_setting"
8
+ spec.version = ChangeBundleid::VERSION
9
+ spec.authors = ["Fabio Gallonetto"]
10
+ spec.email = ["fabio@futureworkshops.com"]
11
+
12
+ spec.summary = "A tool to change a setting in an Xcode project"
13
+ spec.description = "A tool to change a setting in an Xcode project"
14
+ spec.homepage = "http://www.github.com/FutureWorkshops/XcodeProjSetting"
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
+
26
+ spec.add_development_dependency "bundler", "~> 1.14"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
@@ -0,0 +1,56 @@
1
+ require "xcodeproj_setting/version"
2
+ require 'xcodeproj'
3
+
4
+ module XcodeProjSetting
5
+ def self.change_setting(project_filepath, target_name, project_configuration, key, new_value, verbose)
6
+
7
+ configuration = self.get_config_obj(project_filepath, target_name, project_configuration, verbose)
8
+ if configuration.nil?
9
+ puts "ERROR: Unable to find configuration '#{project_configuration}'!"
10
+ exit -12
11
+ end
12
+
13
+ puts "*** Setting Xcode Project's #{key} to '#{new_value}' on target '#{target_name}' for configuration '#{project_configuration}'" if verbose == true
14
+
15
+ configuration.build_settings[key] = new_value
16
+ configuration.project.save
17
+
18
+ end
19
+
20
+ def self.print_setting(project_filepath, target_name, project_configuration, key)
21
+ configuration = self.get_config_obj(project_filepath, target_name, project_configuration, false)
22
+ if configuration.nil?
23
+ puts "ERROR: Unable to find configuration '#{project_configuration}'!"
24
+ exit -12
25
+ end
26
+
27
+ puts configuration.build_settings[key]
28
+
29
+ end
30
+
31
+ private
32
+ def self.get_config_obj(project_filepath, target_name, project_configuration, verbose)
33
+ project_directory=File.dirname project_filepath
34
+ unless File.directory?(project_directory)
35
+ puts "ERROR: The project folder '#{project_directory}' doesn't exist."
36
+ exit -12
37
+ end
38
+
39
+ unless File.exists?(project_filepath)
40
+ puts "ERROR: The project file '#{project_filepath}' doesn't exist."
41
+ exit -12
42
+ end
43
+
44
+ puts "*** Parsing project at '#{project_filepath}'" if verbose == true
45
+ project = Xcodeproj::Project.open(project_filepath)
46
+ target = project.targets.find { |t| t.name == target_name }
47
+ if target.nil?
48
+ puts "ERROR: Unable to find target '#{target_name}'!"
49
+ exit -12
50
+ end
51
+
52
+ target.build_configurations.find { |c| c.name == project_configuration }
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,3 @@
1
+ module ChangeBundleid
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcodeproj_setting
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-20 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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: A tool to change a setting in an Xcode project
70
+ email:
71
+ - fabio@futureworkshops.com
72
+ executables:
73
+ - xcodeproj_setting
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".ruby-gemset"
80
+ - ".ruby-version"
81
+ - ".travis.yml"
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/xcodeproj_setting
87
+ - change_bundleid.gemspec
88
+ - lib/xcodeproj_setting.rb
89
+ - lib/xcodeproj_setting/version.rb
90
+ homepage: http://www.github.com/FutureWorkshops/XcodeProjSetting
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.6.10
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: A tool to change a setting in an Xcode project
114
+ test_files: []