bard 0.66.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: 1b9f7c09700f669c4d27c2d9dfa5661fc3b7eab6bb38f80fa09387af65dbfaa3
4
- data.tar.gz: de2789065284a2506f3951f7d957b6e798d5af2ef03891540c3371ae9629e961
3
+ metadata.gz: 9d6ffeb50c8bcafe4462e42e462d34c81a1d44690c38cef2b44682e11fed4854
4
+ data.tar.gz: 602a01d2fd94765904b0f767945149e8984d84856b2598f8a44afceda82ac62b
5
5
  SHA512:
6
- metadata.gz: 3fa281ed15c4befefce3ee6035ccab28831c8ea2e619b108187c5cb94eb6da29ba53a7df6c50bd4910df50a0bd029d1734daf58de666bff7920c64a93f6f5d38
7
- data.tar.gz: c7988b2f2f7287a4b74e6b1fb3f5d37aacb91c94741276d252df465213641056edb1906964c17368792b96d5a10b143658949a176b81e3dd2d8bb6bc54bc5ee9
6
+ metadata.gz: f5c40d167fe14e473dd56a3e14ccebe922068dcff113783b7074df31de8de100da799c10470a00779fc257cd85efa99568f8accf988886cafc7e0606f8423e6a
7
+ data.tar.gz: 97fa25538c174668498f4a38de33b9cc17e4d60304675256a4a130d50920bfd814fc77aa48c76b88dda2d2dbe44648323cdc45736debe4b184201b3bf82e2a55
data/lib/bard/config.rb CHANGED
@@ -61,6 +61,17 @@ module Bard
61
61
  end
62
62
  end
63
63
 
64
+ def backup *args
65
+ if args.length == 1
66
+ @backup = args.first
67
+ elsif args.length == 0
68
+ return @backup if defined?(@backup)
69
+ @backup = true
70
+ else
71
+ raise ArgumentError
72
+ end
73
+ end
74
+
64
75
  private
65
76
 
66
77
  class Server < Struct.new(:project_name, :key, :ssh, :path, :ping, :gateway, :ssh_key, :env)
@@ -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.66.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.66.0
4
+ version: 0.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel