291: def standard_rake_options
292: [
293: ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
294: lambda { |value|
295: require 'rake/classic_namespace'
296: options.classic_namespace = true
297: }
298: ],
299: ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
300: lambda { |value|
301: options.show_tasks = :describe
302: options.show_task_pattern = Regexp.new(value || '')
303: TaskManager.record_task_metadata = true
304: }
305: ],
306: ['--dry-run', '-n', "Do a dry run without executing actions.",
307: lambda { |value|
308: Rake.verbose(true)
309: Rake.nowrite(true)
310: options.dryrun = true
311: options.trace = true
312: }
313: ],
314: ['--execute', '-e CODE', "Execute some Ruby code and exit.",
315: lambda { |value|
316: eval(value)
317: exit
318: }
319: ],
320: ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
321: lambda { |value|
322: puts eval(value)
323: exit
324: }
325: ],
326: ['--execute-continue', '-E CODE',
327: "Execute some Ruby code, then continue with normal task processing.",
328: lambda { |value| eval(value) }
329: ],
330: ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
331: lambda { |value| $:.push(value) }
332: ],
333: ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
334: lambda { |value| options.nosearch = true }
335: ],
336: ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
337: lambda { |value| options.show_prereqs = true }
338: ],
339: ['--quiet', '-q', "Do not log messages to standard output.",
340: lambda { |value| Rake.verbose(false) }
341: ],
342: ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
343: lambda { |value|
344: value ||= ''
345: @rakefiles.clear
346: @rakefiles << value
347: }
348: ],
349: ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
350: "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
351:
352: lambda { |value| options.rakelib = value.split(':') }
353: ],
354: ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
355: lambda { |value|
356: begin
357: require value
358: rescue LoadError => ex
359: begin
360: rake_require value
361: rescue LoadError
362: raise ex
363: end
364: end
365: }
366: ],
367: ['--rules', "Trace the rules resolution.",
368: lambda { |value| options.trace_rules = true }
369: ],
370: ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
371: lambda { |value|
372: Rake.verbose(false)
373: options.silent = true
374: }
375: ],
376: ['--system', '-g',
377: "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
378: lambda { |value| options.load_system = true }
379: ],
380: ['--no-system', '--nosystem', '-G',
381: "Use standard project Rakefile search paths, ignore system wide rakefiles.",
382: lambda { |value| options.ignore_system = true }
383: ],
384: ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
385: lambda { |value|
386: options.show_tasks = :tasks
387: options.show_task_pattern = Regexp.new(value || '')
388: Rake::TaskManager.record_task_metadata = true
389: }
390: ],
391: ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
392: lambda { |value|
393: options.trace = true
394: Rake.verbose(true)
395: }
396: ],
397: ['--verbose', '-v', "Log message to standard output.",
398: lambda { |value| Rake.verbose(true) }
399: ],
400: ['--version', '-V', "Display the program version.",
401: lambda { |value|
402: puts "rake, version #{RAKEVERSION}"
403: exit
404: }
405: ],
406: ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
407: lambda { |value|
408: options.show_tasks = :lines
409: options.show_task_pattern = Regexp.new(value || '')
410: Rake::TaskManager.record_task_metadata = true
411: }
412: ],
413: ['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
414: lambda { |value|
415: options.ignore_deprecate = true
416: }
417: ],
418: ]
419: end