twenty-cli 0.4.0 → 0.4.1
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/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: 2a291c66707dc74fbe14faa4c93ec362d94b675799a88dbc39d9b1f800328a9f
|
4
|
+
data.tar.gz: ec26a2825ba52a8e1af5b091d04c40a3de261536606bdf5f18d1bb46db4bdd45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5c4487fb85560078a41115b1773994a6a50363bc749a8bdeff6de12a32104aa26c34b2e96d1f639896221ba35a90044d2c739aa41dae4de806af519339a1543
|
7
|
+
data.tar.gz: fc154ad51db82fba730f0728fb75e5897ca56ff588a4b287759342c9001ee97bff6beb621b1cca0c826f094abe782f634c64f69b1ff1484367d67fea19f0306f
|
@@ -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
|