cukunity 0.1.0

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.
Files changed (226) hide show
  1. data/.document +5 -0
  2. data/.gitmodules +0 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +60 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +214 -0
  8. data/Rakefile +51 -0
  9. data/Unity/Assets/Demo/Art/Buttons/down.png +0 -0
  10. data/Unity/Assets/Demo/Art/Buttons/down.png.meta +28 -0
  11. data/Unity/Assets/Demo/Art/Buttons/left.png +0 -0
  12. data/Unity/Assets/Demo/Art/Buttons/left.png.meta +28 -0
  13. data/Unity/Assets/Demo/Art/Buttons/ok.png +0 -0
  14. data/Unity/Assets/Demo/Art/Buttons/ok.png.meta +28 -0
  15. data/Unity/Assets/Demo/Art/Buttons/options.png +0 -0
  16. data/Unity/Assets/Demo/Art/Buttons/options.png.meta +28 -0
  17. data/Unity/Assets/Demo/Art/Buttons/play.png +0 -0
  18. data/Unity/Assets/Demo/Art/Buttons/play.png.meta +28 -0
  19. data/Unity/Assets/Demo/Art/Buttons/quit.png +0 -0
  20. data/Unity/Assets/Demo/Art/Buttons/quit.png.meta +28 -0
  21. data/Unity/Assets/Demo/Art/Buttons/retry.png +0 -0
  22. data/Unity/Assets/Demo/Art/Buttons/retry.png.meta +28 -0
  23. data/Unity/Assets/Demo/Art/Buttons/right.png +0 -0
  24. data/Unity/Assets/Demo/Art/Buttons/right.png.meta +28 -0
  25. data/Unity/Assets/Demo/Art/Buttons/up.png +0 -0
  26. data/Unity/Assets/Demo/Art/Buttons/up.png.meta +28 -0
  27. data/Unity/Assets/Demo/Art/Buttons.meta +2 -0
  28. data/Unity/Assets/Demo/Art/clear.png +0 -0
  29. data/Unity/Assets/Demo/Art/clear.png.meta +28 -0
  30. data/Unity/Assets/Demo/Art/options.png +0 -0
  31. data/Unity/Assets/Demo/Art/options.png.meta +28 -0
  32. data/Unity/Assets/Demo/Art/sokoban.png +0 -0
  33. data/Unity/Assets/Demo/Art/sokoban.png.meta +28 -0
  34. data/Unity/Assets/Demo/Art.meta +2 -0
  35. data/Unity/Assets/Demo/Cubes/CrateCube.mat +0 -0
  36. data/Unity/Assets/Demo/Cubes/CrateCube.mat.meta +2 -0
  37. data/Unity/Assets/Demo/Cubes/CrateCube.prefab +0 -0
  38. data/Unity/Assets/Demo/Cubes/CrateCube.prefab.meta +2 -0
  39. data/Unity/Assets/Demo/Cubes/FloorCube.mat +0 -0
  40. data/Unity/Assets/Demo/Cubes/FloorCube.mat.meta +2 -0
  41. data/Unity/Assets/Demo/Cubes/FloorCube.prefab +0 -0
  42. data/Unity/Assets/Demo/Cubes/FloorCube.prefab.meta +2 -0
  43. data/Unity/Assets/Demo/Cubes/GoalCube.mat +0 -0
  44. data/Unity/Assets/Demo/Cubes/GoalCube.mat.meta +2 -0
  45. data/Unity/Assets/Demo/Cubes/GoalCube.prefab +0 -0
  46. data/Unity/Assets/Demo/Cubes/GoalCube.prefab.meta +2 -0
  47. data/Unity/Assets/Demo/Cubes/PlayerCube.mat +0 -0
  48. data/Unity/Assets/Demo/Cubes/PlayerCube.mat.meta +2 -0
  49. data/Unity/Assets/Demo/Cubes/PlayerCube.prefab +0 -0
  50. data/Unity/Assets/Demo/Cubes/PlayerCube.prefab.meta +2 -0
  51. data/Unity/Assets/Demo/Cubes/WallCube.mat +0 -0
  52. data/Unity/Assets/Demo/Cubes/WallCube.mat.meta +2 -0
  53. data/Unity/Assets/Demo/Cubes/WallCube.prefab +0 -0
  54. data/Unity/Assets/Demo/Cubes/WallCube.prefab.meta +2 -0
  55. data/Unity/Assets/Demo/Cubes.meta +2 -0
  56. data/Unity/Assets/Demo/Resources/MainMenu.prefab +0 -0
  57. data/Unity/Assets/Demo/Resources/MainMenu.prefab.meta +2 -0
  58. data/Unity/Assets/Demo/Resources/OptionsMenu.prefab +0 -0
  59. data/Unity/Assets/Demo/Resources/OptionsMenu.prefab.meta +2 -0
  60. data/Unity/Assets/Demo/Resources.meta +2 -0
  61. data/Unity/Assets/Demo/Scripts/CameraController.js +18 -0
  62. data/Unity/Assets/Demo/Scripts/CameraController.js.meta +2 -0
  63. data/Unity/Assets/Demo/Scripts/EnterPlayerName.js +21 -0
  64. data/Unity/Assets/Demo/Scripts/EnterPlayerName.js.meta +2 -0
  65. data/Unity/Assets/Demo/Scripts/GameLeftButton.js +18 -0
  66. data/Unity/Assets/Demo/Scripts/GameLeftButton.js.meta +2 -0
  67. data/Unity/Assets/Demo/Scripts/GameQuitButton.js +6 -0
  68. data/Unity/Assets/Demo/Scripts/GameQuitButton.js.meta +2 -0
  69. data/Unity/Assets/Demo/Scripts/GameRetryButton.js +7 -0
  70. data/Unity/Assets/Demo/Scripts/GameRetryButton.js.meta +2 -0
  71. data/Unity/Assets/Demo/Scripts/GameRightButton.js +18 -0
  72. data/Unity/Assets/Demo/Scripts/GameRightButton.js.meta +2 -0
  73. data/Unity/Assets/Demo/Scripts/GameUpButton.js +18 -0
  74. data/Unity/Assets/Demo/Scripts/GameUpButton.js.meta +2 -0
  75. data/Unity/Assets/Demo/Scripts/OnTouchGUIElementDown.js +34 -0
  76. data/Unity/Assets/Demo/Scripts/OnTouchGUIElementDown.js.meta +2 -0
  77. data/Unity/Assets/Demo/Scripts/PlayerData.js +3 -0
  78. data/Unity/Assets/Demo/Scripts/PlayerData.js.meta +2 -0
  79. data/Unity/Assets/Demo/Scripts/SokobanController.js +240 -0
  80. data/Unity/Assets/Demo/Scripts/SokobanController.js.meta +2 -0
  81. data/Unity/Assets/Demo/Scripts/TakeScreenShot.js +26 -0
  82. data/Unity/Assets/Demo/Scripts/TakeScreenShot.js.meta +2 -0
  83. data/Unity/Assets/Demo/Scripts/TitleOptionsButton.js +8 -0
  84. data/Unity/Assets/Demo/Scripts/TitleOptionsButton.js.meta +2 -0
  85. data/Unity/Assets/Demo/Scripts/TitleOptionsOkButton.js +8 -0
  86. data/Unity/Assets/Demo/Scripts/TitleOptionsOkButton.js.meta +2 -0
  87. data/Unity/Assets/Demo/Scripts/TitlePlayButton.js +6 -0
  88. data/Unity/Assets/Demo/Scripts/TitlePlayButton.js.meta +2 -0
  89. data/Unity/Assets/Demo/Scripts/TitleQuitButton.js +7 -0
  90. data/Unity/Assets/Demo/Scripts/TitleQuitButton.js.meta +2 -0
  91. data/Unity/Assets/Demo/Scripts/UpdateMovesLabel.js +26 -0
  92. data/Unity/Assets/Demo/Scripts/UpdateMovesLabel.js.meta +2 -0
  93. data/Unity/Assets/Demo/Scripts/UpdatePlayerName.js +14 -0
  94. data/Unity/Assets/Demo/Scripts/UpdatePlayerName.js.meta +2 -0
  95. data/Unity/Assets/Demo/Scripts.meta +2 -0
  96. data/Unity/Assets/Demo/demo_game.unity +0 -0
  97. data/Unity/Assets/Demo/demo_game.unity.meta +2 -0
  98. data/Unity/Assets/Demo/demo_title.unity +0 -0
  99. data/Unity/Assets/Demo/demo_title.unity.meta +2 -0
  100. data/Unity/Assets/Demo.meta +2 -0
  101. data/Unity/Assets/Plugins/CukunityInstance.prefab +0 -0
  102. data/Unity/Assets/Plugins/CukunityInstance.prefab.meta +2 -0
  103. data/Unity/Assets/Plugins/CukunityServer.cs +871 -0
  104. data/Unity/Assets/Plugins/CukunityServer.cs.meta +2 -0
  105. data/Unity/Assets/Plugins/JsonFx.Json.dll +0 -0
  106. data/Unity/Assets/Plugins/JsonFx.Json.dll.meta +2 -0
  107. data/Unity/Assets/Plugins/iOS/CukunityServer.mm +242 -0
  108. data/Unity/Assets/Plugins/iOS/CukunityServer.mm.meta +2 -0
  109. data/Unity/Assets/Plugins/iOS.meta +2 -0
  110. data/Unity/Assets/Plugins.meta +2 -0
  111. data/Unity/Library/AudioManager.asset +0 -0
  112. data/Unity/Library/BuildSettings.asset +0 -0
  113. data/Unity/Library/DynamicsManager.asset +0 -0
  114. data/Unity/Library/EditorBuildSettings.asset +0 -0
  115. data/Unity/Library/EditorSettings.asset +0 -0
  116. data/Unity/Library/EditorUserBuildSettings.asset +0 -0
  117. data/Unity/Library/EditorUserSettings.asset +0 -0
  118. data/Unity/Library/InputManager.asset +0 -0
  119. data/Unity/Library/InspectorExpandedItems.asset +0 -0
  120. data/Unity/Library/MonoManager.asset +0 -0
  121. data/Unity/Library/NetworkManager.asset +0 -0
  122. data/Unity/Library/ProjectSettings.asset +0 -0
  123. data/Unity/Library/QualitySettings.asset +0 -0
  124. data/Unity/Library/TagManager.asset +0 -0
  125. data/Unity/Library/TimeManager.asset +0 -0
  126. data/Unity/ProjectSettings/AudioManager.asset +0 -0
  127. data/Unity/ProjectSettings/DynamicsManager.asset +0 -0
  128. data/Unity/ProjectSettings/EditorBuildSettings.asset +0 -0
  129. data/Unity/ProjectSettings/EditorSettings.asset +0 -0
  130. data/Unity/ProjectSettings/InputManager.asset +0 -0
  131. data/Unity/ProjectSettings/NavMeshLayers.asset +0 -0
  132. data/Unity/ProjectSettings/NetworkManager.asset +0 -0
  133. data/Unity/ProjectSettings/ProjectSettings.asset +0 -0
  134. data/Unity/ProjectSettings/QualitySettings.asset +0 -0
  135. data/Unity/ProjectSettings/TagManager.asset +0 -0
  136. data/Unity/ProjectSettings/TimeManager.asset +0 -0
  137. data/VERSION +1 -0
  138. data/bin/cukunity +7 -0
  139. data/cukunity.gemspec +298 -0
  140. data/features/get_scene_command.feature +39 -0
  141. data/features/i18n/ja/sokoban_clear.feature +109 -0
  142. data/features/install.feature +23 -0
  143. data/features/keyboard_input.feature +26 -0
  144. data/features/load_level_command.feature +36 -0
  145. data/features/run.feature +33 -0
  146. data/features/select_visible.feature +29 -0
  147. data/features/support/env.rb +11 -0
  148. data/features/touch_input.feature +96 -0
  149. data/lib/cukunity/cli/argument_parser.rb +103 -0
  150. data/lib/cukunity/cli/bootstrap_command.rb +39 -0
  151. data/lib/cukunity/cli/doctor_command.rb +150 -0
  152. data/lib/cukunity/cli/features_command.rb +35 -0
  153. data/lib/cukunity/cli/main.rb +18 -0
  154. data/lib/cukunity/cli/options.rb +8 -0
  155. data/lib/cukunity/cli.rb +11 -0
  156. data/lib/cukunity/cucumber/step_definitions/get_scene_command_steps.rb +37 -0
  157. data/lib/cukunity/cucumber/step_definitions/i18n/ja/get_scene_command_steps.rb +37 -0
  158. data/lib/cukunity/cucumber/step_definitions/i18n/ja/install_steps.rb +25 -0
  159. data/lib/cukunity/cucumber/step_definitions/i18n/ja/keyboard_input_steps.rb +17 -0
  160. data/lib/cukunity/cucumber/step_definitions/i18n/ja/load_level_command_steps.rb +17 -0
  161. data/lib/cukunity/cucumber/step_definitions/i18n/ja/run_steps.rb +25 -0
  162. data/lib/cukunity/cucumber/step_definitions/i18n/ja/select_visible_steps.rb +9 -0
  163. data/lib/cukunity/cucumber/step_definitions/i18n/ja/touch_input_steps.rb +19 -0
  164. data/lib/cukunity/cucumber/step_definitions/i18n/ja.rb +9 -0
  165. data/lib/cukunity/cucumber/step_definitions/install_steps.rb +33 -0
  166. data/lib/cukunity/cucumber/step_definitions/keyboard_input_steps.rb +13 -0
  167. data/lib/cukunity/cucumber/step_definitions/load_level_command_steps.rb +17 -0
  168. data/lib/cukunity/cucumber/step_definitions/run_steps.rb +32 -0
  169. data/lib/cukunity/cucumber/step_definitions/select_visible_steps.rb +15 -0
  170. data/lib/cukunity/cucumber/step_definitions/touch_input_steps.rb +18 -0
  171. data/lib/cukunity/cucumber/support/platform_helpers.rb +105 -0
  172. data/lib/cukunity/cucumber/support/spec_helpers.rb +21 -0
  173. data/lib/cukunity/cucumber/support/transforms.rb +5 -0
  174. data/lib/cukunity/cucumber/support/unity_helpers.rb +35 -0
  175. data/lib/cukunity/cucumber.rb +28 -0
  176. data/lib/cukunity/drivers/android/app.rb +43 -0
  177. data/lib/cukunity/drivers/android/appkiller/.gitignore +9 -0
  178. data/lib/cukunity/drivers/android/appkiller/AndroidManifest.xml +17 -0
  179. data/lib/cukunity/drivers/android/appkiller/ant.properties +17 -0
  180. data/lib/cukunity/drivers/android/appkiller/build.xml +85 -0
  181. data/lib/cukunity/drivers/android/appkiller/proguard.cfg +40 -0
  182. data/lib/cukunity/drivers/android/appkiller/project.properties +11 -0
  183. data/lib/cukunity/drivers/android/appkiller/res/layout/main.xml +13 -0
  184. data/lib/cukunity/drivers/android/appkiller/res/values/strings.xml +4 -0
  185. data/lib/cukunity/drivers/android/appkiller/src/cukunity/appkiller/AppKiller.java +29 -0
  186. data/lib/cukunity/drivers/android/keyboard_input.rb +149 -0
  187. data/lib/cukunity/drivers/android/keycodes.rb +531 -0
  188. data/lib/cukunity/drivers/android/monkey_client.rb +65 -0
  189. data/lib/cukunity/drivers/android/process.rb +103 -0
  190. data/lib/cukunity/drivers/android/touch_input.rb +24 -0
  191. data/lib/cukunity/drivers/android/tunnel_client_methods.rb +22 -0
  192. data/lib/cukunity/drivers/android/unity_client.rb +27 -0
  193. data/lib/cukunity/drivers/android/utils.rb +50 -0
  194. data/lib/cukunity/drivers/android.rb +9 -0
  195. data/lib/cukunity/drivers/iOS/app.rb +32 -0
  196. data/lib/cukunity/drivers/iOS/keyboard_input.rb +104 -0
  197. data/lib/cukunity/drivers/iOS/process.rb +42 -0
  198. data/lib/cukunity/drivers/iOS/touch_input.rb +18 -0
  199. data/lib/cukunity/drivers/iOS/tunnel_client_methods.rb +27 -0
  200. data/lib/cukunity/drivers/iOS/uiautomation.rb +97 -0
  201. data/lib/cukunity/drivers/iOS/uiautomation_master.rb +152 -0
  202. data/lib/cukunity/drivers/iOS/uiautomation_slave.js +238 -0
  203. data/lib/cukunity/drivers/iOS/uiautomation_slave.rb +41 -0
  204. data/lib/cukunity/drivers/iOS/unity_client.rb +27 -0
  205. data/lib/cukunity/drivers/iOS/utils.rb +46 -0
  206. data/lib/cukunity/drivers/iOS.rb +9 -0
  207. data/lib/cukunity/exceptions.rb +24 -0
  208. data/lib/cukunity/keyboard_input_methods.rb +35 -0
  209. data/lib/cukunity/request_line_response_client_methods.rb +80 -0
  210. data/lib/cukunity/tasks/cucumber.rake +22 -0
  211. data/lib/cukunity/touch_input_methods.rb +19 -0
  212. data/lib/cukunity/unity/client_methods.rb +46 -0
  213. data/lib/cukunity/unity/command_facade.rb +67 -0
  214. data/lib/cukunity/unity/component.rb +39 -0
  215. data/lib/cukunity/unity/gameobject.rb +53 -0
  216. data/lib/cukunity/unity/hint.rb +27 -0
  217. data/lib/cukunity/unity/json_container.rb +48 -0
  218. data/lib/cukunity/unity/level.rb +6 -0
  219. data/lib/cukunity/unity/scene.rb +18 -0
  220. data/lib/cukunity/unity/screen.rb +45 -0
  221. data/lib/cukunity/unity/screen_hint_methods.rb +61 -0
  222. data/lib/cukunity/unity/text_hint_methods.rb +17 -0
  223. data/lib/cukunity/unity.rb +11 -0
  224. data/lib/cukunity/utils.rb +56 -0
  225. data/lib/cukunity.rb +19 -0
  226. metadata +411 -0
