foobara-files-generator 0.0.6 → 0.0.7

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: a0cfb72ce587828107d61d3ad45f66f96bbe43709cc06b97da795c3851d8b484
4
- data.tar.gz: c19934bbd2b8b1f56a22ccb3b6c59bbbb6c61800e75f244413c4c055b4706751
3
+ metadata.gz: 5caa518db174a21a13145f96490e06c433c4349b8b2bf5f022d5d4b3b593ab36
4
+ data.tar.gz: 7ed979f5baf140244598a5c6769a60f3d9ebba74c30092239f4d245bd1e87f0f
5
5
  SHA512:
6
- metadata.gz: da10e9436653cd54032cb901f03be89a4a4623b937fe8d92e9584570187a36278540716e0c36561df7806c52f49f664ea76920739912bfef7ef22aaddba57adb
7
- data.tar.gz: 05acb8c441e9a8deb63ac52d9a37f7432b47d6ff9efc3e53c72ea2a1a09964175d01da8e70ce7e3b5a96311f3f620ddf9f2666f67fc5293bf67875a459b46825
6
+ metadata.gz: 3764cad8d83d6dfe07e554774aeea61d1a2659b670c726284c9bba5ea793d5ede066433f61fc3d4b3ed41fb050a7242c6f7270ad6fc85d41ecda59c0218465d0
7
+ data.tar.gz: a25ec4f56c92690de30230c0e1e4c558baa38f074ed8ab58ccee052a34b6ff4f3742237ce6acecf621f7e16b3429b479f7052b9d359833c155dd278875e4ebd5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.6] - 2025-05-03
2
+
3
+ - Return consistent errors when unable to shell out commands
4
+
1
5
  ## [0.0.5] - 2025-05-03
2
6
 
3
7
  - Honor raise_if_fails even when the command to shell out to doesn't exist
@@ -3,6 +3,8 @@ require "open3"
3
3
  module Foobara
4
4
  module Generators
5
5
  class WriteGeneratedFilesToDisk < Foobara::Command
6
+ class CouldNotExecuteError < StandardError; end
7
+
6
8
  class << self
7
9
  def generator_key
8
10
  nil
@@ -77,22 +79,30 @@ module Foobara
77
79
  end
78
80
 
79
81
  exit_status = wait_thr.value
82
+
80
83
  unless exit_status.success?
81
84
  # :nocov:
85
+ message = "Could not #{cmd}\n#{stderr.read}"
82
86
  if raise_if_fails
83
- raise "could not #{cmd}\n#{stderr.read}"
87
+ raise CouldNotExecuteError, message
84
88
  else
85
- warn "WARNING: could not #{cmd}\n#{stderr.read}"
89
+ warn "WARNING: #{message}"
86
90
  end
87
91
  # :nocov:
88
92
  end
93
+
94
+ exit_status
89
95
  end
90
96
  rescue Errno::ENOENT
97
+ message = "Could not run: #{cmd}\nMaybe it is not installed?"
98
+
91
99
  if raise_if_fails
92
- raise
100
+ raise CouldNotExecuteError, message
93
101
  else
94
- warn "WARNING: could not run: #{cmd}\nMaybe it is not installed?"
102
+ warn "WARNING: #{message}"
95
103
  end
104
+
105
+ nil
96
106
  end
97
107
 
98
108
  def run_cmd_and_return_output(cmd)
@@ -109,12 +119,12 @@ module Foobara
109
119
  exit_status = wait_thr.value
110
120
  unless exit_status.success?
111
121
  # :nocov:
112
- raise "could not #{cmd}\n#{stderr.read}"
122
+ raise CouldNotExecuteError, "could not #{cmd}\n#{stderr.read}"
113
123
  end
114
124
  # :nocov:
115
125
  end
116
-
117
- retval
126
+ rescue Errno::ENOENT
127
+ raise CouldNotExecuteError, "Could not run: #{cmd}\nMaybe it is not installed?"
118
128
  end
119
129
 
120
130
  def stats
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-files-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi