Remove connect|disconnect commands
This commit is contained in:
parent
906ed2dcfa
commit
c53b2fff67
7 changed files with 0 additions and 101 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
|
@ -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)
|
Loading…
Reference in a new issue