@@ -0,0 +1,21 @@
1
+ module Cukunity
2
+ module SpecHelpers
3
+ def should(negation, target, *args)
4
+ if negation
5
+ target.should_not *args
6
+ else
7
+ target.should *args
8
+ end
9
+ end
10
+
11
+ def should_equal(negation, target, arg)
12
+ if negation
13
+ target.should_not == arg
14
+ else
15
+ target.should == arg
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ World(Cukunity::SpecHelpers)
@@ -0,0 +1,5 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ Transform /^(\d+(?:\.\d+)?)\s*s(?:ecs?|econds?)$/ do |time|
4
+ time.to_f
5
+ end
@@ -0,0 +1,35 @@
1
+ module Cukunity
2
+ module UnityHelpers
3
+ extend Forwardable
4
+ def_delegator :unity, :screen
5
+ def_delegator :unity, :level
6
+ def_delegator :unity, :load_level
7
+ def_delegator :unity, :scene
8
+ def_delegator :unity, :gameobject
9
+ def_delegator :unity, :gameobjects
10
+ def_delegator :unity, :components
11
+ def_delegator :unity, :hints
12
+ def_delegator :unity, :hint
13
+
14
+ def unity
15
+ raise Exception::UnspecifiedPlatform.new if @platform.nil?
16
+ @platform::Unity::Client.instance
17
+ end
18
+
19
+ attr_accessor :current_object
20
+
21
+ attr_accessor :current_gameobject
22
+ def set_current_gameobject(gameobject)
23
+ self.current_object = gameobject
24
+ self.current_gameobject = gameobject
25
+ end
26
+
27
+ attr_accessor :current_component
28
+ def set_current_component(component)
29
+ self.current_object = component
30
+ self.current_component = component
31
+ end
32
+ end
33
+ end
34
+
35
+ World(Cukunity::UnityHelpers)
@@ -0,0 +1,28 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'cucumber'
4
+ require 'rspec/core'
5
+ require 'rspec/expectations'
6
+
7
+ require 'cukunity'
8
+
9
+ cucumber_dir = File.join(File.dirname(__FILE__), 'cucumber')
10
+
11
+ # helpers
12
+ Dir.glob(File.join(cucumber_dir, 'support', '**', '*.rb')) do |f|
13
+ require f
14
+ end
15
+
16
+ # step_definitions
17
+ Dir.glob(File.join(cucumber_dir, 'step_definitions', '**', '*.rb')) do |f|
18
+ require f
19
+ end
20
+
21
+ at_exit do
22
+ # close connections, close pipes, remove temporary files, etc.
23
+ Cukunity::Android::Unity::Client.instance.close
24
+ Cukunity::Android::MonkeyClient.instance.close
25
+ Cukunity::IOS::Unity::Client.instance.close
26
+ Cukunity::IOS::UIAutomationMaster.instance.close
27
+ Cukunity::IOS::UIAutomation.instance.close
28
+ end
@@ -0,0 +1,43 @@
1
+ module Cukunity
2
+ module Android
3
+ module App
4
+ extend Android::Utils
5
+ extend Cukunity::Utils
6
+
7
+ def self.install(path, options = {})
8
+ options = merge_options(options, { :max_time => 30 })
9
+ output, status = adb ['install', '-r', path]
10
+ unless status.exited? and status.exitstatus == 0
11
+ raise Exception::InstallFailed.new
12
+ end
13
+ raise Exception::InstallTimeout.new if check_timeout(options[:max_time]) do
14
+ installed?(path)
15
+ end
16
+ end
17
+
18
+ def self.uninstall(path, options = {})
19
+ options = merge_options(options, { :max_time => 30 })
20
+ output, status = adb ['uninstall', package_name(path)]
21
+ unless status.exited? and status.exitstatus == 0
22
+ raise Exception::UninstallFailed.new
23
+ end
24
+ raise Exception::UninstallTimeout.new if check_timeout(options[:max_time]) do
25
+ not installed?(path)
26
+ end
27
+ end
28
+
29
+ def self.installed
30
+ shell('pm list packages').scan(/^package:(\S+)/).inject([]) do |packages, m|
31
+ packages << m[0]
32
+ end
33
+ end
34
+
35
+ def self.installed?(path)
36
+ package = package_name(path).downcase
37
+ installed.any? do |p|
38
+ p.downcase == package
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,9 @@
1
+ *.apk
2
+ bin/
3
+ gen/
4
+ !AppKiller.apk
5
+ *.ap_
6
+ *.dex
7
+ *.class
8
+ local.properties
9
+
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="cukunity.appkiller"
4
+ android:versionCode="1"
5
+ android:versionName="1.0">
6
+ <application android:label="@string/app_name">
7
+ <activity android:name=".AppKiller"
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
+ <uses-sdk android:minSdkVersion="3" />
16
+ <uses-permission android:name="android.permission.RESTART_PACKAGES" />
17
+ </manifest>
@@ -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 in 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,85 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project name="AppKiller" 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
+ <!-- The project.properties file is created and updated by the 'android'
32
+ tool, as well as ADT.
33
+
34
+ This contains project specific properties such as project target, and library
35
+ dependencies. Lower level build properties are stored in ant.properties
36
+ (or in .classpath for Eclipse projects).
37
+
38
+ This file is an integral part of the build system for your
39
+ application and should be checked into Version Control Systems. -->
40
+ <loadproperties srcFile="project.properties" />
41
+
42
+ <!-- quick check on sdk.dir -->
43
+ <fail
44
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
45
+ unless="sdk.dir"
46
+ />
47
+
48
+
49
+ <!-- extension targets. Uncomment the ones where you want to do custom work
50
+ in between standard targets -->
51
+ <!--
52
+ <target name="-pre-build">
53
+ </target>
54
+ <target name="-pre-compile">
55
+ </target>
56
+
57
+ /* This is typically used for code obfuscation.
58
+ Compiled code location: ${out.classes.absolute.dir}
59
+ If this is not done in place, override ${out.dex.input.absolute.dir} */
60
+ <target name="-post-compile">
61
+ </target>
62
+ -->
63
+
64
+ <!-- Import the actual build file.
65
+
66
+ To customize existing targets, there are two options:
67
+ - Customize only one target:
68
+ - copy/paste the target into this file, *before* the
69
+ <import> task.
70
+ - customize it to your needs.
71
+ - Customize the whole content of build.xml
72
+ - copy/paste the content of the rules files (minus the top node)
73
+ into this file, replacing the <import> task.
74
+ - customize to your needs.
75
+
76
+ ***********************
77
+ ****** IMPORTANT ******
78
+ ***********************
79
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
80
+ in order to avoid having your file be overridden by tools such as "android update project"
81
+ -->
82
+ <!-- version-tag: 1 -->
83
+ <import file="${sdk.dir}/tools/ant/build.xml" />
84
+
85
+ </project>
@@ -0,0 +1,40 @@
1
+ -optimizationpasses 5
2
+ -dontusemixedcaseclassnames
3
+ -dontskipnonpubliclibraryclasses
4
+ -dontpreverify
5
+ -verbose
6
+ -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7
+
8
+ -keep public class * extends android.app.Activity
9
+ -keep public class * extends android.app.Application
10
+ -keep public class * extends android.app.Service
11
+ -keep public class * extends android.content.BroadcastReceiver
12
+ -keep public class * extends android.content.ContentProvider
13
+ -keep public class * extends android.app.backup.BackupAgentHelper
14
+ -keep public class * extends android.preference.Preference
15
+ -keep public class com.android.vending.licensing.ILicensingService
16
+
17
+ -keepclasseswithmembernames class * {
18
+ native <methods>;
19
+ }
20
+
21
+ -keepclasseswithmembers class * {
22
+ public <init>(android.content.Context, android.util.AttributeSet);
23
+ }
24
+
25
+ -keepclasseswithmembers class * {
26
+ public <init>(android.content.Context, android.util.AttributeSet, int);
27
+ }
28
+
29
+ -keepclassmembers class * extends android.app.Activity {
30
+ public void *(android.view.View);
31
+ }
32
+
33
+ -keepclassmembers enum * {
34
+ public static **[] values();
35
+ public static ** valueOf(java.lang.String);
36
+ }
37
+
38
+ -keep class * implements android.os.Parcelable {
39
+ public static final android.os.Parcelable$Creator *;
40
+ }
@@ -0,0 +1,11 @@
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 use,
7
+ # "ant.properties", and override values to adapt the script to your
8
+ # project structure.
9
+
10
+ # Project target.
11
+ target=android-3
@@ -0,0 +1,13 @@
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
+ <TextView
8
+ android:layout_width="fill_parent"
9
+ android:layout_height="wrap_content"
10
+ android:text="Hello World, AppKiller"
11
+ />
12
+ </LinearLayout>
13
+
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <string name="app_name">AppKiller</string>
4
+ </resources>
@@ -0,0 +1,29 @@
1
+ package cukunity.appkiller;
2
+
3
+ import android.app.Activity;
4
+ import android.os.Bundle;
5
+ import android.app.ActivityManager;
6
+ import android.util.Log;
7
+
8
+ public class AppKiller extends Activity
9
+ {
10
+ private static final String TAG = "AppKiller";
11
+
12
+ @Override
13
+ public void onCreate(Bundle savedInstanceState)
14
+ {
15
+ Bundle extras = getIntent().getExtras();
16
+ if (extras != null)
17
+ {
18
+ String pkg = extras.getString("package");
19
+ if ((pkg != null) && (pkg.length() > 0))
20
+ {
21
+ Log.d(TAG, "Restarting " + pkg);
22
+ ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
23
+ am.restartPackage(pkg);
24
+ }
25
+ }
26
+ Log.d(TAG, "Killing self");
27
+ System.exit(0);
28
+ }
29
+ }
@@ -0,0 +1,149 @@
1
+ module Cukunity
2
+ module Android
3
+ module KeyboardInput
4
+ extend Android::Utils
5
+ extend Cukunity::KeyboardInputMethods
6
+
7
+ def self.type_text(text, options = {})
8
+ text.to_s.scan(/[^ ]+| /) do |tokens|
9
+ if tokens == ' '
10
+ press_space
11
+ else
12
+ keyboard_command(options) do
13
+ %Q[type #{tokens}]
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ def self.press_key(code, options = {})
20
+ keyboard_command(options) do
21
+ "press #{keycode(code)}"
22
+ end
23
+ end
24
+
25
+ def self.key_down(code, options = {})
26
+ keyboard_command(options) do
27
+ "key down #{keycode(code)}"
28
+ end
29
+ end
30
+
31
+ def self.key_up(code, options = {})
32
+ keyboard_command(options) do
33
+ "key up #{keycode(code)}"
34
+ end
35
+ end
36
+
37
+ def self.press_done(options = {})
38
+ press_back(options)
39
+ end
40
+
41
+ def self.press_back(options = {})
42
+ press_key('Back', options)
43
+ end
44
+
45
+ def self.press_enter(options = {})
46
+ press_key('Enter', options)
47
+ end
48
+
49
+ def self.press_space(options = {})
50
+ press_key('Space', options)
51
+ end
52
+
53
+ def self.press_delete(options = {})
54
+ press_key('Del', options)
55
+ end
56
+
57
+ def self.dpad_up(options = {})
58
+ press_key('DPad Up', options)
59
+ end
60
+
61
+ def self.dpad_down(options = {})
62
+ press_key('DPad Down', options)
63
+ end
64
+
65
+ def self.dpad_left(options = {})
66
+ press_key('DPad Left', options)
67
+ end
68
+
69
+ def self.dpad_right(options = {})
70
+ press_key('DPad Right', options)
71
+ end
72
+
73
+ def self.dpad_center(options = {})
74
+ press_key('DPad Center', options)
75
+ end
76
+
77
+ def self.show_symbols
78
+ press_key('PictSymbols', options)
79
+ end
80
+
81
+ def self.methods
82
+ shell('dumpsys input_method').scan(/\smId=(\S+)\s/).flatten
83
+ end
84
+
85
+ def self.method
86
+ shell('dumpsys input_method').match(/\smCurId=(\S+)\s/) do |m|
87
+ return m[1]
88
+ end
89
+ nil
90
+ end
91
+
92
+ def self.method?(method2)
93
+ if method2.kind_of? Regexp
94
+ method.match(method2)
95
+ else
96
+ method.downcase == method2.downcase
97
+ end
98
+ end
99
+
100
+ def self.choose_method(method2, options = {})
101
+ while not method?(method2)
102
+ press_key('Sym', options)
103
+ dpad_down(options)
104
+ dpad_center(options)
105
+ end
106
+ end
107
+
108
+ private
109
+ def self.closed?
110
+ shell('dumpsys input_method').match(/\sfieldId=\d+\s/).nil?
111
+ end
112
+
113
+ def self.platform_open_keyboard(options = {})
114
+ raise Exception::KeyboardWaitTimeout.new if check_timeout(10) do
115
+ !closed?
116
+ end
117
+ if options[:clear]
118
+ press_delete options
119
+ else
120
+ dpad_right
121
+ end
122
+ choose_method(options[:method], options) unless options[:method].nil?
123
+ end
124
+
125
+ def self.platform_keyboard_command(options, *cmd)
126
+ monkey.command(*cmd)
127
+ end
128
+
129
+ # http://developer.android.com/reference/android/view/KeyEvent.html
130
+ def self.keycode(code)
131
+ code = code.to_s.strip
132
+ if code =~ /^\d+$/
133
+ code.to_i
134
+ else
135
+ code = code.gsub(/\s+/, '_').upcase
136
+ if code !~ /^KEYCODE_/
137
+ code = "KEYCODE_#{code}"
138
+ end
139
+ code = code.to_sym
140
+ if Cukunity::Android::KeyboardInput::KeyCodes.const_defined?(code)
141
+ Cukunity::Android::KeyboardInput::KeyCodes.const_get(code).to_i
142
+ else
143
+ raise ArgumentError.new("Keycode unknown for \"#{code}\"")
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end