acouchi 0.0.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.
- data/.gitignore +28 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/README.md +48 -0
- data/Rakefile +1 -0
- data/acouchi.gemspec +21 -0
- data/examples/AcouchiSample/AndroidManifest.xml +15 -0
- data/examples/AcouchiSample/Rakefile +13 -0
- data/examples/AcouchiSample/acouchi_configuration.json +6 -0
- data/examples/AcouchiSample/ant.properties +17 -0
- data/examples/AcouchiSample/build.xml +92 -0
- data/examples/AcouchiSample/features/step_definitions/steps.rb +15 -0
- data/examples/AcouchiSample/features/support/env.rb +9 -0
- data/examples/AcouchiSample/features/write_text.feature +7 -0
- data/examples/AcouchiSample/project.properties +14 -0
- data/examples/AcouchiSample/res/drawable-hdpi/ic_launcher.png +0 -0
- data/examples/AcouchiSample/res/drawable-ldpi/ic_launcher.png +0 -0
- data/examples/AcouchiSample/res/drawable-mdpi/ic_launcher.png +0 -0
- data/examples/AcouchiSample/res/drawable-xhdpi/ic_launcher.png +0 -0
- data/examples/AcouchiSample/res/layout/main.xml +12 -0
- data/examples/AcouchiSample/res/values/strings.xml +4 -0
- data/examples/AcouchiSample/src/com/acouchi/sample/StartupActivity.java +15 -0
- data/jars/robotium-solo-3.4.1.jar +0 -0
- data/lib/acouchi.rb +5 -0
- data/lib/acouchi/apk_modifier.rb +54 -0
- data/lib/acouchi/configuration.rb +16 -0
- data/lib/acouchi/cucumber.rb +16 -0
- data/lib/acouchi/project_builder.rb +91 -0
- data/lib/acouchi/solo.rb +49 -0
- data/lib/acouchi/test_runner.rb +33 -0
- data/lib/acouchi/version.rb +3 -0
- data/not-yet-implemented.md +223 -0
- data/src/com/acouchi/Acouchi.java +144 -0
- data/src/com/acouchi/NanoHTTPD.java +1119 -0
- data/src/com/acouchi/TestCase.java +32 -0
- metadata +113 -0
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#android
|
2
|
+
*.apk
|
3
|
+
*.ap_
|
4
|
+
*.dex
|
5
|
+
*.class
|
6
|
+
bin/
|
7
|
+
gen/
|
8
|
+
local.properties
|
9
|
+
proguard-project.txt
|
10
|
+
|
11
|
+
#rubygems
|
12
|
+
*.gem
|
13
|
+
*.rbc
|
14
|
+
.bundle
|
15
|
+
.config
|
16
|
+
.yardoc
|
17
|
+
Gemfile.lock
|
18
|
+
InstalledFiles
|
19
|
+
_yardoc
|
20
|
+
coverage
|
21
|
+
doc/
|
22
|
+
lib/bundler/man
|
23
|
+
pkg
|
24
|
+
rdoc
|
25
|
+
spec/reports
|
26
|
+
test/tmp
|
27
|
+
test/version_tmp
|
28
|
+
tmp
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p0
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
Acouchi
|
2
|
+
=======
|
3
|
+
|
4
|
+
Requirements
|
5
|
+
------------
|
6
|
+
|
7
|
+
* [Android SDK](http://developer.android.com/sdk/installing/index.html) (Make sure to add SDK/tools and SDK/platform-tools to your PATH)
|
8
|
+
* [apktool](http://code.google.com/p/android-apktool/)
|
9
|
+
|
10
|
+
Cucumber
|
11
|
+
--------
|
12
|
+
|
13
|
+
### PROJECT_ROOT/features/support/env.rb
|
14
|
+
|
15
|
+
require "acouchi"
|
16
|
+
require "acouchi/cucumber"
|
17
|
+
|
18
|
+
configuration = Acouchi::Configuration.from_json(File.read("acouchi_configuration.json"))
|
19
|
+
Acouchi::Cucumber.prepare(configuration)
|
20
|
+
|
21
|
+
def page
|
22
|
+
Acouchi::Cucumber.page
|
23
|
+
end
|
24
|
+
|
25
|
+
### PROJECT_ROOT/acouchi_configuration.json
|
26
|
+
|
27
|
+
{
|
28
|
+
"target_package": "com.acouchi.sample",
|
29
|
+
"activity" : "com.acouchi.sample.StartupActivity",
|
30
|
+
"project_path" : ".",
|
31
|
+
"apk" : "AcouchiSample-debug.apk"
|
32
|
+
}
|
33
|
+
|
34
|
+
### PROJECT_ROOT/Rakefile
|
35
|
+
|
36
|
+
require "cucumber"
|
37
|
+
require "cucumber/rake/task"
|
38
|
+
require "acouchi"
|
39
|
+
|
40
|
+
desc "build project with Acouchi code included"
|
41
|
+
task :build do
|
42
|
+
configuration = Acouchi::Configuration.from_json(File.read("acouchi_configuration.json"))
|
43
|
+
Acouchi::ProjectBuilder.new(configuration).build
|
44
|
+
end
|
45
|
+
|
46
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
47
|
+
t.cucumber_opts = "features --format pretty"
|
48
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/acouchi.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'acouchi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "acouchi"
|
8
|
+
gem.version = Acouchi::VERSION
|
9
|
+
gem.authors = ["Andrew Vos"]
|
10
|
+
gem.email = ["andrew.vos@gmail.com"]
|
11
|
+
gem.description = %q{}
|
12
|
+
gem.summary = %q{}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_runtime_dependency "httparty"
|
20
|
+
gem.add_runtime_dependency "childprocess"
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
+
package="com.acouchi.sample"
|
4
|
+
android:versionCode="1"
|
5
|
+
android:versionName="1.0">
|
6
|
+
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
7
|
+
<activity android:name="StartupActivity"
|
8
|
+
android:label="@string/app_name">
|
9
|
+
<intent-filter>
|
10
|
+
<action android:name="android.intent.action.MAIN" />
|
11
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
12
|
+
</intent-filter>
|
13
|
+
</activity>
|
14
|
+
</application>
|
15
|
+
</manifest>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "cucumber"
|
2
|
+
require "cucumber/rake/task"
|
3
|
+
require "acouchi"
|
4
|
+
|
5
|
+
desc "build project with Acouchi code included"
|
6
|
+
task :build do
|
7
|
+
configuration = Acouchi::Configuration.from_json(File.read("acouchi_configuration.json"))
|
8
|
+
Acouchi::ProjectBuilder.new(configuration).build
|
9
|
+
end
|
10
|
+
|
11
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
12
|
+
t.cucumber_opts = "features --format pretty"
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file is used to override default values used by the Ant build system.
|
2
|
+
#
|
3
|
+
# This file must be checked into Version Control Systems, as it is
|
4
|
+
# integral to the build system of your project.
|
5
|
+
|
6
|
+
# This file is only used by the Ant script.
|
7
|
+
|
8
|
+
# You can use this to override default values such as
|
9
|
+
# 'source.dir' for the location of your java source folder and
|
10
|
+
# 'out.dir' for the location of your output folder.
|
11
|
+
|
12
|
+
# You can also use it define how the release builds are signed by declaring
|
13
|
+
# the following properties:
|
14
|
+
# 'key.store' for the location of your keystore and
|
15
|
+
# 'key.alias' for the name of the key to use.
|
16
|
+
# The password will be asked during the build when you use the 'release' target.
|
17
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project name="AcouchiSample" default="help">
|
3
|
+
|
4
|
+
<!-- The local.properties file is created and updated by the 'android' tool.
|
5
|
+
It contains the path to the SDK. It should *NOT* be checked into
|
6
|
+
Version Control Systems. -->
|
7
|
+
<property file="local.properties" />
|
8
|
+
|
9
|
+
<!-- The ant.properties file can be created by you. It is only edited by the
|
10
|
+
'android' tool to add properties to it.
|
11
|
+
This is the place to change some Ant specific build properties.
|
12
|
+
Here are some properties you may want to change/update:
|
13
|
+
|
14
|
+
source.dir
|
15
|
+
The name of the source directory. Default is 'src'.
|
16
|
+
out.dir
|
17
|
+
The name of the output directory. Default is 'bin'.
|
18
|
+
|
19
|
+
For other overridable properties, look at the beginning of the rules
|
20
|
+
files in the SDK, at tools/ant/build.xml
|
21
|
+
|
22
|
+
Properties related to the SDK location or the project target should
|
23
|
+
be updated using the 'android' tool with the 'update' action.
|
24
|
+
|
25
|
+
This file is an integral part of the build system for your
|
26
|
+
application and should be checked into Version Control Systems.
|
27
|
+
|
28
|
+
-->
|
29
|
+
<property file="ant.properties" />
|
30
|
+
|
31
|
+
<!-- if sdk.dir was not set from one of the property file, then
|
32
|
+
get it from the ANDROID_HOME env var.
|
33
|
+
This must be done before we load project.properties since
|
34
|
+
the proguard config can use sdk.dir -->
|
35
|
+
<property environment="env" />
|
36
|
+
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
37
|
+
<isset property="env.ANDROID_HOME" />
|
38
|
+
</condition>
|
39
|
+
|
40
|
+
<!-- The project.properties file is created and updated by the 'android'
|
41
|
+
tool, as well as ADT.
|
42
|
+
|
43
|
+
This contains project specific properties such as project target, and library
|
44
|
+
dependencies. Lower level build properties are stored in ant.properties
|
45
|
+
(or in .classpath for Eclipse projects).
|
46
|
+
|
47
|
+
This file is an integral part of the build system for your
|
48
|
+
application and should be checked into Version Control Systems. -->
|
49
|
+
<loadproperties srcFile="project.properties" />
|
50
|
+
|
51
|
+
<!-- quick check on sdk.dir -->
|
52
|
+
<fail
|
53
|
+
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
54
|
+
unless="sdk.dir"
|
55
|
+
/>
|
56
|
+
|
57
|
+
<!--
|
58
|
+
Import per project custom build rules if present at the root of the project.
|
59
|
+
This is the place to put custom intermediary targets such as:
|
60
|
+
-pre-build
|
61
|
+
-pre-compile
|
62
|
+
-post-compile (This is typically used for code obfuscation.
|
63
|
+
Compiled code location: ${out.classes.absolute.dir}
|
64
|
+
If this is not done in place, override ${out.dex.input.absolute.dir})
|
65
|
+
-post-package
|
66
|
+
-post-build
|
67
|
+
-pre-clean
|
68
|
+
-->
|
69
|
+
<import file="custom_rules.xml" optional="true" />
|
70
|
+
|
71
|
+
<!-- Import the actual build file.
|
72
|
+
|
73
|
+
To customize existing targets, there are two options:
|
74
|
+
- Customize only one target:
|
75
|
+
- copy/paste the target into this file, *before* the
|
76
|
+
<import> task.
|
77
|
+
- customize it to your needs.
|
78
|
+
- Customize the whole content of build.xml
|
79
|
+
- copy/paste the content of the rules files (minus the top node)
|
80
|
+
into this file, replacing the <import> task.
|
81
|
+
- customize to your needs.
|
82
|
+
|
83
|
+
***********************
|
84
|
+
****** IMPORTANT ******
|
85
|
+
***********************
|
86
|
+
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
87
|
+
in order to avoid having your file be overridden by tools such as "android update project"
|
88
|
+
-->
|
89
|
+
<!-- version-tag: 1 -->
|
90
|
+
<import file="${sdk.dir}/tools/ant/build.xml" />
|
91
|
+
|
92
|
+
</project>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
When /^I write the text "(.*?)"$/ do |text|
|
2
|
+
page.enter_text(0, text)
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I clear the text$/ do
|
6
|
+
page.clear_edit_text(0)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I see "(.*?)"$/ do |text|
|
10
|
+
page.should have_text text
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^I do not see "(.*?)"$/ do |text|
|
14
|
+
page.should_not have_text text
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file is automatically generated by Android Tools.
|
2
|
+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
3
|
+
#
|
4
|
+
# This file must be checked in Version Control Systems.
|
5
|
+
#
|
6
|
+
# To customize properties used by the Ant build system edit
|
7
|
+
# "ant.properties", and override values to adapt the script to your
|
8
|
+
# project structure.
|
9
|
+
#
|
10
|
+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
11
|
+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
12
|
+
|
13
|
+
# Project target.
|
14
|
+
target=android-16
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
+
android:orientation="vertical"
|
4
|
+
android:layout_width="fill_parent"
|
5
|
+
android:layout_height="fill_parent"
|
6
|
+
>
|
7
|
+
<EditText
|
8
|
+
android:layout_width="fill_parent"
|
9
|
+
android:layout_height="wrap_content"
|
10
|
+
/>
|
11
|
+
</LinearLayout>
|
12
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package com.acouchi.sample;
|
2
|
+
|
3
|
+
import android.app.Activity;
|
4
|
+
import android.os.Bundle;
|
5
|
+
|
6
|
+
public class StartupActivity extends Activity
|
7
|
+
{
|
8
|
+
/** Called when the activity is first created. */
|
9
|
+
@Override
|
10
|
+
public void onCreate(Bundle savedInstanceState)
|
11
|
+
{
|
12
|
+
super.onCreate(savedInstanceState);
|
13
|
+
setContentView(R.layout.main);
|
14
|
+
}
|
15
|
+
}
|
Binary file
|
data/lib/acouchi.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "tmpdir"
|
2
|
+
require "securerandom"
|
3
|
+
|
4
|
+
module Acouchi
|
5
|
+
class ApkModifier
|
6
|
+
def initialize apk
|
7
|
+
@apk = apk
|
8
|
+
@apk_tool = `which apktool`.strip
|
9
|
+
@output_path = "#{Dir.tmpdir}/#{SecureRandom.uuid}/"
|
10
|
+
|
11
|
+
if @apk_tool.empty?
|
12
|
+
puts "Couldn't find a valid apktool. Please install apktool from http://code.google.com/p/android-apktool/"
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def modify_manifest
|
18
|
+
if block_given?
|
19
|
+
decompile_apk
|
20
|
+
manifest_path = File.join(@output_path, "AndroidManifest.xml")
|
21
|
+
new_manifest = yield(File.read(manifest_path))
|
22
|
+
File.open(manifest_path, "w") {|f| f.write(new_manifest)}
|
23
|
+
compile_apk
|
24
|
+
sign_apk_in_debug_mode
|
25
|
+
overwrite_original_apk
|
26
|
+
else
|
27
|
+
throw "modify_manifest takes a block"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def apktool command
|
33
|
+
puts "#{@apk_tool} #{command}"
|
34
|
+
system "#{@apk_tool} #{command}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def decompile_apk
|
38
|
+
apktool "d #{@apk} #{@output_path}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def compile_apk
|
42
|
+
apktool "b #{@output_path}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def sign_apk_in_debug_mode
|
46
|
+
@new_apk = File.join(@output_path, "dist", File.basename(@apk))
|
47
|
+
system "jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android #{@new_apk} androiddebugkey"
|
48
|
+
end
|
49
|
+
|
50
|
+
def overwrite_original_apk
|
51
|
+
FileUtils.mv(@new_apk, @apk)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Acouchi
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :target_package, :activity, :project_path, :apk
|
4
|
+
|
5
|
+
def self.from_json json
|
6
|
+
require "json"
|
7
|
+
json = JSON.parse(json)
|
8
|
+
configuration = Configuration.new
|
9
|
+
configuration.target_package = json["target_package"]
|
10
|
+
configuration.activity = json["activity"]
|
11
|
+
configuration.project_path = json["project_path"]
|
12
|
+
configuration.apk = json["apk"]
|
13
|
+
configuration
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|