bard 1.8.0 → 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/.github/workflows/ci.yml +0 -5
- data/MIGRATION_GUIDE.md +9 -24
- data/Rakefile +1 -3
- data/features/bard_check.feature +94 -0
- data/features/bard_deploy.feature +18 -0
- data/features/bard_pull.feature +112 -0
- data/features/bard_push.feature +112 -0
- data/features/podman_testcontainers.feature +16 -0
- data/features/step_definitions/check_steps.rb +47 -0
- data/features/step_definitions/git_steps.rb +73 -0
- data/features/step_definitions/global_steps.rb +56 -0
- data/features/step_definitions/podman_steps.rb +23 -0
- data/features/step_definitions/rails_steps.rb +44 -0
- data/features/step_definitions/submodule_steps.rb +110 -0
- data/features/support/env.rb +39 -5
- data/features/support/grit_ext.rb +13 -0
- data/features/support/io.rb +32 -0
- data/features/support/podman.rb +153 -0
- data/lib/bard/command.rb +10 -29
- data/lib/bard/config.rb +0 -2
- data/lib/bard/copy.rb +33 -12
- data/lib/bard/server.rb +1 -43
- data/lib/bard/ssh_server.rb +1 -1
- data/lib/bard/target.rb +15 -65
- data/lib/bard/version.rb +1 -1
- data/spec/acceptance/docker/Dockerfile +1 -2
- data/spec/bard/command_spec.rb +1 -1
- data/spec/bard/copy_spec.rb +3 -3
- data/spec/bard/ssh_server_spec.rb +3 -7
- data/spec/bard/target_spec.rb +5 -9
- metadata +30 -16
- data/cucumber.yml +0 -1
- data/features/data.feature +0 -12
- data/features/deploy.feature +0 -13
- data/features/run.feature +0 -13
- data/features/step_definitions/bard_steps.rb +0 -39
- data/features/support/test_server.rb +0 -215
- data/lib/bard/deprecation.rb +0 -19
- data/spec/bard/deprecation_spec.rb +0 -281
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,281 +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
|
-
|
|
202
|
-
it "warns when using separate path method" do
|
|
203
|
-
output = capture_stderr do
|
|
204
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
205
|
-
target :production do
|
|
206
|
-
ssh "user@host:22"
|
|
207
|
-
path "/app"
|
|
208
|
-
end
|
|
209
|
-
SOURCE
|
|
210
|
-
end
|
|
211
|
-
expect(output).to include("[DEPRECATION]")
|
|
212
|
-
expect(output).to include("Separate `path` call is deprecated")
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
it "warns when using separate gateway method" do
|
|
216
|
-
output = capture_stderr do
|
|
217
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
218
|
-
target :production do
|
|
219
|
-
ssh "user@host:22"
|
|
220
|
-
gateway "bastion@host:22"
|
|
221
|
-
end
|
|
222
|
-
SOURCE
|
|
223
|
-
end
|
|
224
|
-
expect(output).to include("[DEPRECATION]")
|
|
225
|
-
expect(output).to include("Separate `gateway` call is deprecated")
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
it "warns when using separate ssh_key method" do
|
|
229
|
-
output = capture_stderr do
|
|
230
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
231
|
-
target :production do
|
|
232
|
-
ssh "user@host:22"
|
|
233
|
-
ssh_key "~/.ssh/id_rsa"
|
|
234
|
-
end
|
|
235
|
-
SOURCE
|
|
236
|
-
end
|
|
237
|
-
expect(output).to include("[DEPRECATION]")
|
|
238
|
-
expect(output).to include("Separate `ssh_key` call is deprecated")
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
it "warns when using separate env method" do
|
|
242
|
-
output = capture_stderr do
|
|
243
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
244
|
-
target :production do
|
|
245
|
-
ssh "user@host:22"
|
|
246
|
-
env "RAILS_ENV=production"
|
|
247
|
-
end
|
|
248
|
-
SOURCE
|
|
249
|
-
end
|
|
250
|
-
expect(output).to include("[DEPRECATION]")
|
|
251
|
-
expect(output).to include("Separate `env` call is deprecated")
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
it "warns when using strategy method" do
|
|
255
|
-
output = capture_stderr do
|
|
256
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
257
|
-
target :production do
|
|
258
|
-
ssh "user@host:22"
|
|
259
|
-
strategy :ssh
|
|
260
|
-
end
|
|
261
|
-
SOURCE
|
|
262
|
-
end
|
|
263
|
-
expect(output).to include("[DEPRECATION]")
|
|
264
|
-
expect(output).to include("`strategy` is deprecated")
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
it "warns when using option method" do
|
|
268
|
-
output = capture_stderr do
|
|
269
|
-
Bard::Config.new("test", source: <<~SOURCE)
|
|
270
|
-
target :production do
|
|
271
|
-
ssh "user@host:22"
|
|
272
|
-
strategy :ssh
|
|
273
|
-
option :verbose, true
|
|
274
|
-
end
|
|
275
|
-
SOURCE
|
|
276
|
-
end
|
|
277
|
-
expect(output).to include("[DEPRECATION]")
|
|
278
|
-
expect(output).to include("`option` is deprecated")
|
|
279
|
-
end
|
|
280
|
-
end
|
|
281
|
-
end
|