apk 0.1 → 0.1.1

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.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ group :test do
5
+ gem 'rspec'
6
+ gem 'autotest'
7
+ end
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ apk (0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ ZenTest (4.8.2)
10
+ autotest (4.4.6)
11
+ ZenTest (>= 4.4.1)
12
+ diff-lcs (1.1.3)
13
+ rake (0.9.2.2)
14
+ rspec (2.11.0)
15
+ rspec-core (~> 2.11.0)
16
+ rspec-expectations (~> 2.11.0)
17
+ rspec-mocks (~> 2.11.0)
18
+ rspec-core (2.11.1)
19
+ rspec-expectations (2.11.2)
20
+ diff-lcs (~> 1.1.3)
21
+ rspec-mocks (2.11.1)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ apk!
28
+ autotest
29
+ rake
30
+ rspec
data/README.md CHANGED
@@ -0,0 +1,9 @@
1
+ ruby-apk
2
+ ========
3
+
4
+ Parse Android APK with Ruby.
5
+
6
+ System requirements
7
+ -------------------
8
+
9
+ ruby-apk uses tools from Android SDK, which only support x86, so you should install ia32-libs if your OS is amd64 version.
@@ -0,0 +1,5 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new('spec')
4
+
5
+ task :default => :spec
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + "/lib/apk/version"
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "apk"
5
+ s.version = APK::VERSION
6
+ s.date = Date.today.to_s
7
+ s.authors = ["Cedric Fung"]
8
+ s.email = ["wolfplanet@gmail.com"]
9
+ s.summary = "A simple Android APK parser"
10
+ s.description = "Get Android APK's label, features, api, icon, and other information"
11
+ s.homepage = "http://github.com/abitno/ruby-apk"
12
+ s.extra_rdoc_files = ["README.md"]
13
+ s.rdoc_options = ["--charset=UTF-8"]
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+
18
+ s.add_development_dependency "rake"
19
+ s.add_development_dependency "rspec"
20
+ s.add_development_dependency "autotest"
21
+ end
data/bin/apk ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'apk'
4
+
5
+ apk = APK.new ARGV[0]
6
+ puts apk.name
@@ -0,0 +1,17 @@
1
+ require 'apk/aapt'
2
+
3
+ class APK
4
+
5
+ attr_reader :apk, :aapt
6
+
7
+ def initialize(apk_path)
8
+ @apk = apk_path
9
+ @aapt = AAPT.new(@apk)
10
+ end
11
+
12
+
13
+ def method_missing(method, *args, &block)
14
+ @aapt.dump[method]
15
+ end
16
+
17
+ end
@@ -0,0 +1,26 @@
1
+ class APK
2
+ class AAPT
3
+ @@aapt = File.dirname(__FILE__) + "/../binaries/aapt"
4
+ attr_reader :apk
5
+
6
+ def initialize(apk_path)
7
+ @apk = apk_path
8
+ end
9
+
10
+ def aapt(commands)
11
+ `#{@@aapt} #{commands} #{@apk}`
12
+ end
13
+
14
+ def dump
15
+ attrs = {}
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]
22
+ attrs
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ class APK
2
+ VERSION = '0.1.1'
3
+ end
Binary file
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ 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'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-02 00:00:00.000000000 Z
12
+ date: 2012-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,31 +59,28 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: growl-glue
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- description: Get Android apk's label, features, api, icon, and other information
62
+ description: Get Android APK's label, features, api, icon, and other information
79
63
  email:
80
64
  - wolfplanet@gmail.com
81
- executables: []
65
+ executables:
66
+ - apk
82
67
  extensions: []
83
68
  extra_rdoc_files:
84
69
  - README.md
85
70
  files:
71
+ - .gitignore
72
+ - .rspec
73
+ - Gemfile
74
+ - Gemfile.lock
86
75
  - README.md
76
+ - Rakefile
77
+ - apk.gemspec
78
+ - bin/apk
79
+ - lib/apk.rb
80
+ - lib/apk/aapt.rb
81
+ - lib/apk/version.rb
82
+ - lib/binaries/aapt
83
+ - spec/spec_helper.rb
87
84
  homepage: http://github.com/abitno/ruby-apk
88
85
  licenses: []
89
86
  post_install_message:
@@ -108,6 +105,6 @@ rubyforge_project:
108
105
  rubygems_version: 1.8.24
109
106
  signing_key:
110
107
  specification_version: 3
111
- summary: A simple Android apk parser
108
+ summary: A simple Android APK parser
112
109
  test_files: []
113
110
  has_rdoc: