Sha256: 7a92685bd8d1621c42847314bd568710d960f72ab1fed1145c5bc4b1f9d075ed

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

module Tigefa
  class Deprecator
    def self.process(args)
      no_subcommand(args)
      arg_is_present? args, "--server", "The --server command has been replaced by the \
                          'serve' subcommand."
      arg_is_present? args, "--no-server", "To build Tigefa without launching a server, \
                          use the 'build' subcommand."
      arg_is_present? args, "--auto", "The switch '--auto' has been replaced with '--watch'."
      arg_is_present? args, "--no-auto", "To disable auto-replication, simply leave off \
                          the '--watch' switch."
      arg_is_present? args, "--pygments", "The 'pygments' setting can only be set in \
                          your config files."
      arg_is_present? args, "--paginate", "The 'paginate' setting can only be set in your \
                          config files."
      arg_is_present? 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 =~ /^--/ && !%w[--help --version].include?(args.first)
        Tigefa.logger.error "Deprecation:", "Tigefa now uses subcommands instead of just \
                            switches. Run `tigefa help' to find out more."
      end
    end

    def self.arg_is_present?(args, deprecated_argument, message)
      if args.include?(deprecated_argument)
        deprecation_message(message)
      end
    end

    def self.deprecation_message(message)
      Tigefa.logger.error "Deprecation:", message
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tigefa-1.1.3 lib/tigefa/deprecator.rb