mobile_provision 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +39 -0
- data/LICENSE +21 -0
- data/License +21 -0
- data/README.md +53 -0
- data/lib/mobile_provision/representation.rb +97 -0
- data/lib/mobile_provision/version.rb +15 -0
- data/lib/mobile_provision.rb +13 -0
- data/mobile_provision.gemspec +42 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6611395e2cdf186d064cdd6b8f8ee53471da2379
|
4
|
+
data.tar.gz: 27ea603ae9c5933c3cd945012afdb0bbd97a4370
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0da4ee128a49725322d6d1d1874e22df7e8ae13f6c160259924440ff8070dfbda29ba281de8c3463d13b687d86c181eb4d7854ff44c70f38fc580e1b76e3f455
|
7
|
+
data.tar.gz: 88641b70750dca046c51e3ff345ba647bc82875e17de35aee4aa71e6891eff66c208014d88ea502df8ed42fc77b7c85f9213918c7bd9caa65d2b4d0e8ac60640
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
CFPropertyList (2.2.8)
|
5
|
+
ast (2.2.0)
|
6
|
+
diff-lcs (1.2.5)
|
7
|
+
parser (2.3.0.6)
|
8
|
+
ast (~> 2.2)
|
9
|
+
powerpack (0.1.1)
|
10
|
+
rainbow (2.1.0)
|
11
|
+
rspec (3.3.0)
|
12
|
+
rspec-core (~> 3.3.0)
|
13
|
+
rspec-expectations (~> 3.3.0)
|
14
|
+
rspec-mocks (~> 3.3.0)
|
15
|
+
rspec-core (3.3.2)
|
16
|
+
rspec-support (~> 3.3.0)
|
17
|
+
rspec-expectations (3.3.1)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.3.0)
|
20
|
+
rspec-mocks (3.3.2)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.3.0)
|
23
|
+
rspec-support (3.3.0)
|
24
|
+
rubocop (0.37.2)
|
25
|
+
parser (>= 2.3.0.4, < 3.0)
|
26
|
+
powerpack (~> 0.1)
|
27
|
+
rainbow (>= 1.99.1, < 3.0)
|
28
|
+
ruby-progressbar (~> 1.7)
|
29
|
+
unicode-display_width (~> 0.3)
|
30
|
+
ruby-progressbar (1.7.5)
|
31
|
+
unicode-display_width (0.3.1)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
CFPropertyList
|
38
|
+
rspec
|
39
|
+
rubocop
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Appaloosa.io
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/License
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Appaloosa.io
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
MobileProvision
|
2
|
+
===
|
3
|
+
|
4
|
+
MobileProvision is a simple Mobile Provision wrapper written in Ruby.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
---
|
8
|
+
To install *MobileProvision*:
|
9
|
+
|
10
|
+
```
|
11
|
+
$ gem install mobile_provision
|
12
|
+
```
|
13
|
+
|
14
|
+
Or you can include this in your project's `Gemfile`:
|
15
|
+
|
16
|
+
```
|
17
|
+
gem 'mobile_provision'
|
18
|
+
```
|
19
|
+
|
20
|
+
Then execute:
|
21
|
+
|
22
|
+
```
|
23
|
+
$ bundle
|
24
|
+
```
|
25
|
+
Usage
|
26
|
+
---
|
27
|
+
|
28
|
+
```
|
29
|
+
mobile_provision_file = File.open(path_to_mobile_prov)
|
30
|
+
mobile_provision = MobileProvision.new(mobile_provision_file)
|
31
|
+
p mobile_provision.expiration_date
|
32
|
+
p mobile_provision.profile_type # => either ad-hoc, in house, apple store or in error
|
33
|
+
p mobile_provision.registered_udids if mobile_provision.profile_type == AD_HOC
|
34
|
+
mobile_provision_file.close
|
35
|
+
```
|
36
|
+
|
37
|
+
Extractible info
|
38
|
+
---
|
39
|
+
Currently, we can extract:
|
40
|
+
|
41
|
+
+ expiration date
|
42
|
+
+ bundle id
|
43
|
+
+ certificate
|
44
|
+
+ profile type
|
45
|
+
+ registered UDIDs in case of an Ad-Hoc type
|
46
|
+
|
47
|
+
Contributing
|
48
|
+
---
|
49
|
+
1. Fork it ( https://github.com/appaloosa-store/mobile_provision )
|
50
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
51
|
+
3. Commit your changes (git commit -am 'Add some feature')
|
52
|
+
4. Push to the branch (git push origin my-new-feature)
|
53
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'cfpropertylist'
|
3
|
+
|
4
|
+
module MobileProvision
|
5
|
+
class Representation
|
6
|
+
EXPIRATION_DATE_KEY = 'ExpirationDate'
|
7
|
+
ENTITLEMENTS_KEY = 'Entitlements'
|
8
|
+
BUNDLE_ID_KEY = 'application-identifier'
|
9
|
+
CERTIFICATE_KEY = 'DeveloperCertificates'
|
10
|
+
INHOUSE_PROFILE_KEY = 'ProvisionsAllDevices'
|
11
|
+
ADHOC_PROFILE_KEY = 'ProvisionedDevices'
|
12
|
+
|
13
|
+
attr_reader :expiration_date, :bundle_id, :certificate, :profile_type, :registered_udids
|
14
|
+
|
15
|
+
def initialize(file)
|
16
|
+
read!(file)
|
17
|
+
@expiration_date = build_expiration_date
|
18
|
+
@certificate = build_certificate
|
19
|
+
@bundle_id = build_bundle_id
|
20
|
+
@profile_type = build_profile_type
|
21
|
+
@registered_udids = build_registered_udids
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
PLIST_START = '<plist'
|
27
|
+
PLIST_STOP = '</plist>'
|
28
|
+
|
29
|
+
UTF8_ENCODING = 'UTF-8'
|
30
|
+
STRING_FORMAT = 'binary'
|
31
|
+
|
32
|
+
EMPTY_STRING = ''
|
33
|
+
LINE_BREAK = "\n"
|
34
|
+
TABULATION = '\t'
|
35
|
+
|
36
|
+
CERTIFICATE_HEADER = "-----BEGIN CERTIFICATE-----\n"
|
37
|
+
CERTIFICATE_FOOTER = "\n-----END CERTIFICATE-----\n"
|
38
|
+
|
39
|
+
def read!(file)
|
40
|
+
buffer = String.new
|
41
|
+
inside_plist = false
|
42
|
+
file.each do |line|
|
43
|
+
inside_plist = true if line.include? PLIST_START
|
44
|
+
if inside_plist
|
45
|
+
buffer << line
|
46
|
+
break if line.include? PLIST_STOP
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
encoded_plist = buffer.encode(UTF8_ENCODING, STRING_FORMAT, invalid: :replace, undef: :replace, replace: EMPTY_STRING)
|
51
|
+
encoded_plist = encoded_plist.sub(/#{PLIST_STOP}.+/, PLIST_STOP)
|
52
|
+
@plist = read_plist(encoded_plist)
|
53
|
+
end
|
54
|
+
|
55
|
+
def read_plist(data)
|
56
|
+
CFPropertyList::List.new(data: data).value.value
|
57
|
+
end
|
58
|
+
|
59
|
+
def read_plist_value(var, plist = @plist)
|
60
|
+
res = plist[var].value
|
61
|
+
res.is_a?(Array) ? res.collect(&:value) : res
|
62
|
+
rescue NoMethodError
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
|
66
|
+
def build_expiration_date
|
67
|
+
expiration_date = read_plist_value(EXPIRATION_DATE_KEY)
|
68
|
+
Time.parse(expiration_date.to_s).utc
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_bundle_id
|
72
|
+
entitlements = read_plist_value(ENTITLEMENTS_KEY)
|
73
|
+
read_plist_value(BUNDLE_ID_KEY, entitlements)
|
74
|
+
end
|
75
|
+
|
76
|
+
def build_certificate
|
77
|
+
certificate = read_plist_value(CERTIFICATE_KEY).first
|
78
|
+
key = certificate.scan(/.{1,64}/).join(LINE_BREAK)
|
79
|
+
CERTIFICATE_HEADER + key.gsub(TABULATION, EMPTY_STRING) + CERTIFICATE_FOOTER
|
80
|
+
end
|
81
|
+
|
82
|
+
def build_profile_type
|
83
|
+
if read_plist_value(INHOUSE_PROFILE_KEY)
|
84
|
+
IN_HOUSE_TYPE
|
85
|
+
elsif read_plist_value(ADHOC_PROFILE_KEY)
|
86
|
+
AD_HOC_TYPE
|
87
|
+
else
|
88
|
+
PROFILE_ERROR_TYPE
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def build_registered_udids
|
93
|
+
return nil unless @profile_type == AD_HOC_TYPE
|
94
|
+
read_plist_value(ADHOC_PROFILE_KEY)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module MobileProvision
|
5
|
+
# This module holds the MobileProvision version information.
|
6
|
+
module Version
|
7
|
+
STRING = '1.1.0'
|
8
|
+
|
9
|
+
module_function
|
10
|
+
|
11
|
+
def version(*_args)
|
12
|
+
STRING
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mobile_provision/version'
|
2
|
+
require 'mobile_provision/representation'
|
3
|
+
|
4
|
+
module MobileProvision
|
5
|
+
AD_HOC_TYPE = 1
|
6
|
+
IN_HOUSE_TYPE = 2
|
7
|
+
APPLE_STORE_TYPE = 3
|
8
|
+
PROFILE_ERROR_TYPE = 99
|
9
|
+
|
10
|
+
def self.new(file)
|
11
|
+
MobileProvision::Representation.new(file)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
5
|
+
require 'mobile_provision/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'mobile_provision'
|
9
|
+
s.version = MobileProvision::Version::STRING
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.required_ruby_version = '>= 1.9.3'
|
12
|
+
s.authors = ['Alexandre Ignjatovic', 'Robin Sfez', 'Benoit Tigeot', 'Christophe Valentin']
|
13
|
+
s.description = <<-EOF
|
14
|
+
MobileProvision is a convenient Mobile Provision wrapper written in Ruby.
|
15
|
+
EOF
|
16
|
+
|
17
|
+
s.email = 'dev@appaloosa-store.com'
|
18
|
+
s.files = `git ls-files`.split($RS).reject do |file|
|
19
|
+
file =~ %r{^(?:
|
20
|
+
spec/.*
|
21
|
+
|Gemfile
|
22
|
+
|Rakefile
|
23
|
+
|\.rspec
|
24
|
+
|\.gitignore
|
25
|
+
|\.rubocop.yml
|
26
|
+
|\.rubocop_todo.yml
|
27
|
+
|.*\.eps
|
28
|
+
)$}x
|
29
|
+
end
|
30
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
|
+
s.extra_rdoc_files = %w(LICENSE README.md)
|
32
|
+
s.homepage = 'http://github.com/appaloosa-store/mobile_provision'
|
33
|
+
s.licenses = ['MIT']
|
34
|
+
s.require_paths = ['lib']
|
35
|
+
s.rubygems_version = '1.8.23'
|
36
|
+
|
37
|
+
s.summary = 'MobileProvision is a convenient Mobile Provision wrapper written in Ruby.'
|
38
|
+
|
39
|
+
s.add_development_dependency('rspec', '~> 3.4')
|
40
|
+
s.add_development_dependency('rubocop')
|
41
|
+
s.add_dependency('CFPropertyList', '~> 2.3')
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mobile_provision
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandre Ignjatovic
|
8
|
+
- Robin Sfez
|
9
|
+
- Benoit Tigeot
|
10
|
+
- Christophe Valentin
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.4'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.4'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rubocop
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: CFPropertyList
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.3'
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.3'
|
58
|
+
description: |2
|
59
|
+
MobileProvision is a convenient Mobile Provision wrapper written in Ruby.
|
60
|
+
email: dev@appaloosa-store.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files:
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
files:
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE
|
69
|
+
- License
|
70
|
+
- README.md
|
71
|
+
- lib/mobile_provision.rb
|
72
|
+
- lib/mobile_provision/representation.rb
|
73
|
+
- lib/mobile_provision/version.rb
|
74
|
+
- mobile_provision.gemspec
|
75
|
+
homepage: http://github.com/appaloosa-store/mobile_provision
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.9.3
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.3
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: MobileProvision is a convenient Mobile Provision wrapper written in Ruby.
|
99
|
+
test_files: []
|