Skip to content

Commit

Permalink
README improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jun 28, 2016
1 parent 794812b commit 05ff716
Showing 1 changed file with 49 additions and 5 deletions.
54 changes: 49 additions & 5 deletions README.md
Expand Up @@ -6,12 +6,13 @@

Xcodeproj lets you create and modify Xcode projects from [Ruby][ruby].
Script boring management tasks or build Xcode-friendly libraries. Also includes
support for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
support for Xcode workspaces (`.xcworkspace`), configuration files (`.xcconfig`) and
Xcode Scheme files (`.xcscheme`).

It is used in [CocoaPods](https://github.com/CocoaPods/CocoaPods) to create a
static library from scratch, for both iOS and OSX.
a collection of supplemental libraries or frameworks, for all platforms Xcode supports.

The documentation can be found [here](http://docs.cocoapods.org/xcodeproj/index.html).
The API reference can be found [here](http://www.rubydoc.info/gems/xcodeproj).

## Installing Xcodeproj

Expand All @@ -23,12 +24,55 @@ by performing the following command:
## Quickstart

To begin editing an xcodeproj file start by opening it as an Xcodeproj with:
```

```ruby
require 'xcodeproj'
project_path = "/your_path/your_project.xcodeproj"
project_path = '/your_path/your_project.xcodeproj'
project = Xcodeproj::Project.open(project_path)
```

#### Some Small Examples To Get You Started

> Look through all targets
```ruby
project.targets.each do |target|
puts target.name
end
```

> Get all source files for a target
```ruby
target = project.targets.first
files = target.source_build_phase.files.to_a.map do |pbx_build_file|
pbx_build_file.file_ref.real_path.to_s

end.select do |path|
path.end_with?(".m", ".mm", ".swift")

end.select do |path|
File.exists?(path)
end
```

> Set a specific build configuration to all targets
```ruby
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['MY_CUSTOM_FLAG'] ||= 'TRUE'
end
end
```

## Command Line Tool

Installing the Xcodeproj gem will also install a command-line tool `xcodeproj` which you can
use to generate project diffs, target diffs, output all configurations and show a YAML representation.

For more information consult `xcodeproj --help`.

## Collaborate

All Xcodeproj development happens on [GitHub][xcodeproj]. Contributing patches
Expand Down

0 comments on commit 05ff716

Please sign in to comment.