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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d9a6a045f05746636ba95a807ef653ad26f003c36981f6f3830d95818d4781a
4
- data.tar.gz: 55db9d8d8d9c1e63abf36d52e1ab018133fc6778b40145cb8f1b98c3667feb80
3
+ metadata.gz: 2a291c66707dc74fbe14faa4c93ec362d94b675799a88dbc39d9b1f800328a9f
4
+ data.tar.gz: ec26a2825ba52a8e1af5b091d04c40a3de261536606bdf5f18d1bb46db4bdd45
5
5
  SHA512:
6
- metadata.gz: b450d2e1c1074682dbf2fe35f9c2fea183ccdfea42f19bd04b55a8373017e62c8c3553bf17c882d8832a49c5b217b98f4e9f2e7dbce034d533a43ddfd85f916b
7
- data.tar.gz: d066ed882a336f8415a9ea6657194cb3a79be75da24075c29c099570464b07fb4810204719a8373c1d8ad1593161482d1fb594b5811d123c00ece8319e7a85c6
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
- 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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'