motion-provisioning 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dea1ad8887e8b90e0070e9c4c4aa2734ba5583f4
4
+ data.tar.gz: cafec1b76a485e67482f6621d473f057cb7c09b8
5
+ SHA512:
6
+ metadata.gz: c0d2820ccc3ace33d3d9b0acf2e98491d733754d9b052d6351b6bee0dec0a20b6c994821b2235e0fe236034457cf1a235b2f348954236217b18c90bd01e56049
7
+ data.tar.gz: 6365f585b94e6ea27da7ad5c1b941a024692d8ee7ab4765c3bb56f6a30be4846ef8bf7036c1cd5e10d26c72041fa40659323b7ec94af21fe521bb3d579918fd4
@@ -0,0 +1,10 @@
1
+ coverage
2
+ profiles
3
+ provisioning
4
+
5
+ # Dont commit autogenerated certs certs
6
+ spec/fixtures/*.cer
7
+ spec/fixtures/*.p12
8
+ spec/fixtures/*.csr
9
+ spec/fixtures/*.pem
10
+ spec/fixtures/*.srl
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --require spec_helper --format d
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # TODO: Add this to the gempsec when version 0.0.6 is in rubygems
6
+ gem 'rspec-prof', github: 'sinisterchipmunk/rspec-prof'
@@ -0,0 +1,106 @@
1
+ GIT
2
+ remote: git://github.com/sinisterchipmunk/rspec-prof.git
3
+ revision: 0a4d8ed998a3ab88d1a7b4a8f54a8d7faf6ee8c9
4
+ specs:
5
+ rspec-prof (0.0.6)
6
+ rspec (~> 3.0)
7
+ ruby-prof
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ motion-provisioning (0.0.1)
13
+ plist
14
+ security
15
+ spaceship
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ addressable (2.3.8)
21
+ builder (3.2.2)
22
+ colored (1.2)
23
+ commander (4.4.0)
24
+ highline (~> 1.7.2)
25
+ crack (0.4.3)
26
+ safe_yaml (~> 1.0.0)
27
+ credentials_manager (0.16.0)
28
+ colored
29
+ commander (>= 4.3.5)
30
+ highline (>= 1.7.1)
31
+ security
32
+ diff-lcs (1.2.5)
33
+ docile (1.1.5)
34
+ domain_name (0.5.20160615)
35
+ unf (>= 0.0.5, < 1.0.0)
36
+ faraday (0.9.2)
37
+ multipart-post (>= 1.2, < 3)
38
+ faraday-cookie_jar (0.0.6)
39
+ faraday (>= 0.7.4)
40
+ http-cookie (~> 1.0.0)
41
+ faraday_middleware (0.10.0)
42
+ faraday (>= 0.7.4, < 0.10)
43
+ fastimage (1.9.0)
44
+ addressable (~> 2.3.5)
45
+ highline (1.7.8)
46
+ http-cookie (1.0.2)
47
+ domain_name (~> 0.5)
48
+ json (2.0.2)
49
+ multi_xml (0.5.5)
50
+ multipart-post (2.0.0)
51
+ plist (3.2.0)
52
+ rake (10.5.0)
53
+ rspec (3.1.0)
54
+ rspec-core (~> 3.1.0)
55
+ rspec-expectations (~> 3.1.0)
56
+ rspec-mocks (~> 3.1.0)
57
+ rspec-core (3.1.7)
58
+ rspec-support (~> 3.1.0)
59
+ rspec-expectations (3.1.2)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.1.0)
62
+ rspec-mocks (3.1.3)
63
+ rspec-support (~> 3.1.0)
64
+ rspec-support (3.1.2)
65
+ rspec_junit_formatter (0.2.3)
66
+ builder (< 4)
67
+ rspec-core (>= 2, < 4, != 2.12.0)
68
+ ruby-prof (0.15.9)
69
+ safe_yaml (1.0.4)
70
+ security (0.1.3)
71
+ simplecov (0.12.0)
72
+ docile (~> 1.1.0)
73
+ json (>= 1.8, < 3)
74
+ simplecov-html (~> 0.10.0)
75
+ simplecov-html (0.10.0)
76
+ spaceship (0.29.1)
77
+ colored
78
+ credentials_manager (>= 0.9.0)
79
+ faraday (~> 0.9)
80
+ faraday-cookie_jar (~> 0.0.6)
81
+ faraday_middleware (~> 0.9)
82
+ fastimage (~> 1.6)
83
+ multi_xml (~> 0.5)
84
+ plist (~> 3.1)
85
+ unf (0.1.4)
86
+ unf_ext
87
+ unf_ext (0.0.7.2)
88
+ webmock (1.21.0)
89
+ addressable (>= 2.3.6)
90
+ crack (>= 0.3.2)
91
+
92
+ PLATFORMS
93
+ ruby
94
+
95
+ DEPENDENCIES
96
+ bundler (~> 1.12)
97
+ motion-provisioning!
98
+ rake (~> 10.0)
99
+ rspec (~> 3.1.0)
100
+ rspec-prof!
101
+ rspec_junit_formatter (~> 0.2.3)
102
+ simplecov
103
+ webmock (~> 1.21.0)
104
+
105
+ BUNDLED WITH
106
+ 1.12.5
@@ -0,0 +1,46 @@
1
+ Copyright (c) 2015-2016, HipByte (info@hipbyte.com) and contributors.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ This project contains portions of fastlane:
25
+
26
+ The MIT License (MIT)
27
+
28
+ Copyright (c) 2015 Felix Krause
29
+
30
+ Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ of this software and associated documentation files (the "Software"), to deal
32
+ in the Software without restriction, including without limitation the rights
33
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34
+ copies of the Software, and to permit persons to whom the Software is
35
+ furnished to do so, subject to the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be included in all
38
+ copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ SOFTWARE.
@@ -0,0 +1,207 @@
1
+ # MotionProvisioning
2
+
3
+ Simplified provisioning for RubyMotion iOS, tvOS and macOS apps.
4
+
5
+ Getting started with iOS development has a very high barrier. Just
6
+ getting a app and device registered requires you to go through a *very*
7
+ complex web interface at developer.apple.com
8
+
9
+ MotionProvisioning significantly alleviates the pain of these steps.
10
+
11
+ By providing your developer account, MotionProvisioning automatically performs
12
+ the following tasks in the Developer Portal for you:
13
+
14
+ - Creates an application matching your app's name and bundle
15
+ identifier.
16
+ - Creates development and distribution certificates.
17
+ - Creates development, distribution and adhoc profiles.
18
+ - Registers iOS devices.
19
+
20
+ ![motion-provisioning in the terminal](img/motion-provisioning.gif)
21
+
22
+ ## Installation
23
+
24
+ Add this line to your application's Gemfile:
25
+
26
+ ```ruby
27
+ gem 'motion-provisioning'
28
+ ```
29
+
30
+ And then execute:
31
+
32
+ $ bundle
33
+
34
+ ## Configuration
35
+
36
+ MotionProvisioning provides two handy methods. Pass them to the
37
+ `app.codesign_certificate` and `app.provisioning_profile` options in
38
+ the Rakefile.
39
+
40
+ ```ruby
41
+ MotionProvisioning.certificate(platform: platform,
42
+ type: type
43
+ free: free)
44
+ ```
45
+
46
+ |Parameter|Description|
47
+ |---------|------|
48
+ |`platform`|`:ios`, `:tvos`, `:mac`|
49
+ |`type`|`:development`, `:distribution`, `:developer_id` (only mac)|
50
+ |`free`|`true` if you want to use a free developer account. Default: `false`|
51
+
52
+ ```ruby
53
+ MotionProvisioning.profile(bundle_identifier: bundle_identifier,
54
+ app_name: app_name,
55
+ platform: platform,
56
+ type: type
57
+ free: free)
58
+ ```
59
+
60
+ |Parameter|Description|
61
+ |---------|------|
62
+ |`bundle_identifier`|Pass `app.identifier`|
63
+ |`app_name`|Pass `app.name`|
64
+ |`platform`|`:ios`, `:tvos`, `:mac`|
65
+ |`type`|`:development`, `:distribution`, `:adhoc` (only iOS and tvOS), `:developer_id` (only mac)|
66
+ |`free`|`true` if you want to use a free developer account. Default: `false`|
67
+
68
+
69
+ Here's how you would configure an iOS app:
70
+
71
+ ```ruby
72
+ Motion::Project::App.setup do |app|
73
+ app.name = 'My App'
74
+ app.identifier = 'com.example.myapp'
75
+
76
+ app.development do
77
+ app.codesign_certificate = MotionProvisioning.certificate(
78
+ type: :development,
79
+ platform: :ios)
80
+
81
+ app.provisioning_profile = MotionProvisioning.profile(
82
+ bundle_identifier: app.identifier,
83
+ app_name: app.name,
84
+ platform: :ios,
85
+ type: :development)
86
+ end
87
+
88
+ app.release do
89
+ app.codesign_certificate = MotionProvisioning.certificate(
90
+ type: :distribution,
91
+ platform: :ios)
92
+
93
+ app.provisioning_profile = MotionProvisioning.profile(
94
+ bundle_identifier: app.identifier,
95
+ app_name: app.name,
96
+ platform: :ios,
97
+ type: :distribution)
98
+ end
99
+ end
100
+ ```
101
+
102
+ The certificates and profiles will be created and downloaded into a
103
+ `provisioning` folder in the root of your application folder as part of running
104
+ `rake archive:distribution` or `rake device`.
105
+
106
+ ## Developer account
107
+
108
+ The first time you run MotionProvisioning, you will be asked for your Apple ID
109
+ email. It will optionally be stored in a YAML config file in
110
+ `provisioning/config.yaml`.
111
+
112
+ You will then be asked for your password, which will be stored securely in the Keychain.
113
+
114
+ If your account belongs to multiple developer teams, you will be asked to select
115
+ the one you want to use. It will also optionally be stored in the config file.
116
+
117
+ If there are multiple team members, it's very important each team member uses a
118
+ different account. Read "Sharing cerfiticates" below to know more.
119
+
120
+ The config file will look like this:
121
+
122
+ ```yaml
123
+ email: foo@example.com
124
+ team_id: 5GU5F4
125
+ ```
126
+
127
+ Alternatively, you can provide all this information via environment variables:
128
+
129
+ MOTION_PROVISIONING_TEAM_ID
130
+ MOTION_PROVISIONING_EMAIL
131
+ MOTION_PROVISIONING_PASSWORD
132
+
133
+
134
+ ## Free developer account
135
+
136
+ If you dont have a paid Apple developer account, set the `free:`
137
+ option to `true` and a free development certificate and development
138
+ profile, valid to deploy to your device, will be created. You still
139
+ need a paid account to submit an app to the AppStore.
140
+
141
+ You can register a free developer account in
142
+ [developer.apple.com](https://developer.apple.com)
143
+
144
+ ## Sharing certificates
145
+
146
+ Apple imposes restrictions in the number of certificates you can
147
+ create:
148
+
149
+ - One development certificate per team member.
150
+ - One distribution certificate per team.
151
+
152
+ The distribution certificate (and it's corresponding private key) must
153
+ be shared between all team members who will be creating distribution
154
+ builds.
155
+
156
+ MotionProvisioning will ask before revoking the existing distribution
157
+ certificate and creating a new one.
158
+
159
+ After you create a new distribution certificate, share the
160
+ corresponding `.cer` and `.p12` files located in the `provisioning`
161
+ folder with your team members.
162
+
163
+ ## Recreate certificates and profiles
164
+
165
+ Once the certificates and profiles are cached in the `provisioning`
166
+ folder, if you want to re-create them, set the `recreate_profiles` or
167
+ `recreate_certificates` env variable.
168
+
169
+ For example, to recreate the development profile:
170
+
171
+ rake device recreate_profiles=1
172
+
173
+ ## Entitlements and App Services
174
+
175
+ MotionProvisioning does not (yet) manage entitlements and app services (like
176
+ HealthKit, HomeKit or iCloud). To enable them, you need to go to the Developer
177
+ Portal. Then, recreate your provisioning profile and add the appropriate
178
+ entitlements to the `app.entitlements` hash in your Rakefile.
179
+
180
+ ## Devices
181
+
182
+ If there are any iOS devices connected to the computer, and they are not
183
+ included in the provisioning profile, you will be asked to
184
+ register them in the Developer Portal and include them in the profile.
185
+
186
+ You can also add arbitrary device IDs by running:
187
+
188
+ rake "motion-provisioning:add-device[device_name,device_id]"
189
+
190
+ Then, you will need to recreate the profile to include the newly registered device:
191
+
192
+ rake device recreate_profiles=1
193
+
194
+ ## Testing
195
+
196
+ Run:
197
+
198
+ bin/setup
199
+ rspec
200
+
201
+ To generate profiling information:
202
+
203
+ SPEC_PROFILE=1 rspec
204
+
205
+ To generate coverage information:
206
+
207
+ SPEC_COVERAGE=1 rspec
@@ -0,0 +1,71 @@
1
+ require 'motion-provisioning'
2
+
3
+ desc "Generate the certificates needed by the test suite."
4
+ task :generate_certificates do
5
+ FileUtils.mkdir_p('spec/fixtures')
6
+ Dir.chdir('spec/fixtures') do
7
+ # Create the root certs
8
+ `openssl genrsa -out rootCA.p12 2048`
9
+ `openssl req -x509 -new -nodes -key rootCA.p12 -sha256 -days 1024 -out rootCA.pem -subj "/C=US/ST=California/L=San Francisco/O=Apple Inc./OU=IT Department/CN=MotionProvisioning ROOT"`
10
+ `security add-trusted-cert -k "#{Dir.home}/Library/Keychains/login.keychain" rootCA.pem`
11
+ `security import rootCA.pem`
12
+
13
+ [:ios, :mac].each do |platform|
14
+ [:development, :distribution].each do |type|
15
+ generate_certificate(platform, type)
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ # Generates a certificate for the specified platform and type
22
+ def generate_certificate(platform, type)
23
+ `openssl genrsa -out #{platform}_#{type}_private_key.p12 2048`
24
+ `openssl req -new -key #{platform}_#{type}_private_key.p12 -out #{platform}_#{type}.csr -subj "/C=US/ST=California/L=San Francisco/CN=#{platform} #{type}: MotionProvisioning/O=MotionProvisioning/OU=IT Department"`
25
+ `openssl x509 -req -extfile openssl.conf -extensions 'my server exts' -in #{platform}_#{type}.csr -CA rootCA.pem -CAkey rootCA.p12 -CAcreateserial -outform der -out #{platform}_#{type}_certificate.cer -days 500 -sha256`
26
+ end
27
+
28
+ # Run this from time to time to ensure everything is running in the Real World
29
+ # like expected.
30
+ desc "Create all types of certificates and profiles using a real developer account."
31
+ task :production_test do
32
+ require "bundler/setup"
33
+ require "motion-provisioning"
34
+ require "fileutils"
35
+
36
+ MotionProvisioning.client
37
+
38
+ num = rand(9999)
39
+ ios_app_id = "com.hipbyte.iostest#{num}"
40
+ ios_app = MotionProvisioning::Application.find_or_create(bundle_id: ios_app_id, name: "My iOS Test App")
41
+ [:ios, :tvos].each do |platform|
42
+ [:distribution, :adhoc, :development, :development_free].each do |type|
43
+ free = type == :development_free
44
+ type = :development if type == :development_free
45
+ cert_type = type == :development ? :development : :distribution
46
+ MotionProvisioning.certificate(type: cert_type, platform: :ios, free: free)
47
+ MotionProvisioning.profile(bundle_identifier: ios_app_id,
48
+ platform: platform,
49
+ app_name: "My iOS Test App",
50
+ type: type,
51
+ free: free)
52
+ FileUtils.rm(Dir.glob('provisioning/*.cer'))
53
+ end
54
+ end
55
+ ios_app.delete!
56
+
57
+ num = rand(9999)
58
+ mac_app_id = "com.hipbyte.mactest#{num}"
59
+ mac_app = MotionProvisioning::Application.find_or_create(bundle_id: mac_app_id, name: "My macOS Test App", mac: true)
60
+ platform = :mac
61
+ [:distribution, :development].each do |type|
62
+ MotionProvisioning.certificate(type: type, platform: :mac)
63
+ MotionProvisioning.profile(bundle_identifier: mac_app_id,
64
+ platform: platform,
65
+ app_name: "My macOS Test App",
66
+ type: type)
67
+ FileUtils.rm(Dir.glob('provisioning/*.cer'))
68
+ end
69
+ mac_app.delete!
70
+
71
+ end