mirror of
https://github.com/discourse/discourse.git
synced 2025-02-27 06:22:10 +08:00
DEV: autospec chrome check was failing on macOS (#7649)
This commit is contained in:
parent
11ab3c623a
commit
2548d5b0e3
@ -1,6 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "demon/rails_autospec"
|
require "demon/rails_autospec"
|
||||||
|
require 'rbconfig'
|
||||||
|
|
||||||
module Autospec
|
module Autospec
|
||||||
|
|
||||||
@ -116,13 +117,16 @@ module Autospec
|
|||||||
private
|
private
|
||||||
|
|
||||||
def ensure_chrome_is_installed
|
def ensure_chrome_is_installed
|
||||||
|
if RbConfig::CONFIG['host_os'][/darwin|mac os/]
|
||||||
binary = "google-chrome-stable" if system("command -v google-chrome-stable >/dev/null;")
|
binary = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
|
||||||
|
elsif system("command -v google-chrome-stable >/dev/null;")
|
||||||
|
binary = "google-chrome-stable"
|
||||||
|
end
|
||||||
binary ||= "google-chrome" if system("command -v google-chrome >/dev/null;")
|
binary ||= "google-chrome" if system("command -v google-chrome >/dev/null;")
|
||||||
|
|
||||||
raise ChromeNotInstalled.new if !binary
|
raise ChromeNotInstalled.new if !binary
|
||||||
|
|
||||||
if Gem::Version.new(`#{binary} --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59")
|
if Gem::Version.new(`\"#{binary}\" --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59")
|
||||||
raise "Chrome 59 or higher is required"
|
raise "Chrome 59 or higher is required"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user