Skip to content

Commit

Permalink
okay one last sad try at chrome and refactor tmrw
Browse files Browse the repository at this point in the history
  • Loading branch information
estiens committed Jun 4, 2019
1 parent 97c02a3 commit 6a940ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lib/scrapers/base_scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ def initialize
@browser = init_browser
@page = nil

path = ENV['GOOGLE_CHROME_BIN'] || ENV['GOOGLE_CHROME_SHIM']
path = ENV['GOOGLE_CHROME_SHIM'] || ENV['GOOGLE_CHROME_BIN']
if Rails.env.development?
Selenium::WebDriver::Chrome::Service.driver_path = path || '/usr/bin/chromium-browser'
else
Selenium::WebDriver::Chrome::Service.driver_path = path
end
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/scrapers/json_scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def self.get_base_url
def self.init_browser
path = ENV['GOOGLE_CHROME_SHIM'] || ENV['GOOGLE_CHROME_BIN']
if Rails.env.development?
Selenium::WebDriver::Chrome.path = path || '/usr/bin/chromium-browser'
Selenium::WebDriver::Chrome::Service.driver_path = path || '/usr/bin/chromium-browser'
else
Selenium::WebDriver::Chrome.path = path
Selenium::WebDriver::Chrome::Service.driver_path = path
end
options = Selenium::WebDriver::Chrome::Options.new
chrome_dir = Rails.root.join('tmp', 'chrome')
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/match_scraper.rake
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ end
def init_browser
path = ENV['GOOGLE_CHROME_SHIM'] || ENV['GOOGLE_CHROME_BIN']
if Rails.env.development?
Selenium::WebDriver::Chrome.path = path || '/usr/bin/chromium-browser'
Selenium::WebDriver::Chrome::Service.driver_path = path || '/usr/bin/chromium-browser'
else
Selenium::WebDriver::Chrome.path = path
Selenium::WebDriver::Chrome::Service.driver_path = path
end
options = Selenium::WebDriver::Chrome::Options.new
chrome_dir = Rails.root.join('tmp', 'chrome')
Expand Down

0 comments on commit 6a940ea

Please sign in to comment.