calabash-android 0.4.0.pre16 → 0.4.0.pre17

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,16 +5,17 @@ def build
5
5
  test_server_template_dir = File.join(File.dirname(__FILE__), 'test-server')
6
6
 
7
7
  Dir.mktmpdir do |workspace_dir|
8
-
8
+
9
9
  @test_server_dir = File.join(workspace_dir, 'test-server')
10
10
  FileUtils.cp_r(test_server_template_dir, workspace_dir)
11
-
11
+
12
12
  ant_executable = (is_windows? ? "ant.bat" : "ant")
13
13
  args = [
14
14
  ant_executable,
15
- "clean",
15
+ "clean",
16
16
  "package",
17
17
  "-Dandroid.api.level=16",
18
+ "-Dversion=#{Calabash::Android::VERSION}",
18
19
  ]
19
20
  Dir.chdir(@test_server_dir) do
20
21
  STDOUT.sync = true
@@ -28,38 +29,12 @@ def build
28
29
  end
29
30
 
30
31
  FileUtils.mkdir_p "test_servers" unless File.exist? "test_servers"
31
-
32
- FileUtils.cp(File.join(@test_server_dir, "bin", "Test_unsigned.apk"), File.join(File.dirname(__FILE__), 'lib/calabash-android/lib/TestServer.apk'))
33
- end
34
- end
35
-
36
32
 
37
- desc "Update server version to expected server version"
38
- task :match_versions do
39
- test_server_template_dir = File.join(File.dirname(__FILE__), 'test-server')
40
-
41
- version_command = File.join(test_server_template_dir,
42
- "instrumentation-backend",
43
- "src",
44
- "sh",
45
- "calaba",
46
- "instrumentationbackend",
47
- "actions",
48
- "version",
49
- "Version.java" )
50
-
51
- unless File.exist?(version_command)
52
- raise "Unable to find version file at: #{version_command}"
33
+ FileUtils.cp(File.join(@test_server_dir, "bin", "Test_unsigned.apk"), File.join(File.dirname(__FILE__), 'lib/calabash-android/lib/TestServer.apk'))
53
34
  end
54
-
55
- text = File.read(version_command)
56
- text.gsub!(/public static final String VERSION=".*";/,%Q[public static final String VERSION="#{Calabash::Android::SERVER_VERSION}";])
57
- File.open(version_command, 'w') { |f| f.write(text) }
58
-
59
35
  end
60
36
 
61
-
62
- task :build => :match_versions do
37
+ task :build do
63
38
  unless File.exists? "test-server/calabash-js/src"
64
39
  puts "calabash-js not found!"
65
40
  puts "For instuctions see: https://github.com/calabash/calabash-android/wiki/Building-calabash-android"
@@ -69,7 +69,7 @@ elsif cmd == 'console'
69
69
  puts "No such file #{ARGV.first}"
70
70
  exit 1
71
71
  end
72
- calabash_console ARGV.first
72
+ calabash_console(relative_to_full_path(ARGV.shift))
73
73
  exit 0
74
74
  elsif cmd == 'setup'
75
75
  calabash_setup
@@ -23,5 +23,7 @@ def calabash_console(app_path = nil)
23
23
  ENV["TEST_APP_PATH"] = test_server_path
24
24
  end
25
25
 
26
+ build_test_server_if_needed(app_path)
27
+
26
28
  system "#{RbConfig.ruby} -S irb"
27
29
  end
@@ -13,15 +13,7 @@ def calabash_run(app_path = nil)
13
13
  end
14
14
 
15
15
  if app_path
16
- unless File.exist?(test_server_path(app_path))
17
- if ARGV.include? "--no-build"
18
- puts "No test server found for this combination of app and calabash version. Exiting!"
19
- exit 1
20
- else
21
- puts "No test server found for this combination of app and calabash version. Recreating test server."
22
- calabash_build(app_path)
23
- end
24
- end
16
+ build_test_server_if_needed(app_path)
25
17
 
26
18
  test_server_path = test_server_path(app_path)
27
19
  if ENV["TEST_SERVER_PORT"]
@@ -38,6 +38,19 @@ def test_server_path(apk_file_path)
38
38
  "test_servers/#{checksum(apk_file_path)}_#{Calabash::Android::VERSION}.apk"
39
39
  end
