Class: Transpec::Project
- Inherits:
-
Object
- Object
- Transpec::Project
- Defined in:
- lib/transpec/project.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #basename ⇒ Object
-
#initialize(path = Dir.pwd) ⇒ Project
constructor
A new instance of Project.
- #require_bundler? ⇒ Boolean
- #rspec_version ⇒ Object
- #with_bundler_clean_env ⇒ Object
Constructor Details
#initialize(path = Dir.pwd) ⇒ Project
Returns a new instance of Project.
10 11 12 |
# File 'lib/transpec/project.rb', line 10 def initialize(path = Dir.pwd) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/transpec/project.rb', line 8 def path @path end |
Instance Method Details
#basename ⇒ Object
14 15 16 |
# File 'lib/transpec/project.rb', line 14 def basename File.basename(path) end |
#require_bundler? ⇒ Boolean
18 19 20 21 |
# File 'lib/transpec/project.rb', line 18 def require_bundler? gemfile_path = File.join(path, 'Gemfile') File.exist?(gemfile_path) end |
#rspec_version ⇒ Object
23 24 25 |
# File 'lib/transpec/project.rb', line 23 def rspec_version @rspec_version ||= RSpecVersion.new(fetch_rspec_version) end |
#with_bundler_clean_env ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/transpec/project.rb', line 27 def with_bundler_clean_env if defined?(Bundler) && require_bundler? Bundler.with_clean_env do # Bundler.with_clean_env cleans environment variables # which are set after bundler is loaded. yield end else yield end end |