alloy/cocoapods — Issue #26: Podfile DSL
Author: alloy
Created: 2011-10-16 11:34:45+00:00
State: open

With the addition of the `platform' attribute being important in a Podfile, it became clear that we’ll have to rethink the way in which a Podfile is defined a bit. For now (in master) I have changed it to be the same as a normal specification:

```Ruby
Pod::File.new do |f|
f.platform :ios

f.dependency 'JSONKit'
end
```

However, this will become more of an aesthetic issue once we, for example, add the API to define dependency groups:

```Ruby
Pod::File.new do |f|
f.platform :ios

f.dependency 'JSONKit'

f.group :debug do
f.dependency "Kiwi", "1.0"
f.dependency "LRMocky", "0.9.0"
end
end
```

We could create a separate DSL for a Podfile which assigns attributes without the `=` sign, which would make it possible to retain the previous way of defining a Podfile:

```Ruby
platform :iOS

dependency 'JSONKit'

group :debug do
dependency "Kiwi", "1.0"
dependency "LRMocky", "0.9.0"
end
```

I’m still on the fence about this, please let me know what you think.