Checking the arguments to ensure we have a subcommand before proceeding. (#1008)

This commit is contained in:
Parker Moore 2013-04-30 22:17:15 +02:00
parent 463ea15a3e
commit c32b570114
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
module Jekyll
class Deprecator
def self.process(args)
no_subcommand(args)
deprecation_message args, "--server", "The --server command has been replaced by the \
'serve' subcommand."
deprecation_message args, "--no-server", "To build Jekyll without launching a server, \
@ -15,6 +16,14 @@ module Jekyll
deprecation_message args, "--url", "The 'url' setting can only be set in your config files."
end
def self.no_subcommand(args)
if args.size == 0 || args.first =~ /^--/
Jekyll::Logger.error "Deprecation:", "Jekyll now uses subcommands instead of just \
switches. Run `jekyll help' to find out more."
exit(1)
end
end
def self.deprecation_message(args, deprecated_argument, message)
if args.include?(deprecated_argument)
Jekyll::Logger.error "Deprecation:", message