Remove connect|disconnect commands

This commit is contained in:
0x1eef 2024-09-24 15:35:14 -03:00
parent 906ed2dcfa
commit c53b2fff67
7 changed files with 0 additions and 101 deletions

View file

@ -41,8 +41,6 @@ in Ruby. See **Design** for more info.
Commands:
up Start the twenty web server
down Stop the twenty web server
connect Connect a project to twenty
disconnect Disconnect a project from twenty
migrate Migrate the database
console Start the twenty developer console

View file

@ -11,12 +11,6 @@ when "up"
when "down"
wait spawn("down", *ARGV[1..])
exit $?.exitstatus
when "connect"
wait spawn("connect", *ARGV[1..])
exit $?.exitstatus
when "disconnect"
wait spawn("disconnect", *ARGV[1..])
exit $?.exitstatus
when "migrate"
wait spawn("migrate", *ARGV[1..])
exit $?.exitstatus

View file

@ -12,8 +12,6 @@ class Twenty::Command < Cmd
# Commands
require_relative "command/up"
require_relative "command/down"
require_relative "command/connect"
require_relative "command/disconnect"
require_relative "command/migrate"
require_relative "command/console"

View file

@ -1,36 +0,0 @@
# frozen_string_literal: true
class Twenty::Command::Connect < Twenty::Command
set_banner usage: "twenty connect [OPTIONS]",
description: "Connect a project to twenty"
set_option "-p PATH", "--path PATH", "The path to a project", default: nil
##
# Hooks
# Run order:
# Rescue -> SQLiteConn -> RequireMigration -> command
prepend Hook::RequireMigration
prepend Hook::SQLiteConn
prepend Hook::Rescue
def run
options = parse_options(argv)
run_command(options)
end
private
def run_command(options)
path = File.realpath(options.path || Dir.getwd)
if File.exist?(path)
require_models!
project = Twenty::Project.create(
name: File.basename(path),
path:
)
warn "[-] '#{project.name}' connected"
else
abort "[x] The path (#{path}) does not exist"
end
end
end

View file

@ -1,31 +0,0 @@
# frozen_string_literal: true
class Twenty::Command::Disconnect < Twenty::Command
set_banner usage: "twenty disconnect [OPTIONS]",
description: "Disconnect a project from twenty"
set_option "-p PATH", "--path PATH", "The path to a project", default: nil
##
# Hooks
# Rescue -> SQLiteConn -> RequireMigration -> command
prepend Hook::RequireMigration
prepend Hook::SQLiteConn
prepend Hook::Rescue
def run
options = parse_options(argv)
run_command(options)
end
private
def run_command(options)
path = File.realpath(options.path || Dir.getwd)
require_models!
Twenty::Project
.where(path:)
.first!
.destroy
warn "[-] '#{File.basename(path)}' disconnected"
end
end

View file

@ -1,12 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
libdir = File.expand_path File.join(__dir__, "..", "..", "lib")
require File.join(libdir, "twenty/cli")
##
# main
def main(argv)
Twenty::Command::Connect.new(argv).run
end
main(ARGV)

View file

@ -1,12 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
libdir = File.expand_path File.join(__dir__, "..", "..", "lib")
require File.join(libdir, "twenty/cli")
##
# main
def main(argv)
Twenty::Command::Disconnect.new(argv).run
end
main(ARGV)