bin/testautoa in testautoa-0.4.2 vs bin/testautoa in testautoa-0.4.3

- old
+ new

@@ -163,12 +163,12 @@ puts "Available CPUs:" get_abis(@settings["avd_target"]).each{|i| puts "* #{i}"} ask_for_setting("avd_cpu", "Please enter the CPU of Android emulator", @settings["avd_cpu"] ||= "armeabi-v7a") ask_for_setting("avd_sdcard_size", "Please enter the SD card size of Android emulator", @settings["avd_sdcard_size"] ||= "64M") ask_for_setting("avd_ram_size", "Please enter the RAM size of Android emulator", @settings["avd_ram_size"] ||= "1024") - @settings["build_drop_branch_dir"] = "Mobile/Android/branch" - @settings["build_drop_trunk_dir"] = "Mobile/Android/trunk" + @settings["build_drop_branch_dir"] = "Mobile/Android/branch/Corp" + @settings["build_drop_trunk_dir"] = "Mobile/Android/trunk/Corp" open('.testautoa_settings', 'w') do |f| f.puts @settings.to_json end puts "Saved your settings to .testautoa_settings. You can edit the settings manually or run this setup script again" @@ -232,10 +232,16 @@ # mount smbfs location = location.tr('\\','/') username = username.tr('\\',';').tr('/',';') raise "The build drop location is incorrect" if not location.start_with?("//") + paths = location.split('/') + if paths.size > 4 + location = paths.shift(4).join('/') + @settings["build_drop_branch_dir"] = [paths.join('/'), @settings["build_drop_branch_dir"]].join('/') + @settings["build_drop_trunk_dir"] = [paths.join('/'), @settings["build_drop_trunk_dir"]].join('/') + end cmd = "mount -t smbfs //'#{username}':#{password}@#{location[2..-1]} #{mount_node}" output=`#{cmd}` ; result=$?.success? raise "the command '#{cmd}' failed" if result == false mount_node end @@ -284,11 +290,13 @@ release_path = File.join(mount_node, @settings["build_drop_trunk_dir"]) else # copy the version build release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "Android#{ARGV.first}/Release") end + raise "No builds found in #{release_path}" unless File.directory?(release_path) build_dir = Dir.entries(release_path).reject{|d|d.start_with?('.')}.sort_by{|c| File.stat(File.join(release_path,c)).ctime}.last + raise "No builds found in #{release_path}" if build_dir == nil apk_file = "ConcurMobile.apk" source = File.join(release_path, build_dir, apk_file) raise "the file '#{source}' does not exist" if not File.exists?(source) FileUtils.copy(source, File.join(FileUtils.pwd, apk_file)) puts "Copy the build from #{source}" @@ -309,12 +317,12 @@ else feature = ARGV.first + (ARGV.first.end_with?('/')? '' : '/') uri = URI.join(uri, feature) puts `svn export --force #{uri} features --username #{username} --password #{password}` - #uri = URI.join(@settings["svn_location"], "_support/", "support/") - #puts `svn export --force #{uri} features/support --username #{username} --password #{password}` + uri = URI.join(@settings["svn_location"], "_support/", "support/") + puts `svn export --force #{uri} features/support --username #{username} --password #{password}` uri = URI.join(@settings["svn_location"], "_support/", "step_definition/") puts `svn export --force #{uri} features/step_definitions --username #{username} --password #{password}` end end @@ -324,11 +332,15 @@ end def adb_path_w_sn raise_if_android_home_not_set serial_number = @settings["device_serialno"].to_s.strip - serial_number = "-s #{serial_number}" unless serial_number.empty? - File.join(ENV['ANDROID_HOME'], 'platform-tools', 'adb') + " " + serial_number + serial_number = " -s #{serial_number}" unless serial_number.empty? + adb_path + serial_number +end + +def adb_shell(command) + system("#{adb_path_w_sn} shell #{command}") end def android_path raise_if_android_home_not_set File.join(ENV['ANDROID_HOME'], 'tools', 'android')