Rakefile in calabash-android-0.4.0.pre11 vs Rakefile in calabash-android-0.4.0.pre15

- old
+ new

@@ -1,11 +1,11 @@ require 'bundler' load 'lib/calabash-android/helpers.rb' def build test_server_template_dir = File.join(File.dirname(__FILE__), 'test-server') - + Dir.mktmpdir do |workspace_dir| @test_server_dir = File.join(workspace_dir, 'test-server') FileUtils.cp_r(test_server_template_dir, workspace_dir) @@ -32,12 +32,36 @@ FileUtils.cp(File.join(@test_server_dir, "bin", "Test_unsigned.apk"), File.join(File.dirname(__FILE__), 'lib/calabash-android/lib/TestServer.apk')) end end +desc "Update server version to expected server version" +task :match_versions do + test_server_template_dir = File.join(File.dirname(__FILE__), 'test-server') -task :build do + version_command = File.join(test_server_template_dir, + "instrumentation-backend", + "src", + "sh", + "calaba", + "instrumentationbackend", + "actions", + "version", + "Version.java" ) + + unless File.exist?(version_command) + raise "Unable to find version file at: #{version_command}" + end + + text = File.read(version_command) + text.gsub!(/public static final String VERSION=".*";/,%Q[public static final String VERSION="#{Calabash::Android::SERVER_VERSION}";]) + File.open(version_command, 'w') { |f| f.write(text) } + +end + + +task :build => :match_versions do unless File.exists? "test-server/calabash-js/src" puts "calabash-js not found!" puts "For instuctions see: https://github.com/calabash/calabash-android/wiki/Building-calabash-android" exit 1 end @@ -45,7 +69,8 @@ build Rake::Task["install"].execute end + Bundler::GemHelper.install_tasks