Method: Spaceship::Client#load_session_from_env

Defined in:
spaceship/lib/spaceship/client.rb

#load_session_from_envObject



641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'spaceship/lib/spaceship/client.rb', line 641

def load_session_from_env
  return if self.class.spaceship_session_env.to_s.length == 0
  puts("Loading session from environment variable") if Spaceship::Globals.verbose?

  file = Tempfile.new('cookie.yml')
  file.write(self.class.spaceship_session_env.gsub("\\n", "\n"))
  file.close

  begin
    @cookie.load(file.path)
  rescue => ex
    puts("Error loading session from environment")
    puts("Make sure to pass the session in a valid format")
    raise ex
  ensure
    file.unlink
  end
end