Class: Manifold::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/manifold/cli.rb

Overview

CLI provides command line interface functionality for creating and managing umbrella projects for data management.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, logger: Logger.new($stdout)) ⇒ CLI

Returns a new instance of CLI.



9
10
11
12
13
14
# File 'lib/manifold/cli.rb', line 9

def initialize(*args, logger: Logger.new($stdout))
  super(*args)

  self.logger = logger
  logger.level = Logger::INFO
end

Instance Attribute Details

#bq_serviceObject

Returns the value of attribute bq_service.



7
8
9
# File 'lib/manifold/cli.rb', line 7

def bq_service
  @bq_service
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/manifold/cli.rb', line 7

def logger
  @logger
end

Instance Method Details

#add(name) ⇒ Object



42
43
44
45
46
# File 'lib/manifold/cli.rb', line 42

def add(name)
  workspace = API::Workspace.new(name)
  workspace.add
  logger.info "Added workspace '#{name}' with tables and routines directories."
end

#generateObject



49
50
51
52
53
54
# File 'lib/manifold/cli.rb', line 49

def generate
  name = Pathname.pwd.basename.to_s
  project = API::Project.new(name, directory: Pathname.pwd, logger:)
  project.generate
  logger.info "Generated BigQuery schema for all workspaces in the project."
end

#init(name) ⇒ Object



17
18
19
20
# File 'lib/manifold/cli.rb', line 17

def init(name)
  Manifold::API::Project.create(name)
  logger.info "Created umbrella project '#{name}' with workspaces and vectors directories."
end