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

add "-o" option to serve command which opens server URL #4144

Merged
merged 1 commit into from Nov 29, 2015
Merged

add "-o" option to serve command which opens server URL #4144

merged 1 commit into from Nov 29, 2015

Conversation

friedenberg
Copy link
Contributor

Hi Jekyll maintainers,

We were setting up a new Jekyll blog to play around and thought it would be helpful to add a "-o" option to the serve command. This option would open the URL of the server on the device's default browser. We used the "system" ruby method, but we're not sure if that's your preferred approach to opening URL's. It's also unclear if this would work on Windows, as we only tested this on OS X.

We're happy to modify this request to open the URL in a different way, if there are issues with the current implementation. All the unit tests passed when we ran them locally.

cc @Ckearns1210

@envygeeks
Copy link
Contributor

This is broken on Linux (and I don't think it will work on Windows) either, open does not do what you think it does on Ubuntu and Debian where it's actually openvt

@friedenberg
Copy link
Contributor Author

aha, that's what worried me. Is there any safe way to do this with multiple platform support, or is this a lost cause?

@friedenberg
Copy link
Contributor Author

would it be crazy to do something like this?
python -m webbrowser #{server_address}

It might not be safe to assume that python is installed.

@envygeeks
Copy link
Contributor

  • Windows: start url
  • Linux: xdg-open url
  • OS X: As is.

@friedenberg
Copy link
Contributor Author

alright, updated to include different OS commands. (note to self: create PR's off of fork branches and not fork master)

@envygeeks
Copy link
Contributor

/cc @jekyll/core

@alfredxing
Copy link
Member

👍

I know in our Rakefile, we use Launchy to open the built Jekyll site for the preview task.

@@ -45,7 +46,24 @@ def process(options)
file_handler_options
)

Jekyll.logger.info "Server address:", server_address(s, options)
server_address = server_address(s, options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reassignment of server_address is confusing – could you rename the variable on the left here, please?

@friedenberg
Copy link
Contributor Author

ok, fixed the naming of the variable. I'll keep in mind Launchy for stuff like this in the future, too.

parkr added a commit that referenced this pull request Nov 29, 2015
@parkr parkr merged commit 64e87bf into jekyll:master Nov 29, 2015
parkr added a commit that referenced this pull request Nov 29, 2015
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants