Class: Sem::CLI::Projects

Inherits:
Dracula
  • Object
show all
Defined in:
lib/sem/cli/projects.rb

Defined Under Namespace

Classes: EnvVars, Files, SharedConfigs

Instance Method Summary collapse

Instance Method Details

#create(project_name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sem/cli/projects.rb', line 23

def create(project_name)
  url = Sem::Helpers::GitUrl.new(options[:url])

  abort "Git URL #{options[:url]} is invalid." unless url.valid?

  args = {
    :repo_provider => url.repo_provider,
    :repo_owner => url.repo_owner,
    :repo_name => url.repo_name
  }

  project = Sem::API::Project.create!(project_name, args)

  Sem::Views::Projects.info(project)
end

#info(project_name) ⇒ Object



15
16
17
18
19
# File 'lib/sem/cli/projects.rb', line 15

def info(project_name)
  project = Sem::API::Project.find!(project_name)

  Sem::Views::Projects.info(project)
end

#listObject



4
5
6
7
8
9
10
11
12
# File 'lib/sem/cli/projects.rb', line 4

def list
  projects = Sem::API::Project.all

  if !projects.empty?
    Sem::Views::Projects.list(projects)
  else
    Sem::Views::Projects.setup_first_project
  end
end