Class: Plasma::CLI

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

Overview

CLI interface for the plasma-mcp gem

Instance Method Summary collapse

Instance Method Details

#authObject



39
40
41
42
43
44
45
# File 'lib/plasma/cli.rb', line 39

def auth
  puts "Engaging local authentication system..."

  # Start the auth server with options
  auth = Auth.new(options)
  auth.start
end

#consoleObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/plasma/cli.rb', line 48

def console
  require "debug"

  # Load the application so we can use it in the console if we need to
  require_relative "loader"
  _application = Plasma::Loader.load_project

  # Start an interactive console
  binding.irb # rubocop:disable Lint/Debugger
end

#generate(type, name, *parameters) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/plasma/cli.rb', line 66

def generate(type, name, *parameters)
  # Parse parameters into a hash
  params = {}
  parameters.each do |param|
    key, value = param.split(":")
    params[key] = value if key && value
  end

  # Create the generator
  generator = ComponentGenerator.new(type, name, params)
  generator.generate
end

#new(name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/plasma/cli.rb', line 12

def new(name)
  generator = Generator.new(name, options)
  generator.generate

  return if options[:skip_git]

  Dir.chdir(name) do
    system("git init .")
  end
end

#server(path = nil) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/plasma/cli.rb', line 24

def server(path = nil)
  # Change to the specified path if provided
  Dir.chdir(path) if path

  # Start the server
  server = Server.new(options)
  server.start
end

#versionObject



60
61
62
# File 'lib/plasma/cli.rb', line 60

def version
  puts "PLASMA version #{Plasma::VERSION}"
end