Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for specifying emulator serial #13946

Merged
merged 2 commits into from Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastlane/lib/fastlane/helper/adb_helper.rb
Expand Up @@ -26,7 +26,7 @@ def initialize(adb_path: nil)
# Run a certain action
def trigger(command: nil, serial: nil)
android_serial = serial != "" ? "ANDROID_SERIAL=#{serial}" : nil
command = [android_serial, adb_path.shellescape, command].join(" ").strip!
command = [android_serial, adb_path.shellescape, command].join(" ").strip
Action.sh(command)
end

Expand Down
16 changes: 16 additions & 0 deletions fastlane/spec/actions_specs/adb_spec.rb
Expand Up @@ -17,6 +17,22 @@
expect(result).to eq("./fastlane/README.md test command with multiple parts")
end

it "generates a valid command when a non-empty serial is passed" do
result = Fastlane::FastFile.new.parse("lane :test do
adb(command: 'test command with non-empty serial', adb_path: './fastlane/README.md', serial: 'emulator-1234')
end").runner.execute(:test)

expect(result).to eq("ANDROID_SERIAL=emulator-1234 ./fastlane/README.md test command with non-empty serial")
end

it "generates a valid command when an empty serial is passed" do
result = Fastlane::FastFile.new.parse("lane :test do
adb(command: 'test command with empty serial', adb_path: './fastlane/README.md', serial: '')
end").runner.execute(:test)

expect(result).to eq("./fastlane/README.md test command with empty serial")
end

it "picks up path from ANDROID_HOME environment variable" do
stub_const('ENV', { 'ANDROID_HOME' => '/usr/local/android-sdk' })
result = Fastlane::FastFile.new.parse("lane :test do
Expand Down