bard 1.8.0.beta2 → 1.8.0.beta4
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/bard/copy.rb +4 -31
- data/lib/bard/server.rb +4 -0
- data/lib/bard/ssh_server.rb +1 -1
- data/lib/bard/target.rb +14 -7
- data/lib/bard/version.rb +1 -1
- data/spec/bard/ssh_server_spec.rb +7 -3
- data/spec/bard/target_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1a0399d5fd80c8599d584b056a6ae7b77959cdf9f394e3d76461826f2219f9f
|
|
4
|
+
data.tar.gz: cd5b858005ffeddd001fffcef8538c07572b70d81ab086c9b44c4b06b2304f18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 279c018696cdbef81518d54e37bc5f1508b42808e8c8f448bd048816a398f28b46ecd62865481ab3f83da742c4015b1d5acb69941769f004f40e7d88f765add7
|
|
7
|
+
data.tar.gz: 3b7d5e076a8f5f20ac500e8261e4ff15b10dd7a8814c1aba097a8f1635dc610ed60f951af648a2a0e56e6adce2f2da8eee2ca54a2ad93312446883de3e416d93
|
data/lib/bard/copy.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Bard
|
|
|
35
35
|
port = ssh_server.port
|
|
36
36
|
port_opt = port && port.to_s != "22" ? "-P #{port}" : ""
|
|
37
37
|
|
|
38
|
-
from_and_to = [path, target_or_server.scp_uri(path)]
|
|
38
|
+
from_and_to = [path, target_or_server.scp_uri(path).to_s]
|
|
39
39
|
from_and_to.reverse! if direction == :from
|
|
40
40
|
|
|
41
41
|
command = ["scp", ssh_opts, gateway, ssh_key, port_opt, *from_and_to].reject(&:empty?).join(" ")
|
|
@@ -65,18 +65,7 @@ module Bard
|
|
|
65
65
|
# Support both new Target (with server attribute) and old Server
|
|
66
66
|
ssh_server = target_or_server.respond_to?(:server) ? target_or_server.server : target_or_server
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
ssh_uri_value = ssh_server.respond_to?(:ssh_uri) ? ssh_server.ssh_uri : nil
|
|
70
|
-
if ssh_uri_value.respond_to?(:port)
|
|
71
|
-
# Already a URI-like object (old Server or mock)
|
|
72
|
-
ssh_uri = ssh_uri_value
|
|
73
|
-
elsif ssh_uri_value.is_a?(String)
|
|
74
|
-
# String from new SSHServer
|
|
75
|
-
ssh_uri = URI("ssh://#{ssh_uri_value}")
|
|
76
|
-
else
|
|
77
|
-
# Fallback
|
|
78
|
-
ssh_uri = ssh_uri_value
|
|
79
|
-
end
|
|
68
|
+
ssh_uri = ssh_server.ssh_uri
|
|
80
69
|
|
|
81
70
|
gateway = ssh_server.gateway ? "-oProxyCommand=\"ssh #{ssh_server.gateway} -W %h:%p\"" : ""
|
|
82
71
|
|
|
@@ -97,24 +86,8 @@ module Bard
|
|
|
97
86
|
|
|
98
87
|
raise NotImplementedError if from_server.gateway || to_server.gateway || from_server.ssh_key || to_server.ssh_key
|
|
99
88
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if from_uri_value.respond_to?(:port)
|
|
103
|
-
from_uri = from_uri_value
|
|
104
|
-
elsif from_uri_value.is_a?(String)
|
|
105
|
-
from_uri = URI("ssh://#{from_uri_value}")
|
|
106
|
-
else
|
|
107
|
-
from_uri = from_uri_value
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
to_uri_value = to_server.respond_to?(:ssh_uri) ? to_server.ssh_uri : nil
|
|
111
|
-
if to_uri_value.respond_to?(:port)
|
|
112
|
-
to_uri = to_uri_value
|
|
113
|
-
elsif to_uri_value.is_a?(String)
|
|
114
|
-
to_uri = URI("ssh://#{to_uri_value}")
|
|
115
|
-
else
|
|
116
|
-
to_uri = to_uri_value
|
|
117
|
-
end
|
|
89
|
+
from_uri = from_server.ssh_uri
|
|
90
|
+
to_uri = to_server.ssh_uri
|
|
118
91
|
|
|
119
92
|
from_str = "-p#{from_uri.port || 22} #{from_uri.user}@#{from_uri.host}"
|
|
120
93
|
to_str = to.rsync_uri(path).sub(%r(/[^/]+$), '/')
|
data/lib/bard/server.rb
CHANGED
data/lib/bard/ssh_server.rb
CHANGED
data/lib/bard/target.rb
CHANGED
|
@@ -117,8 +117,8 @@ module Bard
|
|
|
117
117
|
# Ping configuration
|
|
118
118
|
def ping(*urls)
|
|
119
119
|
if urls.empty?
|
|
120
|
-
# Getter
|
|
121
|
-
@ping_urls
|
|
120
|
+
# Getter - normalize URLs like Server does
|
|
121
|
+
@ping_urls.map { |url| normalize_ping(url) }
|
|
122
122
|
elsif urls.first == false
|
|
123
123
|
# Disable ping
|
|
124
124
|
@ping_urls = []
|
|
@@ -247,15 +247,13 @@ module Bard
|
|
|
247
247
|
|
|
248
248
|
# URI methods for compatibility
|
|
249
249
|
def scp_uri(file_path = nil)
|
|
250
|
-
|
|
251
|
-
# Port is NOT included here - it must be passed via -P flag to scp
|
|
252
|
-
full_path = path
|
|
250
|
+
full_path = "/#{path}"
|
|
253
251
|
full_path += "/#{file_path}" if file_path
|
|
254
|
-
"
|
|
252
|
+
URI::Generic.build(scheme: "scp", userinfo: server.user, host: server.host, port: server.port.to_i, path: full_path)
|
|
255
253
|
end
|
|
256
254
|
|
|
257
255
|
def rsync_uri(file_path = nil)
|
|
258
|
-
uri =
|
|
256
|
+
uri = ssh_uri
|
|
259
257
|
str = "#{uri.user}@#{uri.host}"
|
|
260
258
|
str += ":#{path}"
|
|
261
259
|
str += "/#{file_path}" if file_path
|
|
@@ -278,5 +276,14 @@ module Bard
|
|
|
278
276
|
end
|
|
279
277
|
end
|
|
280
278
|
end
|
|
279
|
+
|
|
280
|
+
private
|
|
281
|
+
|
|
282
|
+
def normalize_ping(value)
|
|
283
|
+
return nil if value == false || value.nil?
|
|
284
|
+
normalized = value.to_s
|
|
285
|
+
normalized = "https://#{normalized}" unless normalized.start_with?("http")
|
|
286
|
+
normalized
|
|
287
|
+
end
|
|
281
288
|
end
|
|
282
289
|
end
|
data/lib/bard/version.rb
CHANGED
|
@@ -40,14 +40,18 @@ describe Bard::SSHServer do
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
describe "#ssh_uri" do
|
|
43
|
-
it "returns
|
|
43
|
+
it "returns a URI object" do
|
|
44
44
|
server = described_class.new("deploy@example.com:22")
|
|
45
|
-
expect(server.ssh_uri).to
|
|
45
|
+
expect(server.ssh_uri).to be_a(URI::Generic)
|
|
46
|
+
expect(server.ssh_uri.scheme).to eq("ssh")
|
|
47
|
+
expect(server.ssh_uri.user).to eq("deploy")
|
|
48
|
+
expect(server.ssh_uri.host).to eq("example.com")
|
|
49
|
+
expect(server.ssh_uri.port).to eq(22)
|
|
46
50
|
end
|
|
47
51
|
|
|
48
52
|
it "includes port if non-standard" do
|
|
49
53
|
server = described_class.new("deploy@example.com:2222")
|
|
50
|
-
expect(server.ssh_uri).to eq(
|
|
54
|
+
expect(server.ssh_uri.port).to eq(2222)
|
|
51
55
|
end
|
|
52
56
|
end
|
|
53
57
|
|
data/spec/bard/target_spec.rb
CHANGED
|
@@ -37,7 +37,11 @@ describe Bard::Target do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "parses SSH URI" do
|
|
40
|
-
expect(target.ssh_uri).to
|
|
40
|
+
expect(target.ssh_uri).to be_a(URI::Generic)
|
|
41
|
+
expect(target.ssh_uri.scheme).to eq("ssh")
|
|
42
|
+
expect(target.ssh_uri.user).to eq("deploy")
|
|
43
|
+
expect(target.ssh_uri.host).to eq("example.com")
|
|
44
|
+
expect(target.ssh_uri.port).to eq(22)
|
|
41
45
|
end
|
|
42
46
|
end
|
|
43
47
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.0.
|
|
4
|
+
version: 1.8.0.beta4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: thor
|