twenty-cli 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2788338657a1baa50cd9df1dbf6f0ee6cec4670c70e888d0ecf483c2dee42aec
4
- data.tar.gz: b1cc4f163fc1a2be7aeb924ab9bbfba5f4769d4d848fe78265b288fb77e14dc3
3
+ metadata.gz: 11aeb74ec54a850fe0d39de13bb11c4da47e452e4e27adb7eb43dc69f6c7237c
4
+ data.tar.gz: 7ae6e0a4e454e395cd4eb4a60e7fb446099cc19c8bcda15e11d7533e21abbaec
5
5
  SHA512:
6
- metadata.gz: d3db4deea8e6f421c1189d328298f1acf38f2058f33fff6d11b3413c898a674159130252e5131992268871e4a217de19b051e516c76ddc128d27688865a92403
7
- data.tar.gz: 2cdd2d036d9d1abb8680abe9b97a904a6608f650093579897f7b00dc3b3dd874971eae85ede66d308371a0d46c1f5362a0f7cb543dc5d997ff092f48c25ba0ca
6
+ metadata.gz: c30f12237301803e9502f97a1ea1f7fe845f0232acbb77b2a7093007fe5b4e0e5279d088f696b6144402246be56a0c5d43bf7a993a791f50e3cf5e0fcef9ccb0
7
+ data.tar.gz: a23b70eef9714a4ef3a63f30c6c0b39aadd4ba9434fcbe6713196b66734f3dcb2c7ceca9530a88e80dca176cb6caf3ffac831203452b253a6cd32b53358420af
@@ -2,11 +2,12 @@
2
2
 
3
3
  module Twenty::Command::Hook
4
4
  module RequireMigration
5
+ Error = Class.new(RuntimeError)
6
+
5
7
  def run_command(...)
6
8
  if pending_migrations?
7
- warn "There are pending migrations.\n" \
8
- "Run \"twenty migrate\" first.\n"
9
- exit(1)
9
+ raise Error, "There are pending database migrations to run. \n" \
10
+ "Try 'twenty migrate'"
10
11
  else
11
12
  super(...)
12
13
  end
@@ -3,6 +3,7 @@
3
3
  module Twenty::Command::Hook
4
4
  module Rescue
5
5
  FRAME_MAX = 15
6
+ INDENT_BY = 2
6
7
 
7
8
  def run(...)
8
9
  super(...)
@@ -11,7 +12,8 @@ module Twenty::Command::Hook
11
12
  $stderr.print "\n",
12
13
  " ", Paint[" Exception ", :white, :red, :bold], "\n",
13
14
  " ", Paint[ex.class.to_s, :bold], "\n",
14
- " ", ex.message, "\n\n",
15
+ ex.message.each_line.map { [" " * INDENT_BY, _1] }.join,
16
+ "\n\n",
15
17
  " ", Paint[" Backtrace ", :white, :blue, :bold], "\n",
16
18
  format_backtrace(ex.backtrace), "\n",
17
19
  "\n"
@@ -20,8 +22,8 @@ module Twenty::Command::Hook
20
22
  private
21
23
 
22
24
  def format_backtrace(backtrace)
23
- backtrace.last(FRAME_MAX).map do
24
- " #{_1.gsub(Dir.getwd, "")}"
25
+ backtrace[0..FRAME_MAX-1].map do
26
+ [" " * INDENT_BY, _1.gsub(Dir.getwd, "")].join
25
27
  end.join("\n")
26
28
  end
27
29
  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.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'