Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shares schemes of any development pods. #3600

Merged
merged 3 commits into from May 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Enhancements

* Schemes of development pods will now be shared.
[Boris Bügling](https://github.com/neonichu)
[#3600](https://github.com/CocoaPods/CocoaPods/issues/3600)

* Allow opting out of pod source locking, meaning `pod try` yields editable
projects.
[Samuel Giddins](https://github.com/segiddins)
Expand Down
15 changes: 15 additions & 0 deletions lib/cocoapods/installer.rb
Expand Up @@ -136,6 +136,7 @@ def generate_pods_project
set_target_dependencies
run_podfile_post_install_hooks
write_pod_project
share_development_pod_schemes
write_lockfiles
end
end
Expand Down Expand Up @@ -604,6 +605,20 @@ def write_pod_project
end
end

# Shares schemes of development Pods.
#
# @return [void]
#
def share_development_pod_schemes
development_pod_targets = sandbox.development_pods.keys.map do |pod|
pods_project.targets.select { |target| target.name =~ /^Pods-.*-#{pod}$/ }
end.flatten

development_pod_targets.each do |pod_target|
Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.name)
end
end

# Writes the Podfile and the lock files.
#
# @todo Pass the checkout options to the Lockfile.
Expand Down
15 changes: 15 additions & 0 deletions spec/unit/installer_spec.rb
Expand Up @@ -590,6 +590,21 @@ def test_extension_target(symbol_type)
@installer.send(:write_pod_project)
end

it 'shares schemes of development pods' do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile)
pod_target = PodTarget.new([spec], target_definition, config.sandbox)

@installer.pods_project.stubs(:targets).returns([pod_target])
@installer.sandbox.stubs(:development_pods).returns('BananaLib' => nil)

Xcodeproj::XCScheme.expects(:share_scheme).with(
@installer.pods_project.path,
'Pods-default-BananaLib')

@installer.send(:share_development_pod_schemes)
end

it "uses the user project's object version for the pods project" do
tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods'
FileUtils.mkdir_p(tmp_directory)
Expand Down