Skip to content

Commit d450b27

Browse files
committed
make publish.rb easier for those without ssh
1 parent aa61634 commit d450b27

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ Previewing Your Changes Online
5050

5151
We have a special script to use to publish your changes using the `gh-pages`
5252
branch of your fork of ev3dev.github.io. If you have SSH setup for your GitHub
53-
account, simply run`./publish <gh-user>` where *gh-user* is your actual GitHub
54-
user name. If you don't have SSH setup, you can use https by running
55-
`./publish https://github.com/<gh-user>/ev3dev.github.io.git` instead.
53+
account, simply run`./publish <gh-user>` where `<gh-user>` is your actual GitHub
54+
user name.
5655
This will copy the contents of `_site`, fix it up a bit and push it to your
5756
fork on GitHub. You can view the results at `http://<gh-user>.github.io/ev3dev.github.io`.

publish.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
# This script publishes the ev3dev website to the gh-pages branch of your
66
# personal fork. This allows you to share a preview of your changes with others.
77
#
8-
# Usage: ./publish.rb { <gh-user> | <gh-url> } [ --test '<command>' ] [ --no-fix-links ]
8+
# Usage: ./publish.rb { <gh-user> } [ --ssh ] [ --test '<command>' ] [ --no-fix-links ]
99
#
10-
# <gh-user> is your github user name. This is short for
11-
# "git@github.com:<gh-user>/ev3dev.github.io.git"
10+
# <gh-user> is your github user name.
1211
#
13-
# <gh-url> is the url for your fork on GitHub. For example, if you don't want
14-
# to use ssh, then pass "https://github.com/<gh-user>/ev3dev.github.io.git"
15-
# as the argument.
12+
# --ssh will use SSH instead of HTTPS when connecting to GitHub.
1613
#
1714
# --test '<command>' will run <command> in a shell and return the result. The
1815
# working directory will be a temporary directory containing the fixed up files.
@@ -36,9 +33,11 @@
3633
system "git init"
3734

3835
unless ARGV.include? "--test"
39-
git_url = ARGV[0]
40-
if not git_url.include? "/"
41-
git_url = "git@github.com:#{ARGV[0]}/ev3dev.github.io.git"
36+
gh_user = ARGV[0]
37+
if ARGV.include?("--ssh")
38+
git_url = "git@github.com:#{gh_user}/ev3dev.github.io.git"
39+
else
40+
git_url = "https://github.com/#{gh_user}/ev3dev.github.io.git"
4241
end
4342
system "git remote add origin #{git_url}"
4443

0 commit comments

Comments
 (0)