bard 1.8.0 → 1.9.1
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/CLAUDE.md +76 -0
- data/PLUGINS.md +114 -0
- data/README.md +14 -6
- data/features/ci.feature +62 -0
- data/features/deploy_git_workflow.feature +88 -0
- data/features/step_definitions/bard_steps.rb +96 -0
- data/features/support/bard-coverage +16 -0
- data/features/support/env.rb +10 -1
- data/features/support/test_server.rb +2 -1
- data/lib/bard/ci/github_actions.rb +1 -2
- data/lib/bard/ci/jenkins.rb +82 -11
- data/lib/bard/ci/local.rb +6 -6
- data/lib/bard/ci/runner.rb +35 -1
- data/lib/bard/ci.rb +11 -23
- data/lib/bard/cli/ci.rb +45 -38
- data/lib/bard/cli/deploy.rb +40 -8
- data/lib/bard/cli/hurt.rb +10 -15
- data/lib/bard/cli/install.rb +7 -12
- data/lib/bard/cli/open.rb +12 -16
- data/lib/bard/cli/ping.rb +8 -14
- data/lib/bard/cli/run.rb +5 -3
- data/lib/bard/cli/stage.rb +10 -1
- data/lib/bard/cli/vim.rb +5 -10
- data/lib/bard/cli.rb +13 -11
- data/lib/bard/command.rb +3 -3
- data/lib/bard/config.rb +4 -14
- data/lib/bard/github.rb +2 -4
- data/lib/bard/plugin.rb +99 -0
- data/lib/bard/plugins/backup.rb +19 -0
- data/lib/bard/plugins/github_pages.rb +34 -0
- data/lib/bard/plugins/hurt.rb +5 -0
- data/lib/bard/plugins/install.rb +5 -0
- data/lib/bard/plugins/jenkins.rb +6 -0
- data/lib/bard/plugins/new.rb +5 -0
- data/lib/bard/plugins/ping.rb +6 -0
- data/lib/bard/plugins/provision.rb +5 -0
- data/lib/bard/plugins/vim.rb +5 -0
- data/lib/bard/provision/ssh.rb +9 -2
- data/lib/bard/secrets.rb +10 -0
- data/lib/bard/server.rb +3 -2
- data/lib/bard/target.rb +3 -2
- data/lib/bard/version.rb +1 -1
- data/spec/bard/ci/github_actions_spec.rb +116 -13
- data/spec/bard/ci/jenkins_spec.rb +139 -0
- data/spec/bard/ci/runner_spec.rb +61 -0
- data/spec/bard/cli/ci_spec.rb +34 -8
- data/spec/bard/cli/deploy_spec.rb +20 -8
- data/spec/bard/cli/hurt_spec.rb +2 -2
- data/spec/bard/cli/install_spec.rb +4 -4
- data/spec/bard/cli/open_spec.rb +10 -8
- data/spec/bard/cli/ping_spec.rb +5 -5
- data/spec/bard/cli/run_spec.rb +20 -1
- data/spec/bard/cli/stage_spec.rb +20 -0
- data/spec/bard/cli/vim_spec.rb +5 -5
- data/spec/bard/config_spec.rb +12 -0
- data/spec/bard/github_spec.rb +1 -1
- data/spec/bard/plugin_spec.rb +79 -0
- data/spec/bard/provision/ssh_spec.rb +17 -4
- data/spec/spec_helper.rb +6 -1
- metadata +27 -3
- data/README.rdoc +0 -15
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require "bard/plugin"
|
|
2
|
+
|
|
3
|
+
RSpec.describe Bard::Plugin do
|
|
4
|
+
before do
|
|
5
|
+
described_class.reset!
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe ".register" do
|
|
9
|
+
it "registers a plugin by name" do
|
|
10
|
+
described_class.register :test_plugin
|
|
11
|
+
|
|
12
|
+
expect(described_class[:test_plugin]).to be_a(Bard::Plugin)
|
|
13
|
+
expect(described_class[:test_plugin].name).to eq :test_plugin
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "accepts a block to configure the plugin" do
|
|
17
|
+
described_class.register :test_plugin do
|
|
18
|
+
require_file "some/file"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
plugin = described_class[:test_plugin]
|
|
22
|
+
expect(plugin.instance_variable_get(:@requires)).to include("some/file")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe ".all" do
|
|
27
|
+
it "returns all registered plugins" do
|
|
28
|
+
described_class.register :plugin1
|
|
29
|
+
described_class.register :plugin2
|
|
30
|
+
|
|
31
|
+
expect(described_class.all.map(&:name)).to contain_exactly(:plugin1, :plugin2)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe ".reset!" do
|
|
36
|
+
it "clears the registry" do
|
|
37
|
+
described_class.register :test_plugin
|
|
38
|
+
|
|
39
|
+
described_class.reset!
|
|
40
|
+
|
|
41
|
+
expect(described_class.all).to be_empty
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "#cli" do
|
|
46
|
+
it "stores CLI modules to include" do
|
|
47
|
+
described_class.register :test_plugin do
|
|
48
|
+
cli "SomeModule", require: "some/module"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
plugin = described_class[:test_plugin]
|
|
52
|
+
expect(plugin.cli_modules).to include("SomeModule")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe "#target_method" do
|
|
57
|
+
it "stores target methods to define" do
|
|
58
|
+
block = proc { "value" }
|
|
59
|
+
described_class.register :test_plugin do
|
|
60
|
+
target_method :custom_method, &block
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
plugin = described_class[:test_plugin]
|
|
64
|
+
expect(plugin.instance_variable_get(:@target_methods)).to have_key(:custom_method)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe "#config_method" do
|
|
69
|
+
it "stores config methods to define" do
|
|
70
|
+
block = proc { "value" }
|
|
71
|
+
described_class.register :test_plugin do
|
|
72
|
+
config_method :custom_method, &block
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
plugin = described_class[:test_plugin]
|
|
76
|
+
expect(plugin.instance_variable_get(:@config_methods)).to have_key(:custom_method)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -45,26 +45,39 @@ describe Bard::Provision::SSH do
|
|
|
45
45
|
context "when SSH is not available on target port but available on default port" do
|
|
46
46
|
it "reconfigures SSH port and adds to known hosts" do
|
|
47
47
|
allow(ssh_provisioner).to receive(:password_auth_enabled?).and_return(false)
|
|
48
|
-
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri, port: 2222).and_return(false)
|
|
48
|
+
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri, port: 2222).and_return(false, true)
|
|
49
49
|
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri).and_return(true)
|
|
50
50
|
allow(ssh_provisioner).to receive(:ssh_known_host?).with(provision_ssh_uri).and_return(false)
|
|
51
|
+
allow(ssh_provisioner).to receive(:sleep)
|
|
51
52
|
|
|
52
53
|
expect(ssh_provisioner).to receive(:add_ssh_known_host!).with(provision_ssh_uri).twice
|
|
53
54
|
expect(provision_server).to receive(:run!).with(
|
|
54
|
-
'echo "Port 2222" | sudo tee /etc/ssh/sshd_config.d/port_2222.conf
|
|
55
|
+
'echo "Port 2222" | sudo tee /etc/ssh/sshd_config.d/port_2222.conf && sudo service ssh restart',
|
|
55
56
|
home: true
|
|
56
57
|
)
|
|
57
58
|
|
|
58
59
|
ssh_provisioner.call
|
|
59
60
|
end
|
|
60
61
|
|
|
61
|
-
it "
|
|
62
|
+
it "raises if new port is not responding after reconfiguration" do
|
|
62
63
|
allow(ssh_provisioner).to receive(:password_auth_enabled?).and_return(false)
|
|
63
64
|
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri, port: 2222).and_return(false)
|
|
64
65
|
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri).and_return(true)
|
|
66
|
+
allow(ssh_provisioner).to receive(:ssh_known_host?).with(provision_ssh_uri).and_return(true)
|
|
67
|
+
allow(provision_server).to receive(:run!)
|
|
68
|
+
allow(ssh_provisioner).to receive(:sleep)
|
|
69
|
+
|
|
70
|
+
expect { ssh_provisioner.call }.to raise_error(/reconfigured SSH to port 2222 but it's not responding/)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "prints status messages during reconfiguration" do
|
|
74
|
+
allow(ssh_provisioner).to receive(:password_auth_enabled?).and_return(false)
|
|
75
|
+
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri, port: 2222).and_return(false, true)
|
|
76
|
+
allow(ssh_provisioner).to receive(:ssh_available?).with(provision_ssh_uri).and_return(true)
|
|
65
77
|
allow(ssh_provisioner).to receive(:ssh_known_host?).and_return(false)
|
|
66
78
|
allow(ssh_provisioner).to receive(:add_ssh_known_host!)
|
|
67
79
|
allow(provision_server).to receive(:run!)
|
|
80
|
+
allow(ssh_provisioner).to receive(:sleep)
|
|
68
81
|
|
|
69
82
|
expect(ssh_provisioner).to receive(:print).with("SSH:")
|
|
70
83
|
expect(ssh_provisioner).to receive(:print).with(" Adding known host,")
|
|
@@ -218,7 +231,7 @@ describe Bard::Provision::SSH do
|
|
|
218
231
|
describe "#disable_password_auth!" do
|
|
219
232
|
it "creates sshd config file to disable password authentication and restarts ssh" do
|
|
220
233
|
expect(provision_server).to receive(:run!).with(
|
|
221
|
-
%q{echo "PasswordAuthentication no" | sudo tee /etc/ssh/sshd_config.d/disable_password_auth.conf
|
|
234
|
+
%q{echo "PasswordAuthentication no" | sudo tee /etc/ssh/sshd_config.d/disable_password_auth.conf && sudo service ssh restart},
|
|
222
235
|
home: true
|
|
223
236
|
)
|
|
224
237
|
|
data/spec/spec_helper.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: 1.
|
|
4
|
+
version: 1.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-02-11 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: thor
|
|
@@ -161,21 +161,25 @@ files:
|
|
|
161
161
|
- ".gitmodules"
|
|
162
162
|
- ".rspec"
|
|
163
163
|
- ARCHITECTURE.md
|
|
164
|
+
- CLAUDE.md
|
|
164
165
|
- CUSTOM_STRATEGIES.md
|
|
165
166
|
- Gemfile
|
|
166
167
|
- LICENSE
|
|
167
168
|
- MIGRATION_GUIDE.md
|
|
169
|
+
- PLUGINS.md
|
|
168
170
|
- README.md
|
|
169
|
-
- README.rdoc
|
|
170
171
|
- Rakefile
|
|
171
172
|
- bard.gemspec
|
|
172
173
|
- bin/bard
|
|
173
174
|
- bin/setup
|
|
174
175
|
- cucumber.yml
|
|
176
|
+
- features/ci.feature
|
|
175
177
|
- features/data.feature
|
|
176
178
|
- features/deploy.feature
|
|
179
|
+
- features/deploy_git_workflow.feature
|
|
177
180
|
- features/run.feature
|
|
178
181
|
- features/step_definitions/bard_steps.rb
|
|
182
|
+
- features/support/bard-coverage
|
|
179
183
|
- features/support/env.rb
|
|
180
184
|
- features/support/test_server.rb
|
|
181
185
|
- install_files/.github/dependabot.yml
|
|
@@ -224,6 +228,16 @@ files:
|
|
|
224
228
|
- lib/bard/github.rb
|
|
225
229
|
- lib/bard/github_pages.rb
|
|
226
230
|
- lib/bard/ping.rb
|
|
231
|
+
- lib/bard/plugin.rb
|
|
232
|
+
- lib/bard/plugins/backup.rb
|
|
233
|
+
- lib/bard/plugins/github_pages.rb
|
|
234
|
+
- lib/bard/plugins/hurt.rb
|
|
235
|
+
- lib/bard/plugins/install.rb
|
|
236
|
+
- lib/bard/plugins/jenkins.rb
|
|
237
|
+
- lib/bard/plugins/new.rb
|
|
238
|
+
- lib/bard/plugins/ping.rb
|
|
239
|
+
- lib/bard/plugins/provision.rb
|
|
240
|
+
- lib/bard/plugins/vim.rb
|
|
227
241
|
- lib/bard/provision.rb
|
|
228
242
|
- lib/bard/provision/app.rb
|
|
229
243
|
- lib/bard/provision/apt.rb
|
|
@@ -240,6 +254,7 @@ files:
|
|
|
240
254
|
- lib/bard/provision/ssh.rb
|
|
241
255
|
- lib/bard/provision/swapfile.rb
|
|
242
256
|
- lib/bard/provision/user.rb
|
|
257
|
+
- lib/bard/secrets.rb
|
|
243
258
|
- lib/bard/server.rb
|
|
244
259
|
- lib/bard/ssh_server.rb
|
|
245
260
|
- lib/bard/target.rb
|
|
@@ -250,6 +265,8 @@ files:
|
|
|
250
265
|
- spec/acceptance/docker/test_key.pub
|
|
251
266
|
- spec/bard/capability_spec.rb
|
|
252
267
|
- spec/bard/ci/github_actions_spec.rb
|
|
268
|
+
- spec/bard/ci/jenkins_spec.rb
|
|
269
|
+
- spec/bard/ci/runner_spec.rb
|
|
253
270
|
- spec/bard/ci_spec.rb
|
|
254
271
|
- spec/bard/cli/ci_spec.rb
|
|
255
272
|
- spec/bard/cli/command_spec.rb
|
|
@@ -278,6 +295,7 @@ files:
|
|
|
278
295
|
- spec/bard/github_pages_spec.rb
|
|
279
296
|
- spec/bard/github_spec.rb
|
|
280
297
|
- spec/bard/ping_spec.rb
|
|
298
|
+
- spec/bard/plugin_spec.rb
|
|
281
299
|
- spec/bard/provision/app_spec.rb
|
|
282
300
|
- spec/bard/provision/apt_spec.rb
|
|
283
301
|
- spec/bard/provision/authorizedkeys_spec.rb
|
|
@@ -323,10 +341,13 @@ rubygems_version: 3.6.2
|
|
|
323
341
|
specification_version: 4
|
|
324
342
|
summary: CLI to automate common development tasks.
|
|
325
343
|
test_files:
|
|
344
|
+
- features/ci.feature
|
|
326
345
|
- features/data.feature
|
|
327
346
|
- features/deploy.feature
|
|
347
|
+
- features/deploy_git_workflow.feature
|
|
328
348
|
- features/run.feature
|
|
329
349
|
- features/step_definitions/bard_steps.rb
|
|
350
|
+
- features/support/bard-coverage
|
|
330
351
|
- features/support/env.rb
|
|
331
352
|
- features/support/test_server.rb
|
|
332
353
|
- spec/acceptance/.gitignore
|
|
@@ -335,6 +356,8 @@ test_files:
|
|
|
335
356
|
- spec/acceptance/docker/test_key.pub
|
|
336
357
|
- spec/bard/capability_spec.rb
|
|
337
358
|
- spec/bard/ci/github_actions_spec.rb
|
|
359
|
+
- spec/bard/ci/jenkins_spec.rb
|
|
360
|
+
- spec/bard/ci/runner_spec.rb
|
|
338
361
|
- spec/bard/ci_spec.rb
|
|
339
362
|
- spec/bard/cli/ci_spec.rb
|
|
340
363
|
- spec/bard/cli/command_spec.rb
|
|
@@ -363,6 +386,7 @@ test_files:
|
|
|
363
386
|
- spec/bard/github_pages_spec.rb
|
|
364
387
|
- spec/bard/github_spec.rb
|
|
365
388
|
- spec/bard/ping_spec.rb
|
|
389
|
+
- spec/bard/plugin_spec.rb
|
|
366
390
|
- spec/bard/provision/app_spec.rb
|
|
367
391
|
- spec/bard/provision/apt_spec.rb
|
|
368
392
|
- spec/bard/provision/authorizedkeys_spec.rb
|
data/README.rdoc
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
= BARD
|
|
2
|
-
|
|
3
|
-
This is a collection of tools designed to ease collaboration within Bot and Rose Design.
|
|
4
|
-
It wraps git, capistrano, and rake to make things as simple as:
|
|
5
|
-
|
|
6
|
-
bard stage
|
|
7
|
-
bard deploy
|
|
8
|
-
|
|
9
|
-
Seed database from staging or production:
|
|
10
|
-
bard data
|
|
11
|
-
|
|
12
|
-
== Copyright
|
|
13
|
-
|
|
14
|
-
Copyright (c) 2018 Micah Geisel. See LICENSE for details.
|
|
15
|
-
|