acouchi 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/acouchi.gemspec +1 -0
- data/lib/acouchi/apk_modifier.rb +3 -12
- data/lib/acouchi/executables.rb +13 -1
- data/lib/acouchi/project_builder.rb +1 -5
- data/lib/acouchi/test_runner.rb +1 -3
- data/lib/acouchi/version.rb +1 -1
- data/lib/acouchi/which.rb +3 -20
- metadata +17 -1
data/acouchi.gemspec
CHANGED
data/lib/acouchi/apk_modifier.rb
CHANGED
@@ -6,11 +6,6 @@ module Acouchi
|
|
6
6
|
def initialize apk
|
7
7
|
@apk = apk
|
8
8
|
@output_path = "#{Dir.tmpdir}/#{SecureRandom.uuid}/"
|
9
|
-
|
10
|
-
unless apktool
|
11
|
-
puts "Couldn't find a valid apktool. Please install apktool from http://code.google.com/p/android-apktool/"
|
12
|
-
exit
|
13
|
-
end
|
14
9
|
end
|
15
10
|
|
16
11
|
def modify_manifest
|
@@ -28,21 +23,17 @@ module Acouchi
|
|
28
23
|
end
|
29
24
|
|
30
25
|
private
|
31
|
-
def apktool
|
32
|
-
@apktool ||= Which.find_executable("apktool.bat", "apktool")
|
33
|
-
end
|
34
|
-
|
35
26
|
def decompile_apk
|
36
|
-
ProcessLauncher.new(apktool, "d", @apk, @output_path).with_inherited_io.start_and_crash_if_process_fails
|
27
|
+
ProcessLauncher.new(Executables.apktool, "d", @apk, @output_path).with_inherited_io.start_and_crash_if_process_fails
|
37
28
|
end
|
38
29
|
|
39
30
|
def compile_apk
|
40
|
-
ProcessLauncher.new(apktool, "b", @output_path).with_inherited_io.start_and_crash_if_process_fails
|
31
|
+
ProcessLauncher.new(Executables.apktool, "b", @output_path).with_inherited_io.start_and_crash_if_process_fails
|
41
32
|
end
|
42
33
|
|
43
34
|
def sign_apk_in_debug_mode
|
44
35
|
@new_apk = File.join(@output_path, "dist", File.basename(@apk))
|
45
|
-
jarsigner =
|
36
|
+
jarsigner = Executables.jarsigner
|
46
37
|
debug_keystore = File.join(ENV["HOME"], ".android", "debug.keystore")
|
47
38
|
ProcessLauncher.new(
|
48
39
|
jarsigner,
|
data/lib/acouchi/executables.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
module Acouchi
|
2
2
|
class Executables
|
3
3
|
def self.adb
|
4
|
-
@adb ||= Which.find_executable("adb
|
4
|
+
@adb ||= Which.find_executable("adb")
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.jarsigner
|
8
|
+
@jarsigner ||= Which.find_executable("jarsigner")
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.apktool
|
12
|
+
@apktool ||= Which.find_executable("apktool")
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.ant
|
16
|
+
@ant ||= Which.find_executable("ant")
|
5
17
|
end
|
6
18
|
end
|
7
19
|
end
|
@@ -75,13 +75,9 @@ module Acouchi
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def ant
|
79
|
-
Which.find_executable("ant.bat", "ant")
|
80
|
-
end
|
81
|
-
|
82
78
|
def build_apk
|
83
79
|
Dir.chdir configuration.project_path do
|
84
|
-
ProcessLauncher.new(ant, "clean", "debug").with_inherited_io.start_and_crash_if_process_fails
|
80
|
+
ProcessLauncher.new(Executables.ant, "clean", "debug").with_inherited_io.start_and_crash_if_process_fails
|
85
81
|
end
|
86
82
|
end
|
87
83
|
end
|
data/lib/acouchi/test_runner.rb
CHANGED
@@ -13,9 +13,7 @@ module Acouchi
|
|
13
13
|
@test_runner_process = ProcessLauncher.new(Executables.adb, "shell", "am", "instrument", "-w", "#{@configuration.target_package}/android.test.InstrumentationTestRunner")
|
14
14
|
@test_runner_process.start_in_background
|
15
15
|
|
16
|
-
|
17
|
-
sleep 0.1
|
18
|
-
end
|
16
|
+
sleep 0.1 until ready?
|
19
17
|
end
|
20
18
|
|
21
19
|
def stop
|
data/lib/acouchi/version.rb
CHANGED
data/lib/acouchi/which.rb
CHANGED
@@ -1,29 +1,12 @@
|
|
1
1
|
module Acouchi
|
2
2
|
class Which
|
3
|
-
def self.find_executable
|
4
|
-
|
3
|
+
def self.find_executable name
|
4
|
+
require "ptools"
|
5
|
+
if executable = File.which(name)
|
5
6
|
executable
|
6
7
|
else
|
7
8
|
raise %{Couldn't find any matches for the aliases "#{aliases.join(", ")}"}
|
8
9
|
end
|
9
10
|
end
|
10
|
-
|
11
|
-
private
|
12
|
-
def self.which? command
|
13
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
14
|
-
exe = File.join(path, "#{command}")
|
15
|
-
return exe if executable? exe
|
16
|
-
end
|
17
|
-
return nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.executable? file
|
21
|
-
return true if File.executable?(file)
|
22
|
-
extensions = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : []
|
23
|
-
File.exist?(file) &&
|
24
|
-
File.file?(file) &&
|
25
|
-
extensions.any? &&
|
26
|
-
extensions.any? {|e| file.downcase.end_with?(e.downcase)}
|
27
|
-
end
|
28
11
|
end
|
29
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acouchi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: ptools
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: ''
|
63
79
|
email:
|
64
80
|
- andrew.vos@gmail.com
|