calabash-android 0.4.10.pre2 → 0.4.10.pre3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eca1c2b618f5e1a0eae2efd4ac343c4cd116c093
4
- data.tar.gz: b629099127e76a694fcb385dac08be6025cbb82d
3
+ metadata.gz: bf41c00cbb592aeebf19da60bc9004282ae08ad3
4
+ data.tar.gz: ad1ac78a2ac3635c53656632170dbaa7f42249f8
5
5
  SHA512:
6
- metadata.gz: 012c85a07ca6cff09116b3cef62f2db210fed15fa2e1b313515749e3b6370c84024c854db4646337313b31c2321bb1571fe64a8902638fe13ff6e448b00fa3fe
7
- data.tar.gz: e24c6c300b64f1335dfc8c82e1ce9727c93c161ab524ed3d51af1b7dbf845c8fcf4851630e3e985db5fb5f616cc7b36fde766fad4a044cdd9ead672270d5bc49
6
+ metadata.gz: 8181fef5a6c3e0fdcfcd4f4ec3dfb14508c76aa9ce26f9897a70eab912233b626ab5e6c012fe87cdd873c0009854d7edb343356d434d41609674434f49fc6d6e
7
+ data.tar.gz: fb06704063ae204280d9ce35d4c4cf915f20634aab13dfc573b7c7bc8718107f26bb04a8c83f2205dd0c1a1108ceada5b292032f2ca97e19534710a45ec1a7a7
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'bundler'
2
- load 'lib/calabash-android/helpers.rb'
3
2
  load 'lib/calabash-android/env.rb'
4
3
 
5
4
  def build
@@ -15,7 +14,7 @@ def build
15
14
  "clean",
16
15
  "package",
17
16
  "-debug",
18
- "-Dtools.dir=\"#{tools_dir}\"",
17
+ "-Dtools.dir=\"#{Env.tools_dir}\"",
19
18
  "-Dandroid.api.level=17",
20
19
  "-Dversion=#{Calabash::Android::VERSION}",
21
20
  ]
@@ -51,27 +51,27 @@ def relative_to_full_path(file_path)
51
51
  File.expand_path(file_path)
52
52
  end
53
53
 
54
- def raise_if_android_home_not_set
55
- raise "Please set the ANDROID_HOME environment variable" unless ENV["ANDROID_HOME"]
54
+ def exit_if_android_sdk_not_found
55
+ unless File.exists?(Env.android_home_path || "")
56
+ puts "Please set ANDROID_HOME to point to the Android SDK"
57
+ exit 1
58
+ end
56
59
  end
57
60
 
58
61
  if (ARGV.length == 0)
59
62
  print_usage
60
- exit 0
61
63
  end
62
64
  cmd = ARGV.shift
63
65
  if cmd == 'help'
64
66
  print_help
65
- exit 0
66
67
  elsif cmd == 'build'
67
- raise_if_android_home_not_set
68
+ exit_if_android_sdk_not_found
68
69
  puts "Please specify the app you want to build a test server for" if (ARGV.empty? or not is_apk_file?(ARGV.first))
69
70
  while not ARGV.empty? and is_apk_file?(ARGV.first)
70
71
  calabash_build(relative_to_full_path(ARGV.shift))
71
72
  end
72
- exit 0
73
73
  elsif cmd == 'run'
74
- raise_if_android_home_not_set
74
+ exit_if_android_sdk_not_found
75
75
  if ARGV.empty? or not is_apk_file?(ARGV.first)
76
76
  exit calabash_run()
77
77
  else
@@ -79,7 +79,6 @@ elsif cmd == 'run'
79
79
  end
80
80
  elsif cmd == 'gen'
81
81
  calabash_scaffold
82
- exit 0
83
82
  elsif cmd == 'console'
84
83
  if ARGV.empty?
85
84
  puts "Please specify an app"
@@ -90,10 +89,9 @@ elsif cmd == 'console'
90
89
  exit 1
91
90
  end
92
91
  calabash_console(relative_to_full_path(ARGV.shift))
93
- exit 0
94
92
  elsif cmd == 'setup'
93
+ exit_if_android_sdk_not_found
95
94
  calabash_setup
96
- exit 0
97
95
  elsif cmd == 'extract-manifest'
98
96
  if ARGV.empty?
99
97
  puts "Please specify an app"
@@ -105,7 +103,6 @@ elsif cmd == 'extract-manifest'
105
103
  end
106
104
 
107
105
  puts manifest ARGV.first
108
- exit 0
109
106
  elsif cmd == 'resign'
110
107
  unless File.exist?(File.expand_path(ARGV.first))
111
108
  puts "No such file #{ARGV.first}"
@@ -115,7 +112,6 @@ elsif cmd == 'resign'
115
112
 
116
113
  elsif cmd == 'version'
117
114
  puts Calabash::Android::VERSION
118
- exit 0
119
115
  else
120
116
  print_usage
121
117
  end
@@ -26,9 +26,8 @@ def calabash_build(app)
26
26
  FileUtils.mkdir_p File.dirname(test_server_file_name) unless File.exist? File.dirname(test_server_file_name)
27
27
 
28
28
  unsigned_test_apk = File.join(File.dirname(__FILE__), '..', 'lib/calabash-android/lib/TestServer.apk')
