Module: RSpec::Core::RubyProject
- Defined in:
- lib/rspec/core/ruby_project.rb
Class Method Summary collapse
-
.add_dir_to_load_path(dir) ⇒ Object
:nodoc:.
- .add_to_load_path(*dirs) ⇒ Object
-
.ascend_until ⇒ Object
:nodoc:.
-
.determine_root ⇒ Object
:nodoc:.
-
.find_first_parent_containing(dir) ⇒ Object
:nodoc:.
-
.root ⇒ Object
:nodoc:.
Class Method Details
.add_dir_to_load_path(dir) ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/rspec/core/ruby_project.rb', line 14 def add_dir_to_load_path(dir) # :nodoc: $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) end |
.add_to_load_path(*dirs) ⇒ Object
10 11 12 |
# File 'lib/rspec/core/ruby_project.rb', line 10 def add_to_load_path(*dirs) dirs.map {|dir| add_dir_to_load_path(File.join(root, dir))} end |
.ascend_until ⇒ Object
:nodoc:
30 31 32 33 34 |
# File 'lib/rspec/core/ruby_project.rb', line 30 def ascend_until # :nodoc: Pathname(File.('.')).ascend do |path| return path if yield(path) end end |
.determine_root ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/rspec/core/ruby_project.rb', line 22 def determine_root # :nodoc: find_first_parent_containing('spec') || '.' end |
.find_first_parent_containing(dir) ⇒ Object
:nodoc:
26 27 28 |
# File 'lib/rspec/core/ruby_project.rb', line 26 def find_first_parent_containing(dir) # :nodoc: ascend_until {|path| File.exists?(File.join(path, dir))} end |