Skip to content

Commit

Permalink
Initial Commit 🚢
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkVillacampa committed Aug 9, 2016
0 parents commit 63bb255
Show file tree
Hide file tree
Showing 74 changed files with 6,449 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage
profiles
provisioning

# Dont commit autogenerated certs certs
spec/fixtures/*.cer
spec/fixtures/*.p12
spec/fixtures/*.csr
spec/fixtures/*.pem
spec/fixtures/*.srl
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color --require spec_helper --format d
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gemspec

# TODO: Add this to the gempsec when version 0.0.6 is in rubygems
gem 'rspec-prof', github: 'sinisterchipmunk/rspec-prof'
106 changes: 106 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
GIT
remote: git://github.com/sinisterchipmunk/rspec-prof.git
revision: 0a4d8ed998a3ab88d1a7b4a8f54a8d7faf6ee8c9
specs:
rspec-prof (0.0.6)
rspec (~> 3.0)
ruby-prof

PATH
remote: .
specs:
motion-provisioning (0.0.1)
plist
security
spaceship

GEM
remote: https://rubygems.org/
specs:
addressable (2.3.8)
builder (3.2.2)
colored (1.2)
commander (4.4.0)
highline (~> 1.7.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
credentials_manager (0.16.0)
colored
commander (>= 4.3.5)
highline (>= 1.7.1)
security
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.20160615)
unf (>= 0.0.5, < 1.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
faraday_middleware (0.10.0)
faraday (>= 0.7.4, < 0.10)
fastimage (1.9.0)
addressable (~> 2.3.5)
highline (1.7.8)
http-cookie (1.0.2)
domain_name (~> 0.5)
json (2.0.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
plist (3.2.0)
rake (10.5.0)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
rspec_junit_formatter (0.2.3)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
ruby-prof (0.15.9)
safe_yaml (1.0.4)
security (0.1.3)
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
spaceship (0.29.1)
colored
credentials_manager (>= 0.9.0)
faraday (~> 0.9)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.9)
fastimage (~> 1.6)
multi_xml (~> 0.5)
plist (~> 3.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
webmock (1.21.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.12)
motion-provisioning!
rake (~> 10.0)
rspec (~> 3.1.0)
rspec-prof!
rspec_junit_formatter (~> 0.2.3)
simplecov
webmock (~> 1.21.0)

BUNDLED WITH
1.12.5
46 changes: 46 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Copyright (c) 2015-2016, HipByte ([email protected]) and contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This project contains portions of fastlane:

The MIT License (MIT)

Copyright (c) 2015 Felix Krause

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
207 changes: 207 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# MotionProvisioning

Simplified provisioning for RubyMotion iOS, tvOS and macOS apps.

Getting started with iOS development has a very high barrier. Just
getting a app and device registered requires you to go through a *very*
complex web interface at developer.apple.com

MotionProvisioning significantly alleviates the pain of these steps.

By providing your developer account, MotionProvisioning automatically performs
the following tasks in the Developer Portal for you:

- Creates an application matching your app's name and bundle
identifier.
- Creates development and distribution certificates.
- Creates development, distribution and adhoc profiles.
- Registers iOS devices.

[gif]

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'motion-provisioning'
```

And then execute:

$ bundle

## Configuration

MotionProvisioning provides two handy methods. Pass them to the
`app.codesign_certificate` and `app.provisioning_profile` options in
the Rakefile.

```ruby
MotionProvisioning.certificate(platform: platform,
type: type
free: free)
```

|Parameter|Description|
|---------|------|
|`platform`|`:ios`, `:tvos`, `:mac`|
|`type`|`:development`, `:distribution`, `:developer_id` (only mac)|
|`free`|`true` if you want to use a free developer account. Default: `false`|

```ruby
MotionProvisioning.profile(bundle_identifier: bundle_identifier,
app_name: app_name,
platform: platform,
type: type
free: free)
```

|Parameter|Description|
|---------|------|
|`bundle_identifier`|Pass `app.identifier`|
|`app_name`|Pass `app.name`|
|`platform`|`:ios`, `:tvos`, `:mac`|
|`type`|`:development`, `:distribution`, `:adhoc` (only iOS and tvOS), `:developer_id` (only mac)|
|`free`|`true` if you want to use a free developer account. Default: `false`|


Here's how you would configure an iOS app:

```ruby
Motion::Project::App.setup do |app|
app.name = 'My App'
app.identifier = 'com.example.myapp'

app.development do
app.codesign_certificate = MotionProvisioning.certificate(
type: :development,
platform: :ios)

app.provisioning_profile = MotionProvisioning.profile(
bundle_identifier: app.identifier,
app_name: app.name,
platform: :ios,
type: :development)
end

app.release do
app.codesign_certificate = MotionProvisioning.certificate(
type: :distribution,
platform: :ios)

app.provisioning_profile = MotionProvisioning.profile(
bundle_identifier: app.identifier,
app_name: app.name,
platform: :ios,
type: :distribution)
end
end
```

The certificates and profiles will be created and downloaded into a
`provisioning` folder in the root of your application folder as part of running
`rake archive:distribution` or `rake device`.

## Developer account

The first time you run MotionProvisioning, you will be asked for your Apple ID
email. It will optionally be stored in a YAML config file in
`provisioning/config.yaml`.

You will then be asked for your password, which will be stored securely in the Keychain.

If your account belongs to multiple developer teams, you will be asked to select
the one you want to use. It will also optionally be stored in the config file.

If there are multiple team members, it's very important each team member uses a
different account. Read "Sharing cerfiticates" below to know more.

The config file will look like this:

```yaml
email: [email protected]
team_id: 5GU5F4
```
Alternatively, you can provide all this information via environment variables:
MOTION_PROVISIONING_TEAM_ID
MOTION_PROVISIONING_EMAIL
MOTION_PROVISIONING_PASSWORD
## Free developer account
If you dont have a paid Apple developer account, set the `free:`
option to `true` and a free development certificate and development
profile, valid to deploy to your device, will be created. You still
need a paid account to submit an app to the AppStore.

You can register a free developer account in
[developer.apple.com](https://developer.apple.com)

## Sharing certificates

Apple imposes restrictions in the number of certificates you can
create:

- One development certificate per team member.
- One distribution certificate per team.

The distribution certificate (and it's corresponding private key) must
be shared between all team members who will be creating distribution
builds.

MotionProvisioning will ask before revoking the existing distribution
certificate and creating a new one.

After you create a new distribution certificate, share the
corresponding `.cer` and `.p12` files located in the `provisioning`
folder with your team members.

## Recreate certificates and profiles

Once the certificates and profiles are cached in the `provisioning`
folder, if you want to re-create them, set the `recreate_profiles` or
`recreate_certificates` env variable.

For example, to recreate the development profile:

rake device recreate_profiles=1

## Entitlements and App Services

MotionProvisioning does not (yet) manage entitlements and app services (like
HealthKit, HomeKit or iCloud). To enable them, you need to go to the Developer
Portal. Then, recreate your provisioning profile and add the appropriate
entitlements to the `app.entitlements` hash in your Rakefile.

## Devices

If there are any iOS devices connected to the computer, and they are not
included in the provisioning profile, you will be asked to
register them in the Developer Portal and include them in the profile.

You can also add arbitrary device IDs by running:

rake "motion-provisioning:add-device[device_name,device_id]"

Then, you will need to recreate the profile to include the newly registered device:

rake device recreate_profiles=1

## Testing

Run:

bin/setup
rspec

To generate profiling information:

SPEC_PROFILE=1 rspec

To generate coverage information:

SPEC_COVERAGE=1 rspec
Loading

0 comments on commit 63bb255

Please sign in to comment.