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
- #depend_on_rspec_rails? ⇒ Boolean
-
#initialize(path = Dir.pwd) ⇒ Project
constructor
A new instance of Project.
- #rspec_version ⇒ Object
- #using_bundler? ⇒ Boolean
- #with_bundler_clean_env ⇒ Object
Constructor Details
#initialize(path = Dir.pwd) ⇒ Project
Returns a new instance of Project.
11 12 13 |
# File 'lib/transpec/project.rb', line 11 def initialize(path = Dir.pwd) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/transpec/project.rb', line 9 def path @path end |
Instance Method Details
#basename ⇒ Object
15 16 17 |
# File 'lib/transpec/project.rb', line 15 def basename File.basename(path) end |
#depend_on_rspec_rails? ⇒ Boolean
23 24 25 26 27 |
# File 'lib/transpec/project.rb', line 23 def depend_on_rspec_rails? return @depend_on_rspec_rails if instance_variable_defined?(:@depend_on_rspec_rails) return @depend_on_rspec_rails = false unless using_bundler? @depend_on_rspec_rails = dependency_gems.any? { |gem| gem.name == 'rspec-rails' } end |
#rspec_version ⇒ Object
29 30 31 |
# File 'lib/transpec/project.rb', line 29 def rspec_version @rspec_version ||= RSpecVersion.new(fetch_rspec_version) end |
#using_bundler? ⇒ Boolean
19 20 21 |
# File 'lib/transpec/project.rb', line 19 def using_bundler? File.exist?(gemfile_lock_path) end |
#with_bundler_clean_env ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/transpec/project.rb', line 33 def with_bundler_clean_env if defined?(Bundler) && using_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 |