Skip to content

Commit b14b864

Browse files
committed
Built-in binaries for linux/mac
Closes #17 This will make it a lot easier to get started and you won't have to worry about conflicting binaries and path issues.
1 parent 565517c commit b14b864

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ end
4040
Habitat.raise_if_missing_settings!
4141
```
4242

43-
Then install Chromedriver and view the guides: https://luckyframework.org/guides/browser-tests/
43+
Then view the guides: https://luckyframework.org/guides/browser-tests/
4444

4545
You should be ready to go!
4646

@@ -61,4 +61,4 @@ View guide at: https://luckyframework.org/guides/browser-tests/
6161

6262
## Contributors
6363

64-
* [paulcsmith](https://github.com/paulcsmith) Paul Smith - creator, maintainer
64+
- [paulcsmith](https://github.com/paulcsmith) Paul Smith - creator, maintainer

src/lucky_flow/chromedriver.cr

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,33 @@ class LuckyFlow::Chromedriver
66
getter log_io = IO::Memory.new
77

88
private def initialize
9-
ensure_chromedriver_is_installed
109
@process = start_chromedriver
1110
end
1211

1312
def self.start
1413
new
1514
end
1615

17-
private def ensure_chromedriver_is_installed
18-
if !Process.find_executable("chromedriver")
19-
raise <<-ERROR
20-
Chromedriver must be available from the command line to use LuckyFlow.
21-
22-
▸ On macOS: brew install chromedriver
23-
▸ On Linux: https://makandracards.com/makandra/29465-install-chromedriver-on-linux
24-
25-
ERROR
26-
end
27-
end
28-
2916
private def start_chromedriver : Process
3017
Process.new(
31-
"chromedriver",
18+
"#{__DIR__}/../../vendor/chromedriver-2.40-#{os}",
3219
["--port=4444", "--url-base=/wd/hub"],
3320
output: log_io,
3421
error: STDERR,
3522
shell: true
3623
)
3724
end
3825

26+
private def os
27+
{% if flag?(:linux) %}
28+
"linux64"
29+
{% elsif flag?(:darwin) %}
30+
"mac64"
31+
{% else %}
32+
raise "This OS is not supported yet."
33+
{% end %}
34+
end
35+
3936
def stop
4037
process.kill unless process.terminated?
4138
end

vendor/chromedriver-2.40-linux64

7.76 MB
Binary file not shown.

vendor/chromedriver-2.40-mac64

11.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)