Module: Squared::Workspace

Extended by:
Common
Defined in:
lib/squared/workspace.rb,
lib/squared/workspace/repo.rb,
lib/squared/workspace/series.rb,
lib/squared/workspace/project.rb,
lib/squared/workspace/application.rb,
lib/squared/workspace/project/git.rb,
lib/squared/workspace/project/base.rb,
lib/squared/workspace/project/node.rb,
lib/squared/workspace/project/ruby.rb,
lib/squared/workspace/project/python.rb

Defined Under Namespace

Modules: Project, Repo Classes: Application, Series

Constant Summary

Constants included from Common

Common::ARG

Class Method Summary collapse

Class Method Details

.expect(name) ⇒ Object

Raises:

  • (NoMethodError)


20
21
22
23
24
25
# File 'lib/squared/workspace.rb', line 20

def expect(name)
  ret = project(name)
  return ret if ret&.path&.directory?

  raise NoMethodError, "project is not initialized (#{name})"
end

.project?(name) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/squared/workspace.rb', line 27

def project?(name)
  !!project(name)&.enabled?
end

.resolve(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/squared/workspace.rb', line 8

def resolve(*args)
  ret = args.map do |id|
    if id.is_a?(Symbol)
      project id
    else
      id = dirpath(id) if id.is_a?(String)
      __get__(:project).find { |_, val| val.path.to_s == id.to_s }
    end
  end
  ret.size == 1 ? ret.first : ret
end