<commit_before># Contributing to CDTDatastore

## Setting up your environment

You have probably got most of these set up already, but starting from scratch
you'll need:

* Xcode
* Xcode command line tools
* Cocoapods
* Homebrew (optional, but useful)
* xcpretty (optional)

First, download Xcode from the app store or [ADC][adc].

When this is installed, install the command line tools. The simplest way is:

```bash
xcode-select --install
```

Install homebrew using the [guide on the homebrew site][homebrew].

Install cocoapods using the [guide on their site][cpinstall].

Finally, if you want to build from the command line, install [xcpretty][xcpretty],
which makes the `xcodebuild` output more readable.

It's a gem:

```bash
sudo gem install xcpretty
```

[adc]: http://developer.apple.com/
[xcpretty]: https://github.com/mneorr/XCPretty
[homebrew]: http://brew.sh
[cpinstall]: http://guides.cocoapods.org/using/index.html

## Getting started with the project

Open up `CDTDatastore.xcworkspace`. This workspace is where you should do all
your work. It contains:

* The CDTDatastore source code, following the folder structure in `Classes`.
* The test project, `Tests`.
* The example application, `Project`.
* `Pods` where the test and example app dependencies are built (including
  CDTDatastore itself).

Initially, the Pods project will be missing and the tests and example app
won't build or run.

To run the tests, install the dependencies using Cocoapods:

```bash
# Close the Xcode workspace before doing this!

cd Tests
pod install
```

To run the example project, you'll need to run `pod install` from the project
directory:

```bash
cd Project
pod install
```

This will create the Pods project and add CDTDatastore and its dependencies
to the projects. You can now run the tests and the example project from Xcode.

As you edit the source code in the `CDTDatastore` group, the Pods project will
be rebuilt when you run the tests as it references the code in `Classes`.

At this point, run both the tests from the Tests project and the example app
to make sure you're setup correctly.

### Documentation

Install [appledocs][appledocs].

Use `rake docs` to build the docs and install into Xcode.

[appledocs]: http://gentlebytes.com/appledoc/

### Using xcodebuild and xcpretty to run the tests

Run the following at the command line:

```
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' test | xcpretty
```

To test on a specific device you need to specify `-destination`:

```
// iOS
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' -destination "platform=iOS Simulator,OS=latest,name=iPhone Retina (3.5-inch)" test | xcpretty

// Mac OS X
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' -destination "platform=OS X" test | xcpretty
```

Xcodebuild references:

* [man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html)

Miss out the `| xcpretty` if you didn't install that.

## Contributing your changes

We follow a fairly standard proceedure:

* Fork the CDTDatastore repo into your own account, clone to your machine.
* Create a branch with your changes on (`git checkout -b my-new-feature`)
  * Make sure to update the CHANGELOG and CONTRIBUTORS before sending a PR.
  * All contributions must include tests.
  * Try to follow the style of the code around the code you
    are adding -- the project contains source code from a few places with
    slightly differing styles.
* Commit your changes (`git commit -am 'Add some feature'`)
* Push to the branch (`git push origin my-new-feature`)
* Issue a PR for this to our repo.
<commit_msg>Clarify how to get CDTDatastore.xcworkspace set up<commit_after># Contributing to CDTDatastore

## Setting up your environment

You have probably got most of these set up already, but starting from scratch
you'll need:

* Xcode
* Xcode command line tools
* Cocoapods
* Homebrew (optional, but useful)
* xcpretty (optional)

First, download Xcode from the app store or [ADC][adc].

When this is installed, install the command line tools. The simplest way is:

```bash
xcode-select --install
```

Install homebrew using the [guide on the homebrew site][homebrew].

Install cocoapods using the [guide on their site][cpinstall].

Finally, if you want to build from the command line, install [xcpretty][xcpretty],
which makes the `xcodebuild` output more readable.

It's a gem:

```bash
sudo gem install xcpretty
```

[adc]: http://developer.apple.com/
[xcpretty]: https://github.com/mneorr/XCPretty
[homebrew]: http://brew.sh
[cpinstall]: http://guides.cocoapods.org/using/index.html

## Getting started with the project

The main workspace is `CDTDatastore.xcworkspace` in the root of the checkout.
Before the projects inside will run, you need to use Cocoapods to get the
dependencies set up correctly for each project. The `Podfile` is actually
inside the `Tests` folder:

```bash
# Close the Xcode workspace before doing this!

cd Tests
pod install
```

Open up `CDTDatastore.xcworkspace`. This workspace is where you should do all
your work. It contains:

* The CDTDatastore source code, following the folder structure in `Classes`.
* The test project, `Tests`.
* The example application, `Project`.
* `Pods` where the test and example app dependencies are built (including
  CDTDatastore itself).

If things don't work, you probably skipped over the bit above where the
dependencies are set up.

As you edit the source code in the `CDTDatastore` group, the Pods project will
be rebuilt when you run the tests as it references the code in `Classes`.

At this point, run both the tests from the Tests project and the example app
to make sure you're setup correctly.

### Adding and removing files

First, make sure you add them to the right folder within the `Classes` structure:

* `common` for most new files.
  * Use a subfolder of `common` for discrete subsystems. 
* `vendor` for any libraries that can't be brought in via cocoapods.

**If you add or remove files, run `pod update` in `Tests` to get them into
the build. Then add them to the workspace, under the CDTDatastore group.**

When adding files to the workspace, make sure to keep the groups in the
workspace up to date with the file locations on the file system.

### Documentation

Install [appledocs][appledocs].

Use `rake docs` to build the docs and install into Xcode.

[appledocs]: http://gentlebytes.com/appledoc/

### Using xcodebuild and xcpretty to run the tests

Run the following at the command line:

```
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' test | xcpretty -c
```

To test on a specific device you need to specify `-destination`:

```
// iOS
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' -destination "platform=iOS Simulator,OS=latest,name=iPhone Retina (3.5-inch)" test | xcpretty

// Mac OS X
xcodebuild -workspace CDTDatastore.xcworkspace -scheme 'Tests' -destination "platform=OS X" test | xcpretty
```

Xcodebuild references:

* [man page](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html)

Miss out the `| xcpretty` if you didn't install that.

## Contributing your changes

We follow a fairly standard proceedure:

* Fork the CDTDatastore repo into your own account, clone to your machine.
* Create a branch with your changes on (`git checkout -b my-new-feature`)
  * Make sure to update the CHANGELOG and CONTRIBUTORS before sending a PR.
  * All contributions must include tests.
  * Try to follow the style of the code around the code you
    are adding -- the project contains source code from a few places with
    slightly differing styles.
* Commit your changes (`git commit -am 'Add some feature'`)
* Push to the branch (`git push origin my-new-feature`)
* Issue a PR for this to our repo.

{'fraction_non_alphanumeric': 0.0825898547030334, 'fraction_numerical': 0.0010196278358399185, 'mean_word_length': 4.396836313617607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3461475', 'n_tokens_mistral': 2378, 'n_tokens_neox': 2252, 'n_words': 1060}