2158: def standard_rake_options
2159: [
2160: ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
2161: lambda { |value|
2162: require 'rake/classic_namespace'
2163: options.classic_namespace = true
2164: }
2165: ],
2166: ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
2167: lambda { |value|
2168: options.show_tasks = true
2169: options.full_description = true
2170: options.show_task_pattern = Regexp.new(value || '')
2171: }
2172: ],
2173: ['--dry-run', '-n', "Do a dry run without executing actions.",
2174: lambda { |value|
2175: verbose(true)
2176: nowrite(true)
2177: options.dryrun = true
2178: options.trace = true
2179: }
2180: ],
2181: ['--execute', '-e CODE', "Execute some Ruby code and exit.",
2182: lambda { |value|
2183: eval(value)
2184: exit
2185: }
2186: ],
2187: ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
2188: lambda { |value|
2189: puts eval(value)
2190: exit
2191: }
2192: ],
2193: ['--execute-continue', '-E CODE',
2194: "Execute some Ruby code, then continue with normal task processing.",
2195: lambda { |value| eval(value) }
2196: ],
2197: ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
2198: lambda { |value| $:.push(value) }
2199: ],
2200: ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
2201: lambda { |value| options.show_prereqs = true }
2202: ],
2203: ['--quiet', '-q', "Do not log messages to standard output.",
2204: lambda { |value| verbose(false) }
2205: ],
2206: ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
2207: lambda { |value|
2208: value ||= ''
2209: @rakefiles.clear
2210: @rakefiles << value
2211: }
2212: ],
2213: ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
2214: "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
2215: lambda { |value| options.rakelib = value.split(':') }
2216: ],
2217: ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
2218: lambda { |value|
2219: begin
2220: require value
2221: rescue LoadError => ex
2222: begin
2223: rake_require value
2224: rescue LoadError => ex2
2225: raise ex
2226: end
2227: end
2228: }
2229: ],
2230: ['--rules', "Trace the rules resolution.",
2231: lambda { |value| options.trace_rules = true }
2232: ],
2233: ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
2234: lambda { |value| options.nosearch = true }
2235: ],
2236: ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
2237: lambda { |value|
2238: verbose(false)
2239: options.silent = true
2240: }
2241: ],
2242: ['--system', '-g',
2243: "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
2244: lambda { |value| options.load_system = true }
2245: ],
2246: ['--no-system', '--nosystem', '-G',
2247: "Use standard project Rakefile search paths, ignore system wide rakefiles.",
2248: lambda { |value| options.ignore_system = true }
2249: ],
2250: ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
2251: lambda { |value|
2252: options.show_tasks = true
2253: options.show_task_pattern = Regexp.new(value || '')
2254: options.full_description = false
2255: }
2256: ],
2257: ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
2258: lambda { |value|
2259: options.trace = true
2260: verbose(true)
2261: }
2262: ],
2263: ['--verbose', '-v', "Log message to standard output (default).",
2264: lambda { |value| verbose(true) }
2265: ],
2266: ['--version', '-V', "Display the program version.",
2267: lambda { |value|
2268: puts "rake, version #{RAKEVERSION}"
2269: exit
2270: }
2271: ]
2272: ]
2273: end