Module: WatchTower::Project::Init::ClassMethods

Defined in:
lib/watch_tower/project/init.rb

Instance Method Summary collapse

Instance Method Details

#new_from_path(path) ⇒ Project

Create a new project from a path (to a file or a folder)

Parameters:

  • path, (String)

    the path to the file

Returns:

  • (Project)

    a new initialized project

Raises:



16
17
18
19
20
21
22
23
24
# File 'lib/watch_tower/project/init.rb', line 16

def new_from_path(path)
  raise FileNotFound unless path && File.exists?(path)
  LOG.debug("#{__FILE__}:#{__LINE__}: Creating a project from #{path}")
  if GitBased.active_for_path?(path)
    Project.new GitBased.project_name(path), GitBased.working_directory(path)
  else
    Project.new PathBased.project_name(path), PathBased.working_directory(path)
  end
end