app-info 2.3.0 → 2.4.1

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
  SHA256:
3
- metadata.gz: 7e60db88b8b1bc77db8a80623e1f5f52f47114e04f7941486ca8e21ee9ca19f2
4
- data.tar.gz: 78c45e538580d4c1c48807b77f38f650a09f4d1610581efb1c423d870c14425f
3
+ metadata.gz: aa6b8e87ba8dc7e9e7717d1e3c4885c5748c3aac3079780ff1262ab9ab62ea1d
4
+ data.tar.gz: 1d4b0f573c2b875b7347ceb5a161560e1453db0b891cc2b7c28cddea9ba6fdbf
5
5
  SHA512:
6
- metadata.gz: bfba684fb8bcf015c46f5457b2f4ea1e3bcbaac670a921f2b748a208d1069efff449e22ffb373754622d55927e4f65554aaa5e33c3576dbd55eb3437d3084ee0
7
- data.tar.gz: 470dedd66f3bbd04a328e36a125599ca53c0ba9cc7c6778dea6cf74d61f348661080a0f4b801b8b02557c7e842a68e1ecbc7c585f0271e15e5625566ac7a1763
6
+ metadata.gz: 300a98a543b36cee225ca5252f9f2883b5641f778f287c76e964a0a6c4c08054597e6de01e6ad023859f852d952d714c29d7ba47689f93355bd6c688bbf43102
7
+ data.tar.gz: e21a5002f708006fc0233034ecb5cecb40139ca7d9aefdc92e9004b9bd0b1e3ad10f94278959b1a4c5bd42d24ec416a1cf7e0f76736f777603f94431f4201ded
data/CHANGELOG.md CHANGED
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
 
10
10
  > List all changes before release a new version.
11
11
 
12
+ ## [2.4.1] (2021-03-08)
13
+
14
+ ### Changed
15
+
16
+ - Rename `cleanup!` to `clear!` method in ipa.
17
+
18
+ ### Added
19
+
20
+ - Add `clear!` method to ipa,apk, dsym and proguard.
21
+ - Make `contents` to be a public method.
22
+
12
23
  ## [2.3.0] (2021-01-15)
13
24
 
14
25
  ### Changed
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source 'https://rubygems.org'
4
- # source 'https://gems.ruby-china.com'
5
4
 
6
5
  # Specify your gem's dependencies in app-info.gemspec
7
6
  gemspec
data/README.md CHANGED
@@ -51,7 +51,7 @@ parser = AppInfo.parse('App.dSYm.zip')
51
51
 
52
52
  # If detect file type failed, you can parse in other way
53
53
  parser = AppInfo::IPA.new('iphone.ipa')
54
- parser = AppInfo::IPA.new('android.apk')
54
+ parser = AppInfo::APK.new('android.apk')
55
55
  parser = AppInfo::InfoPlist.new('App/Info.plist')
56
56
  parser = AppInfo::MobileProvision.new('provisioning_profile/uuid.mobileprovision')
57
57
  parser = AppInfo::DSYM.new('App.dSYm.zip')
data/lib/app_info/apk.rb CHANGED
@@ -10,7 +10,7 @@ module AppInfo
10
10
  class APK
11
11
  extend Forwardable
12
12
 
13
- attr_reader :file, :apk
13
+ attr_reader :file
14
14
 
15
15
  # APK Devices
16
16
  module Device
@@ -22,9 +22,6 @@ module AppInfo
22
22
 
23
23
  def initialize(file)
24
24
  @file = file
25
-
26
- Zip.warn_invalid_date = false # fix invaild date format warnings
27
- @apk = ::Android::Apk.new(file)
28
25
  end
29
26
 
30
27
  def size(humanable = false)
@@ -36,7 +33,7 @@ module AppInfo
36
33
  end
37
34
  alias file_type os
38
35
 
39
- def_delegators :@apk, :manifest, :resource, :dex
36
+ def_delegators :apk, :manifest, :resource, :dex
40
37
 
41
38
  def_delegators :manifest, :version_name, :package_name,
42
39
  :use_permissions, :components
@@ -93,13 +90,13 @@ module AppInfo
93
90
  end
94
91
 
