Module: Rake

Extended by:
Rake, FileUtilsExt
Includes:
Test::Unit::Assertions
Included in:
Rake
Defined in:
lib/rake.rb,
lib/rake/task.rb,
lib/rake/clean.rb,
lib/rake/win32.rb,
lib/rake/scope.rb,
lib/rake/tasklib.rb,
lib/rake/version.rb,
lib/rake/runtest.rb,
lib/rake/promise.rb,
lib/rake/testtask.rb,
lib/rake/backtrace.rb,
lib/rake/file_list.rb,
lib/rake/file_list.rb,
lib/rake/file_task.rb,
lib/rake/cloneable.rb,
lib/rake/early_time.rb,
lib/rake/multi_task.rb,
lib/rake/thread_pool.rb,
lib/rake/cpu_counter.rb,
lib/rake/application.rb,
lib/rake/packagetask.rb,
lib/rake/linked_list.rb,
lib/rake/rake_module.rb,
lib/rake/trace_output.rb,
lib/rake/task_manager.rb,
lib/rake/pseudo_status.rb,
lib/rake/private_reader.rb,
lib/rake/dsl_definition.rb,
lib/rake/task_arguments.rb,
lib/rake/file_utils_ext.rb,
lib/rake/default_loader.rb,
lib/rake/invocation_chain.rb,
lib/rake/contrib/ftptools.rb,
lib/rake/loaders/makefile.rb,
lib/rake/file_creation_task.rb,
lib/rake/task_argument_error.rb,
lib/rake/contrib/sshpublisher.rb,
lib/rake/thread_history_display.rb,
lib/rake/invocation_exception_mixin.rb,
lib/rake/contrib/compositepublisher.rb,
lib/rake/contrib/rubyforgepublisher.rb,
lib/rake/rule_recursion_overflow_error.rb

Overview

:nodoc:

Defined Under Namespace

Modules: AltSystem, Backtrace, Cleaner, Cloneable, DSL, FileUtilsExt, InvocationExceptionMixin, PrivateReader, TaskManager, TraceOutput, Version, Win32 Classes: Application, CompositePublisher, CpuCounter, DefaultLoader, EarlyTime, FileCreationTask, FileList, FileTask, FtpFile, FtpUploader, InvocationChain, LinkedList, MakefileLoader, MultiTask, NameSpace, PackageTask, Promise, PseudoStatus, RubyForgePublisher, RuleRecursionOverflowError, Scope, SshDirPublisher, SshFilePublisher, SshFreshDirPublisher, Task, TaskArgumentError, TaskArguments, TaskLib, TestTask, ThreadHistoryDisplay, ThreadPool

Constant Summary

VERSION =
'10.3.2'
EARLY =
EarlyTime.instance
CommandLineOptionError =
Class.new(StandardError)
EMPTY_TASK_ARGS =

:nodoc:

TaskArguments.new([], [])

Constants included from FileUtilsExt

FileUtilsExt::DEFAULT

Constants included from FileUtils

FileUtils::LN_SUPPORTED, FileUtils::RUBY

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from FileUtilsExt

nowrite, rake_check_options, rake_merge_option, rake_output_message, verbose, when_writing

Methods included from FileUtils

#ruby, #safe_ln, #sh, #split_all

Class Method Details

+ (Object) add_rakelib(*files)

Add files to the rakelib list



32
33
34
35
# File 'lib/rake/rake_module.rb', line 32

def add_rakelib(*files)
  application.options.rakelib ||= []
  application.options.rakelib.concat(files)
end

+ (Object) application

Current Rake Application



7
8
9
# File 'lib/rake/rake_module.rb', line 7

def application
  @application ||= Rake::Application.new
end

+ (Object) application=(app)

Set the current Rake application object.



12
13
14
# File 'lib/rake/rake_module.rb', line 12

def application=(app)
  @application = app
end

+ (Object) each_dir_parent(dir)

Yield each file or directory component.



405
406
407
408
409
410
411
412
# File 'lib/rake/file_list.rb', line 405

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

+ (Object) load_rakefile(path)

Load a rakefile.



27
28
29
# File 'lib/rake/rake_module.rb', line 27

def load_rakefile(path)
  load(path)
end

+ (Object) original_dir

Return the original directory where the Rake application was started.



22
23
24
# File 'lib/rake/rake_module.rb', line 22

def original_dir
  application.original_dir
end

+ (Object) suggested_thread_count

:nodoc:



16
17
18
19
# File 'lib/rake/rake_module.rb', line 16

def suggested_thread_count # :nodoc:
  @cpu_count ||= Rake::CpuCounter.count
  @cpu_count + 4
end

Instance Method Details

- (Object) run_tests(pattern = 'test/test*.rb', log_enabled = false)

Deprecated way of running tests in process, but only for Test::Unit. – TODO: Remove in rake 11



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rake/runtest.rb', line 13

def run_tests(pattern='test/test*.rb', log_enabled=false) # :nodoc:
  FileList.glob(pattern).each do |fn|
    $stderr.puts fn if log_enabled
    begin
      require fn
    rescue Exception => ex
      $stderr.puts "Error in #{fn}: #{ex.message}"
      $stderr.puts ex.backtrace
      assert false
    end
  end
end