29
- platforms = Dir["#{android_home_path}/platforms/android-*"].sort_by { |item| '%08s' % item.split('-').last }
30
- android_platform = platforms.last
31
- raise "No Android SDK found in #{ENV["ANDROID_HOME"].gsub("\\", "/")}/platforms/" unless android_platform
29
+
30
+ android_platform = Env.android_platform_path
32
31
  Dir.mktmpdir do |workspace_dir|
33
32
  Dir.chdir(workspace_dir) do
34
33
  FileUtils.cp(unsigned_test_apk, "TestServer.apk")
@@ -42,7 +41,7 @@ def calabash_build(app)
42
41
  raise "Could not replace test package name in manifest"
43
42
  end
44
43
 
45
- unless system %Q{"#{tools_dir}/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
44
+ unless system %Q{"#{Env.tools_dir}/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
46
45
  raise "Could not create dummy.apk"
47
46
  end
48
47
 
@@ -1,10 +1,6 @@
1
1
  require "calabash-android/version"
2
2
 
3
3
  def calabash_setup
4
- unless File.exists?(ENV["ANDROID_HOME"] || "")
5
- puts "Please set ANDROID_HOME to point to the Android SDK"
6
- exit 1
7
- end
8
4
  @settings = {}
9
5
 
10
6
  puts "Please enter keystore information to use a custom keystore instead of the default"
@@ -22,8 +18,4 @@ end
22
18
  def ask_for_setting(key, msg)
23
19
  puts msg
24
20
  @settings[key] = STDIN.gets.chomp
25
- end
26
-
27
- def platform_versions
28
- Dir["#{ENV["ANDROID_HOME"]}/platforms/android-*"].collect{|platform| platform.split("-").last.to_i}.sort
29
21
  end
@@ -1,4 +1,3 @@
1
-
2
1
  class Env
3
2
 
4
3
  def self.keytool_path
@@ -24,4 +23,29 @@ class Env
24
23
  def self.is_windows?
25
24
  (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
26
25
  end
26
+
27
+ def self.tools_dir
28
+ Dir.chdir(android_home_path) do
29
+ dirs = Dir["build-tools/*"] + Dir["platform-tools"]
30
+ raise "Could not find tools directory in #{android_home_path}" if dirs.empty?
31
+ File.expand_path(dirs.first)
32
+ end
33
+ end
34
+
35
+ def self.adb
36
+ %Q("#{android_home_path}/platform-tools/adb")
37
+ end
38
+
39
+ def self.android_home_path
40
+ ENV["ANDROID_HOME"]
41
+ end
42
+
43
+ def self.android_platform_path
44
+ Dir.chdir(android_home_path) do
45
+ platforms = Dir["platforms/android-*"].sort_by { |item| '%08s' % item.split('-').last }
46
+ raise "No Android SDK found in #{android_home_path}/platforms/" if platforms.empty?
47
+ File.expand_path(platforms.last)
48
+ end
49
+ end
50
+
27
51
  end
@@ -90,16 +90,6 @@ def sign_apk(app_path, dest_path)
90
90
  java_keystore.sign_apk(app_path, dest_path)
91
91
  end
92
92
 
93
- def tools_dir
94
- dirs = Dir["#{android_home_path}/build-tools/*/"] + Dir["#{android_home_path}/platform-tools/"]
95
- raise "Could not find tools directory in ANDROID_HOME" if dirs.empty?
96
- dirs.first
97
- end
98
-
99
- def android_home_path
100
- ENV["ANDROID_HOME"].gsub("\\", "/")
101
- end
102
-
103
93
  def fingerprint_from_apk(app_path)
104
94
  app_path = File.expand_path(app_path)
105
95
  Dir.mktmpdir do |tmp_dir|
@@ -402,15 +402,7 @@ module Operations
402
402
  end
403
403
 
404
404
  def adb_command
405
- "#{adb} -s #{serial}"
406
- end
407
-
408
- def adb
409
- if Env.is_windows?
410
- %Q("#{ENV["ANDROID_HOME"]}\\platform-tools\\adb.exe")
411
- else
412
- %Q("#{ENV["ANDROID_HOME"]}/platform-tools/adb")
413
- end
405
+ "#{Env.adb} -s #{serial}"
414
406
  end
415
407
 
416
408
  def default_serial
@@ -447,7 +439,7 @@ module Operations
447
439
  end
448
440
 
449
441
  def connected_devices
450
- lines = `#{adb} devices`.split("\n")
442
+ lines = `#{Env.adb} devices`.split("\n")
451
443
  lines.shift
452
444
  lines.collect { |l| l.split("\t").first}
453
445
  end
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.10.pre2"
3
+ VERSION = "0.4.10.pre3"
4
4
  end
5
5
  end
@@ -20,13 +20,11 @@ public class Actions {
20
20
  public static Instrumentation parentInstrumentation;
21
21
  public static InstrumentationTestCase parentTestCase;
22
22
  private Context context;
23
- private Context targetContext;
24
-
23
+
25
24
  public Actions(Instrumentation parentInstrumentation, InstrumentationTestCase parentTestCase) {
26
25
  Actions.parentInstrumentation = parentInstrumentation;
27
26
  Actions.parentTestCase = parentTestCase;
28
27
  this.context = parentInstrumentation.getContext();
29
- this.targetContext = parentInstrumentation.getTargetContext();
30
28
  loadActions();
31
29
  }
32
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10.pre2
4
+ version: 0.4.10.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber