2193: def standard_rake_options
2194: [
2195: ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
2196: lambda { |value|
2197: require 'rake/classic_namespace'
2198: options.classic_namespace = true
2199: }
2200: ],
2201: ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
2202: lambda { |value|
2203: options.show_tasks = true
2204: options.full_description = true
2205: options.show_task_pattern = Regexp.new(value || '')
2206: }
2207: ],
2208: ['--dry-run', '-n', "Do a dry run without executing actions.",
2209: lambda { |value|
2210: verbose(true)
2211: nowrite(true)
2212: options.dryrun = true
2213: options.trace = true
2214: }
2215: ],
2216: ['--execute', '-e CODE', "Execute some Ruby code and exit.",
2217: lambda { |value|
2218: eval(value)
2219: exit
2220: }
2221: ],
2222: ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
2223: lambda { |value|
2224: puts eval(value)
2225: exit
2226: }
2227: ],
2228: ['--execute-continue', '-E CODE',
2229: "Execute some Ruby code, then continue with normal task processing.",
2230: lambda { |value| eval(value) }
2231: ],
2232: ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
2233: lambda { |value| $:.push(value) }
2234: ],
2235: ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
2236: lambda { |value| options.show_prereqs = true }
2237: ],
2238: ['--quiet', '-q', "Do not log messages to standard output.",
2239: lambda { |value| verbose(false) }
2240: ],
2241: ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
2242: lambda { |value|
2243: value ||= ''
2244: @rakefiles.clear
2245: @rakefiles << value
2246: }
2247: ],
2248: ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
2249: "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
2250: lambda { |value| options.rakelib = value.split(':') }
2251: ],
2252: ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
2253: lambda { |value|
2254: begin
2255: require value
2256: rescue LoadError => ex
2257: begin
2258: rake_require value
2259: rescue LoadError => ex2
2260: raise ex
2261: end
2262: end
2263: }
2264: ],
2265: ['--rules', "Trace the rules resolution.",
2266: lambda { |value| options.trace_rules = true }
2267: ],
2268: ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
2269: lambda { |value| options.nosearch = true }
2270: ],
2271: ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
2272: lambda { |value|
2273: verbose(false)
2274: options.silent = true
2275: }
2276: ],
2277: ['--system', '-g',
2278: "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
2279: lambda { |value| options.load_system = true }
2280: ],
2281: ['--no-system', '--nosystem', '-G',
2282: "Use standard project Rakefile search paths, ignore system wide rakefiles.",
2283: lambda { |value| options.ignore_system = true }
2284: ],
2285: ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
2286: lambda { |value|
2287: options.show_tasks = true
2288: options.show_task_pattern = Regexp.new(value || '')
2289: options.full_description = false
2290: }
2291: ],
2292: ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
2293: lambda { |value|
2294: options.trace = true
2295: verbose(true)
2296: }
2297: ],
2298: ['--verbose', '-v', "Log message to standard output.",
2299: lambda { |value| verbose(true) }
2300: ],
2301: ['--version', '-V', "Display the program version.",
2302: lambda { |value|
2303: puts "rake, version #{RAKEVERSION}"
2304: exit
2305: }
2306: ]
2307: ]
2308: end