bard 2.1.0 → 3.0.0
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/README.md +7 -487
- data/Rakefile +1 -4
- data/bard.gemspec +2 -11
- data/lib/bard/config.rb +22 -20
- data/lib/bard/plugins/ping/target_methods.rb +0 -9
- data/lib/bard/plugins/ssh/connection.rb +2 -35
- data/lib/bard/target.rb +0 -15
- data/lib/bard/version.rb +1 -1
- data/lib/bard.rb +2 -1
- data/spec/bard/capability_spec.rb +0 -8
- data/spec/bard/config_spec.rb +33 -48
- data/spec/bard/target_spec.rb +1 -36
- metadata +4 -223
- data/ARCHITECTURE.md +0 -957
- data/CUSTOM_STRATEGIES.md +0 -701
- data/MIGRATION_GUIDE.md +0 -513
- data/PLUGINS.md +0 -99
- data/bin/bard +0 -4
- data/features/ci.feature +0 -63
- data/features/data.feature +0 -13
- data/features/deploy.feature +0 -14
- data/features/deploy_git_workflow.feature +0 -89
- data/features/run.feature +0 -14
- data/features/step_definitions/bard_steps.rb +0 -136
- data/features/support/bard-coverage +0 -16
- data/features/support/env.rb +0 -22
- data/features/support/test_server.rb +0 -216
- data/lib/bard/cli.rb +0 -44
- data/lib/bard/command.rb +0 -31
- data/lib/bard/copy.rb +0 -45
- data/lib/bard/plugins/data.rb +0 -56
- data/lib/bard/plugins/deploy/ci/github_actions.rb +0 -202
- data/lib/bard/plugins/deploy/ci/jenkins.rb +0 -176
- data/lib/bard/plugins/deploy/ci/local.rb +0 -57
- data/lib/bard/plugins/deploy/ci/runner.rb +0 -112
- data/lib/bard/plugins/deploy/ci/state.rb +0 -40
- data/lib/bard/plugins/deploy/ci.rb +0 -38
- data/lib/bard/plugins/deploy/ssh_strategy.rb +0 -26
- data/lib/bard/plugins/deploy/strategy.rb +0 -60
- data/lib/bard/plugins/deploy.rb +0 -260
- data/lib/bard/plugins/git.rb +0 -36
- data/lib/bard/plugins/github.rb +0 -152
- data/lib/bard/plugins/github_pages/strategy.rb +0 -163
- data/lib/bard/plugins/github_pages.rb +0 -30
- data/lib/bard/plugins/hurt.rb +0 -13
- data/lib/bard/plugins/install/.github/dependabot.yml +0 -18
- data/lib/bard/plugins/install/.github/workflows/cache-ci.yml +0 -15
- data/lib/bard/plugins/install/.github/workflows/ci.yml +0 -74
- data/lib/bard/plugins/install/apt_dependencies.rb +0 -33
- data/lib/bard/plugins/install/ci +0 -5
- data/lib/bard/plugins/install/setup +0 -13
- data/lib/bard/plugins/install/specified_bundler.rb +0 -15
- data/lib/bard/plugins/install/specified_ruby.rb +0 -59
- data/lib/bard/plugins/install.rb +0 -9
- data/lib/bard/plugins/open.rb +0 -20
- data/lib/bard/plugins/ping/check.rb +0 -66
- data/lib/bard/plugins/ping.rb +0 -10
- data/lib/bard/plugins/run.rb +0 -19
- data/lib/bard/plugins/setup.rb +0 -75
- data/lib/bard/plugins/ssh/copy.rb +0 -95
- data/lib/bard/plugins/ssh.rb +0 -10
- data/lib/bard/plugins/vim.rb +0 -6
- data/lib/bard/retryable.rb +0 -25
- data/lib/bard/secrets.rb +0 -10
- data/spec/acceptance/.gitignore +0 -4
- data/spec/acceptance/docker/Dockerfile +0 -36
- data/spec/acceptance/docker/test_key +0 -27
- data/spec/acceptance/docker/test_key.pub +0 -1
- data/spec/bard/ci/github_actions_spec.rb +0 -138
- data/spec/bard/ci/jenkins_spec.rb +0 -139
- data/spec/bard/ci/runner_spec.rb +0 -61
- data/spec/bard/ci_spec.rb +0 -10
- data/spec/bard/cli/ci_spec.rb +0 -170
- data/spec/bard/cli/data_spec.rb +0 -58
- data/spec/bard/cli/deploy_spec.rb +0 -243
- data/spec/bard/cli/hurt_spec.rb +0 -17
- data/spec/bard/cli/install_spec.rb +0 -19
- data/spec/bard/cli/master_key_spec.rb +0 -38
- data/spec/bard/cli/open_spec.rb +0 -51
- data/spec/bard/cli/ping_spec.rb +0 -32
- data/spec/bard/cli/run_spec.rb +0 -57
- data/spec/bard/cli/setup_spec.rb +0 -99
- data/spec/bard/cli/ssh_spec.rb +0 -40
- data/spec/bard/cli/stage_spec.rb +0 -127
- data/spec/bard/cli/vim_spec.rb +0 -28
- data/spec/bard/command_spec.rb +0 -30
- data/spec/bard/copy_spec.rb +0 -69
- data/spec/bard/deploy_strategy/ssh_spec.rb +0 -135
- data/spec/bard/deploy_strategy_spec.rb +0 -107
- data/spec/bard/dynamic_dsl_spec.rb +0 -46
- data/spec/bard/git_spec.rb +0 -65
- data/spec/bard/github_spec.rb +0 -45
- data/spec/bard/ping_spec.rb +0 -60
- data/spec/bard/ssh_copy_spec.rb +0 -44
data/spec/bard/ping_spec.rb
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "bard/plugins/ping/check"
|
|
3
|
-
|
|
4
|
-
describe Bard::Ping do
|
|
5
|
-
let(:target) { double("target", ping: ["http://example.com"]) }
|
|
6
|
-
let(:ping) { described_class.new(target) }
|
|
7
|
-
|
|
8
|
-
def success_response
|
|
9
|
-
Net::HTTPSuccess.new(1.0, "200", "OK")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def not_found_response
|
|
13
|
-
Net::HTTPNotFound.new(1.0, "404", "Not Found")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "when the target is reachable" do
|
|
17
|
-
it "returns an empty array" do
|
|
18
|
-
allow(ping).to receive(:http_get).and_return(success_response)
|
|
19
|
-
expect(ping.call).to be_empty
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "when the target is not reachable" do
|
|
24
|
-
it "returns the url" do
|
|
25
|
-
allow(ping).to receive(:http_get).and_return(not_found_response)
|
|
26
|
-
expect(ping.call).to eq(["http://example.com"])
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "when there is a redirect" do
|
|
31
|
-
it "follows the redirect and returns an empty array" do
|
|
32
|
-
redirect_response = Net::HTTPRedirection.new(1.0, "301", "Moved Permanently")
|
|
33
|
-
redirect_response["location"] = "/new"
|
|
34
|
-
allow(ping).to receive(:http_get).with(URI("http://example.com")).and_return(redirect_response)
|
|
35
|
-
allow(ping).to receive(:http_get).with(URI("http://example.com/new")).and_return(success_response)
|
|
36
|
-
expect(ping.call).to be_empty
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
context "when a transient error occurs" do
|
|
41
|
-
it "retries once before marking down" do
|
|
42
|
-
calls = 0
|
|
43
|
-
allow(ping).to receive(:http_get) do
|
|
44
|
-
calls += 1
|
|
45
|
-
raise Errno::ECONNRESET if calls == 1
|
|
46
|
-
|
|
47
|
-
success_response
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
expect(ping.call).to be_empty
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
context "when errors persist across retries" do
|
|
55
|
-
it "returns the url" do
|
|
56
|
-
allow(ping).to receive(:http_get).and_raise(Errno::ECONNREFUSED)
|
|
57
|
-
expect(ping.call).to eq(["http://example.com"])
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
data/spec/bard/ssh_copy_spec.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "bard/plugins/ssh/copy"
|
|
3
|
-
|
|
4
|
-
describe Bard::SSH::Copy do
|
|
5
|
-
let(:ssh_server) { double("ssh_server", gateway: nil, ssh_key: nil, port: "22", ssh_uri: double(port: 22, user: "user", host: "example.com")) }
|
|
6
|
-
let(:production) { double("production", key: :production, server: ssh_server, scp_uri: "user@example.com:/path/to/file", rsync_uri: "user@example.com:/path/to/", path: "/path/to", has_capability?: true) }
|
|
7
|
-
let(:local) { double("local", key: :local, has_capability?: false) }
|
|
8
|
-
|
|
9
|
-
describe ".can_handle?" do
|
|
10
|
-
it "handles pairs where at least one target has ssh capability" do
|
|
11
|
-
expect(Bard::SSH::Copy.can_handle?(local, production)).to be true
|
|
12
|
-
expect(Bard::SSH::Copy.can_handle?(production, local)).to be true
|
|
13
|
-
expect(Bard::SSH::Copy.can_handle?(production, production)).to be true
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "does not handle pairs where neither target has ssh capability" do
|
|
17
|
-
expect(Bard::SSH::Copy.can_handle?(local, local)).to be false
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
context ".file via Bard::Copy dispatch" do
|
|
22
|
-
it "should copy a file from a remote server to the local machine" do
|
|
23
|
-
expect(Bard::Command).to receive(:run!).with("scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR user@example.com:/path/to/file path/to/file", verbose: false)
|
|
24
|
-
Bard::Copy.file "path/to/file", from: production, to: local
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "should copy a file from the local machine to a remote server" do
|
|
28
|
-
expect(Bard::Command).to receive(:run!).with("scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR path/to/file user@example.com:/path/to/file", verbose: false)
|
|
29
|
-
Bard::Copy.file "path/to/file", from: local, to: production
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context ".dir via Bard::Copy dispatch" do
|
|
34
|
-
it "should copy a directory from a remote server to the local machine" do
|
|
35
|
-
expect(Bard::Command).to receive(:run!).with("rsync -e'ssh -p22' --delete --info=progress2 -az user@example.com:/path/to/ ./path/", verbose: false)
|
|
36
|
-
Bard::Copy.dir "path/to", from: production, to: local
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "should copy a directory from the local machine to a remote server" do
|
|
40
|
-
expect(Bard::Command).to receive(:run!).with("rsync -e'ssh -p22' --delete --info=progress2 -az ./path/to user@example.com:/path/to/", verbose: false)
|
|
41
|
-
Bard::Copy.dir "path/to", from: local, to: production
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|