Class: SigningIdentity

Inherits:
Object
  • Object
show all
Defined in:
lib/ipa_utilities/parsers.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ SigningIdentity

Returns a new instance of SigningIdentity.



3
4
5
# File 'lib/ipa_utilities/parsers.rb', line 3

def initialize(name)
  @identity = name
end

Class Method Details

.from_base64(base64) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ipa_utilities/parsers.rb', line 7

def self.from_base64(base64)
  string = "-----BEGIN CERTIFICATE-----\n"
  string += base64
  string += "-----END CERTIFICATE-----"

  File.write("cer.pem", string)

  pem = `openssl x509 -text -in cer.pem`

  system "rm -rf cer.pem"

  SigningIdentity.new(pem[/CN=(.*?),/, 1])
end

.from_file(file) ⇒ Object



21
22
23
24
# File 'lib/ipa_utilities/parsers.rb', line 21

def self.from_file(file)
  pem = `openssl x509 -text -in #{file}`
  SigningIdentity.new(pem[/CN=(.*?),/, 1])
end

Instance Method Details

#apns?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/ipa_utilities/parsers.rb', line 30

def apns?
  @identity.include?("IOS Push Services")
end

#display_nameObject



46
47
48
# File 'lib/ipa_utilities/parsers.rb', line 46

def display_name
  @identity[/: (.*?)$/, 1]
end

#environmentObject



38
39
40
41
42
43
44
# File 'lib/ipa_utilities/parsers.rb', line 38

def environment
  if apns?
    production? ? "Production" : "Development (Sandbox)"
  else
    production? ? "Production" : "Development"
  end
end

#nameObject



26
27
28
# File 'lib/ipa_utilities/parsers.rb', line 26

def name
  @identity
end

#production?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/ipa_utilities/parsers.rb', line 34

def production?
  !@identity[/[Development|Developer]/]
end