bard 1.8.0.beta → 2.0.0.beta
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/MIGRATION_GUIDE.md +9 -24
- data/lib/bard/config.rb +0 -2
- data/lib/bard/server.rb +1 -39
- data/lib/bard/version.rb +1 -1
- metadata +2 -5
- data/lib/bard/deprecation.rb +0 -19
- data/spec/bard/deprecation_spec.rb +0 -202
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 315f02fbb865e24647f358979a3f135d6a9b5fa58d27d447cc92cc9462ba80b6
|
|
4
|
+
data.tar.gz: 3fd528b19bbfb0edfeb3b05aff689a4c4bc52ef9c2ac218566b1c0be8e071ade
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 464041788694b06f9ef754a01a5de77e198140ad738cc60a7596110f32044b0e8b73ebb405aa210b488ad269b64d3829d51b368cc297617b9c0c8bfc479126c6
|
|
7
|
+
data.tar.gz: c48d80a55fc37dd081cb6220919c9f3cef0f0356f75b8befcd8fd1dbf89e11619075f3db9b8ec7cdf387da9e80ee120b39a93b500c839ba816c627cea3dff6ae
|
data/MIGRATION_GUIDE.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
This guide will help you migrate your Bard configuration from v1.x to v2.0.
|
|
4
4
|
|
|
5
|
-
> **Note:** Bard v1.8.0 is a transitional release that supports both v1.x and v2.0 APIs. When using deprecated v1.x patterns, you'll see deprecation warnings indicating what to change. This gives you time to migrate at your own pace while keeping your deployments working.
|
|
6
|
-
|
|
7
5
|
## Overview of Changes
|
|
8
6
|
|
|
9
7
|
Bard v2.0 introduces a cleaner, more modular architecture:
|
|
@@ -479,35 +477,22 @@ mv bard.rb.backup bard.rb
|
|
|
479
477
|
- Check [CUSTOM_STRATEGIES.md](CUSTOM_STRATEGIES.md) for strategy creation
|
|
480
478
|
- Open an issue at https://github.com/botandrose/bard/issues
|
|
481
479
|
|
|
482
|
-
## Transitional Release (v1.
|
|
480
|
+
## Transitional Release (v1.9.x)
|
|
483
481
|
|
|
484
|
-
|
|
482
|
+
A transitional release (v1.9.x) will support both v1 and v2 APIs simultaneously with deprecation warnings. This allows gradual migration.
|
|
485
483
|
|
|
486
|
-
**Using v1.
|
|
484
|
+
**Using v1.9.x:**
|
|
487
485
|
```bash
|
|
488
486
|
# Gemfile
|
|
489
|
-
gem 'bard', '~> 1.
|
|
487
|
+
gem 'bard', '~> 1.9'
|
|
490
488
|
|
|
491
489
|
bundle update bard
|
|
492
490
|
```
|
|
493
491
|
|
|
494
|
-
v1.
|
|
495
|
-
- Accept both `server` and `target` (with deprecation warning
|
|
496
|
-
- Accept both old and new SSH configuration styles
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
- Support full v2.0 API
|
|
492
|
+
v1.9.x will:
|
|
493
|
+
- Accept both `server` and `target` (with deprecation warning)
|
|
494
|
+
- Accept both old and new SSH configuration styles
|
|
495
|
+
- Show deprecation warnings for old API usage
|
|
496
|
+
- Support full v2 API
|
|
500
497
|
|
|
501
498
|
This gives you time to migrate at your own pace while keeping your deployments working.
|
|
502
|
-
|
|
503
|
-
### Deprecation Warnings
|
|
504
|
-
|
|
505
|
-
When using deprecated patterns, you'll see warnings like:
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
[DEPRECATION] `server` is deprecated; use `target` instead (will be removed in v2.0) (called from bard.rb:3)
|
|
509
|
-
[DEPRECATION] Separate SSH options are deprecated; pass as keyword arguments to `ssh` instead (will be removed in v2.0) (called from bard.rb:5)
|
|
510
|
-
[DEPRECATION] `strategy` is deprecated; use the strategy method directly (will be removed in v2.0) (called from bard.rb:10)
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
These warnings help you identify what needs to change before upgrading to v2.0.
|
data/lib/bard/config.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require "bard/server"
|
|
2
2
|
require "bard/target"
|
|
3
|
-
require "bard/deprecation"
|
|
4
3
|
|
|
5
4
|
module Bard
|
|
6
5
|
class Config
|
|
@@ -44,7 +43,6 @@ module Bard
|
|
|
44
43
|
|
|
45
44
|
# Old v1.x API - creates Server instances
|
|
46
45
|
def server(key, &block)
|
|
47
|
-
Deprecation.warn "`server` is deprecated; use `target` instead (will be removed in v2.0)"
|
|
48
46
|
key = key.to_sym
|
|
49
47
|
@servers[key] = Server.define(project_name, key, &block)
|
|
50
48
|
end
|
data/lib/bard/server.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "uri"
|
|
2
2
|
require "bard/command"
|
|
3
3
|
require "bard/copy"
|
|
4
|
-
require "bard/deprecation"
|
|
5
4
|
|
|
6
5
|
module Bard
|
|
7
6
|
class Server < Struct.new(:project_name, :key, :ssh, :path, :ping, :gateway, :ssh_key, :env, :github_pages)
|
|
@@ -25,24 +24,7 @@ module Bard
|
|
|
25
24
|
end
|
|
26
25
|
end
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
fields.each do |field|
|
|
30
|
-
define_method field do |*args|
|
|
31
|
-
if args.length == 1
|
|
32
|
-
Deprecation.warn message
|
|
33
|
-
send :"#{field}=", args.first
|
|
34
|
-
elsif args.length == 0
|
|
35
|
-
super()
|
|
36
|
-
else
|
|
37
|
-
raise ArgumentError
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
setting :ssh, :ping, :github_pages
|
|
44
|
-
setting_with_deprecation :gateway, :ssh_key, :env,
|
|
45
|
-
message: "Separate SSH options are deprecated; pass as keyword arguments to `ssh` instead, e.g., `ssh \"user@host\", path: \"/app\"` (will be removed in v2.0)"
|
|
27
|
+
setting :ssh, :path, :ping, :gateway, :ssh_key, :env, :github_pages
|
|
46
28
|
|
|
47
29
|
def ping(*args)
|
|
48
30
|
if args.length == 0
|
|
@@ -68,7 +50,6 @@ module Bard
|
|
|
68
50
|
|
|
69
51
|
def path(*args)
|
|
70
52
|
if args.length == 1
|
|
71
|
-
Deprecation.warn "Separate SSH options are deprecated; pass as keyword arguments to `ssh` instead, e.g., `ssh \"user@host\", path: \"/app\"` (will be removed in v2.0)"
|
|
72
53
|
self.path = args.first
|
|
73
54
|
elsif args.length == 0
|
|
74
55
|
super() || project_name
|
|
@@ -77,25 +58,6 @@ module Bard
|
|
|
77
58
|
end
|
|
78
59
|
end
|
|
79
60
|
|
|
80
|
-
def strategy(name)
|
|
81
|
-
Deprecation.warn "`strategy` is deprecated; use the strategy method directly, e.g., `jets \"url\"` instead of `strategy :jets` (will be removed in v2.0)"
|
|
82
|
-
@strategy = name
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def option(key, value)
|
|
86
|
-
Deprecation.warn "`option` is deprecated; pass options as keyword arguments to the strategy method, e.g., `jets \"url\", run_tests: true` (will be removed in v2.0)"
|
|
87
|
-
@options ||= {}
|
|
88
|
-
@options[key] = value
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def strategy_name
|
|
92
|
-
@strategy
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def strategy_options
|
|
96
|
-
@options || {}
|
|
97
|
-
end
|
|
98
|
-
|
|
99
61
|
def ssh_uri which=:ssh
|
|
100
62
|
value = send(which)
|
|
101
63
|
URI("ssh://#{value}")
|
data/lib/bard/version.rb
CHANGED
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:
|
|
4
|
+
version: 2.0.0.beta
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-12-
|
|
10
|
+
date: 2025-12-18 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: thor
|
|
@@ -227,7 +227,6 @@ files:
|
|
|
227
227
|
- lib/bard/deploy_strategy.rb
|
|
228
228
|
- lib/bard/deploy_strategy/github_pages.rb
|
|
229
229
|
- lib/bard/deploy_strategy/ssh.rb
|
|
230
|
-
- lib/bard/deprecation.rb
|
|
231
230
|
- lib/bard/git.rb
|
|
232
231
|
- lib/bard/github.rb
|
|
233
232
|
- lib/bard/github_pages.rb
|
|
@@ -280,7 +279,6 @@ files:
|
|
|
280
279
|
- spec/bard/copy_spec.rb
|
|
281
280
|
- spec/bard/deploy_strategy/ssh_spec.rb
|
|
282
281
|
- spec/bard/deploy_strategy_spec.rb
|
|
283
|
-
- spec/bard/deprecation_spec.rb
|
|
284
282
|
- spec/bard/dynamic_dsl_spec.rb
|
|
285
283
|
- spec/bard/git_spec.rb
|
|
286
284
|
- spec/bard/github_pages_spec.rb
|
|
@@ -374,7 +372,6 @@ test_files:
|
|
|
374
372
|
- spec/bard/copy_spec.rb
|
|
375
373
|
- spec/bard/deploy_strategy/ssh_spec.rb
|
|
376
374
|
- spec/bard/deploy_strategy_spec.rb
|
|
377
|
-
- spec/bard/deprecation_spec.rb
|
|
378
375
|
- spec/bard/dynamic_dsl_spec.rb
|
|
379
376
|
- spec/bard/git_spec.rb
|
|
380
377
|
- spec/bard/github_pages_spec.rb
|
data/lib/bard/deprecation.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module Bard
|
|
2
|
-
module Deprecation
|
|
3
|
-
@warned = {}
|
|
4
|
-
|
|
5
|
-
def self.warn(message, callsite: nil)
|
|
6
|
-
callsite ||= caller_locations(2, 1).first
|
|
7
|
-
key = "#{callsite.path}:#{callsite.lineno}:#{message}"
|
|
8
|
-
return if @warned[key]
|
|
9
|
-
|
|
10
|
-
@warned[key] = true
|
|
11
|
-
location = "#{callsite.path}:#{callsite.lineno}"
|
|
12
|
-
Kernel.warn "[DEPRECATION] #{message} (called from #{location})"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.reset!
|
|
16
|
-
@warned = {}
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
require "bard/deprecation"
|
|
2
|
-
require "bard/config"
|
|
3
|
-
require "bard/server"
|
|
4
|
-
|
|
5
|
-
describe Bard::Deprecation do
|
|
6
|
-
before do
|
|
7
|
-
Bard::Deprecation.reset!
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe ".warn" do
|
|
11
|
-
it "outputs a deprecation warning to stderr" do
|
|
12
|
-
expect {
|
|
13
|
-
Bard::Deprecation.warn "test message"
|
|
14
|
-
}.to output(/\[DEPRECATION\] test message/).to_stderr
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "includes the callsite location" do
|
|
18
|
-
output = capture_stderr { Bard::Deprecation.warn "test message" }
|
|
19
|
-
expect(output).to match(/called from.*deprecation_spec\.rb/)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "only warns once per callsite" do
|
|
23
|
-
output = capture_stderr do
|
|
24
|
-
3.times { Bard::Deprecation.warn "repeated message" }
|
|
25
|
-
end
|
|
26
|
-
expect(output.scan(/\[DEPRECATION\]/).count).to eq 1
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "warns separately for different callsites" do
|
|
30
|
-
output = capture_stderr do
|
|
31
|
-
Bard::Deprecation.warn "message 1"
|
|
32
|
-
Bard::Deprecation.warn "message 2"
|
|
33
|
-
end
|
|
34
|
-
expect(output.scan(/\[DEPRECATION\]/).count).to eq 2
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe ".reset!" do
|
|
39
|
-
it "clears the warning cache" do
|
|
40
|
-
capture_stderr { Bard::Deprecation.warn "test" }
|
|
41
|
-
Bard::Deprecation.reset!
|
|
42
|
-
output = capture_stderr { Bard::Deprecation.warn "test" }
|
|
43
|
-
expect(output).to include("[DEPRECATION]")
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def capture_stderr
|
|
48
|
-
original_stderr = $stderr
|
|
49
|
-
$stderr = StringIO.new
|
|
50
|
-
yield
|
|
51
|
-
$stderr.string
|
|
52
|
-
ensure
|
|
53
|
-
$stderr = original_stderr
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
describe "Deprecation warnings" do
|
|
58
|
-
before do
|
|
59
|
-
Bard::Deprecation.reset!
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def capture_stderr
|
|
63
|
-
original_stderr = $stderr
|
|
64
|
-
$stderr = StringIO.new
|
|
65
|
-
yield
|
|
66
|
-
$stderr.string
|
|
67
|
-
ensure
|
|
68
|
-
$stderr = original_stderr
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe "Config#server" do
|
|
72
|
-
it "warns when using server instead of target" do
|
|
73
|
-
output = capture_stderr do
|
|
74
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
75
|
-
server :production do
|
|
76
|
-
ssh "user@host:22"
|
|
77
|
-
end
|
|
78
|
-
SOURCE
|
|
79
|
-
end
|
|
80
|
-
expect(output).to include("[DEPRECATION]")
|
|
81
|
-
expect(output).to include("`server` is deprecated")
|
|
82
|
-
expect(output).to include("use `target` instead")
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "does not warn when using target" do
|
|
86
|
-
output = capture_stderr do
|
|
87
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
88
|
-
target :production do
|
|
89
|
-
ssh "user@host:22"
|
|
90
|
-
end
|
|
91
|
-
SOURCE
|
|
92
|
-
end
|
|
93
|
-
expect(output).not_to include("[DEPRECATION]")
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe "Server SSH options" do
|
|
98
|
-
it "warns when using separate path method" do
|
|
99
|
-
output = capture_stderr do
|
|
100
|
-
Bard::Server.define("test", :production) do
|
|
101
|
-
ssh "user@host:22"
|
|
102
|
-
path "/app"
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
expect(output).to include("[DEPRECATION]")
|
|
106
|
-
expect(output).to include("Separate SSH options are deprecated")
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
it "warns when using separate gateway method" do
|
|
110
|
-
output = capture_stderr do
|
|
111
|
-
Bard::Server.define("test", :production) do
|
|
112
|
-
ssh "user@host:22"
|
|
113
|
-
gateway "bastion@host:22"
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
expect(output).to include("[DEPRECATION]")
|
|
117
|
-
expect(output).to include("Separate SSH options are deprecated")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
it "warns when using separate ssh_key method" do
|
|
121
|
-
output = capture_stderr do
|
|
122
|
-
Bard::Server.define("test", :production) do
|
|
123
|
-
ssh "user@host:22"
|
|
124
|
-
ssh_key "~/.ssh/id_rsa"
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
expect(output).to include("[DEPRECATION]")
|
|
128
|
-
expect(output).to include("Separate SSH options are deprecated")
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
it "warns when using separate env method" do
|
|
132
|
-
output = capture_stderr do
|
|
133
|
-
Bard::Server.define("test", :production) do
|
|
134
|
-
ssh "user@host:22"
|
|
135
|
-
env "RAILS_ENV=production"
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
expect(output).to include("[DEPRECATION]")
|
|
139
|
-
expect(output).to include("Separate SSH options are deprecated")
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
describe "Server strategy configuration" do
|
|
144
|
-
it "warns when using strategy method" do
|
|
145
|
-
output = capture_stderr do
|
|
146
|
-
Bard::Server.define("test", :production) do
|
|
147
|
-
ssh "user@host:22"
|
|
148
|
-
strategy :custom
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
expect(output).to include("[DEPRECATION]")
|
|
152
|
-
expect(output).to include("`strategy` is deprecated")
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
it "warns when using option method" do
|
|
156
|
-
output = capture_stderr do
|
|
157
|
-
Bard::Server.define("test", :production) do
|
|
158
|
-
ssh "user@host:22"
|
|
159
|
-
option :run_tests, true
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
expect(output).to include("[DEPRECATION]")
|
|
163
|
-
expect(output).to include("`option` is deprecated")
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
it "stores strategy name for backward compatibility" do
|
|
167
|
-
server = nil
|
|
168
|
-
capture_stderr do
|
|
169
|
-
server = Bard::Server.define("test", :production) do
|
|
170
|
-
ssh "user@host:22"
|
|
171
|
-
strategy :jets
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
expect(server.strategy_name).to eq :jets
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
it "stores strategy options for backward compatibility" do
|
|
178
|
-
server = nil
|
|
179
|
-
capture_stderr do
|
|
180
|
-
server = Bard::Server.define("test", :production) do
|
|
181
|
-
ssh "user@host:22"
|
|
182
|
-
option :run_tests, true
|
|
183
|
-
option :verbose, false
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
expect(server.strategy_options).to eq({ run_tests: true, verbose: false })
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
describe "Target (new API)" do
|
|
191
|
-
it "does not warn when using hash options with ssh" do
|
|
192
|
-
output = capture_stderr do
|
|
193
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
194
|
-
target :production do
|
|
195
|
-
ssh "user@host:22", path: "/app", gateway: "bastion@host:22"
|
|
196
|
-
end
|
|
197
|
-
SOURCE
|
|
198
|
-
end
|
|
199
|
-
expect(output).not_to include("[DEPRECATION]")
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
end
|