diff --git a/README.md b/README.md index 46ec967..15f736e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cli/bin/twenty b/cli/bin/twenty index 8434eca..b2c09e4 100755 --- a/cli/bin/twenty +++ b/cli/bin/twenty @@ -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 diff --git a/cli/lib/twenty/cli/command.rb b/cli/lib/twenty/cli/command.rb index 315d252..9d25caa 100644 --- a/cli/lib/twenty/cli/command.rb +++ b/cli/lib/twenty/cli/command.rb @@ -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" diff --git a/cli/lib/twenty/cli/command/connect.rb b/cli/lib/twenty/cli/command/connect.rb deleted file mode 100644 index d027356..0000000 --- a/cli/lib/twenty/cli/command/connect.rb +++ /dev/null @@ -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 diff --git a/cli/lib/twenty/cli/command/disconnect.rb b/cli/lib/twenty/cli/command/disconnect.rb deleted file mode 100644 index 464090c..0000000 --- a/cli/lib/twenty/cli/command/disconnect.rb +++ /dev/null @@ -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 diff --git a/cli/libexec/twenty/connect b/cli/libexec/twenty/connect deleted file mode 100755 index d386655..0000000 --- a/cli/libexec/twenty/connect +++ /dev/null @@ -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) diff --git a/cli/libexec/twenty/disconnect b/cli/libexec/twenty/disconnect deleted file mode 100755 index 87085e5..0000000 --- a/cli/libexec/twenty/disconnect +++ /dev/null @@ -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)