bard 1.8.0.beta3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4723f9821cfeae7ef2a4e0e2aaacf1aff1940f2ce2d0a01fd924661eddf75fbb
4
- data.tar.gz: 0a6268ae7024340e0bb764ff43acfa518f492b9d2b4cf0a0f4807312b72819bd
3
+ metadata.gz: b1a0399d5fd80c8599d584b056a6ae7b77959cdf9f394e3d76461826f2219f9f
4
+ data.tar.gz: cd5b858005ffeddd001fffcef8538c07572b70d81ab086c9b44c4b06b2304f18
5
5
  SHA512:
6
- metadata.gz: ac9c56474359bc212ab0844c3d517bdd92c8963db65397fb4d537d93f039d07636619e1260409e45a8e92bfbda546290698cb84f9d91aa0165b187dd8f767a97
7
- data.tar.gz: b85045b73743600cce448b3adc67b134be3b15c3cda7ac0573aaedda0bffdc26a0057c85c664cf7912c08b9a322b72b283b5ba0fd7359e941a0cbc267a081a25
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
- # Get ssh_uri - it might be a URI object (old Server), string (new SSHServer), or mock
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
- # Get ssh_uri - it might be a URI object (old Server), string (new SSHServer), or mock
101
- from_uri_value = from_server.respond_to?(:ssh_uri) ? from_server.ssh_uri : nil
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(/[^/]+$), '/')
@@ -23,7 +23,7 @@ module Bard
23
23
  end
24
24
 
25
25
  def ssh_uri
26
- "#{user}@#{host}:#{port}"
26
+ URI("ssh://#{user}@#{host}:#{port}")
27
27
  end
28
28
 
29
29
  def hostname
data/lib/bard/target.rb CHANGED
@@ -247,15 +247,13 @@ module Bard
247
247
 
248
248
  # URI methods for compatibility
249
249
  def scp_uri(file_path = nil)
250
- # Use traditional scp format: user@host:path (relative to home)
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
- "#{server.user}@#{server.host}:#{full_path}"
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 = URI("ssh://#{ssh_uri}")
256
+ uri = ssh_uri
259
257
  str = "#{uri.user}@#{uri.host}"
260
258
  str += ":#{path}"
261
259
  str += "/#{file_path}" if file_path
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.8.0.beta3"
2
+ VERSION = "1.8.0.beta4"
3
3
  end
4
4
 
@@ -40,14 +40,18 @@ describe Bard::SSHServer do
40
40
  end
41
41
 
42
42
  describe "#ssh_uri" do
43
- it "returns the SSH connection string" do
43
+ it "returns a URI object" do
44
44
  server = described_class.new("deploy@example.com:22")
45
- expect(server.ssh_uri).to eq("deploy@example.com:22")
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("deploy@example.com:2222")
54
+ expect(server.ssh_uri.port).to eq(2222)
51
55
  end
52
56
  end
53
57
 
@@ -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 eq("deploy@example.com:22")
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.beta3
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: 2026-01-01 00:00:00.000000000 Z
10
+ date: 2026-01-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor