bard 0.67.0 → 0.68.0

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: 4170341bba5f3a124381a496820b362c93c2ea3c446c9bfbeaa2278ecee747b5
4
- data.tar.gz: 30a958dfa912b143f6985eb97f8a47935e62a208a084729840d0d7504719e764
3
+ metadata.gz: 9d6ffeb50c8bcafe4462e42e462d34c81a1d44690c38cef2b44682e11fed4854
4
+ data.tar.gz: 602a01d2fd94765904b0f767945149e8984d84856b2598f8a44afceda82ac62b
5
5
  SHA512:
6
- metadata.gz: 19098e1641726805f743f38780b55733aaf65d7b4c95457f978303d09421e0caa90d36819310f521c6cac28f69c0440092caf9d23fe8b6641953a47e10a08570
7
- data.tar.gz: bf75c63be5037270cdad29f60ebc4b6d1025342ab3db10359a7200a592552b21d9ccfb7fa52b8162ba4ddc710b0e5ede4bd4541efab7f366b16aa2c571bed62d
6
+ metadata.gz: f5c40d167fe14e473dd56a3e14ccebe922068dcff113783b7074df31de8de100da799c10470a00779fc257cd85efa99568f8accf988886cafc7e0606f8423e6a
7
+ data.tar.gz: 97fa25538c174668498f4a38de33b9cc17e4d60304675256a4a130d50920bfd814fc77aa48c76b88dda2d2dbe44648323cdc45736debe4b184201b3bf82e2a55
@@ -1,5 +1,9 @@
1
1
  module Bard
2
2
  class RemoteCommand < Struct.new(:server, :command, :home)
3
+ def self.run! *args
4
+ new(*args).run!
5
+ end
6
+
3
7
  def local_command
4
8
  uri = URI.parse("ssh://#{server.ssh}")
5
9
  ssh_key = server.ssh_key ? "-i #{server.ssh_key} " : ""
@@ -17,6 +21,25 @@ module Bard
17
21
  end
18
22
  cmd
19
23
  end
24
+
25
+ def run! verbose: false
26
+ failed = false
27
+
28
+ if verbose
29
+ failed = !(system local_command)
30
+ else
31
+ stdout, stderr, status = Open3.capture3(local_command)
32
+ failed = status.to_i.nonzero?
33
+ if failed
34
+ $stdout.puts stdout
35
+ $stderr.puts stderr
36
+ end
37
+ end
38
+
39
+ if failed
40
+ raise "Running command failed: #{local_command}"
41
+ end
42
+ end
20
43
  end
21
44
  end
22
45
 
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "0.67.0"
2
+ VERSION = "0.68.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.67.0
4
+ version: 0.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel