Skip to content

Commit 16046a9

Browse files
committed
Merge pull request #503 from phatblat/ben/readme
Readme 2.0
2 parents d65f262 + 912c7a7 commit 16046a9

File tree

1 file changed

+118
-49
lines changed

1 file changed

+118
-49
lines changed

README.md

Lines changed: 118 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,150 @@
44
[![Build Status](https://travis-ci.org/libgit2/objective-git.svg?branch=master)](https://travis-ci.org/libgit2/objective-git)
55

66
ObjectiveGit provides Cocoa bindings to the
7-
[libgit2](https://github.com/libgit2/libgit2) library.
7+
[libgit2](https://github.com/libgit2/libgit2) library, packaged as a dynamic framework for OS X and iOS 8 or better.
88

9-
Not all libgit2 features are available yet. If you run across something missing,
10-
please consider [contributing a pull request](#contributing)!
9+
## Features
10+
11+
A brief summary of the available functionality:
12+
13+
* Read: log, diff, blame, reflog, status
14+
* Write: init, checkout, commit, branch, tag, reset
15+
* Internals: configuration, tree, blob, object database
16+
* Network: clone, fetch, push, pull (in progress #464)
17+
* Transports: HTTP, HTTPS, SSH, local filesystem
18+
19+
Not all libgit2 features are available, but if you run across something missing, please consider [contributing a pull request](#contributing)!
20+
21+
Many classes in the ObjectiveGit API wrap a C struct from libgit2 and expose the underlying data and operations using Cocoa idioms. The underlying libgit2 types are prefixed with `git_` and are often accessible via a property so that your application can take advantage of the libgit2 API directly.
22+
23+
The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The public API is also decorated with nullability attributes so that you will get compile-time feedback of whether nil is allowed or not. This also makes the framework much nicer to use in Swift.
1124

1225
## Getting Started
1326

27+
### Xcode
28+
29+
ObjectiveGit requires Xcode 6.3 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use
30+
[Carthage](#carthage) to install pre-built binaries
31+
or download them [manually](#manually).
32+
33+
### Other Tools
34+
1435
To start building the framework, you must install the required dependencies,
1536
[xctool](https://github.com/facebook/xctool) and
1637
[cmake](https://github.com/Kitware/CMake). We recommend using
17-
[Homebrew](http://brew.sh) to install these two tools.
38+
[Homebrew](http://brew.sh) to install these tools.
1839

19-
Once you have the dependencies you should clone this repository and then run
20-
`script/bootstrap`. This will automatically pull down and install any other
40+
Once you have the dependencies you should clone this repository and then run [`script/bootstrap`](script/bootstrap). This will automatically pull down and install any other
2141
dependencies.
2242

23-
Note that the `bootstrap` script automatically installs some libraries that
24-
ObjectiveGit relies upon, using Homebrew. If you want this behavior, please
25-
make sure you have Homebrew installed.
43+
Note that the `bootstrap` script automatically installs some libraries that ObjectiveGit relies upon, using Homebrew. If you not want to use Homebrew, you will need to ensure these dependent libraries and their headers are installed where the build scripts [expect them to be](https://github.com/libgit2/objective-git/blob/master/script/bootstrap#L80-L99).
2644

2745
To develop ObjectiveGit on its own, open the `ObjectiveGitFramework.xcworkspace` file.
28-
Note that Xcode 6.3 is required to build the framework and run unit tests.
29-
Projects that must use an older version of Xcode can use
30-
[Carthage](https://github.com/Carthage/Carthage) to install pre-built binaries
31-
or download them from the [releases](https://github.com/libgit2/objective-git/releases).
3246

33-
## Importing ObjectiveGit on OS X
47+
# Installation
48+
49+
There are three ways of including ObjectiveGit in a project:
50+
51+
1. [Carthage](#carthage) <-- recommended
52+
1. [Manual](#manual)
53+
1. [Subproject](#subproject)
54+
55+
56+
## Carthage
57+
58+
59+
1. Add ObjectiveGit to your [`Cartfile`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).
60+
61+
```
62+
github "libgit2/objective-git"
63+
```
64+
65+
1. Run `carthage update`.
66+
1. **Mac targets**
67+
* On your application targets' "General" settings tab, in the "Embedded Binaries" section, drag and drop the `ObjectiveGit.framework` from the [`Carthage/Build/Mac`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#carthagebuild) folder on disk.
68+
69+
![Embedded Binaries](http://imgur.com/W9EVyIX.png)
70+
71+
1. **iOS targets**
72+
* On your application targets' "General" settings tab, in the "Linked Frameworks and Libraries" section, drag and drop the `ObjectiveGit.framework` from the [`Carthage/Build/iOS`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#carthagebuild) folder on disk.
73+
![Linked Frameworks](http://i.imgur.com/y4caRw0.png)
74+
75+
* On your application targets' "Build Phases" settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:
76+
77+
```
78+
/usr/local/bin/carthage copy-frameworks
79+
```
80+
81+
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
82+
83+
```
84+
$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework
85+
```
3486

35-
It is simple enough to add the ObjectiveGit framework to a desktop application
36-
project. An example of this is the
37-
[CommitViewer](https://github.com/Abizern/CommitViewer) example on GitHub. In summary:
87+
![Carthage Copy Frameworks](http://i.imgur.com/zXai6rb.png)
3888

39-
1. Drag the `ObjectiveGitFramework.xcodeproj` file into the project navigator.
40-
1. Add the ObjectiveGit framework as a target dependency of your application.
89+
1. Commit the [`Cartfile.resolved`](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfileresolved)
90+
91+
The different instructions for iOS works around an [App Store submission bug](http://www.openradar.me/radar?id=6409498411401216) triggered by universal binaries.
92+
93+
94+
### Copying debug symbols for debugging and crash reporting
95+
96+
_dSYM files are not currently included in the GitHub release zip files. You will need to pass **--no-use-binaries** to carthage in order to build locally and generate the dSYM files alongside the framework._
97+
98+
1. On your application target's "Build Phases" settings tab, click the "+" icon and choose "New Copy Files Phase".
99+
2. Click the “Destination” drop-down menu and select "Products Directory".
100+
3. Drag and drop the `ObjectiveGit.framework.dSYM` file from `Carthage/Build/[platform]` into the list.
101+
102+
![Copy dSYM Files](http://i.imgur.com/WKJdHHQ.png)
103+
104+
105+
## Manual
106+
107+
1. Download the latest `ObjectiveGit.framework.zip` from [releases](https://github.com/libgit2/objective-git/releases).
108+
1. Unzip the file.
109+
1. Follow the Carthage instructions #3 or #4, depending on platform.
110+
111+
Note that the iOS framework we release is a "fat" framework containing slices for both the iOS Simulator and devices. This makes it easy to get started with your iOS project. However, Apple does not currently allow apps containing frameworks with simulator slices to be submitted to the app store. Carthage (above) already has a solution for this. If you're looking to roll your own, take a look at Realm's [strip frameworks script](https://github.com/realm/realm-cocoa/blob/master/scripts/strip-frameworks.sh).
112+
113+
114+
## Subproject
115+
116+
### Examples
117+
118+
* OS X: [CommitViewer](https://github.com/Abizern/CommitViewer)
119+
* iOS: [ObjectiveGit iOS Example](https://github.com/Raekye/ObjectiveGit-iOS-Example)
120+
121+
1. Add ObjectiveGit as a submodule to your project:
122+
123+
```
124+
git submodule add https://github.com/libgit2/objective-git.git External/ObjectiveGit
125+
```
126+
127+
1. Run `script/bootstrap`.
128+
1. Drag the `ObjectiveGitFramework.xcodeproj` file into the Project Navigator pane of your project.
129+
1. Add `ObjectiveGit-Mac` or `ObjectiveGit-iOS` as a target dependency of your application, depending on platform.
41130
1. Link your application with `ObjectiveGit.framework`.
42-
1. Add a new "Copy Files" build phase, set the destination to "Frameworks" and
43-
add `ObjectiveGit.framework` to that. This will package the framework with
44-
your application as an embedded private framework.
45-
1. Set the “Header Search Paths” (`HEADER_SEARCH_PATHS`) build setting to the
46-
correct path for the libgit2 headers in your project. For example, if you
47-
added the submodule to your project as `External/ObjectiveGit`, you would
48-
set this build setting to `External/ObjectiveGit/External/libgit2/include`.
49-
If you see build errors saying that `git2/filter.h` cannot be found, then
50-
double-check that you set this setting correctly.
51-
1. Don't forget to `#import <ObjectiveGit/ObjectiveGit.h>` as you would with any
52-
other framework.
53-
54-
## Importing ObjectiveGit on iOS
55-
56-
Getting started is slightly more difficult on iOS because third-party frameworks
57-
are not officially supported. ObjectiveGit offers a static library instead. An example
58-
of this is the [ObjectiveGit iOS Example](https://github.com/Raekye/ObjectiveGit-iOS-Example)
59-
on GitHub. In summary:
60-
61-
1. Drag `ObjectiveGitFramework.xcodeproj` into the Project Navigator.
62-
1. Add `ObjectiveGit-iOS` as a target dependency of your application.
63-
1. Link your application to `libObjectiveGit-iOS.a`, `libz.dylib`, and `libiconv.dylib`.
64-
1. In your target's build settings:
65-
1. Set "Always Search User Paths" to `YES`
66-
1. Add `$(BUILT_PRODUCTS_DIR)/usr/local/include` and
67-
`PATH/TO/OBJECTIVE-GIT/External/libgit2/include` to the "User Header
68-
Search Paths"
69-
1. Add `-all_load` to the "Other Linker Flags"
131+
1. Set the “Header Search Paths” (`HEADER_SEARCH_PATHS`) build setting to the correct path for the libgit2 headers in your project. For example, if you added the submodule to your project as `External/ObjectiveGit`, you would set this build setting to `External/ObjectiveGit/External/libgit2/include`. If you see build errors saying that `git2/filter.h` cannot be found, then double-check that you set this setting correctly.
132+
1. Add a new "Copy Files" build phase, set the destination to "Frameworks" and add `ObjectiveGit.framework` to the list. This will package the framework with your application as an embedded private framework.
133+
* It's hard to tell the difference between the platforms, but the Mac framework is in `build/Debug` whereas the iOS framework is in `build/Debug-iphoneos`
134+
1. Don't forget to `#import <ObjectiveGit/ObjectiveGit.h>` or `@import ObjectiveGit;` as you would with any other framework.
135+
136+
70137

71138
## Contributing
72139

73-
Fork the repository on GitHub, make it awesomer (preferably in a branch named
74-
for the topic), send a pull request.
140+
1. Fork this repository
141+
1. Make it awesomer (preferably in a branch named for the topic)
142+
1. Send a pull request
75143

76144
All contributions should match GitHub's [Objective-C coding
77145
conventions](https://github.com/github/objective-c-conventions).
78146

79147
You can see all the amazing people that have contributed to this project
80148
[here](https://github.com/libgit2/objective-git/contributors).
81149

150+
82151
## License
83152

84153
ObjectiveGit is released under the MIT license. See

0 commit comments

Comments
 (0)