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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sw.rb +7 -17
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b88ddd0f384b3470b917fb4724cfe1ea59bc15dcca692fbae65c557750563189
4
- data.tar.gz: e39cc05b260edf400acf42f7b6ff39492c0b8831a480727a9e4c58e24ec98f7c
3
+ metadata.gz: aa79f761b062f76eb35f8d3ed7b32937d7dc7f7a2adbedb3a593aab3f70179bf
4
+ data.tar.gz: 5ee2be69a26597bf26af700c695c00046a6a8289ff5887bdd48cac7c0d80c742
5
5
  SHA512:
6
- metadata.gz: 886251238d05991fecd7ba11bfc4e0b88c4963cfed70ec9a5785767bcf44a6d5e0c59edced9e6518da9f5e4b5921b8225c4d3ccc627707582a2c7d2f1820c39a
7
- data.tar.gz: 34561bc217d8ba2c83afc4dfa3bd0d2d7a9abee520dc0f26de3842f6f5cb26f02df0bc39a521388b0ac5060ce780cbcee61eb5e3391251f9f561dd361a3154fb
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.0'
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
- abort("#$program_name: #{message}")
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
- if $?.success?
22
- result
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamW