Permalink
Browse files

Squashed commit of the following:

commit dcffcc8dc095a4afa4144353e3caf8ab08072b0b
Author: Mattt Thompson <m@mattt.me>
Date:   Wed Mar 26 06:52:53 2014 -0700

    Parsing and displaying mobileprovision plist file in table

commit 44416a36fb760eb6957f113d099532b4ddd1fdf7
Author: Mattt Thompson <m@mattt.me>
Date:   Wed Mar 26 06:35:01 2014 -0700

    Updating gemspec

commit 483954cf466903a00c4fbd490321454f74fb7ec7
Author: Mattt Thompson <m@mattt.me>
Date:   Wed Mar 26 06:34:54 2014 -0700

    Refactoring and renaming show command to info

commit 877bb50
Author: Nicola Brisotto <nicolabrisotto@gmail.com>
Date:   Fri Jan 24 12:04:41 2014 +0100

    remove unused zip lib config

commit a28721c
Author: Nicola Brisotto <nicolabrisotto@gmail.com>
Date:   Fri Jan 24 11:17:15 2014 +0100

    add the show command to print the embedded.mobileprovision profile of an ipa
  • Loading branch information...
mattt committed Mar 26, 2014
1 parent b920e5c commit 65f09d9fd645330591d3a3872fe55650c5a9efb9
Showing with 69 additions and 2 deletions.
  1. +1 −0 bin/ipa
  2. +1 −1 lib/shenzhen/commands.rb
  3. +63 −0 lib/shenzhen/commands/info.rb
  4. +4 −1 shenzhen.gemspec
View
@@ -4,6 +4,7 @@ require 'dotenv'
Dotenv.load
require 'commander/import'
require 'terminal-table'
$:.push File.expand_path("../../lib", __FILE__)
require 'shenzhen'
View
@@ -7,4 +7,4 @@
require 'commands/build'
require 'commands/distribute'
require 'commands/info'
@@ -0,0 +1,63 @@
require 'plist'
require 'tempfile'
require 'zip'
command :info do |c|
c.syntax = 'ipa info [options]'
c.summary = 'Show mobile provisioning information about an .ipa file'
c.description = ''
c.action do |args, options|
say_error "`security` command not found in $PATH" and abort if `which security` == ""
determine_file! unless @file = args.pop
say_error "Missing or unspecified .ipa file" and abort unless @file and ::File.exist?(@file)
Zip::File.open(@file) do |zipfile|
entry = zipfile.find_entry("Payload/#{File.basename(@file)}.app/embedded.mobileprovision")
say_error "Embedded mobile provisioning file not found in #{@file}" and abort unless entry
tempfile = Tempfile.new(::File.basename(entry.name))
begin
zipfile.extract(entry, tempfile.path)
plist = Plist::parse_xml(`security cms -D -i #{tempfile.path}`)
table = Terminal::Table.new do |t|
plist.each do |key, value|
next if key == "DeveloperCertificates"
columns = []
columns << key
columns << case value
when Hash
value.collect{|k, v| "#{k}: #{v}"}.join("\n")
else
value.to_s
end
t << columns
end
end
puts table
rescue => e
say_error e.message
ensure
tempfile.close and tempfile.unlink
end
end
end
private
def determine_file!
files = Dir['*.ipa']
@file ||= case files.length
when 0 then nil
when 1 then files.first
else
@file = choose "Select an .ipa File:", *files
end
end
end
View
@@ -14,12 +14,15 @@ Gem::Specification.new do |s|
s.description = "CLI for Building & Distributing iOS Apps (.ipa Files)"
s.add_dependency "commander", "~> 4.1"
s.add_dependency "terminal-table", "~> 1.4.5"
s.add_dependency "json", "~> 1.8"
s.add_dependency "faraday", "~> 0.8"
s.add_dependency "faraday", "~> 0.8.9"
s.add_dependency "faraday_middleware", "~> 0.9"
s.add_dependency "dotenv", "~> 0.7"
s.add_dependency "aws-sdk", "~> 1.0"
s.add_dependency "net-sftp", "~> 2.1.2"
s.add_dependency "plist", "~> 3.1.0"
s.add_dependency "rubyzip", "~> 1.1"
s.add_development_dependency "rspec"
s.add_development_dependency "rake"

0 comments on commit 65f09d9

Please sign in to comment.