Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that phantomjs is installed? #25

Closed
ismayc opened this issue Jul 31, 2016 · 8 comments
Closed

Check that phantomjs is installed? #25

ismayc opened this issue Jul 31, 2016 · 8 comments

Comments

@ismayc
Copy link

ismayc commented Jul 31, 2016

Is there a way to include something like what I have for packages

needed_pkgs <- c("nycflights13", "dplyr", "ggplot2", "knitr", 
  "devtools", "ggplot2", "webshot")
new.pkgs <- needed_pkgs[!(needed_pkgs %in% installed.packages())]

if (length(new.pkgs)) {
  install.packages(new.pkgs, repos = "http://cran.rstudio.com")
}

to check to see if phantomjs is installed? Right now I just have a commented out

#webshot::install_phantomjs()

in the same chunk as my chunk above but it would be nice if I could run a check and install it if needed.

@vnijs
Copy link

vnijs commented Jul 31, 2016

On a mac you can use Sys.which("phantomjs"). Won't work on Windows though unless phanomjs is in your path

@ismayc
Copy link
Author

ismayc commented Jul 31, 2016

Thanks! The mac check will work for me for now.

@vnijs
Copy link

vnijs commented Jul 31, 2016

Just noticed webshot:::find_phantom(). Should work on both Mac and Windows

@ismayc
Copy link
Author

ismayc commented Jul 31, 2016

Thanks, @vnijs! I completely over-looked that.

@yihui
Copy link
Collaborator

yihui commented Jul 31, 2016

Yep, just check if webshot:::find_phantom() is NULL.

@yihui yihui closed this as completed Jul 31, 2016
ismayc added a commit to ModernStats/bookdown that referenced this issue Jul 31, 2016
@coatless
Copy link
Contributor

Would you folks be interested in a PR with a modified version of install_phantomjs() that checks if it is already installed at the given version? Or an exported package function that detects if phantomjs is present?

@wch
Copy link
Owner

wch commented May 21, 2019

@coatless Sure, a modified install_phantomjs sounds like a good idea. Maybe with an argument force which defaults to FALSE?

@coatless
Copy link
Contributor

@wch Great! I'll submit a PR to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants