Skip to content

Commit f07faec

Browse files
committed
Merge branch '__rultor'
2 parents a78479b + c5bdd85 commit f07faec

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jgd
3434

3535
Now your site is deployed to `gh-pages` branch of your repo. Done.
3636

37-
## Comand Line Options
37+
## Command Line Options
3838

3939
Below is a list of all command line options.
4040

@@ -44,6 +44,7 @@ Below is a list of all command line options.
4444
| `-b` or `--branch` | The branch to push your site to. Defaults to `gh-pages`. If the branch does not exist, it will be created. |
4545
| `-r` or `--branch-from` | The source branch. Defaults to `master`. |
4646
| `-c` or `--config` | Name of the optional deploy config file. See [Production variables](#production-variables) below for more information. |
47+
| `-d` or `--drafts` | Adds the `--drafts` option to Jekyll so that it will build draft posts. |
4748
| `-h` or `--help` | Displays a list of all options. |
4849

4950
## Production variables

bash/deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BRANCH=$2
88
BRANCH_FROM=$3
99
DEPLOY_CONFIG=$4
1010
BUNDLE=$5
11+
DRAFTS=$6
1112
SRC=$(pwd)
1213
TEMP=$(mktemp -d -t jgd-XXX)
1314
trap "rm -rf ${TEMP}" EXIT
@@ -24,9 +25,9 @@ echo -e "\nBuilding Jekyll site:"
2425
rm -rf _site
2526

2627
if [ -r ${DEPLOY_CONFIG} ]; then
27-
${BUNDLE} jekyll build --config _config.yml,${DEPLOY_CONFIG}
28+
${BUNDLE} jekyll build --config _config.yml,${DEPLOY_CONFIG} ${DRAFTS}
2829
else
29-
${BUNDLE} jekyll build
30+
${BUNDLE} jekyll build ${DRAFTS}
3031
fi
3132

3233
if [ ! -e _site ]; then

bin/jgd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Usage: jgd [options]
1313
opt :branch_from, 'Source branch', type: String, default: 'master'
1414
opt :config, 'Deploy Config File', type: String, default: '_config-deploy.yml'
1515
opt :bundle, 'Use bundle'
16+
opt :drafts, 'Generate drafts'
1617
end
1718

1819
branch = opts[:branch]
@@ -23,11 +24,12 @@ fail 'branch-from can\'t be empty' if branch_from.empty?
2324
fail 'config can\'t be empty' if config.empty?
2425
url = opts[:url]
2526
url = `git config --get remote.origin.url`.strip if url.empty?
26-
bundle = opts[:bundle] ? '"bundle exec"' : ''
27+
bundle = opts[:bundle] ? '"bundle exec"' : '""'
28+
drafts = opts[:drafts] ? '"--drafts"' : '""'
2729

2830
spec = Gem::Specification.find_by_name('jgd')
2931
root = spec.gem_dir
3032
script = File.join(root, 'bash/deploy.sh')
3133

3234
fail 'deployment failed, see log above' \
33-
unless system("#{script} #{url} #{branch} #{branch_from} #{config} #{bundle}")
35+
unless system("#{script} #{url} #{branch} #{branch_from} #{config} #{bundle} #{drafts}")

0 commit comments

Comments
 (0)