Class: Moft::Deprecator

Inherits:
Object
  • Object
show all
Defined in:
lib/moft/deprecator.rb

Class Method Summary collapse

Class Method Details

.deprecation_message(args, deprecated_argument, message) ⇒ Object



27
28
29
30
31
32
# File 'lib/moft/deprecator.rb', line 27

def self.deprecation_message(args, deprecated_argument, message)
  if args.include?(deprecated_argument)
    Moft::Logger.error "Deprecation:", message
    exit(1)
  end
end

.no_subcommand(args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/moft/deprecator.rb', line 19

def self.no_subcommand(args)
  if args.size == 0 || args.first =~ /^--/
    Moft::Logger.error "Deprecation:", "Moft now uses subcommands instead of just \
                        switches. Run `moft help' to find out more."
    exit(1)
  end
end

.process(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/moft/deprecator.rb', line 3

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 Moft without launching a server, \
                      use the 'build' subcommand."
  deprecation_message args, "--auto", "The switch '--auto' has been replaced with '--watch'."
  deprecation_message args, "--no-auto", "To disable auto-replication, simply leave off \
                      the '--watch' switch."
  deprecation_message args, "--pygments", "The 'pygments' setting can only be set in \
                      your config files."
  deprecation_message args, "--paginate", "The 'paginate' setting can only be set in your \
                      config files."
  deprecation_message args, "--url", "The 'url' setting can only be set in your config files."
end