apple_manifest_rails 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +14 -6
- data/README.md +40 -23
- data/app/controllers/apple_manifest_rails/manifest_controller.rb +7 -8
- data/app/views/apple_manifest_rails/manifest/check_install.html.haml +1 -1
- data/app/views/apple_manifest_rails/manifest/enroll.html.haml +1 -1
- data/app/views/layouts/apple_manifest_rails/application.html.erb +1 -1
- data/config/routes.rb +3 -3
- data/lib/apple_manifest_rails.rb +36 -4
- data/lib/{apple_manifest → apple_manifest_rails}/enroll/mobile_config.rb +2 -2
- data/lib/{apple_manifest → apple_manifest_rails}/enroll/response_parser.rb +1 -1
- data/lib/{apple_manifest → apple_manifest_rails}/install/checker.rb +8 -8
- data/lib/{apple_manifest → apple_manifest_rails}/install/ipa.rb +5 -9
- data/lib/apple_manifest_rails/template_dir.rb +30 -0
- data/lib/apple_manifest_rails/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGMyNGZjOTA5NzBiZmY5NGRiM2FjNDE0ZTFiOGU5MWRkZGFlYzIzYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGMzYzM4M2QwY2FlOThjNmUyOGE5NDFkZDIwMmQ5ZGU3YmY0YzJhNg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGVmZWQ0ZjEyOTBiN2UyMWM3Y2QzNmI3ZjE4MTA3MTc5N2E1M2Q2MDNjYmM2
|
10
|
+
OTdmNmZmY2RhMTcxOTVhMDEwYmU5NGM0NTUxNjRlZTZhYWZlYjEyNWU4NGM3
|
11
|
+
ZGIwMDJiYjJiY2ZiZmFjN2E5MTM2YTVkYmQ5NWI4MjYxMTk3Mzg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODk3OTA2NTNjYTNiYzhiNjQxMDBjNjZjYTliMjM3NGU5NjVhYmEwNzk2ZWZk
|
14
|
+
OWEwZjNlZjE4ZDAyZGEwYWU0YjIwMmFlY2ZmZWM4ZTg1N2Q5ZWZjNGFmNWNj
|
15
|
+
NWUwYWNiYTViZjlkYzQ3NGEyY2VmM2Y3ZTM5MjU5YzliMjVjNGY=
|
data/README.md
CHANGED
@@ -4,17 +4,53 @@ Mountable Rails engine for capturing iOS UDID, check if IPA is installable, and
|
|
4
4
|
|
5
5
|
Created for a Rails 3.2 app, might work in Rails 4, but I haven't tried. Let me know if it works!
|
6
6
|
|
7
|
+
## Configuration
|
8
|
+
|
9
|
+
By default, the engine assumes the following directory structure in your rails project:
|
10
|
+
|
11
|
+
```
|
12
|
+
rails_application/
|
13
|
+
app/
|
14
|
+
config/
|
15
|
+
...
|
16
|
+
mobile_build/ <------------- config.template_dir
|
17
|
+
builds/
|
18
|
+
app.ipa <------------- config.ipa_path
|
19
|
+
manifest.plist
|
20
|
+
Profile.mobileconfig
|
21
|
+
```
|
22
|
+
|
23
|
+
The app.ipa file is the actual compiled binary archive from Xcode. The engine will look at the embedded.mobileprovision to check if the client is installable.
|
24
|
+
|
25
|
+
### Important Info
|
26
|
+
|
27
|
+
The plist and mobileconfig files are part of the UDID capture and install processes, they are templates that will be modified before being sent to the client. See the `templates` directory for what these files need to look like. Customize them to your liking and make sure they exist where expected.
|
28
|
+
|
29
|
+
The engine will not work without these.
|
30
|
+
|
31
|
+
### Custom Initializer
|
32
|
+
|
33
|
+
Optionally, you can override these defaults by setting up an initializer in your rails app, e.g. `config/initializers/apple_manifest_rails.rb`
|
34
|
+
|
35
|
+
```
|
36
|
+
AppleManifestRails.configure do |config|
|
37
|
+
config.page_title = "Who needs testflight? I've got apple_manifest_rails!"
|
38
|
+
config.template_dir = Rails.root.join('apple_manifest_rails', 'templates')
|
39
|
+
config.ipa_path = Rails.root.join('apple_manifest_rails', 'binaries', 'my_custom.ipa')
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
7
43
|
## Install
|
8
44
|
|
9
|
-
1
|
45
|
+
Step 1: Add to your rails gemfile
|
10
46
|
|
11
47
|
```ruby
|
12
48
|
gem 'apple_manifest_rails'
|
13
49
|
```
|
14
50
|
|
15
|
-
2
|
51
|
+
Step 2: `bundle install`
|
16
52
|
|
17
|
-
3
|
53
|
+
Step 3: Mount the engine in `config/routes.rb`
|
18
54
|
|
19
55
|
```ruby
|
20
56
|
Example::Application.routes.draw do
|
@@ -22,26 +58,7 @@ Example::Application.routes.draw do
|
|
22
58
|
end
|
23
59
|
```
|
24
60
|
|
25
|
-
4
|
26
|
-
|
27
|
-
## Configure
|
28
|
-
|
29
|
-
The engine assumes the following directory structure in your rails project
|
30
|
-
```
|
31
|
-
rails_application/
|
32
|
-
app/
|
33
|
-
config/
|
34
|
-
...
|
35
|
-
mobile_build/
|
36
|
-
builds/
|
37
|
-
app.ipa
|
38
|
-
manifest.plist
|
39
|
-
Profile.mobileconfig
|
40
|
-
```
|
41
|
-
|
42
|
-
The plist and mobileconfig files are part of the UDID capture and install processes, they are templates that will be modified before being sent to the client. See the `templates` directory for what these files need to look like. Customize them to your liking.
|
43
|
-
|
44
|
-
The app.ipa file is the actual compiled binary archive from Xcode. The engine will look at the embedded.mobileprovision to check if the client is installable.
|
61
|
+
Step 4: Start your `rails server` and navigate iOS Safari to `/enroll` or `/install` (aliased)
|
45
62
|
|
46
63
|
## Contributing
|
47
64
|
|
@@ -8,13 +8,13 @@ module AppleManifestRails
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def mobileconfig
|
11
|
-
enroll =
|
11
|
+
enroll = AppleManifestRails::Enroll::MobileConfig.new(request)
|
12
12
|
enroll.write_mobileconfig
|
13
13
|
send_file enroll.outfile_path, type: enroll.mime_type
|
14
14
|
end
|
15
15
|
|
16
16
|
def extract_udid
|
17
|
-
parser =
|
17
|
+
parser = AppleManifestRails::Enroll::ResponseParser.new(request)
|
18
18
|
udid = parser.get 'UDID'
|
19
19
|
version = parser.get 'VERSION'
|
20
20
|
product = parser.get 'PRODUCT'
|
@@ -25,8 +25,8 @@ module AppleManifestRails
|
|
25
25
|
# Check install
|
26
26
|
def check_install
|
27
27
|
@udid = params[:udid]
|
28
|
-
@checker =
|
29
|
-
set_itms_url if @checker.installable?
|
28
|
+
@checker = AppleManifestRails::Install::Checker.new
|
29
|
+
set_itms_url if @checker.installable?(@udid)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Install (Send IPA)
|
@@ -36,7 +36,7 @@ module AppleManifestRails
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def manifest
|
39
|
-
install =
|
39
|
+
install = AppleManifestRails::Install::IPA.new(request)
|
40
40
|
install.write_manifest
|
41
41
|
send_file install.manifest_path
|
42
42
|
end
|
@@ -47,12 +47,11 @@ module AppleManifestRails
|
|
47
47
|
|
48
48
|
private
|
49
49
|
def ipa_path
|
50
|
-
|
51
|
-
Rails.root.join('mobile_build', 'builds', filename).to_s
|
50
|
+
AppleManifestRails.ipa_path
|
52
51
|
end
|
53
52
|
|
54
53
|
def set_itms_url
|
55
|
-
@itms_url =
|
54
|
+
@itms_url = AppleManifestRails::Install::IPA.new(request).itms_uri
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title
|
4
|
+
<title><%= AppleManifestRails.page_title %></title>
|
5
5
|
<%= stylesheet_link_tag "apple_manifest_rails/application", :media => "all" %>
|
6
6
|
<%= javascript_include_tag "apple_manifest_rails/application" %>
|
7
7
|
<%= csrf_meta_tags %>
|
data/config/routes.rb
CHANGED
@@ -3,7 +3,7 @@ AppleManifestRails::Engine.routes.draw do
|
|
3
3
|
get "/enroll/mobileconfig" => "manifest#mobileconfig"
|
4
4
|
post "/enroll/mobileconfig/extract_udid" => "manifest#extract_udid"
|
5
5
|
get "/enroll/mobileconfig/extract_udid/check_install" => "manifest#check_install"
|
6
|
-
get "/install" => "manifest#
|
6
|
+
get "/install" => "manifest#enroll"
|
7
7
|
get "/apple_manifest/manifest.plist" => "manifest#manifest"
|
8
|
-
get "/install/
|
9
|
-
end
|
8
|
+
get "/install/app.ipa" => "manifest#send_ipa"
|
9
|
+
end
|
data/lib/apple_manifest_rails.rb
CHANGED
@@ -1,9 +1,41 @@
|
|
1
1
|
require "apple_manifest_rails/engine"
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "
|
5
|
-
require "
|
6
|
-
require "
|
3
|
+
require "apple_manifest_rails/enroll/mobile_config"
|
4
|
+
require "apple_manifest_rails/enroll/response_parser"
|
5
|
+
require "apple_manifest_rails/install/checker"
|
6
|
+
require "apple_manifest_rails/install/ipa"
|
7
|
+
require "apple_manifest_rails/template_dir"
|
7
8
|
|
8
9
|
module AppleManifestRails
|
10
|
+
def self.configure
|
11
|
+
yield self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.page_title
|
15
|
+
@page_title ||= "AppleManifestRails v#{VERSION}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.page_title=(str)
|
19
|
+
@page_title = str
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.template_dir
|
23
|
+
@template_dir ||= TemplateDir.new(Rails.root.join('apple_manifest_templates'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.template_dir=(path)
|
27
|
+
@template_dir ||= TemplateDir.new(path.to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.template name
|
31
|
+
template_dir.join name
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.ipa_path
|
35
|
+
@ipa_path ||= template_dir.join('builds', 'app.ipa')
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.ipa_path= str
|
39
|
+
@ipa_path = str
|
40
|
+
end
|
9
41
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module AppleManifestRails
|
2
2
|
module Enroll
|
3
3
|
class MobileConfig
|
4
4
|
attr_accessor :next_url
|
@@ -25,7 +25,7 @@ module AppleManifest
|
|
25
25
|
|
26
26
|
private
|
27
27
|
def template_path
|
28
|
-
|
28
|
+
AppleManifestRails.template('Profile.mobileconfig')
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'zip/zipfilesystem'
|
3
3
|
|
4
|
-
module
|
4
|
+
module AppleManifestRails
|
5
5
|
module Install
|
6
6
|
class Checker
|
7
7
|
attr_accessor :mobileprovision
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
ipa_path =
|
9
|
+
def initialize
|
10
|
+
ipa_path = AppleManifestRails.ipa_path
|
11
11
|
extract_mobileprovision_from ipa_path
|
12
|
-
@installable = self.mobileprovision.include? udid
|
13
12
|
end
|
14
13
|
|
14
|
+
def installable? udid
|
15
|
+
self.mobileprovision.include? udid
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
15
19
|
def extract_mobileprovision_from ipa_path
|
16
20
|
tempfile = File.join('tmp', 'embedded.mobileprovision')
|
17
21
|
FileUtils.rm tempfile if File.exists? tempfile
|
@@ -26,10 +30,6 @@ module AppleManifest
|
|
26
30
|
File.open(tempfile) {|f| self.mobileprovision = f.read }
|
27
31
|
FileUtils.rm tempfile
|
28
32
|
end
|
29
|
-
|
30
|
-
def installable?
|
31
|
-
@installable
|
32
|
-
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module
|
1
|
+
module AppleManifestRails
|
2
2
|
module Install
|
3
3
|
class IPA
|
4
4
|
|
5
5
|
def template
|
6
|
-
|
6
|
+
AppleManifestRails.template('manifest.plist')
|
7
7
|
end
|
8
|
-
|
9
|
-
def
|
8
|
+
|
9
|
+
def manifest_path
|
10
10
|
Rails.root.join('tmp', 'manifest.plist').to_s
|
11
11
|
end
|
12
12
|
|
@@ -25,16 +25,12 @@ module AppleManifest
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def write_manifest
|
28
|
-
File.open(
|
28
|
+
File.open(manifest_path, "w") do |f|
|
29
29
|
File.open(template, "r") do |tmpl|
|
30
30
|
f.write tmpl.read.gsub("[IPAURL]", self.url)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
def manifest_path
|
36
|
-
Rails.root.join("tmp","manifest.plist").to_s
|
37
|
-
end
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module AppleManifestRails
|
2
|
+
class TemplateDir
|
3
|
+
attr_accessor :dir
|
4
|
+
class InvalidTemplateDirError < StandardError ; end
|
5
|
+
class TemplateMissingError < StandardError ; end
|
6
|
+
EXPECTED_TEMPLATES = %w{Profile.mobileconfig manifest.plist}
|
7
|
+
|
8
|
+
def initialize dir
|
9
|
+
errors = []
|
10
|
+
self.dir = File.expand_path(dir.to_s)
|
11
|
+
if File.directory?(self.dir)
|
12
|
+
EXPECTED_TEMPLATES.each do |t|
|
13
|
+
path = self.join(t)
|
14
|
+
unless File.exists?(path)
|
15
|
+
errors << "Template missing! #{path}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
else
|
19
|
+
raise InvalidTemplateDirError, "Expected a template directory! #{self.dir}"
|
20
|
+
end
|
21
|
+
if errors.size > 0
|
22
|
+
raise TemplateMissingError, errors.join("\n")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def join *args
|
27
|
+
File.join(self.dir, args)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_manifest_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keyvan Fatehi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -73,11 +73,12 @@ files:
|
|
73
73
|
- app/views/apple_manifest_rails/manifest/install.html.haml
|
74
74
|
- app/views/layouts/apple_manifest_rails/application.html.erb
|
75
75
|
- config/routes.rb
|
76
|
-
- lib/apple_manifest/enroll/mobile_config.rb
|
77
|
-
- lib/apple_manifest/enroll/response_parser.rb
|
78
|
-
- lib/apple_manifest/install/checker.rb
|
79
|
-
- lib/apple_manifest/install/ipa.rb
|
80
76
|
- lib/apple_manifest_rails/engine.rb
|
77
|
+
- lib/apple_manifest_rails/enroll/mobile_config.rb
|
78
|
+
- lib/apple_manifest_rails/enroll/response_parser.rb
|
79
|
+
- lib/apple_manifest_rails/install/checker.rb
|
80
|
+
- lib/apple_manifest_rails/install/ipa.rb
|
81
|
+
- lib/apple_manifest_rails/template_dir.rb
|
81
82
|
- lib/apple_manifest_rails/version.rb
|
82
83
|
- lib/apple_manifest_rails.rb
|
83
84
|
- lib/tasks/apple_manifest_rails_tasks.rake
|
@@ -97,12 +98,12 @@ require_paths:
|
|
97
98
|
- lib
|
98
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
|
-
- - '>='
|
101
|
+
- - ! '>='
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: 1.9.2
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
requirements:
|
105
|
-
- - '>='
|
106
|
+
- - ! '>='
|
106
107
|
- !ruby/object:Gem::Version
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
@@ -112,3 +113,4 @@ signing_key:
|
|
112
113
|
specification_version: 4
|
113
114
|
summary: Rails engine for iOS app distribution
|
114
115
|
test_files: []
|
116
|
+
has_rdoc:
|