Skip to content

Commit

Permalink
Change ItunesTransporter to default to shell script exection for Xcod…
Browse files Browse the repository at this point in the history
…e 6.x
  • Loading branch information
Michael Furtak committed Apr 26, 2016
1 parent 7bca644 commit 8e6c18a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 36 deletions.
3 changes: 3 additions & 0 deletions fastlane_core/lib/fastlane_core/itunes_transporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def self.hide_transporter_output?
# if false, allows a direct call to the iTMSTransporter Java app (preferred).
# see: https://github.com/fastlane/fastlane/pull/4003
def initialize(user = nil, password = nil, use_shell_script = false)
# Xcode 6.x doesn't have the same iTMSTransporter Java setup as later Xcode versions, so
# we can't default to using the better direct Java invocation strategy for those versions.
use_shell_script ||= Helper.xcode_version.start_with?('6.')
use_shell_script ||= !ENV['FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT'].nil?
data = CredentialsManager::AccountManager.new(user: user, password: password)

Expand Down
94 changes: 58 additions & 36 deletions fastlane_core/spec/itunes_transporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,70 +70,92 @@
].join(' ')
end

describe "by default" do
describe "upload command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command)
describe "with Xcode 7.x installed" do
before(:each) { allow(FastlaneCore::Helper).to receive(:xcode_version).and_return('7.3') }

describe "by default" do
describe "upload command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command)
end
end

describe "download command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.download('my.app.id', '/tmp')).to eq(java_download_command)
end
end
end

describe "download command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.download('my.app.id', '/tmp')).to eq(java_download_command)
describe "when use shell script ENV var is set" do
describe "upload command generation" do
it 'generates a call to the shell script' do
with_env_values('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT' => 'true') do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.upload('my.app.id', '/tmp')).to eq(shell_upload_command)
end
end
end

describe "download command generation" do
it 'generates a call to the shell script' do
with_env_values('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT' => 'true') do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
expect(transporter.download('my.app.id', '/tmp')).to eq(shell_download_command)
end
end
end
end
end

describe "when use shell script ENV var is set" do
describe "upload command generation" do
it 'generates a call to the shell script' do
with_env_values('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT' => 'true') do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
describe "use_shell_script is true" do
describe "upload command generation" do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", true)
expect(transporter.upload('my.app.id', '/tmp')).to eq(shell_upload_command)
end
end
end

describe "download command generation" do
it 'generates a call to the shell script' do
with_env_values('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT' => 'true') do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<")
describe "download command generation" do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", true)
expect(transporter.download('my.app.id', '/tmp')).to eq(shell_download_command)
end
end
end
end

describe "use_shell_script is true" do
describe "upload command generation" do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", true)
expect(transporter.upload('my.app.id', '/tmp')).to eq(shell_upload_command)
describe "use_shell_script is false" do
describe "upload command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", false)
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command)
end
end
end

describe "download command generation" do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", true)
expect(transporter.download('my.app.id', '/tmp')).to eq(shell_download_command)
describe "download command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", false)
expect(transporter.download('my.app.id', '/tmp')).to eq(java_download_command)
end
end
end
end

describe "use_shell_script is false" do
describe "with Xcode 6.x installed" do
before(:each) { allow(FastlaneCore::Helper).to receive(:xcode_version).and_return('6.4') }

describe "upload command generation" do
it 'generates a call to java directly' do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", false)
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command)
expect(transporter.upload('my.app.id', '/tmp')).to eq(shell_upload_command)
end
end

describe "download command generation" do
it 'generates a call to java directly' do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new('fabric.devtools@gmail.com', "!> p@$s_-+=w'o%rd\"&#*<", false)
expect(transporter.download('my.app.id', '/tmp')).to eq(java_download_command)
expect(transporter.download('my.app.id', '/tmp')).to eq(shell_download_command)
end
end
end
Expand Down

0 comments on commit 8e6c18a

Please sign in to comment.