Skip to content
Snippets Groups Projects
Commit af26d036 authored by Jordon Bedwell's avatar Jordon Bedwell
Browse files

Cleanup default-args.

parent de748369
No related branches found
No related tags found
No related merge requests found
......@@ -2,28 +2,27 @@
require "shellwords"
def to_bool(val)
val == "true" || val == "1" ? "true" : nil
%w(true 1).include?(val) \
? "true" : nil
end
# --
%w(VERBOSE DRAFTS FORCE_POLLING).each do |v|
ENV[v] = to_bool(ENV[v])
ENV[v] = to_bool(
ENV[v]
)
end
# --
def build?; %W(b build).include?(ARGV[0]); end
def serve?; %W(s serve server).include?(ARGV[0]); end
def build?; %w(b build).include?(ARGV[0]); end
def serve?; %w(s serve server).include?(ARGV[0]); end
def safe?; ENV["JEKYLL_DOCKER_TAG"] == "pages" || ENV["JEKYLL_DOCKER_NAME"] == "minimal"; end
def debug?; ENV["VERBOSE"]; end
# --
ARGV.shift and ARGV.unshift("serve") if "s" == ARGV[0]
ARGV.push("--force_polling") if ENV["FORCE_POLLING"] && (build? || serve?)
ARGV.unshift(ARGV.shift, "-H", "0.0.0.0") if serve?
ARGV.push("--drafts") if ENV["DRAFTS"]
ARGV.push("--verbose") if debug?
$stdout.puts Shellwords.shelljoin(ARGV)
$stdout.puts Shellwords.shelljoin(
ARGV
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment