Module: Gunter::Model::Project

Defined in:
lib/gunter/model/project.rb

Overview

Gunter Project model class

Class Method Summary collapse

Class Method Details

.create(repo, location = nil, git: Gunter.model(:git), template: Gunter.model(:template)) ⇒ Object

Create a new project

Parameters:

  • repo (String)

    the repository name

  • location (String) (defaults to: nil)

    the location to clone the repository (optional)



12
13
14
15
16
17
18
19
# File 'lib/gunter/model/project.rb', line 12

def create(repo, location = nil, git: Gunter.model(:git), template: Gunter.model(:template))
  unless repo.match?(%r{\A\w+/\w+\z})
    repo_by_name = template.all.dig(repo, :repo)
    repo = repo_by_name if repo_by_name
  end

  git.clone(repo, location)
end