ios_android_toolbox 0.0.20 → 0.0.21

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.
@@ -1,5 +1,7 @@
1
+ require 'rubygems'
1
2
  require 'fileutils'
2
3
  require 'time'
4
+ require 'plist'
3
5
 
4
6
  module IosAndroidToolbox
5
7
  class IosProvisioningProfile
@@ -10,6 +12,22 @@ module IosAndroidToolbox
10
12
 
11
13
  attr_reader :contents
12
14
 
15
+ def plist_string
16
+ @plist_string ||= begin
17
+ xml_start = contents.index('<?xml version=')
18
+ return nil if xml_start.nil?
19
+
20
+ xml_end = contents.index('</plist>', xml_start)
21
+ return nil if xml_end.nil?
22
+
23
+ contents.slice(xml_start, xml_end - xml_start + 8)
24
+ end
25
+ end
26
+
27
+ def plist
28
+ plist ||= Plist.parse_xml(plist_string)
29
+ end
30
+
13
31
  def uuid
14
32
  # <key>UUID</key>
15
33
  # <string>06AF2826-608D-4CE9-99AE-AA917FF1641E</string>
@@ -50,6 +68,26 @@ module IosAndroidToolbox
50
68
  !!(/<key>ProvisionedDevices<\/key>/.match(contents))
51
69
  end
52
70
 
71
+ def provisioned_devices
72
+ plist['ProvisionedDevices']
73
+ end
74
+
75
+ def aps_environment
76
+ plist['Entitlements']['aps-environment']
77
+ end
78
+
79
+ def get_task_allow
80
+ plist['Entitlements']['get-task-allow']
81
+ end
82
+
83
+ def is_development?
84
+ provisioned_devices.is_a? Array and get_task_allow == true and aps_environment == 'development'
85
+ end
86
+
87
+ def is_production?
88
+ provisioned_devices.nil? and get_task_allow == false and aps_environment == 'production'
89
+ end
90
+
53
91
  def initialize(contents)
54
92
  # If we specify a path, read it first
55
93
  begin
@@ -1,3 +1,3 @@
1
1
  module IosAndroidToolbox
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_android_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 20
10
- version: 0.0.20
9
+ - 21
10
+ version: 0.0.21
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Sales
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-08 00:00:00 Z
18
+ date: 2013-05-13 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: ""