95
92
  def signs
96
- @apk.signs.each_with_object([]) do |(path, sign), obj|
93
+ apk.signs.each_with_object([]) do |(path, sign), obj|
97
94
  obj << Sign.new(path, sign)
98
95
  end
99
96
  end
100
97
 
101
98
  def certificates
102
- @apk.certificates.each_with_object([]) do |(path, certificate), obj|
99
+ apk.certificates.each_with_object([]) do |(path, certificate), obj|
103
100
  obj << Certificate.new(path, certificate)
104
101
  end
105
102
  end
@@ -112,13 +109,17 @@ module AppInfo
112
109
  components.select { |c| c.type == 'service' }
113
110
  end
114
111
 
112
+ def apk
113
+ Zip.warn_invalid_date = false # fix invaild date format warnings
114
+
115
+ @apk ||= ::Android::Apk.new(@file)
116
+ end
117
+
115
118
  def icons
116
119
  unless @icons
117
- tmp_path = File.join(Dir.mktmpdir, "AppInfo-android-#{SecureRandom.hex}")
118
-
119
- @icons = @apk.icon.each_with_object([]) do |(path, data), obj|
120
+ @icons = apk.icon.each_with_object([]) do |(path, data), obj|
120
121
  icon_name = File.basename(path)
121
- icon_path = File.join(tmp_path, File.dirname(path))
122
+ icon_path = File.join(contents, File.dirname(path))
122
123
  icon_file = File.join(icon_path, icon_name)
123
124
  FileUtils.mkdir_p icon_path
124
125
  File.open(icon_file, 'wb') { |f| f.write(data) }
@@ -134,6 +135,22 @@ module AppInfo
134
135
  @icons
135
136
  end
136
137
 
138
+ def clear!
139
+ return unless @contents
140
+
141
+ FileUtils.rm_rf(@contents)
142
+
143
+ @apk = nil
144
+ @contents = nil
145
+ @icons = nil
146
+ @app_path = nil
147
+ @info = nil
148
+ end
149
+
150
+ def contents
151
+ @contents ||= File.join(Dir.mktmpdir, "AppInfo-android-#{SecureRandom.hex}")
152
+ end
153
+
137
154
  private
138
155
 
139
156
  def manifest_values(path, key = 'name')
data/lib/app_info/dsym.rb CHANGED
@@ -74,7 +74,17 @@ module AppInfo
74
74
  @app_path
75
75
  end
76
76
 
77
- private
77
+ def clear!
78
+ return unless @contents
79
+
80
+ FileUtils.rm_rf(@contents)
81
+
82
+ @contents = nil
83
+ @app_path = nil
84
+ @info = nil
85
+ @object = nil
86
+ @macho_type = nil
87
+ end
78
88
 
79
89
  def contents
80
90
  unless @contents
data/lib/app_info/ipa.rb CHANGED
@@ -147,7 +147,7 @@ module AppInfo
147
147
  @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first
148
148
  end
149
149
 
150
- def cleanup!
150
+ def clear!
151
151
  return unless @contents
152
152
 
153
153
  FileUtils.rm_rf(@contents)
@@ -160,12 +160,12 @@ module AppInfo
160
160
  @info = nil
161
161
  end
162
162
 
163
- private
164
-
165
163
  def contents
166
164
  @contents ||= Util.unarchive(@file, path: 'ios')
167
165
  end
168
166
 
167
+ private
168
+
169
169
  def icons_root_path
170
170
  iphone = 'CFBundleIcons'
171
171
  ipad = 'CFBundleIcons~ipad'
@@ -86,5 +86,18 @@ module AppInfo
86
86
  def contents
87
87
  @contents ||= Util.unarchive(@file, path: 'proguard')
88
88
  end
89
+
90
+ def clear!
91
+ return unless @contents
92
+
93
+ FileUtils.rm_rf(@contents)
94
+
95
+ @contents = nil
96
+ @manifest = nil
97
+ @mapping_path = nil
98
+ @metadata_path = nil
99
+ @manifest_path = nil
100
+ @symbol_path = nil
101
+ end
89
102
  end
90
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppInfo
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app-info
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: CFPropertyList