capor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c68f38464e06f4905c32b642d093f4ab966810c4
4
- data.tar.gz: 4d6fce9ca40216cd39dfae9d2e75228df7e1cfb2
3
+ metadata.gz: 3be9c92d8108fd930436d34a98bd3bb8f8cc2dc9
4
+ data.tar.gz: f2dc647b0472d4cc7e1c765c07c2d596234e9fe1
5
5
  SHA512:
6
- metadata.gz: 36549ef37f4eb6d9f65addff684c1ff04fd446bca13e8dd1dee8f491aa06dfe906c7f8e0247f4fdd3d5dd55986aed3847953fef6bb407620e4b5a1e959f7d985
7
- data.tar.gz: c699fbcecf22759a7d8445aa3ecf93546f29b201727ef1a606ecbd416ce033e6941b1a4b5d72a7091a38b0b1dbe6246e12e098c59b0557611d4dc51289386823
6
+ metadata.gz: ce14415849a9bf4f1b561aa017d9dd24688bbe020fb26d6ce0063e7bd5c9a1dde89bb4eff9d822ae0d03953924b6bc290dae460b5d484923c184689a687ce5f2
7
+ data.tar.gz: 2a9adc5b5a1cf3b6c421c89e54f22cb8779de55358ecd9944f0ba04af8aa37ddc83bded9b1d85eacbdcfb359bdadf1ef7c8de4d6f3aa243b743798f43c30ba72
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
@@ -0,0 +1 @@
1
+ > Capor is command line tool for parser iOS .ipa file, you cat the ipa package info like cat a file.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ require 'capor'
@@ -0,0 +1,30 @@
1
+
2
+ Gem::Specification.new do |s|
3
+ s.name = 'capor'
4
+ s.version = '0.0.4'
5
+ s.date = '2017-05-07'
6
+ s.summary = 'Capor is command line tool for parser iOS .ipa file.'
7
+ s.description = 'Capor is command line tool for parser iOS .ipa file, you cat the ipa package info like cat a file.'
8
+ s.author = 'Gump Wang'
9
+ s.email = '1989wg@gmail.com'
10
+ s.license = 'MIT'
11
+ s.homepage = 'https://www.github.com/wanggang316/capor'
12
+
13
+
14
+
15
+ s.add_dependency 'commander', '~> 4.3'
16
+ s.add_dependency 'rubyzip', '~> 1.0', '>= 1.0.0'
17
+ s.add_dependency 'plist', '~> 3.3'
18
+ s.add_dependency 'terminal-table', '~> 1.7', '>= 1.7.3'
19
+ s.add_dependency 'CFPropertyList', '~> 2.3'
20
+
21
+
22
+
23
+ s.bindir = 'bin'
24
+ s.files = `git ls-files -z`.split("\x0")
25
+ s.require_paths = ["lib"]
26
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
+
28
+
29
+
30
+ end
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'commander/import'
4
+ require 'zip'
5
+ require 'zip/filesystem'
6
+ require 'terminal-table'
7
+ require 'cfpropertylist'
8
+
9
+ program :name, 'capor'
10
+ program :version, '0.0.1'
11
+ program :description, 'Get ipa info'
12
+ program :help, 'Author', 'gumpwang <gumpwang2016@gmail.com>'
13
+
14
+
15
+ command :info do |c|
16
+ c.syntax = 'capor info [options]'
17
+ c.summary = 'this is summary add by summary'
18
+ c.description = 'this is the description add by wanggang'
19
+ c.example 'description', 'command example'
20
+
21
+ c.action do |args, options|
22
+ determine_file! unless @file = args.pop
23
+ say_error "Missing or unspecified .ipa file" and abort unless @file and ::File.exist?(@file)
24
+
25
+ # say @file
26
+
27
+ puts "----> #{File.basename(@file, File.extname(@file))}.app"
28
+
29
+ # find .app entry
30
+ Zip::File.open(@file) do |zipfile|
31
+ puts zipfile
32
+ app_entry = zipfile.find_entry("Payload/#{File.basename(@file, File.extname(@file))}.app")
33
+ info_entry = zipfile.find_entry("#{app_entry.name}embedded.mobileprovision") if app_entry
34
+
35
+ if (!info_entry)
36
+ zipfile.dir.entries("Payload").each do |dir_entry|
37
+ if dir_entry =~ /.app$/
38
+ say "Using .app: #{dir_entry}"
39
+ app_entry = zipfile.find_entry("Payload/#{dir_entry}")
40
+ info_entry = zipfile.find_entry("#{app_entry.name}Info.plist") if app_entry
41
+ puts "zipname is : #{app_entry}"
42
+ puts "Info.plist is : #{info_entry}"
43
+ break
44
+ end
45
+ end
46
+ end
47
+ say_error "Embedded mobile provisioning file not found in #{@file}" and abort unless info_entry
48
+
49
+
50
+ tempdir = ::File.new(Dir.mktmpdir)
51
+
52
+ puts tempdir.path
53
+
54
+ begin
55
+ puts "zipfile is : #{zipfile}"
56
+ zipfile.each do |zip_entry|
57
+ temp_entry_path = ::File.join(tempdir.path, zip_entry.name)
58
+ FileUtils.mkdir_p(::File.dirname(temp_entry_path))
59
+ zipfile.extract(zip_entry, temp_entry_path) unless ::File.exist?(temp_entry_path)
60
+ end
61
+
62
+ temp_info_plist = ::File.new(::File.join(tempdir.path, info_entry.name))
63
+ puts "temp_info_plist is : #{temp_info_plist.path}"
64
+ temp_app_directory = ::File.new(::File.join(tempdir.path, app_entry.name))
65
+ puts "temp_app_directory is : #{temp_app_directory.path}"
66
+
67
+ plist ||= CFPropertyList.native_types(
68
+ CFPropertyList::List.new(file: temp_info_plist).value)
69
+
70
+ table = Terminal::Table.new do |t|
71
+ plist.each do |key, value|
72
+ next if key == "DeveloperCertificates"
73
+
74
+ columns = []
75
+ columns << key
76
+ columns << case value
77
+ when Hash
78
+ value.collect{|k, v| "#{k}: #{v}"}.join("\n")
79
+ when Array
80
+ value.join("\n")
81
+ else
82
+ value.to_s
83
+ end
84
+
85
+ t << columns
86
+ t << :separator
87
+
88
+ end
89
+ end
90
+
91
+ puts table
92
+ end
93
+
94
+ end
95
+
96
+ end
97
+
98
+
99
+ def determine_file!
100
+ files = Dir['*.ipa']
101
+ @file ||= case files.length
102
+ when 0 then nil
103
+ when 1 then files.first
104
+ else
105
+ @file = choose "Select an .ipa File:", *files
106
+ end
107
+ end
108
+ end
109
+
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'commander/import'
4
+ require 'zip'
5
+ require 'zip/filesystem'
6
+ require 'plist'
7
+ require 'terminal-table'
8
+
9
+ program :name, 'capor'
10
+ program :version, '0.0.1'
11
+ program :description, 'Get ipa info'
12
+ program :help, 'Author', 'gumpwang <gumpwang2016@gmail.com>'
13
+
14
+
15
+ command :profile do |c|
16
+ c.syntax = 'capor profile [options]'
17
+ c.summary = 'this is summary add by summary'
18
+ c.description = 'this is the description add by wanggang'
19
+ # password
20
+ c.example 'description', 'command example'
21
+ c.option '--some-switch', 'Some switch that does something'
22
+
23
+ c.option '--prefix STRING', String, 'Adds a prefix to bar'
24
+ c.option '--suffix STRING', String, 'Adds a suffix to bar'
25
+ # choice = choose("Favorite language?", :ruby, :perl, :js)
26
+
27
+ c.action do |args, options|
28
+ # Do something or c.when_called Nopo::Commands::Info
29
+ # say 'foo'
30
+ # say args.to_s
31
+ # say options.to_s
32
+ # options.default :prefix => '(', :suffix => ')'
33
+
34
+ # @file = args.pop
35
+ determine_file! unless @file = args.pop
36
+ say_error "Missing or unspecified .ipa file" and abort unless @file and ::File.exist?(@file)
37
+
38
+ # say @file
39
+
40
+ puts "----> #{File.basename(@file, File.extname(@file))}.app"
41
+
42
+ # find .app entry
43
+ Zip::File.open(@file) do |zipfile|
44
+ puts zipfile
45
+ app_entry = zipfile.find_entry("Payload/#{File.basename(@file, File.extname(@file))}.app")
46
+ provisioning_profile_entry = zipfile.find_entry("#{app_entry.name}embedded.mobileprovision") if app_entry
47
+
48
+ if (!provisioning_profile_entry)
49
+ zipfile.dir.entries("Payload").each do |dir_entry|
50
+ if dir_entry =~ /.app$/
51
+ say "Using .app: #{dir_entry}"
52
+ app_entry = zipfile.find_entry("Payload/#{dir_entry}")
53
+ provisioning_profile_entry = zipfile.find_entry("#{app_entry.name}embedded.mobileprovision") if app_entry
54
+ puts "zipname is : #{app_entry}"
55
+ puts "provisioning_profile_entry is : #{provisioning_profile_entry}"
56
+ break
57
+ end
58
+ end
59
+ end
60
+ say_error "Embedded mobile provisioning file not found in #{@file}" and abort unless provisioning_profile_entry
61
+
62
+
63
+ # puts "===> #{Dir.mktmpdir}"
64
+ tempdir = ::File.new(Dir.mktmpdir)
65
+
66
+ puts tempdir.path
67
+
68
+ begin
69
+ puts "zipfile is : #{zipfile}"
70
+ zipfile.each do |zip_entry|
71
+ temp_entry_path = ::File.join(tempdir.path, zip_entry.name)
72
+ FileUtils.mkdir_p(::File.dirname(temp_entry_path))
73
+ zipfile.extract(zip_entry, temp_entry_path) unless ::File.exist?(temp_entry_path)
74
+ end
75
+
76
+ temp_provisioning_profile = ::File.new(::File.join(tempdir.path, provisioning_profile_entry.name))
77
+ puts "temp_provisioning_profile is : #{temp_provisioning_profile}"
78
+ temp_app_directory = ::File.new(::File.join(tempdir.path, app_entry.name))
79
+ puts "temp_app_directory is : #{temp_app_directory.path}"
80
+
81
+ plist = Plist::parse_xml(`security cms -D -i "#{temp_provisioning_profile.path}"`)
82
+ # puts "---> plist is : #{plist}"
83
+
84
+ codesign = `codesign -dv "#{temp_app_directory.path}" 2>&1`
85
+ puts "---->>>>> codesign is : #{codesign}"
86
+ codesigned = /Signed Time/ === codesign
87
+ puts "====>>>>> codegigned is : #{codesigned}"
88
+
89
+ table = Terminal::Table.new do |t|
90
+ plist.each do |key, value|
91
+ next if key == "DeveloperCertificates"
92
+
93
+ columns = []
94
+ columns << key
95
+ columns << case value
96
+ when Hash
97
+ value.collect{|k, v| "#{k}: #{v}"}.join("\n")
98
+ when Array
99
+ value.join("\n")
100
+ else
101
+ value.to_s
102
+ end
103
+
104
+ t << columns
105
+ t << :separator
106
+
107
+ end
108
+
109
+ t << ["Codesigned", codesigned.to_s.capitalize]
110
+ end
111
+
112
+ puts table
113
+ end
114
+
115
+
116
+ end
117
+
118
+
119
+ # say "#{options.prefix}bar#{options.suffix}"
120
+ end
121
+
122
+
123
+ def determine_file!
124
+ files = Dir['*.ipa']
125
+ @file ||= case files.length
126
+ when 0 then nil
127
+ when 1 then files.first
128
+ else
129
+ @file = choose "Select an .ipa File:", *files
130
+ end
131
+ end
132
+ end
133
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gump Wang
@@ -95,11 +95,18 @@ dependencies:
95
95
  description: Capor is command line tool for parser iOS .ipa file, you cat the ipa
96
96
  package info like cat a file.
97
97
  email: 1989wg@gmail.com
98
- executables: []
98
+ executables:
99
+ - capor
99
100
  extensions: []
100
101
  extra_rdoc_files: []
101
102
  files:
103
+ - ".gitignore"
104
+ - README.md
105
+ - bin/capor
106
+ - capor.gemspec
102
107
  - lib/capor.rb
108
+ - lib/capor/info.rb
109
+ - lib/capor/profile.rb
103
110
  homepage: https://www.github.com/wanggang316/capor
104
111
  licenses:
105
112
  - MIT