Module: Rake
Constant Summary
-
CommandLineOptionError =
# File 'lib/rake/application.rb', line 13Class.new(StandardError)
-
EARLY =
# File 'lib/rake/early_time.rb', line 21EarlyTime.instance
-
EMPTY_TASK_ARGS =
Internal use only
# File 'lib/rake/task_arguments.rb', line 108TaskArguments.new([], [])
-
LATE =
# File 'lib/rake/late_time.rb', line 17LateTime.instance
-
VERSION =
# File 'lib/rake/version.rb', line 3"13.2.1"
Class Attribute Summary
-
.application
rw
Current Rake
Application
. -
.application=(app)
rw
Set the current
Rake
application object.
Class Method Summary
-
.add_rakelib(*files)
Add files to the rakelib list.
-
.load_rakefile(path)
Load a rakefile.
-
.original_dir
Return the original directory where the
Rake
application was started. -
.with_application(block_application = Rake::Application.new)
Make
block_application
the default rake application inside a block so you can load rakefiles into a different application. -
.each_dir_parent(dir)
Internal use only
Yield each file or directory component.
-
.from_pathname(path)
Internal use only
Convert Pathname and Pathname-like objects to strings; leave everything else alone.
- .suggested_thread_count Internal use only
FileUtilsExt
- Extended
nowrite | Get/set the nowrite flag controlling output from the |
rake_check_options | Check that the options do not contain options not listed in |
rake_output_message | Send the message to the default rake output (which is $stderr). |
verbose | Get/set the verbose flag controlling output from the |
when_writing | Use this function to prevent potentially destructive ruby code from running when the |
::FileUtils
- Included
ruby | Run a Ruby interpreter with the given arguments. |
safe_ln | Attempt to do a normal file link, but fall back to a copy if the link fails. |
sh | Run the system command |
split_all | Split a file path into individual directory names. |
create_shell_runner, set_verbose_option, sh_show_command |
Class Attribute Details
.application (rw)
Current Rake ::Rake::Application
# File 'lib/rake/rake_module.rb', line 8
def application @application ||= Rake::Application.new end
.application=(app) (rw)
Set the current Rake
application object.
# File 'lib/rake/rake_module.rb', line 13
def application=(app) @application = app end
Class Method Details
.add_rakelib(*files)
Add files to the rakelib list
# File 'lib/rake/rake_module.rb', line 33
def add_rakelib(*files) application. .rakelib ||= [] application. .rakelib.concat(files) end
.each_dir_parent(dir)
Yield each file or directory component.
# File 'lib/rake/file_list.rb', line 418
def each_dir_parent(dir) # :nodoc: old_length = nil while dir != "." && dir.length != old_length yield(dir) old_length = dir.length dir = File.dirname(dir) end end
.from_pathname(path)
Convert Pathname and Pathname-like objects to strings; leave everything else alone
# File 'lib/rake/file_list.rb', line 429
def from_pathname(path) # :nodoc: path = path.to_path if path.respond_to?(:to_path) path = path.to_str if path.respond_to?(:to_str) path end
.load_rakefile(path)
Load a rakefile.
# File 'lib/rake/rake_module.rb', line 28
def load_rakefile(path) load(path) end
.original_dir
Return the original directory where the Rake
application was started.
# File 'lib/rake/rake_module.rb', line 23
def original_dir application.original_dir end
.suggested_thread_count
# File 'lib/rake/rake_module.rb', line 17
def suggested_thread_count # :nodoc: @cpu_count ||= Rake::CpuCounter.count @cpu_count + 4 end
.with_application(block_application = Rake::Application.new)
Make block_application
the default rake application inside a block so you can load rakefiles into a different application.
This is useful when you want to run rake tasks inside a library without running rake in a sub-shell.
Example:
Dir.chdir 'other/directory'
other_rake = Rake.with_application do |rake|
rake.load_rakefile
end
puts other_rake.tasks
# File 'lib/rake/rake_module.rb', line 54
def with_application(block_application = Rake::Application.new) orig_application = Rake.application Rake.application = block_application yield block_application block_application ensure Rake.application = orig_application end