twenty-cli 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/twenty +6 -6
- data/lib/twenty/cli/command/connect.rb +12 -4
- data/lib/twenty/cli/command/disconnect.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f84fc65f4ec693f37ea17ad2533b989dfab49d2abc9356aca07eaa1f371c972
|
4
|
+
data.tar.gz: d67645ec3b5368a5ea3bb3595d51bf5ab4bc646734c36a2661e119ef23cfe14b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 815b1a2f6b18bc659e1c4bf8f141d5f03852875d773f4e5fed9ca248e868971ed9fe59d33c037c6a9a11b8b6e72fb6a20c038cffa1bb27d9463f04552a2529ac
|
7
|
+
data.tar.gz: 144f63ce4061f3d5dafdab45539bcaf35d47b3bce40438a0dcbdf364546f0d4eb12be738f716abaafd260d220c4662d72db7390417a90636f5fe1b563c69ba0e
|
data/bin/twenty
CHANGED
@@ -26,10 +26,10 @@ when "console"
|
|
26
26
|
else
|
27
27
|
warn "Usage: twenty COMMAND [OPTIONS]\n\n" \
|
28
28
|
"Commands:\n" \
|
29
|
-
" up Start the twenty web server
|
30
|
-
" down Stop the twenty web server
|
31
|
-
" connect Connect a project to twenty
|
32
|
-
" disconnect Disconnect a project from twenty
|
33
|
-
" migrate Migrate the database
|
34
|
-
" console Start the twenty developer console
|
29
|
+
" up Start the twenty web server\n" \
|
30
|
+
" down Stop the twenty web server\n" \
|
31
|
+
" connect Connect a project to twenty\n" \
|
32
|
+
" disconnect Disconnect a project from twenty\n" \
|
33
|
+
" migrate Migrate the database\n" \
|
34
|
+
" console Start the twenty developer console\n" \
|
35
35
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
class Twenty::Command::Connect < Twenty::Command
|
4
4
|
set_banner usage: "twenty connect [OPTIONS]",
|
5
5
|
description: "Connect a project to twenty"
|
6
|
+
set_option "-p PATH", "--path PATH", "The path to a project", default: nil
|
7
|
+
|
6
8
|
prepend Twenty::Command::MigrationMixin
|
7
9
|
prepend Twenty::Command::SQLiteMixin
|
8
10
|
prepend Twenty::Command::RescueMixin
|
@@ -15,9 +17,15 @@ class Twenty::Command::Connect < Twenty::Command
|
|
15
17
|
private
|
16
18
|
|
17
19
|
def run_command(options)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
path = options.path ? File.expand_path(options.path) : Dir.getwd
|
21
|
+
if File.exist?(path)
|
22
|
+
project = Twenty::Project.create(
|
23
|
+
name: File.basename(path),
|
24
|
+
path:,
|
25
|
+
)
|
26
|
+
warn "[-] '#{project.name}' connected"
|
27
|
+
else
|
28
|
+
abort "[x] The path (#{path}) does not exist"
|
29
|
+
end
|
22
30
|
end
|
23
31
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
class Twenty::Command::Disconnect < Twenty::Command
|
4
4
|
set_banner usage: "twenty disconnect [OPTIONS]",
|
5
5
|
description: "Disconnect a project from twenty"
|
6
|
+
set_option "-p PATH", "--path PATH", "The path to a project", default: nil
|
6
7
|
prepend Twenty::Command::MigrationMixin
|
7
8
|
prepend Twenty::Command::SQLiteMixin
|
8
9
|
prepend Twenty::Command::RescueMixin
|
@@ -15,9 +16,11 @@ class Twenty::Command::Disconnect < Twenty::Command
|
|
15
16
|
private
|
16
17
|
|
17
18
|
def run_command(options)
|
19
|
+
path = options.path ? File.expand_path(options.path) : Dir.getwd
|
18
20
|
Twenty::Project
|
19
|
-
.where(path:
|
21
|
+
.where(path:)
|
20
22
|
.first!
|
21
23
|
.destroy
|
24
|
+
warn "[-] '#{File.basename(path)}' disconnected"
|
22
25
|
end
|
23
26
|
end
|