xcodeproj_merge 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +34 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/xcodeproj_merge +13 -0
- data/lib/xcodeproj_merge.rb +50 -0
- data/lib/xcodeproj_merge/version.rb +3 -0
- data/xcodeproj_merge.gemspec +25 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 964aef3b361fa81e8e42038cb32a204acf3c9c83
|
4
|
+
data.tar.gz: 57ab5704756ab7b068f9911d8e79342872f4d460
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a1ee2b60e8b5c13f00b707fb11b90e5d3cf859dc4ce71f68d7119a0aca01e77d900c204ec2613bbb506ef1809003bf06e3d80cf02589558bc2b769a9ba2984fb
|
7
|
+
data.tar.gz: c4bea6f46127a32eb98eedfadd4e8a093a30e976a3f065321d0d86af267684062453b5aa3402352ae75942278a0e1f3d393400a912520b2b10f06c899e6a43dd
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# xcodeproj_merge
|
2
|
+
|
3
|
+
Copies file references from one Xcode project to another.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'xcodeproj_merge'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install xcodeproj_merge
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
$ xcodeproj_merge source.xcodeproj destination.xcodeproj
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec xcodeproj_merge` to use the gem in this directory, ignoring other installed copies of this gem.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/treehouse/xcodeproj_merge.
|
34
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "xcodeproj_merge"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/xcodeproj_merge
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "xcodeproj_merge"
|
4
|
+
|
5
|
+
def show_usage
|
6
|
+
puts "Usage: xcodeproj_merge source.xcodeproj destination.xcodeproj"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
src = ARGV.shift or show_usage
|
11
|
+
dest = ARGV.shift or show_usage
|
12
|
+
merge = XcodeprojMerge.new(src, dest)
|
13
|
+
merge.call
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "xcodeproj"
|
2
|
+
require "xcodeproj_merge/version"
|
3
|
+
|
4
|
+
class XcodeprojMerge
|
5
|
+
def initialize(source_project_path, destination_project_path)
|
6
|
+
@source = Xcodeproj::Project.open(source_project_path)
|
7
|
+
@destination = Xcodeproj::Project.open(destination_project_path)
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :source, :destination
|
11
|
+
|
12
|
+
def call
|
13
|
+
build_phase_names.each do |phase_name|
|
14
|
+
merge_file_references_for_phase(phase_name)
|
15
|
+
end
|
16
|
+
destination.save
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_phase_names
|
22
|
+
%w(source_build_phase frameworks_build_phases resources_build_phase headers_build_phase)
|
23
|
+
end
|
24
|
+
|
25
|
+
def default_target(project)
|
26
|
+
project.targets[0] or raise "No target found in #{project}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def merge_file_references_for_phase(phase_name)
|
30
|
+
source_phase = default_target(source).send(phase_name)
|
31
|
+
destination_phase = default_target(destination).send(phase_name)
|
32
|
+
|
33
|
+
source_phase.files_references.each do |source_ref|
|
34
|
+
unless destination_phase.files_references.include?(source_ref)
|
35
|
+
add_file_reference(source_ref, destination_phase)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_file_reference(source_ref, phase)
|
41
|
+
group = destination[source_ref.parent.path] || destination.main_group
|
42
|
+
existing_ref = group.files.grep(source_ref).first
|
43
|
+
|
44
|
+
destination_ref = existing_ref || group.new_reference(source_ref.path)
|
45
|
+
destination_ref.fileEncoding = source_ref.fileEncoding
|
46
|
+
destination_ref.include_in_index = source_ref.include_in_index
|
47
|
+
|
48
|
+
phase.add_file_reference(destination_ref, true)
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xcodeproj_merge/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xcodeproj_merge"
|
8
|
+
spec.version = XcodeprojMerge::VERSION
|
9
|
+
spec.authors = ["Milo Winningham"]
|
10
|
+
spec.email = ["milo@winningham.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Copies file references from one Xcode project to another.}
|
13
|
+
spec.homepage = "https://github.com/treehouse/xcodeproj_merge"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "xcodeproj", "~> 0.28.2"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xcodeproj_merge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Milo Winningham
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-02 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: 0.28.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.28.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.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
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: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- milo@winningham.net
|
72
|
+
executables:
|
73
|
+
- xcodeproj_merge
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- Gemfile
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/console
|
83
|
+
- bin/setup
|
84
|
+
- exe/xcodeproj_merge
|
85
|
+
- lib/xcodeproj_merge.rb
|
86
|
+
- lib/xcodeproj_merge/version.rb
|
87
|
+
- xcodeproj_merge.gemspec
|
88
|
+
homepage: https://github.com/treehouse/xcodeproj_merge
|
89
|
+
licenses: []
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.5.1
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Copies file references from one Xcode project to another.
|
111
|
+
test_files: []
|