Skip to content

Commit

Permalink
Merge pull request #299 from CocoaPods/mr-dsl-project-directive
Browse files Browse the repository at this point in the history
[DSL] Rename xcodeproj to project
  • Loading branch information
mrackwitz committed Jan 28, 2016
2 parents f730a31 + d3db81b commit 8c55fdc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CocoaPods Core Changelog

## Master

##### Breaking

* The `xcodeproj` Podfile DSL method has been renamed to `project`.
[Marius Rackwitz](https://github.com/mrackwitz)
[Core#298](https://github.com/CocoaPods/Core/issues/298)


## 1.0.0.beta.2 (2016-01-05)

##### Enhancements
Expand Down
20 changes: 16 additions & 4 deletions lib/cocoapods-core/podfile/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -468,27 +468,39 @@ def platform(name, target = nil)
#
# # This Target can be found in a Xcode project called `FastGPS`
# target "MyGPSApp" do
# xcodeproj 'FastGPS'
# project 'FastGPS'
# ...
# end
#
# # Same Podfile, multiple Xcodeprojects
# target "MyNotesApp" do
# xcodeproj 'FastNotes'
# project 'FastNotes'
# ...
# end
#
# @example Using custom build configurations
#
# xcodeproj 'TestProject', 'Mac App Store' => :release, 'Test' => :debug
# project 'TestProject', 'Mac App Store' => :release, 'Test' => :debug
#
# @return [void]
#
def xcodeproj(path, build_configurations = {})
def project(path, build_configurations = {})
current_target_definition.user_project_path = path
current_target_definition.build_configurations = build_configurations
end

# @!visibility private
#
# @deprecated #{xcodeproj} was renamed to #{project}.
#
# TODO: This method can be deleted once people have migrated to this 1.0
# DSL.
#
def xcodeproj(*args)
CoreUI.warn 'xcodeproj was renamed to `project`. Please use that from now on.'
project(*args)
end

# @!visibility private
#
# @deprecated linking a single target with multiple Xcode targets is no
Expand Down
23 changes: 21 additions & 2 deletions spec/podfile/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,13 @@ module Pod
end

it 'allows specifying the user Xcode project for a Target definition' do
podfile = Podfile.new { xcodeproj 'App.xcodeproj' }
podfile = Podfile.new { project 'App.xcodeproj' }
podfile.target_definitions['Pods'].user_project_path.should == 'App.xcodeproj'
end

it 'allows specifying the build configurations of a user project' do
podfile = Podfile.new do
xcodeproj 'App.xcodeproj', 'Mac App Store' => :release, 'Test' => :debug
project 'App.xcodeproj', 'Mac App Store' => :release, 'Test' => :debug
end
podfile.target_definitions['Pods'].build_configurations.should == {
'Mac App Store' => :release, 'Test' => :debug
Expand Down Expand Up @@ -467,5 +467,24 @@ module Pod
end

#-------------------------------------------------------------------------#

describe 'Deprecations' do
it 'raises when using the #link_with method' do
should.raise(Informative) do
Podfile.new do
link_with 'App'
end
end.message.should == 'The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead.'
end

it 'warns when using the #xcodeproj method' do
podfile = Podfile.new { xcodeproj 'App.xcodeproj', 'Test' => :debug }
podfile.target_definitions['Pods'].user_project_path.should == 'App.xcodeproj'
podfile.target_definitions['Pods'].build_configurations.should == { 'Test' => :debug }
CoreUI.warnings.should == 'xcodeproj was renamed to `project`. Please use that from now on.'
end
end

#-------------------------------------------------------------------------#
end
end
4 changes: 2 additions & 2 deletions spec/podfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ module Pod
before do
@podfile = Podfile.new do
platform :ios
xcodeproj 'iOS Project', 'iOS App Store' => :release, 'Test' => :debug
project 'iOS Project', 'iOS App Store' => :release, 'Test' => :debug

target :debug do
pod 'SSZipArchive'
Expand All @@ -480,7 +480,7 @@ module Pod

target :osx_target do
platform :osx
xcodeproj 'OSX Project.xcodeproj', 'Mac App Store' => :release, 'Test' => :debug
project 'OSX Project.xcodeproj', 'Mac App Store' => :release, 'Test' => :debug
pod 'ASIHTTPRequest'
target :nested_osx_target do
end
Expand Down

0 comments on commit 8c55fdc

Please sign in to comment.