Module: EasyCreds::Project

Defined in:
lib/easy_creds/project.rb

Overview

Detects whether the current working directory is a Rails project or a standalone directory, and exposes project-scoped paths (credentials dir, log dir, etc.) to the rest of the gem without coupling to Rails constants.

Defined Under Namespace

Classes: Rails, Standalone

Class Method Summary collapse

Class Method Details

.detect(cwd = Dir.pwd) ⇒ Object

Returns a Rails or Standalone project object for the given path.



9
10
11
12
# File 'lib/easy_creds/project.rb', line 9

def self.detect(cwd = Dir.pwd)
  root = find_rails_root(Pathname.new(cwd.to_s))
  root ? Project::Rails.new(root: root) : build_standalone(cwd)
end