sw 0.3.0 → 0.3.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 +4 -4
- data/lib/sw.rb +7 -17
- 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: aa79f761b062f76eb35f8d3ed7b32937d7dc7f7a2adbedb3a593aab3f70179bf
|
|
4
|
+
data.tar.gz: 5ee2be69a26597bf26af700c695c00046a6a8289ff5887bdd48cac7c0d80c742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d58388bcaf148da9f2e600511fb642d64453c925887d2606bde4553600d64b4d0b482100c4ffe0fcc3b492d5969dc81fa0ce26c2c84dff703e0363115cad9632
|
|
7
|
+
data.tar.gz: 8d450a87cdab7e57643a2b97900374ddfa7311c8fb161b75acb7d8b1d6a0b94adba9f42a5bc572443b8e0b18a1c6edb26729f4091277271dc3e62f348ac009ae
|
data/lib/sw.rb
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
SW_VERSION = '0.3.
|
|
3
|
+
SW_VERSION = '0.3.2'
|
|
4
4
|
|
|
5
|
-
# Have a global variable that's just the filename, not its path. (This is useful in error messages,
|
|
6
|
-
# usages, and in `ps` outputs as it's much smaller)
|
|
7
5
|
$program_name ||= File.basename(Process.argv0)
|
|
8
6
|
|
|
9
|
-
def abort!(message=$!)
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def warn!(message, **kw)
|
|
14
|
-
warn("#$program_name: #{message}", **kw)
|
|
15
|
-
end
|
|
7
|
+
def abort!(message=$!) = abort("#$program_name: #{message}")
|
|
8
|
+
def warn!(message, **kw) = warn("#$program_name: #{message}", **kw)
|
|
16
9
|
|
|
17
|
-
def x!(cmd)
|
|
10
|
+
def x!(cmd, chomp: true)
|
|
18
11
|
puts "running: #{cmd}" if $VERBOSE
|
|
19
12
|
result = Kernel.`(cmd) #`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else
|
|
24
|
-
raise RuntimeError, "Command failed with exit 1: #{cmd}", caller(1)
|
|
25
|
-
end
|
|
13
|
+
result.chomp! if chomp
|
|
14
|
+
$?.success? or raise RuntimeError, "Command failed with exit #{$?.exitstatus}: #{cmd}", caller(1)
|
|
15
|
+
result
|
|
26
16
|
end
|