40
40
 
41
+
42
+ def build_test_server_if_needed(app_path)
43
+ unless File.exist?(test_server_path(app_path))
44
+ if ARGV.include? "--no-build"
45
+ puts "No test server found for this combination of app and calabash version. Exiting!"
46
+ exit 1
47
+ else
48
+ puts "No test server found for this combination of app and calabash version. Recreating test server."
49
+ calabash_build(app_path)
50
+ end
51
+ end
52
+ end
53
+
41
54
  def resign_apk(app_path)
42
55
  Dir.mktmpdir do |tmp_dir|
43
56
  log "Resign apk"
@@ -48,6 +48,14 @@ module Operations
48
48
  default_device.perform_action(action, *arguments)
49
49
  end
50
50
 
51
+ def reinstall_apps
52
+ default_device.reinstall_apps
53
+ end
54
+
55
+ def reinstall_test_server
56
+ default_device.reinstall_test_server
57
+ end
58
+
51
59
  def install_app(app_path)
52
60
  default_device.install_app(app_path)
53
61
  end
@@ -168,6 +176,10 @@ module Operations
168
176
  def reinstall_apps()
169
177
  uninstall_app(package_name(@app_path))
170
178
  install_app(@app_path)
179
+ reinstall_test_server()
180
+ end
181
+
182
+ def reinstall_test_server()
171
183
  uninstall_app(package_name(@test_server_path))
172
184
  install_app(@test_server_path)
173
185
  end
@@ -384,21 +396,19 @@ module Operations
384
396
  response = perform_action('version')
385
397
  unless response['success']
386
398
  msg = ["Unable to obtain Test Server version. "]
387
- msg << "Please delete your test_servers"
388
- msg << "and re-run calabash-android run..."
399
+ msg << "Please run 'reinstall_test_server' to make sure you have the correct version"
389
400
  msg_s = msg.join("\n")
390
401
  log(msg_s)
391
402
  raise msg_s
392
403
  end
393
- unless response['message'] == Calabash::Android::SERVER_VERSION
404
+ unless response['message'] == Calabash::Android::VERSION
394
405
 
395
406
  msg = ["Calabash Client and Test-server version mismatch."]
396
407
  msg << "Client version #{Calabash::Android::VERSION}"
397
408
  msg << "Test-server version #{response['message']}"
398
- msg << "Expected Test-server version #{Calabash::Android::SERVER_VERSION}"
409
+ msg << "Expected Test-server version #{Calabash::Android::VERSION}"
399
410
  msg << "\n\nSolution:\n\n"
400
- msg << "Please delete your test_servers"
401
- msg << "and re-run calabash-android run..."
411
+ msg << "Run 'reinstall_test_server' to make sure you have the correct version"
402
412
  msg_s = msg.join("\n")
403
413
  log(msg_s)
404
414
  raise msg_s
@@ -1,6 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- SERVER_VERSION = "0.4.0.pre16"
4
- VERSION = "0.4.0.pre16"
3
+ VERSION = "0.4.0.pre17"
5
4
  end
6
5
  end
@@ -69,6 +69,7 @@
69
69
  <copy todir="${staging.dir}/assets">
70
70
  <fileset dir="${calabashjs.dir}"/>
71
71
  </copy>
72
+ <replace file="${staging.dir}/src/sh/calaba/instrumentationbackend/actions/version/Version.java" token="####VERSION####" value="${version}" failOnNoReplacements="true" />
72
73
  </target>
73
74
 
74
75
 
@@ -14,18 +14,12 @@ public class Version implements Action {
14
14
  /******
15
15
  * Generate Version Number
16
16
  * DO NOT EDIT
17
- *
18
- * Version number is changed by changing SERVER_VERSION
19
- * in calabash-android/version.rb
20
- *
21
- * When doing so, this version will be copied here when
22
- * test server is built.
23
- *
17
+ *
24
18
  */
25
- public static final String VERSION="0.4.0.pre16";
26
-
19
+ public static final String VERSION="####VERSION####";
20
+
27
21
  @Override
28
- public Result execute(String... args) {
22
+ public Result execute(String... args) {
29
23
  return new Result(true,VERSION);
30
24
  }
31
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre16
4
+ version: 0.4.0.pre17
5
5
  prerelease: 6
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: 2013-02-03 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber