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

Include non-shared schemes in Project.schemes #680

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
[nickgravelyn](https://github.com/nickgravelyn)
[#757](https://github.com/CocoaPods/Xcodeproj/pull/757)

* Include non-shared schemes in `Project.schemes`.
[Serge Lebedev](https://github.com/lebedev)
[#680](https://github.com/CocoaPods/Xcodeproj/pull/680)


## 1.16.0 (2020-04-10)

Expand Down
2 changes: 1 addition & 1 deletion lib/xcodeproj/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def sort(options = nil)
# @return [Array]
#
def self.schemes(project_path)
schemes = Dir[File.join(project_path, 'xcshareddata', 'xcschemes', '*.xcscheme')].map do |scheme|
schemes = Dir[File.join(project_path, '**', 'xcschemes', '*.xcscheme')].map do |scheme|
File.basename(scheme, '.xcscheme')
end
schemes << File.basename(project_path, '.xcodeproj') if schemes.empty?
Expand Down
7 changes: 6 additions & 1 deletion spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ module ProjectSpecs
#-------------------------------------------------------------------------#

describe 'Project schemes' do
it 'return project name as scheme if there are no shared schemes' do
it 'return project name as scheme if there are no schemes' do
schemes = Xcodeproj::Project.schemes(fixture_path('SharedSchemes/Pods/Pods.xcodeproj'))
schemes[0].should == 'Pods'
end
Expand All @@ -649,6 +649,11 @@ module ProjectSpecs
schemes.sort.should == %w(SharedSchemes SharedSchemesForTest)
end

it 'finds a non-shared scheme' do
schemes = Xcodeproj::Project.schemes(fixture_path('Sample Project/Cocoa Application.xcodeproj'))
schemes.include?('Cocoa ApplicationImporter').should == true
end

describe '#recreate_user_schemes' do
it 'can recreate the user schemes' do
sut = Xcodeproj::Project.new(SpecHelper.temporary_directory + 'Pods.xcodeproj')
Expand Down