helios_aim 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +173 -0
  4. data/LICENSE +19 -0
  5. data/README.md +363 -0
  6. data/Rakefile +10 -0
  7. data/bin/helios +20 -0
  8. data/helios_aim.gemspec +47 -0
  9. data/lib/helios.rb +27 -0
  10. data/lib/helios/backend.rb +64 -0
  11. data/lib/helios/backend/data.rb +40 -0
  12. data/lib/helios/backend/in-app-purchase.rb +43 -0
  13. data/lib/helios/backend/newsstand.rb +97 -0
  14. data/lib/helios/backend/passbook.rb +41 -0
  15. data/lib/helios/backend/push-notification.rb +110 -0
  16. data/lib/helios/commands.rb +4 -0
  17. data/lib/helios/commands/console.rb +21 -0
  18. data/lib/helios/commands/link.rb +19 -0
  19. data/lib/helios/commands/new.rb +76 -0
  20. data/lib/helios/commands/server.rb +52 -0
  21. data/lib/helios/frontend.rb +66 -0
  22. data/lib/helios/frontend/fonts/icons.eot +0 -0
  23. data/lib/helios/frontend/fonts/icons.ttf +0 -0
  24. data/lib/helios/frontend/fonts/icons.woff +0 -0
  25. data/lib/helios/frontend/images/bg.jpg +0 -0
  26. data/lib/helios/frontend/images/helios.svg +33 -0
  27. data/lib/helios/frontend/javascripts/helios.coffee +72 -0
  28. data/lib/helios/frontend/javascripts/helios/collections.coffee +99 -0
  29. data/lib/helios/frontend/javascripts/helios/models.coffee +23 -0
  30. data/lib/helios/frontend/javascripts/helios/router.coffee +50 -0
  31. data/lib/helios/frontend/javascripts/helios/views.coffee +307 -0
  32. data/lib/helios/frontend/javascripts/vendor/backbone.datagrid.js +662 -0
  33. data/lib/helios/frontend/javascripts/vendor/backbone.js +1487 -0
  34. data/lib/helios/frontend/javascripts/vendor/backbone.paginator.js +1046 -0
  35. data/lib/helios/frontend/javascripts/vendor/codemirror.javascript.js +411 -0
  36. data/lib/helios/frontend/javascripts/vendor/codemirror.js +3047 -0
  37. data/lib/helios/frontend/javascripts/vendor/date.js +104 -0
  38. data/lib/helios/frontend/javascripts/vendor/foundation.js +331 -0
  39. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.alerts.js +50 -0
  40. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.clearing.js +478 -0
  41. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.cookie.js +74 -0
  42. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.dropdown.js +122 -0
  43. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.forms.js +403 -0
  44. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.joyride.js +613 -0
  45. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.magellan.js +130 -0
  46. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.orbit.js +355 -0
  47. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.placeholder.js +159 -0
  48. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.reveal.js +272 -0
  49. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.section.js +183 -0
  50. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.tooltips.js +195 -0
  51. data/lib/helios/frontend/javascripts/vendor/foundation/foundation.topbar.js +208 -0
  52. data/lib/helios/frontend/javascripts/vendor/jquery.js +9597 -0
  53. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload-ui.js +807 -0
  54. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload.js +1201 -0
  55. data/lib/helios/frontend/javascripts/vendor/jquery/jquery.ui.widget.js +530 -0
  56. data/lib/helios/frontend/javascripts/vendor/linkheaders.js +117 -0
  57. data/lib/helios/frontend/javascripts/vendor/underscore.js +1227 -0
  58. data/lib/helios/frontend/stylesheets/_codemirror.sass +219 -0
  59. data/lib/helios/frontend/stylesheets/_fonts.sass +80 -0
  60. data/lib/helios/frontend/stylesheets/_iphone.sass +141 -0
  61. data/lib/helios/frontend/stylesheets/_settings.scss +989 -0
  62. data/lib/helios/frontend/stylesheets/screen.sass +187 -0
  63. data/lib/helios/frontend/templates/data/entities.jst.tpl +11 -0
  64. data/lib/helios/frontend/templates/in-app-purchase/receipts.jst.tpl +11 -0
  65. data/lib/helios/frontend/templates/navigation.jst.tpl +31 -0
  66. data/lib/helios/frontend/templates/newsstand/issues.jst.tpl +16 -0
  67. data/lib/helios/frontend/templates/newsstand/new.jst.tpl +28 -0
  68. data/lib/helios/frontend/templates/passbook/passes.jst.tpl +11 -0
  69. data/lib/helios/frontend/templates/push-notification/compose.jst.tpl +70 -0
  70. data/lib/helios/frontend/templates/push-notification/devices.jst.tpl +17 -0
  71. data/lib/helios/frontend/views/index.haml +22 -0
  72. data/lib/helios/templates/.env.erb +1 -0
  73. data/lib/helios/templates/.gitignore +3 -0
  74. data/lib/helios/templates/Gemfile.erb +10 -0
  75. data/lib/helios/templates/Procfile.erb +1 -0
  76. data/lib/helios/templates/README.md.erb +4 -0
  77. data/lib/helios/templates/config.ru.erb +11 -0
  78. data/lib/helios/version.rb +3 -0
  79. metadata +475 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2QyM2QxMGE3Y2VmMWJkZjUzZThmZGY4YzMzNjEzMjNmNTBhNDU2YQ==
