FileUtils.mkdir_p(FASTLANE_SPEC_SCRATCH)

default_platform :ios

desc "Run all the tests"
lane :test do
  File.write("#{FASTLANE_SPEC_SCRATCH}/tests.txt", Time.now.to_s)
end


platform :mac do
  
  desc "Build and upload a new build to Apple TestFlight"
  desc "This action will also do a build version bump and push it to git."
  desc "This will **not** send an email to all testers, it will only be uploaded to the new TestFlight."
  lane :beta do
    File.write("#{FASTLANE_SPEC_SCRATCH}/mac_beta.txt", Time.now.to_s)
  end
  
end

platform :ios do
  desc "Submit a new version to the App Store"
  lane :beta do
    File.write("#{FASTLANE_SPEC_SCRATCH}/ios_beta.txt", Time.now.to_s)
  end

  lane :release do
    File.write("#{FASTLANE_SPEC_SCRATCH}/ios_release.txt", Time.now.to_s)
  end

end

platform :android do

  before_all do
    File.write("#{FASTLANE_SPEC_SCRATCH}/before_all_android.txt", Time.now.to_s)
  end

  desc "Upload something to Google"
  lane :beta do
    File.write("#{FASTLANE_SPEC_SCRATCH}/android_beta.txt", Time.now.to_s)
  end

  private_lane :such_private do

  end

  lane :witherror do
    raise 'my exception'
  end

  lane :unsupported_action do
    team_name('Fastlane Tools')
  end

  after_all do
    File.write("#{FASTLANE_SPEC_SCRATCH}/after_all_android.txt", Time.now.to_s)
  end

  error do
    File.write("#{FASTLANE_SPEC_SCRATCH}/android_error.txt", Time.now.to_s)
  end
end

before_all do |lane|
  File.write("#{FASTLANE_SPEC_SCRATCH}/before_all.txt", Time.now.to_s)
end

before_each do |lane|
  File.write("#{FASTLANE_SPEC_SCRATCH}/before_each_#{lane}.txt", Time.now.to_s)
end

after_each do |lane|
  File.write("#{FASTLANE_SPEC_SCRATCH}/after_each_#{lane}.txt", Time.now.to_s)
end

lane :anotherroot do
  File.write("#{FASTLANE_SPEC_SCRATCH}/another_root.txt", Time.now.to_s)
end

error do
  File.write("#{FASTLANE_SPEC_SCRATCH}/error.txt", Time.now.to_s)
end