Class: Rake::Application
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
TraceOutput ,
TaskManager
|
|
Inherits: | Object |
Defined in: | lib/rake/application.rb |
Overview
::Rake
main application object. When invoking rake
from the command line, a Application
object is created and run.
Constant Summary
-
DEFAULT_RAKEFILES =
# File 'lib/rake/application.rb', line 41[ "rakefile", "Rakefile", "rakefile.rb", "Rakefile.rb" ].freeze
Class Method Summary
-
.new ⇒ Application
constructor
Initialize a
Application
object.
Instance Attribute Summary
-
#name
readonly
The name of the application (typically ‘rake’).
-
#original_dir
readonly
The original directory where rake was invoked.
-
#rakefile
readonly
Name of the actual rakefile used.
-
#terminal_columns
rw
Number of columns on the terminal.
-
#top_level_tasks
readonly
List of the top level task names (task names from the command line).
-
#tty_output=(value)
rw
Override the detected TTY output state (mostly for testing).
-
#truncate_output? ⇒ Boolean
readonly
Internal use only
We will truncate output if we are outputting to a TTY or if we’ve been given an explicit column width to honor.
-
#tty_output? ⇒ Boolean
rw
Internal use only
True if we are outputting to TTY, false otherwise.
- #unix? ⇒ Boolean readonly Internal use only
- #windows? ⇒ Boolean readonly Internal use only
TaskManager
- Included
#last_description | Track the last comment made in the Rakefile. |
Instance Method Summary
-
#add_loader(ext, loader)
Add a loader to handle imported files ending in the extension
ext
. -
#init(app_name = "rake", argv = ARGV)
Initialize the command line parameters and app name.
-
#load_rakefile
Find the rakefile and then load it and any pending imports.
-
#options
Application
options from the command line. -
#run(argv = ARGV)
Run the
::Rake
application. -
#run_with_threads
Run the given block with the thread startup and shutdown.
-
#top_level
Run the top level tasks of a
::Rake
application. -
#add_import(fn)
Internal use only
Add a file to the list of files to be imported.
-
#collect_command_line_tasks(args)
Internal use only
Collect the list of tasks on the command line.
-
#default_task_name
Internal use only
Default task name (“default”).
-
#deprecate(old_usage, new_usage, call_site)
Internal use only
Warn about deprecated usage.
- #display_cause_details(ex) Internal use only
-
#display_error_message(ex)
Internal use only
Display the error message that caused the exception.
- #display_exception_backtrace(ex) Internal use only
- #display_exception_details(ex) Internal use only
- #display_exception_details_seen Internal use only
- #display_exception_message_details(ex) Internal use only
-
#display_prerequisites
Internal use only
Display the tasks and prerequisites.
-
#display_tasks_and_comments
Internal use only
Display the tasks and comments.
-
#dynamic_width
Internal use only
Calculate the dynamic width of the.
- #dynamic_width_stty Internal use only
- #dynamic_width_tput Internal use only
-
#exit_because_of_exception(ex)
Internal use only
Exit the program because of an unhandled exception.
- #find_rakefile_location Internal use only
-
#handle_options(argv)
Internal use only
Read and handle the command line options.
- #has_cause?(ex) ⇒ Boolean Internal use only
-
#have_rakefile
Internal use only
True if one of the files in RAKEFILES is in the current directory.
-
#invoke_task(task_string)
Internal use only
Invokes a task with arguments that are extracted from
task_string
-
#load_imports
Internal use only
Load the pending list of imported files.
- #parse_task_string(string) Internal use only
- #print_rakefile_directory(location) Internal use only
-
#rake_require(file_name, paths = $LOAD_PATH, loaded = $")
Internal use only
Similar to the regular Ruby
require
command, but will check for *.rake files in addition to *.rb files. - #rakefile_location(backtrace = caller) Internal use only
- #raw_load_rakefile Internal use only
- #set_default_options Internal use only
-
#standard_exception_handling
Internal use only
Provide standard exception handling for the given block.
-
#standard_rake_options
Internal use only
A list of all the standard options used in rake, suitable for passing to OptionParser.
-
#system_dir
Internal use only
The directory path containing the system wide rakefiles.
- #terminal_width Internal use only
-
#thread_pool
Internal use only
Return the thread pool used for multithreaded processing.
- #trace(*strings) Internal use only
- #truncate(string, width) Internal use only
- #glob(path, &block) private Internal use only
-
#has_chain?(exception) ⇒ Boolean
private
Internal use only
Does the exception have a task invocation chain?
- #select_tasks_to_show(options, show_tasks, value) private Internal use only
- #select_trace_output(options, trace_option, value) private Internal use only
- #sort_options(options) private Internal use only
-
#standard_system_dir
private
Internal use only
See additional method definition at line 733.
TraceOutput
- Included
#trace_on | Write trace output to output stream |
TaskManager
- Included
#[] | Find a matching task for |
#clear | Clear all tasks in this application. |
#current_scope | Return the list of scope names currently active in the task manager. |
#enhance_with_matching_rule | If a rule can be found that matches the task name, enhance the task with the prerequisites and actions from the rule. |
#generate_did_you_mean_suggestions, #generate_message_for_undefined_task, | |
#in_namespace | Evaluate the block in a nested namespace named #name. |
#intern | Lookup a task. |
#lookup | Lookup a task, using scope and the scope hints in the task name. |
#resolve_args | Resolve the arguments for a task/rule. |
#tasks | List of all defined tasks in this application. |
#tasks_in_scope | List of all the tasks defined in the given scope (and its sub-scopes). |
#add_location | Add a location to the locations field of the given task. |
#attempt_rule | Attempt to create a rule given the list of prerequisites. |
#find_location | Find the location that called into the dsl layer. |
#generate_name | Generate an anonymous namespace name. |
#get_description | Return the current description, clearing it in the process. |
#lookup_in_scope | Lookup the task name. |
#make_sources | Make a list of sources from the list of file name extensions / translation procs. |
#resolve_args_without_dependencies | Resolve task arguments for a task or rule when there are no dependencies declared. |
#create_rule, #define_task, #initialize, #synthesize_file_task, | |
#resolve_args_with_dependencies | Resolve task arguments for a task or rule when there are dependencies declared. |
#trace_rule |
Constructor Details
.new ⇒ Application
Initialize a Application
object.
# File 'lib/rake/application.rb', line 49
def initialize super @name = "rake" @rakefiles = DEFAULT_RAKEFILES.dup @rakefile = nil @pending_imports = [] @imported = [] @loaders = {} @default_loader = Rake::DefaultLoader.new @original_dir = Dir.pwd @top_level_tasks = [] add_loader("rb", DefaultLoader.new) add_loader("rf", DefaultLoader.new) add_loader("rake", DefaultLoader.new) @tty_output = STDOUT.tty? @terminal_columns = ENV["RAKE_COLUMNS"].to_i end
Instance Attribute Details
#name (readonly)
The name of the application (typically ‘rake’)
# File 'lib/rake/application.rb', line 24
attr_reader :name
#original_dir (readonly)
The original directory where rake was invoked.
# File 'lib/rake/application.rb', line 27
attr_reader :original_dir
#rakefile (readonly)
Name of the actual rakefile used.
# File 'lib/rake/application.rb', line 30
attr_reader :rakefile
#terminal_columns (rw)
Number of columns on the terminal
# File 'lib/rake/application.rb', line 33
attr_accessor :terminal_columns
#top_level_tasks (readonly)
List of the top level task names (task names from the command line).
# File 'lib/rake/application.rb', line 36
attr_reader :top_level_tasks
#truncate_output? ⇒ Boolean
(readonly)
We will truncate output if we are outputting to a TTY or if we’ve been given an explicit column width to honor
# File 'lib/rake/application.rb', line 293
def truncate_output? # :nodoc: tty_output? || @terminal_columns.nonzero? end
#tty_output=(value) (rw)
Override the detected TTY output state (mostly for testing)
# File 'lib/rake/application.rb', line 39
attr_writer :tty_output
#tty_output? ⇒ Boolean
(rw)
True if we are outputting to TTY, false otherwise
# File 'lib/rake/application.rb', line 287
def tty_output? # :nodoc: @tty_output end
#unix? ⇒ Boolean
(readonly)
# File 'lib/rake/application.rb', line 361
def unix? # :nodoc: RbConfig::CONFIG["host_os"] =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i end
#windows? ⇒ Boolean
(readonly)
Instance Method Details
#add_import(fn)
Add a file to the list of files to be imported.
# File 'lib/rake/application.rb', line 770
def add_import(fn) # :nodoc: @pending_imports << fn end
#add_loader(ext, loader)
Add a loader to handle imported files ending in the extension ext
.
# File 'lib/rake/application.rb', line 139
def add_loader(ext, loader) ext = ".#{ext}" unless ext =~ /^\./ @loaders[ext] = loader end
#collect_command_line_tasks(args)
Collect the list of tasks on the command line. If no tasks are given, return a list containing only the default task. Environmental assignments are processed at this time as well.
args
is the list of arguments to peruse to get the list of tasks. It should be the command line that was given to rake, less any recognised command-line options, which OptionParser.parse
will have taken care of already.
# File 'lib/rake/application.rb', line 751
def collect_command_line_tasks(args) # :nodoc: @top_level_tasks = [] args.each do |arg| if arg =~ /^(\w+)=(.*)$/m ENV[$1] = $2 else @top_level_tasks << arg unless arg =~ /^-/ end end @top_level_tasks.push(default_task_name) if @top_level_tasks.empty? end
#default_task_name
Default task name (“default”). (May be overridden by subclasses)
# File 'lib/rake/application.rb', line 765
def default_task_name # :nodoc: "default" end
#deprecate(old_usage, new_usage, call_site)
Warn about deprecated usage.
Example:
Rake.application.deprecate("import", "Rake.import", caller.first)
# File 'lib/rake/application.rb', line 258
def deprecate(old_usage, new_usage, call_site) # :nodoc: unless .ignore_deprecate $stderr.puts "WARNING: '#{old_usage}' is deprecated. " + "Please use '#{new_usage}' instead.\n" + " at #{call_site}" end end
#display_cause_details(ex)
# File 'lib/rake/application.rb', line 222
def display_cause_details(ex) # :nodoc: return if display_exception_details_seen.include? ex trace "\nCaused by:" display_exception_details(ex) end
#display_error_message(ex)
Display the error message that caused the exception.
# File 'lib/rake/application.rb', line 206
def (ex) # :nodoc: trace "#{name} aborted!" display_exception_details(ex) trace "Tasks: #{ex.chain}" if has_chain?(ex) trace "(See full trace by running task with --trace)" unless .backtrace end
#display_exception_backtrace(ex)
#display_exception_details(ex)
# File 'lib/rake/application.rb', line 214
def display_exception_details(ex) # :nodoc: display_exception_details_seen << ex (ex) display_exception_backtrace(ex) display_cause_details(ex.cause) if has_cause?(ex) end
#display_exception_details_seen
# File 'lib/rake/application.rb', line 229
def display_exception_details_seen # :nodoc: Thread.current[:rake_display_exception_details_seen] ||= [] end
#display_exception_message_details(ex)
#display_prerequisites
Display the tasks and prerequisites
#display_tasks_and_comments
Display the tasks and comments.
# File 'lib/rake/application.rb', line 298
def display_tasks_and_comments # :nodoc: displayable_tasks = tasks.select { |t| ( .show_all_tasks || t.comment) && t.name =~ .show_task_pattern } case .show_tasks when :tasks width = displayable_tasks.map { |t| t.name_with_args.length }.max || 10 if truncate_output? max_column = terminal_width - name.size - width - 7 else max_column = nil end displayable_tasks.each do |t| printf("#{name} %-#{width}s # %s\n", t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment) end when :describe displayable_tasks.each do |t| puts "#{name} #{t.name_with_args}" comment = t.full_comment || "" comment.split("\n").each do |line| puts " #{line}" end puts end when :lines displayable_tasks.each do |t| t.locations.each do |loc| printf "#{name} %-30s %s\n", t.name_with_args, loc end end else fail "Unknown show task mode: '#{ .show_tasks}'" end end
#dynamic_width
Calculate the dynamic width of the
# File 'lib/rake/application.rb', line 349
def dynamic_width # :nodoc: @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput) end
#dynamic_width_stty
# File 'lib/rake/application.rb', line 353
def dynamic_width_stty # :nodoc: %x{stty size 2>/dev/null}.split[1].to_i end
#dynamic_width_tput
# File 'lib/rake/application.rb', line 357
def dynamic_width_tput # :nodoc: %x{tput cols 2>/dev/null}.to_i end
#exit_because_of_exception(ex)
Exit the program because of an unhandled exception. (may be overridden by subclasses)
# File 'lib/rake/application.rb', line 201
def exit_because_of_exception(ex) # :nodoc: exit(false) end
#find_rakefile_location
# File 'lib/rake/application.rb', line 671
def find_rakefile_location # :nodoc: here = Dir.pwd until (fn = have_rakefile) Dir.chdir("..") return nil if Dir.pwd == here || .nosearch here = Dir.pwd end [fn, here] ensure Dir.chdir(Rake.original_dir) end
#glob(path, &block) (private)
#handle_options(argv)
Read and handle the command line options. Returns the command line arguments that we didn’t understand, which should (in theory) be just task names and env vars.
# File 'lib/rake/application.rb', line 637
def (argv) # :nodoc: OptionParser.new do |opts| opts. = "#{Rake.application.name} [-f rakefile] {options} targets..." opts.separator "" opts.separator "Options are ..." opts.on_tail("-h", "--help", "-H", "Display this help message.") do puts opts exit end .each { |args| opts.on(*args) } opts.environment("RAKEOPT") end.parse(argv) end
#has_cause?(ex) ⇒ Boolean
# File 'lib/rake/application.rb', line 233
def has_cause?(ex) # :nodoc: ex.respond_to?(:cause) && ex.cause end
#has_chain?(exception) ⇒ Boolean
(private)
Does the exception have a task invocation chain?
# File 'lib/rake/application.rb', line 267
def has_chain?(exception) # :nodoc: exception.respond_to?(:chain) && exception.chain end
#have_rakefile
True if one of the files in RAKEFILES is in the current directory. If a match is found, it is copied into @rakefile.
#init(app_name = "rake", argv = ARGV)
Initialize the command line parameters and app name.
# File 'lib/rake/application.rb', line 88
def init(app_name="rake", argv = ARGV) standard_exception_handling do @name = app_name begin args = argv rescue ArgumentError # Backward compatibility for capistrano args = end collect_command_line_tasks(args) end end
#invoke_task(task_string)
Invokes a task with arguments that are extracted from task_string
# File 'lib/rake/application.rb', line 157
def invoke_task(task_string) # :nodoc: name, args = parse_task_string(task_string) t = self[name] t.invoke(*args) end
#load_imports
Load the pending list of imported files.
# File 'lib/rake/application.rb', line 775
def load_imports # :nodoc: while fn = @pending_imports.shift next if @imported.member?(fn) fn_task = lookup(fn) and fn_task.invoke ext = File.extname(fn) loader = @loaders[ext] || @default_loader loader.load(fn) if fn_task = lookup(fn) and fn_task.needed? fn_task.reenable fn_task.invoke loader.load(fn) end @imported << fn end end
#load_rakefile
Find the rakefile and then load it and any pending imports.
# File 'lib/rake/application.rb', line 102
def load_rakefile standard_exception_handling do raw_load_rakefile end end
#options
Application
options from the command line
# File 'lib/rake/application.rb', line 145
def @options ||= OpenStruct.new end
#parse_task_string(string)
# File 'lib/rake/application.rb', line 163
def parse_task_string(string) # :nodoc: /^([^\[]+)(?:\[(.*)\])$/ =~ string.to_s name = $1 remaining_args = $2 return string, [] unless name return name, [] if remaining_args.empty? args = [] begin /\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args remaining_args = $2 args << $1.gsub(/\\(.)/, '\1') end while remaining_args return name, args end
#print_rakefile_directory(location)
# File 'lib/rake/application.rb', line 683
def print_rakefile_directory(location) # :nodoc: $stderr.puts "(in #{Dir.pwd})" unless .silent or original_dir == location end
#rake_require(file_name, paths = $LOAD_PATH, loaded = $")
Similar to the regular Ruby require
command, but will check for *.rake files in addition to *.rb files.
# File 'lib/rake/application.rb', line 657
def rake_require(file_name, paths=$LOAD_PATH, loaded=$") # :nodoc: fn = file_name + ".rake" return false if loaded.include?(fn) paths.each do |path| full_path = File.join(path, fn) if File.exist?(full_path) Rake.load_rakefile(full_path) loaded << fn return true end end fail LoadError, "Can't find #{file_name}" end
#rakefile_location(backtrace = caller)
# File 'lib/rake/application.rb', line 791
def rakefile_location(backtrace=caller) # :nodoc: backtrace.map { |t| t[/([^:]+):/, 1] } re = /^#{@rakefile}$/ re = /#{re.source}/i if windows? backtrace.find { |str| str =~ re } || "" end
#raw_load_rakefile
# File 'lib/rake/application.rb', line 688
def raw_load_rakefile # :nodoc: rakefile, location = find_rakefile_location if (! .ignore_system) && ( .load_system || rakefile.nil?) && system_dir && File.directory?(system_dir) print_rakefile_directory(location) glob("#{system_dir}/*.rake") do |name| add_import name end else fail "No Rakefile found (looking for: #{@rakefiles.join(', ')})" if rakefile.nil? @rakefile = rakefile Dir.chdir(location) print_rakefile_directory(location) Rake.load_rakefile(File. (@rakefile)) if @rakefile && @rakefile != "" .rakelib.each do |rlib| glob("#{rlib}/*.rake") do |name| add_import name end end end load_imports end
#run(argv = ARGV)
Run the ::Rake
application. The run method performs the following three steps:
-
Initialize the command line options (#init).
-
Define the tasks (#load_rakefile).
-
Run the top level tasks (#top_level).
If you wish to build a custom rake command, you should call #init on your application. Then define any tasks. Finally, call #top_level to run your top level tasks.
# File 'lib/rake/application.rb', line 79
def run(argv = ARGV) standard_exception_handling do init "rake", argv load_rakefile top_level end end
#run_with_threads
Run the given block with the thread startup and shutdown.
# File 'lib/rake/application.rb', line 122
def run_with_threads thread_pool.gather_history if .job_stats == :history yield thread_pool.join if .job_stats stats = thread_pool.statistics puts "Maximum active threads: #{stats[:max_active_threads]} + main" puts "Total threads in play: #{stats[:total_threads_in_play]} + main" end ThreadHistoryDisplay.new(thread_pool.history).show if .job_stats == :history end
#select_tasks_to_show(options, show_tasks, value) (private)
# File 'lib/rake/application.rb', line 613
def select_tasks_to_show(, show_tasks, value) # :nodoc: .show_tasks = show_tasks .show_task_pattern = Regexp.new(value || "") Rake::TaskManager. = true end
#select_trace_output(options, trace_option, value) (private)
# File 'lib/rake/application.rb', line 620
def select_trace_output(, trace_option, value) # :nodoc: value = value.strip unless value.nil? case value when "stdout" .trace_output = $stdout when "stderr", nil .trace_output = $stderr else fail CommandLineOptionError, "Unrecognized --#{trace_option} option '#{value}'" end end
#set_default_options
# File 'lib/rake/application.rb', line 800
def # :nodoc: .always_multitask = false .backtrace = false .build_all = false .dryrun = false .ignore_deprecate = false .ignore_system = false .job_stats = false .load_system = false .nosearch = false .rakelib = %w[rakelib] .show_all_tasks = false .show_prereqs = false .show_task_pattern = nil .show_tasks = nil .silent = false .suppress_backtrace_pattern = nil .thread_pool_size = Rake.suggested_thread_count .trace = false .trace_output = $stderr .trace_rules = false end
#sort_options(options) (private)
# File 'lib/rake/application.rb', line 393
def ( ) # :nodoc: .sort_by { |opt| opt.select { |o| o.is_a?(String) && o =~ /^-/ }.map(&:downcase).sort.reverse } end
#standard_exception_handling
Provide standard exception handling for the given block.
# File 'lib/rake/application.rb', line 185
def standard_exception_handling # :nodoc: yield rescue SystemExit # Exit silently with current status raise rescue OptionParser::InvalidOption => ex $stderr.puts ex. exit(false) rescue Exception => ex # Exit with error message (ex) exit_because_of_exception(ex) end
#standard_rake_options
A list of all the standard options used in rake, suitable for passing to OptionParser.
# File 'lib/rake/application.rb', line 402
def # :nodoc: ( [ ["--all", "-A", "Show all tasks, even uncommented ones (in combination with -T or -D)", lambda { |value| .show_all_tasks = value } ], ["--backtrace=[OUT]", "Enable full backtrace. OUT can be stderr (default) or stdout.", lambda { |value| .backtrace = true select_trace_output(, "backtrace", value) } ], ["--build-all", "-B", "Build all prerequisites, including those which are up-to-date.", lambda { |value| .build_all = true } ], ["--comments", "Show commented tasks only", lambda { |value| .show_all_tasks = !value } ], ["--describe", "-D [PATTERN]", "Describe the tasks (matching optional PATTERN), then exit.", lambda { |value| select_tasks_to_show(, :describe, value) } ], ["--dry-run", "-n", "Do a dry run without executing actions.", lambda { |value| Rake.verbose(true) Rake.nowrite(true) .dryrun = true .trace = true } ], ["--execute", "-e CODE", "Execute some Ruby code and exit.", lambda { |value| eval(value) exit } ], ["--execute-print", "-p CODE", "Execute some Ruby code, print the result, then exit.", lambda { |value| puts eval(value) exit } ], ["--execute-continue", "-E CODE", "Execute some Ruby code, " + "then continue with normal task processing.", lambda { |value| eval(value) } ], ["--jobs", "-j [NUMBER]", "Specifies the maximum number of tasks to execute in parallel. " + "(default is number of CPU cores + 4)", lambda { |value| if value.nil? || value == "" value = Float::INFINITY elsif value =~ /^\d+$/ value = value.to_i else value = Rake.suggested_thread_count end value = 1 if value < 1 .thread_pool_size = value - 1 } ], ["--job-stats [LEVEL]", "Display job statistics. " + "LEVEL=history displays a complete job list", lambda { |value| if value =~ /^history/i .job_stats = :history else .job_stats = true end } ], ["--libdir", "-I LIBDIR", "Include LIBDIR in the search path for required modules.", lambda { |value| $:.push(value) } ], ["--multitask", "-m", "Treat all tasks as multitasks.", lambda { |value| .always_multitask = true } ], ["--no-search", "--nosearch", "-N", "Do not search parent directories for the Rakefile.", lambda { |value| .nosearch = true } ], ["--prereqs", "-P", "Display the tasks and dependencies, then exit.", lambda { |value| .show_prereqs = true } ], ["--quiet", "-q", "Do not log messages to standard output.", lambda { |value| Rake.verbose(false) } ], ["--rakefile", "-f [FILENAME]", "Use FILENAME as the rakefile to search for.", lambda { |value| value ||= "" @rakefiles.clear @rakefiles << value } ], ["--rakelibdir", "--rakelib", "-R RAKELIBDIR", "Auto-import any .rake files in RAKELIBDIR. " + "(default is 'rakelib')", lambda { |value| .rakelib = value.split(File::PATH_SEPARATOR) } ], ["--require", "-r MODULE", "Require MODULE before executing rakefile.", lambda { |value| begin require value rescue LoadError => ex begin rake_require value rescue LoadError raise ex end end } ], ["--rules", "Trace the rules resolution.", lambda { |value| .trace_rules = true } ], ["--silent", "-s", "Like --quiet, but also suppresses the " + "'in directory' announcement.", lambda { |value| Rake.verbose(false) .silent = true } ], ["--suppress-backtrace PATTERN", "Suppress backtrace lines matching regexp PATTERN. " + "Ignored if --trace is on.", lambda { |value| .suppress_backtrace_pattern = Regexp.new(value) } ], ["--system", "-g", "Using system wide (global) rakefiles " + "(usually '~/.rake/*.rake').", lambda { |value| .load_system = true } ], ["--no-system", "--nosystem", "-G", "Use standard project Rakefile search paths, " + "ignore system wide rakefiles.", lambda { |value| .ignore_system = true } ], ["--tasks", "-T [PATTERN]", "Display the tasks (matching optional PATTERN) " + "with descriptions, then exit. " + "-AT combination displays all of tasks contained no description.", lambda { |value| select_tasks_to_show(, :tasks, value) } ], ["--trace=[OUT]", "-t", "Turn on invoke/execute tracing, enable full backtrace. " + "OUT can be stderr (default) or stdout.", lambda { |value| .trace = true .backtrace = true select_trace_output(, "trace", value) Rake.verbose(true) } ], ["--verbose", "-v", "Log message to standard output.", lambda { |value| Rake.verbose(true) } ], ["--version", "-V", "Display the program version.", lambda { |value| puts "rake, version #{Rake::VERSION}" exit } ], ["--where", "-W [PATTERN]", "Describe the tasks (matching optional PATTERN), then exit.", lambda { |value| select_tasks_to_show(, :lines, value) .show_all_tasks = true } ], ["--no-deprecation-warnings", "-X", "Disable the deprecation warnings.", lambda { |value| .ignore_deprecate = true } ], ]) end
#standard_system_dir (private)
See additional method definition at line 733.
# File 'lib/rake/application.rb', line 737
def standard_system_dir #:nodoc: Win32.win32_system_dir end
#system_dir
The directory path containing the system wide rakefiles.
# File 'lib/rake/application.rb', line 720
def system_dir # :nodoc: @system_dir ||= begin if ENV["RAKE_SYSTEM"] ENV["RAKE_SYSTEM"] else standard_system_dir end end end
#terminal_width
# File 'lib/rake/application.rb', line 337
def terminal_width # :nodoc: if @terminal_columns.nonzero? result = @terminal_columns else result = unix? ? dynamic_width : 80 end (result < 10) ? 80 : result rescue 80 end
#thread_pool
Return the thread pool used for multithreaded processing.
# File 'lib/rake/application.rb', line 150
def thread_pool # :nodoc: @thread_pool ||= ThreadPool.new( .thread_pool_size || Rake.suggested_thread_count-1) end
#top_level
Run the top level tasks of a ::Rake
application.
# File 'lib/rake/application.rb', line 109
def top_level run_with_threads do if .show_tasks display_tasks_and_comments elsif .show_prereqs display_prerequisites else top_level_tasks.each { |task_name| invoke_task(task_name) } end end end
#trace(*strings)
# File 'lib/rake/application.rb', line 388
def trace(*strings) # :nodoc: .trace_output ||= $stderr trace_on( .trace_output, *strings) end
#truncate(string, width)
# File 'lib/rake/application.rb', line 370
def truncate(string, width) # :nodoc: if string.nil? "" elsif string.length <= width string else (string[0, width - 3] || "") + "..." end end