5
+ data.tar.gz: !binary |-
6
+ Y2Q4NDAxYmJlNDg5ZjRjOTRkMDYzNjk1MjBkZDk5MWUxMzcyOGFjNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OGQ2YTg3YzAyMmU0ZGY4MDVmZWJhYTZlMWJlZmIzYTNiODdiMTVmYjcyYmZl
10
+ NDZkY2QzMDRmNDEyMWY1OTA5OGZlNmI3NjJiMjViMzA0YjI1NzdlYWE3ODRj
11
+ OTEzYTIzZjMxNWUyOGU3YjQ2NzUzNTc0ZDg1NGI4N2NiYzg1YTQ=
12
+ data.tar.gz: !binary |-
13
+ Y2Y3NzYzNzk3MzY2ZmFkYWFlMmZhNjI4ZjhhMjE4Yjk0OTBkYjRhZmUxMmZj
14
+ YmY2ZGVjNDc4MTY0MTE2NmU5ZWMyN2JmZjMxNzc1NmIwODU4MjlkNTcwMjZi
15
+ ZTE1YzcyMzUzNGFhMzE3ZjBjYjUyNmMwOGVjMTg0YzQ2MjJiMzY=
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,173 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ helios (0.2.2)
5
+ coffee-script (~> 2.2)
6
+ commander (~> 4.1)
7
+ compass (~> 0.12)
8
+ core_data
9
+ fog (~> 1.10)
10
+ foreman (~> 0.63)
11
+ haml (>= 3.1)
12
+ houston (~> 0.2)
13
+ json (~> 1.7)
14
+ rack-contrib (~> 1.1)
15
+ rack-in-app-purchase (~> 0.1)
16
+ rack-newsstand (~> 0.1)
17
+ rack-passbook (~> 0.1)
18
+ rack-push-notification (~> 0.4)
19
+ rack-scaffold_aim
20
+ rails-database-url (~> 1.0)
21
+ sinatra (~> 1.3)
22
+ sinatra-assetpack (~> 0.2.2)
23
+ sinatra-backbone (~> 0.1.1)
24
+ sinatra-contrib (~> 1.3)
25
+ sinatra-param (~> 0.1)
26
+ sinatra-support (~> 1.2)
27
+ zurb-foundation (= 4.1.2)
28
+
29
+ GEM
30
+ remote: https://rubygems.org/
31
+ specs:
32
+ activesupport (3.2.13)
33
+ i18n (= 0.6.1)
34
+ multi_json (~> 1.0)
35
+ backports (3.3.0)
36
+ builder (3.2.0)
37
+ chunky_png (1.2.8)
38
+ coffee-script (2.2.0)
39
+ coffee-script-source
40
+ execjs
41
+ coffee-script-source (1.6.2)
42
+ commander (4.1.3)
43
+ highline (~> 1.6.11)
44
+ compass (0.12.2)
45
+ chunky_png (~> 1.2)
46
+ fssm (>= 0.2.7)
47
+ sass (~> 3.1)
48
+ core_data (0.1.1)
49
+ nokogiri (~> 1.4)
50
+ diff-lcs (1.2.4)
51
+ dotenv (0.7.0)
52
+ eventmachine (1.0.3)
53
+ excon (0.21.0)
54
+ execjs (1.4.0)
55
+ multi_json (~> 1.0)
56
+ fog (1.11.1)
57
+ builder
58
+ excon (~> 0.20)
59
+ formatador (~> 0.2.0)
60
+ json (~> 1.7)
61
+ mime-types
62
+ net-scp (~> 1.1)
63
+ net-ssh (>= 2.1.3)
64
+ nokogiri (~> 1.5.0)
65
+ ruby-hmac
66
+ foreman (0.63.0)
67
+ dotenv (>= 0.7)
68
+ thor (>= 0.13.6)
69
+ formatador (0.2.4)
70
+ fssm (0.2.10)
71
+ haml (4.0.2)
72
+ tilt
73
+ highline (1.6.18)
74
+ houston (0.2.2)
75
+ commander (~> 4.1)
76
+ json
77
+ i18n (0.6.1)
78
+ jsmin (1.0.1)
79
+ json (1.7.7)
80
+ mime-types (1.23)
81
+ multi_json (1.7.3)
82
+ net-scp (1.1.0)
83
+ net-ssh (>= 2.6.5)
84
+ net-ssh (2.6.7)
85
+ nokogiri (1.5.9)
86
+ plist (3.1.0)
87
+ rack (1.5.2)
88
+ rack-contrib (1.1.0)
89
+ rack (>= 0.9.1)
90
+ rack-in-app-purchase (0.1.0)
91
+ rack (~> 1.4)
92
+ sequel (~> 3.37)
93
+ sinatra (~> 1.3)
94
+ venice
95
+ rack-newsstand (0.1.1)
96
+ builder (>= 3.0)
97
+ plist (~> 3.1)
98
+ rack (~> 1.4)
99
+ sequel (~> 3.37)
100
+ sinatra (~> 1.3)
101
+ rack-passbook (0.1.1)
102
+ rack (~> 1.4)
103
+ sequel (~> 3.37)
104
+ sinatra (~> 1.3)
105
+ rack-protection (1.5.0)
106
+ rack
107
+ rack-push-notification (0.4.1)
108
+ rack (~> 1.4)
109
+ rack-contrib (~> 1.1)
110
+ sequel (~> 3.37)
111
+ sinatra (~> 1.3)
112
+ sinatra-param (~> 0.1)
113
+ rack-scaffold_aim (>= 0.0.1)
114
+ activesupport (>= 3.0)
115
+ rack (~> 1.4)
116
+ rack-contrib (~> 1.1)
117
+ sinatra (~> 1.3)
118
+ sinatra-param (~> 0.1)
119
+ rack-test (0.6.2)
120
+ rack (>= 1.0)
121
+ rails-database-url (1.0.0)
122
+ rake (10.0.4)
123
+ rspec (2.13.0)
124
+ rspec-core (~> 2.13.0)
125
+ rspec-expectations (~> 2.13.0)
126
+ rspec-mocks (~> 2.13.0)
127
+ rspec-core (2.13.1)
128
+ rspec-expectations (2.13.0)
129
+ diff-lcs (>= 1.1.3, < 2.0)
130
+ rspec-mocks (2.13.1)
131
+ ruby-hmac (0.4.0)
132
+ sass (3.2.9)
133
+ sequel (3.47.0)
134
+ sinatra (1.4.2)
135
+ rack (~> 1.5, >= 1.5.2)
136
+ rack-protection (~> 1.4)
137
+ tilt (~> 1.3, >= 1.3.4)
138
+ sinatra-assetpack (0.2.2)
139
+ backports
140
+ jsmin
141
+ rack-test
142
+ sinatra
143
+ tilt (>= 1.3.0)
144
+ sinatra-backbone (0.1.1)
145
+ sinatra
146
+ sinatra-contrib (1.4.0)
147
+ backports (>= 2.0)
148
+ eventmachine
149
+ rack-protection
150
+ rack-test
151
+ sinatra (~> 1.4.2)
152
+ tilt (~> 1.3)
153
+ sinatra-param (0.1.3)
154
+ sinatra (~> 1.3)
155
+ sinatra-support (1.2.2)
156
+ sinatra (>= 1.0)
157
+ terminal-table (1.4.5)
158
+ thor (0.18.1)
159
+ tilt (1.4.1)
160
+ venice (0.1.0)
161
+ commander (~> 4.1)
162
+ json
163
+ terminal-table (~> 1.4)
164
+ zurb-foundation (4.1.2)
165
+ sass (>= 3.2.0)
166
+
167
+ PLATFORMS
168
+ ruby
169
+
170
+ DEPENDENCIES
171
+ helios!
172
+ rake
173
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Heroku (http://heroku.com/)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,363 @@
1
+ ![Helios - an extensible open source mobile backend framework](https://raw.github.com/helios-framework/helios.io/assets/helios-banner.png)
2
+
3
+ Helios is an open-source framework that provides essential backend services for iOS apps, from data synchronization and user accounts to push notifications, in-app purchases, and passbook integration. It allows developers to get a client-server app up-and-running in just a few minutes, and seamlessly incorporate functionality as necessary.
4
+
5
+ Helios is designed for "mobile first" development. Build out great features on the device, and implement the server-side components as necessary. Pour all of your energy into crafting a great user experience, rather than getting mired down with the backend.
6
+
7
+ One great example of this philosophy in Helios is Core Data Synchronization. This allows you to use your existing Core Data model definition to automatically generate a REST webservice, which can be used to shuttle data between the server and client. No iCloud, _no problem_.
8
+
9
+ ![Helios Web UI Screenshot](https://raw.github.com/helios-framework/helios.io/assets/helios-screenshot.png)
10
+
11
+ Helios also comes with a Web UI. Browse and search through all of your database records, push notification registrations, in-app purchases, and passbook passes. You can even send targeted push notifications right from the browser.
12
+
13
+ ---
14
+
15
+ ## Requirements
16
+
17
+ - Ruby 1.9
18
+ - PostgreSQL 9.1 _([Postgres.app](http://postgresapp.com) is the easiest way to get a Postgres server running on your Mac)_
19
+
20
+ ## Getting Started on OS X
21
+
22
+ 1. Verify Ruby Installation:
23
+
24
+ `$ ruby -v`
25
+
26
+ > If you do not see `ruby 1.9.x` printed, we suggest installing [RVM](http://rvm.io) to manage Ruby versions.
27
+
28
+ 2. Install Helios at the command prompt:
29
+
30
+ `$ gem install helios`
31
+
32
+ 3. Create a new Helios application:
33
+
34
+ `$ helios new myapp`
35
+
36
+ 3. Create a Postgres database at the command prompt:
37
+
38
+ `$ createdb -h localhost myapp`
39
+
40
+ > Database credentials are read from the `.env` file generated by Helios, as the variable `DATABASE_URL`. By default, this will point to a database with the name of the generated app.
41
+
42
+ 4. Change directory to `myapp`
43
+
44
+ `$ cd myapp`
45
+
46
+ 5. Start the web server:
47
+
48
+ `$ helios server`
49
+
50
+ 6. Go to [http://localhost:5000/admin](http://localhost:5000/admin) and you’ll see your app's Web UI
51
+
52
+ Read on for instructions on the following:
53
+
54
+ - Linking a Core Data model
55
+ - Integrating Helios into your mobile client
56
+
57
+ ## Usage
58
+
59
+ Built on the Rack webserver interface, Helios can be easily added into any existing Rails or Sinatra application as middleware. Or, if you're starting with a Helios application, you can build a new Rails or Sinatra application on top of it.
60
+
61
+ This means that you can develop your application using the tools and frameworks you love, and maintain flexibility with your architecture as your needs evolve.
62
+
63
+ ### Sinatra / Rack
64
+
65
+ #### Gemfile
66
+
67
+ ```ruby
68
+ gem 'helios'
69
+ ```
70
+
71
+ #### config.ru
72
+
73
+ ```ruby
74
+ require 'bundler'
75
+ Bundler.require
76
+
77
+ run Helios::Application.new do
78
+ service :data, model: 'path/to/DataModel.xcdatamodel'
79
+ service :push_notification, apn_certificate: 'path/to/apple_push_notification.pem', apn_environment: 'development'
80
+ service :in_app_purchase
81
+ service :passbook
82
+ end
83
+ ```
84
+
85
+ ### Rails
86
+
87
+ To create a Rails app that uses Postgres as its database, pass the `-d postgresql` argument to the `rails new` command:
88
+
89
+ $ rails new APP_PATH -d postgresql
90
+
91
+ If you're adding Helios to an existing Rails project, be sure to specify a PostgreSQL database in `config/database.yml` and check that the `pg` gem is included in your `Gemfile`:
92
+
93
+ #### Gemfile
94
+
95
+ gem 'helios'
96
+ gem 'pg'
97
+
98
+ Helios can be run as Rails middleware by adding this to the configuration block in `config/application.rb`
99
+
100
+ #### config/application.rb
101
+
102
+ ```ruby
103
+ config.middleware.use Helios::Application do
104
+ service :data, model: 'path/to/DataModel.xcdatamodel'
105
+ service :push_notification, apn_certificate: 'path/to/apple_push_notification.pem', apn_environment: 'development'
106
+ service :in_app_purchase
107
+ service :passbook
108
+ end
109
+ ```
110
+
111
+ ## Available Services
112
+
113
+ Each service in Helios can be enabled and configured separately:
114
+
115
+ `data`: Generates a REST webservice from a schema definition. Currently supports Core Data (`.xcdatamodel`) files.
116
+
117
+ **Parameters**
118
+
119
+ - `model`: Path to the data model file
120
+
121
+ **Associated Classes**
122
+
123
+ Each entity in the specified data model will have a `Sequel::Model` subclass created for it under the `Rack::CoreData::Models` namespace.
124
+
125
+ <table>
126
+ <caption>Endpoints</caption>
127
+ <tr>
128
+ <td><tt>GET /:resources</tt></td>
129
+ <td>Get list of all of the specified resources</td>
130
+ </tr>
131
+ <tr>
132
+ <td><tt>POST /:resources</tt></td>
133
+ <td>Create a new instance of the specified resource</td>
134
+ </tr>
135
+ <tr>
136
+ <td><tt>GET /:resources/:id</tt></td>
137
+ <td>Get the specified resource instance</td>
138
+ </tr>
139
+ <tr>
140
+ <td><tt>PUT /:resources/:id</tt></td>
141
+ <td>Update the specified resource instance</td>
142
+ </tr>
143
+ <tr>
144
+ <td><tt>DELETE /:resources/:id</tt></td>
145
+ <td>Delete the specified resource instance</td>
146
+ </tr>
147
+ </table>
148
+
149
+ ---
150
+
151
+ `push_notification`: Adds iOS push notification registration / unregistration endpoints.
152
+
153
+ **Associated Classes**
154
+
155
+ - `Rack::PushNotification::Device`
156
+
157
+ <table>
158
+ <caption>Endpoints</caption>
159
+ <tr>
160
+ <td><tt>PUT /devices/:token</tt></td>
161
+ <td>Register or update existing device for push notifications</td>
162
+ </tr>
163
+ <tr>
164
+ <td><tt>DELETE /devices/:token</tt></td>
165
+ <td>Unregister a device from receiving push notifications</td>
166
+ </tr>
167
+ <tr>
168
+ <td><tt>POST /message</tt></td>
169
+ <td>Send out a push notification to some devices</td>
170
+ </tr>
171
+ </table>
172
+
173
+ ---
174
+
175
+ `in_app_purchase`: Adds an endpoint for iOS in-app purchase receipt verification endpoints, as well one for returning product identifiers.
176
+
177
+ **Associated Classes**
178
+
179
+ - `Rack::InAppPurchase::Receipt`
180
+ - `Rack::InAppPurchase::Product`
181
+
182
+ <table>
183
+ <caption>Endpoints</caption>
184
+ <tr>
185
+ <td><tt>POST /receipts/verify</tt></td>
186
+ <td>Decode the associated Base64-encoded <tt>receipt-data</tt>, recording the receipt data and verifying the information with Apple</td>
187
+ </tr>
188
+ <tr>
189
+ <td><tt>GET /products/identifiers</tt></td>
190
+ <td>Return an array of valid product identifiers</td>
191
+ </tr>
192
+ </table>
193
+
194
+ ---
195
+
196
+ `passbook`: Adds endpoints for the [web service protocol](https://developer.apple.com/library/prerelease/ios/#documentation/PassKit/Reference/PassKit_WebService/WebService.html) for communicating with Passbook
197
+
198
+ **Associated Classes**
199
+
200
+ - `Rack::Passbook::Pass`
201
+ - `Rack::Passbook::Registration`
202
+
203
+ <table>
204
+ <caption>Endpoints</caption>
205
+ <tr>
206
+ <td><tt>GET /v1/passes/:passTypeIdentifier/:serialNumber</tt></td>
207
+ <td>Get the Latest Version of a Pass</td>
208
+ </tr>
209
+ <tr>
210
+ <td><tt>GET /v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier[?passesUpdatedSince=tag]</tt></td>
211
+ <td>Get the Serial Numbers for Passes Associated with a Device</td>
212
+ </tr>
213
+ <tr>
214
+ <td><tt>POST /v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier/:serialNumber</tt></td>
215
+ <td>Register a Device to Receive Push Notifications for a Pass</td>
216
+ </tr>
217
+ <tr>
218
+ <td><tt>DELETE /v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier/:serialNumber</tt></td>
219
+ <td>Unregister a Device</td>
220
+ </tr>
221
+ </table>
222
+
223
+ ## Command-Line Interface
224
+
225
+ Helios comes with a CLI to help create and manage your application. After you `$ gem install helios`, you'll have the `helios` binary available.
226
+
227
+ $ helios --help
228
+ helios
229
+
230
+ A command-line interface for building mobile infrastructures
231
+
232
+ Commands:
233
+ console Open IRB session with Helios environment
234
+ help Display global or [command] help documentation.
235
+ link Links a Core Data model
236
+ new Creates a new Helios project
237
+ server Start running Helios locally
238
+
239
+ ### Creating an Application
240
+
241
+ The first step to using Helios is to create a new application. This can be done with the `$ helios new` command, which should be familiar if you've ever used Rails.
242
+
243
+ $ helios new --help
244
+
245
+ Usage: helios new path/to/app
246
+
247
+ The `helios new` command creates a new Helios application with a default
248
+ directory structure and configuration at the path you specify.
249
+
250
+ Options:
251
+ --skip-gemfile Don't create a Gemfile
252
+ -B, --skip-bundle Don't run bundle install
253
+ -G, --skip-git Don't create a git repository
254
+ --edge Setup the application with Gemfile pointing to Helios repository
255
+ -f, --force Overwrite files that already exist
256
+ -p, --pretend Run but do not make any changes
257
+ -s, --skip Skip files that already exist
258
+
259
+ ### Linking a Core Data Model
260
+
261
+ In order to keep your data model and REST webservices in sync, you can link it to your helios application:
262
+
263
+ $ helios link path/to/DataModel.xcdatamodel
264
+
265
+ This creates a hard link between the data model file in your Xcode and Helios projects—any changes made to either file will affect both. The next time you start the server, Helios will automatically migrate the database to create tables and insert columns to accomodate any new entities or attributes.
266
+
267
+ ### Starting the Application Locally
268
+
269
+ To run Helios in development mode on `localhost`, run the `server` command:
270
+
271
+ $ helios server
272
+
273
+ ### Testing Push Notifications
274
+
275
+ Once you have registered a device and set up your certificate, try this:
276
+
277
+ $ curl -X POST -d 'payload={"aps": {"alert":"Blastoff!"}}' http://localhost:5000/message
278
+
279
+ ### Running the Helios Console
280
+
281
+ You can start an IRB session with the runtime environment of the Helios application with the `console` command:
282
+
283
+ $ helios console
284
+
285
+ This command activates the services as configured by your Helios application, including any generated Core Data models. The `rack` module is automatically included on launch, allowing you to access everything more directly:
286
+
287
+ > Passbook::Passes.all # => [...]
288
+
289
+ ## Deploying to Heroku
290
+
291
+ [Heroku](http://www.heroku.com) is the easiest way to get your app up and running. For full instructions on how to get started, check out ["Getting Started with Ruby on Heroku"](https://devcenter.heroku.com/articles/ruby).
292
+
293
+ Once you've installed the [Heroku Toolbelt](https://toolbelt.heroku.com), and have a Heroku account, enter the following commands from the project directory:
294
+
295
+ $ heroku create
296
+ $ git push heroku master
297
+
298
+ ## Integrating with an iOS Application
299
+
300
+ ### Core Data Synchronization
301
+
302
+ With [AFIncrementalStore](https://github.com/AFNetworking/AFIncrementalStore), you can integrate your Helios app directly into the Core Data stack. Whether it’s a fetch or save changes request, or fulfilling an attribute or relation fault, AFIncrementalStore handles all of the networking needed to read and write to and from the server.
303
+
304
+ See ["Building an iOS App with AFIncrementalStore and the Core Data Buildpack"](https://devcenter.heroku.com/articles/ios-core-data-buildpack-app) on the Heroku Dev Center for a comprehensive guide on how to use AFIncrementalStore with the Core Data buildpack. An article for Helios is forthcoming, but aside from deployment, the instructions are essentially unchanged.
305
+
306
+ ### Push Notification Registration
307
+
308
+ With [Orbiter](https://github.com/mattt/Orbiter) you can integrate Push Notifications into your app easily.
309
+
310
+ ```objective-c
311
+ - (void)application:(UIApplication *)application
312
+ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
313
+ {
314
+ NSURL *serverURL = [NSURL URLWithString:@"http://raging-notification-3556.herokuapp.com/"];
315
+ Orbiter *orbiter = [[Orbiter alloc] initWithBaseURL:serverURL credential:nil];
316
+ [orbiter registerDeviceToken:deviceToken withAlias:nil success:^(id responseObject) {
317
+ NSLog(@"Registration Success: %@", responseObject);
318
+ } failure:^(NSError *error) {
319
+ NSLog(@"Registration Error: %@", error);
320
+ }];
321
+ }
322
+ ```
323
+
324
+ ### Converting Your Push Notification Certificate
325
+
326
+ > These instructions come from the [APN on Rails](https://github.com/PRX/apn_on_rails) project.
327
+
328
+ Once you have the certificate from Apple for your application, export your key
329
+ and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:
330
+
331
+ 1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
332
+ 2. Right click and choose `Export 2 items…`.
333
+ 3. Choose the p12 format from the drop down and name it `cert.p12`.
334
+
335
+ Now covert the p12 file to a pem file:
336
+
337
+ $ openssl pkcs12 -in cert.p12 -out apple_push_notification.pem -nodes -clcerts
338
+
339
+ ## Coming Attractions
340
+
341
+ There's still a lot to do to make Helios even better. Here are some ideas that are at the top of the list:
342
+
343
+ - Test coverage
344
+ - More documentation
345
+ - More example projects
346
+ - Better RubyMotion integration
347
+ - Support for multiple schema definitions (not just Core Data)
348
+ - Send push notifications from the UI
349
+ - Support for additional platforms (Android, WP7)
350
+
351
+ ---
352
+
353
+ ## Contact
354
+
355
+ Mattt Thompson
356
+
357
+ - http://github.com/mattt
358
+ - http://twitter.com/mattt
359
+ - <mattt@heroku.com>
360
+
361
+ ## License
362
+
363
+ Helios is released under the [MIT](http://opensource.org/licenses/MIT) license.