apk 0.1.2 → 0.1.3

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,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apk (0.1.1)
4
+ apk (0.1.2)
5
5
  rubyzip
6
6
 
7
7
  GEM
data/bin/apk CHANGED
@@ -4,5 +4,8 @@ require 'apk'
4
4
 
5
5
  apk = APK.new ARGV[0]
6
6
  puts apk.name
7
+ puts apk.version_name
8
+ puts apk.version_code
9
+ puts apk.label
7
10
 
8
11
  puts apk.drawable('ic_launcher.png')
@@ -14,11 +14,11 @@ module Android
14
14
  def dump
15
15
  attrs = {}
16
16
  info = aapt('dump badging')
17
- package = info.match(/package:\s*(.*)/)[1]
18
- attrs[:name] = package.match(/name='(\S*)'/)[1]
19
- attrs[:version_code] = package.match(/versionCode='(\S*)'/)[1]
20
- attrs[:version_name] = package.match(/versionName='(\S*)'/)[1]
21
- attrs[:label] = info.match(/application-label:\s*'(\S*)'/)[1]
17
+ package = info.match(/package:\s*(.*)/)[1] rescue nil
18
+ attrs[:name] = package.match(/name='([^']*)'/)[1] rescue nil
19
+ attrs[:version_code] = package.match(/versionCode='([^']*)'/)[1] rescue nil
20
+ attrs[:version_name] = package.match(/versionName='([^']*)'/)[1] rescue nil
21
+ attrs[:label] = info.match(/application-label:\s*'([^']*)'/)[1] rescue nil
22
22
  attrs
23
23
  end
24
24
 
data/lib/apk.rb CHANGED
@@ -4,7 +4,7 @@ require 'android/resource'
4
4
  class APK
5
5
  include Android
6
6
 
7
- attr_reader :apk, :aapt, :resource
7
+ attr_reader :apk, :aapt, :resource, :dump
8
8
 
9
9
  def initialize(apk_path)
10
10
  @apk = apk_path
@@ -19,7 +19,7 @@ class APK
19
19
  end
20
20
 
21
21
  def method_missing(method, *args, &block)
22
- @aapt.dump[method]
22
+ (@dump ||= @aapt.dump)[method]
23
23
  end
24
24
 
25
25
  end
@@ -1,3 +1,3 @@
1
1
  class APK
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: