android_apk 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ #Android APK
2
+ This gem library is Android application package file (.apk) analyzer.
3
+ you can read any information of android apk files.
4
+
5
+ ## Attention
6
+ You must set path to 'AndroidSDK/platform-tools'.
7
+ And you must can execute 'aapt' command.
8
+
9
+ ## How to use
10
+
11
+ ```
12
+ require 'android_apk'
13
+
14
+ apk = AndroidApk.analyze("/path/to/apkfile.apk")
15
+
16
+ apk.nil? # This file is invalid apk file.
17
+
18
+ apk.label #Application Name
19
+ apk.package_name #Package Name
20
+ apk.icon #Included Icon file in apk file
21
+ apk.version_code #Version Code
22
+ apk.version_name "Version Name
23
+ ```
24
+
25
+ ## License
26
+ This Library is using MIT license.
27
+
28
+ ## Contact
29
+ Kyosuke INOUE < kyoro@hakamastyle.net>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/android_apk.gemspec CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "android_apk"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyosuke INOUE"]
12
- s.date = "2012-07-29"
12
+ s.date = "2012-07-30"
13
13
  s.description = "This library can analyze Android APK application package. You can get any information of android apk file."
14
14
  s.email = "kyoro@hakamastyle.net"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.md",
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "android_apk.gemspec",
data/lib/android_apk.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require "tmpdir"
2
+ require "pp"
1
3
  class AndroidApk
2
- attr_accessor :results,:label,:icon,:package_name,:version_code, :version_name
4
+ attr_accessor :results,:label,:icon,:package_name,:version_code, :version_name, :filepath
3
5
  def self.analyze(filepath)
4
6
  return nil unless File.exist?(filepath)
5
7
  apk = AndroidApk.new
@@ -8,6 +10,7 @@ class AndroidApk
8
10
  if results.index("ERROR: dump failed")
9
11
  return nil
10
12
  end
13
+ apk.filepath = filepath
11
14
  apk.results = results
12
15
  results.split("\n").each do |line|
13
16
  info = line.split("\s")
@@ -26,4 +29,14 @@ class AndroidApk
26
29
  return apk
27
30
  end
28
31
 
32
+ def icon_file
33
+ Dir.mktmpdir do |dir|
34
+ command = sprintf("unzip %s -d %s 2>&1",self.filepath,dir)
35
+ results = `#{command}`
36
+ path = dir + "/" + self.icon
37
+ return nil unless File.exist?(path)
38
+ return path
39
+ end
40
+ end
41
+
29
42
  end
@@ -32,4 +32,8 @@ describe "AndroidApk" do
32
32
  apk.version_name.should == "1"
33
33
  end
34
34
 
35
+ it "Icon file unzip" do
36
+ apk.icon_file.should_not == nil
37
+ end
38
+
35
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: android_apk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-29 00:00:00.000000000Z
12
+ date: 2012-07-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70182732921780 !ruby/object:Gem::Requirement
16
+ requirement: &70130724842940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70182732921780
24
+ version_requirements: *70130724842940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70182732921120 !ruby/object:Gem::Requirement
27
+ requirement: &70130724842280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70182732921120
35
+ version_requirements: *70130724842280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70182732920560 !ruby/object:Gem::Requirement
38
+ requirement: &70130724841680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70182732920560
46
+ version_requirements: *70130724841680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70182732920080 !ruby/object:Gem::Requirement
49
+ requirement: &70130724841060 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70182732920080
57
+ version_requirements: *70130724841060
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70182732919440 !ruby/object:Gem::Requirement
60
+ requirement: &70130724840340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70182732919440
68
+ version_requirements: *70130724840340
69
69
  description: This library can analyze Android APK application package. You can get
70
70
  any information of android apk file.
71
71
  email: kyoro@hakamastyle.net
@@ -73,14 +73,14 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files:
75
75
  - LICENSE.txt
76
- - README.rdoc
76
+ - README.md
77
77
  files:
78
78
  - .document
79
79
  - .rspec
80
80
  - Gemfile
81
81
  - Gemfile.lock
82
82
  - LICENSE.txt
83
- - README.rdoc
83
+ - README.md
84
84
  - Rakefile
85
85
  - VERSION
86
86
  - android_apk.gemspec
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: 4523945286599670255
107
+ hash: -1391984821603650232
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = android_apk
2
-
3
- Description goes here.
4
-
5
- == Contributing to android_apk
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2012 Kyosuke INOUE. See LICENSE.txt for
18
- further details.
19
-