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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d9a6a045f05746636ba95a807ef653ad26f003c36981f6f3830d95818d4781a
4
- data.tar.gz: 55db9d8d8d9c1e63abf36d52e1ab018133fc6778b40145cb8f1b98c3667feb80
3
+ metadata.gz: 5f84fc65f4ec693f37ea17ad2533b989dfab49d2abc9356aca07eaa1f371c972
4
+ data.tar.gz: d67645ec3b5368a5ea3bb3595d51bf5ab4bc646734c36a2661e119ef23cfe14b
5
5
  SHA512:
6
- metadata.gz: b450d2e1c1074682dbf2fe35f9c2fea183ccdfea42f19bd04b55a8373017e62c8c3553bf17c882d8832a49c5b217b98f4e9f2e7dbce034d533a43ddfd85f916b
7
- data.tar.gz: d066ed882a336f8415a9ea6657194cb3a79be75da24075c29c099570464b07fb4810204719a8373c1d8ad1593161482d1fb594b5811d123c00ece8319e7a85c6
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.\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" \
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
- Twenty::Project.create(
19
- name: File.basename(Dir.getwd),
20
- path: Dir.getwd
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: Dir.getwd)
21
+ .where(path:)
20
22
  .first!
21
23
  .destroy
24
+ warn "[-] '#{File.basename(path)}' disconnected"
22
25
  end
23
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twenty-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'