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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -487
  3. data/Rakefile +1 -4
  4. data/bard.gemspec +2 -11
  5. data/lib/bard/config.rb +22 -20
  6. data/lib/bard/plugins/ping/target_methods.rb +0 -9
  7. data/lib/bard/plugins/ssh/connection.rb +2 -35
  8. data/lib/bard/target.rb +0 -15
  9. data/lib/bard/version.rb +1 -1
  10. data/lib/bard.rb +2 -1
  11. data/spec/bard/capability_spec.rb +0 -8
  12. data/spec/bard/config_spec.rb +33 -48
  13. data/spec/bard/target_spec.rb +1 -36
  14. metadata +4 -223
  15. data/ARCHITECTURE.md +0 -957
  16. data/CUSTOM_STRATEGIES.md +0 -701
  17. data/MIGRATION_GUIDE.md +0 -513
  18. data/PLUGINS.md +0 -99
  19. data/bin/bard +0 -4
  20. data/features/ci.feature +0 -63
  21. data/features/data.feature +0 -13
  22. data/features/deploy.feature +0 -14
  23. data/features/deploy_git_workflow.feature +0 -89
  24. data/features/run.feature +0 -14
  25. data/features/step_definitions/bard_steps.rb +0 -136
  26. data/features/support/bard-coverage +0 -16
  27. data/features/support/env.rb +0 -22
  28. data/features/support/test_server.rb +0 -216
  29. data/lib/bard/cli.rb +0 -44
  30. data/lib/bard/command.rb +0 -31
  31. data/lib/bard/copy.rb +0 -45
  32. data/lib/bard/plugins/data.rb +0 -56
  33. data/lib/bard/plugins/deploy/ci/github_actions.rb +0 -202
  34. data/lib/bard/plugins/deploy/ci/jenkins.rb +0 -176
  35. data/lib/bard/plugins/deploy/ci/local.rb +0 -57
  36. data/lib/bard/plugins/deploy/ci/runner.rb +0 -112
  37. data/lib/bard/plugins/deploy/ci/state.rb +0 -40
  38. data/lib/bard/plugins/deploy/ci.rb +0 -38
  39. data/lib/bard/plugins/deploy/ssh_strategy.rb +0 -26
  40. data/lib/bard/plugins/deploy/strategy.rb +0 -60
  41. data/lib/bard/plugins/deploy.rb +0 -260
  42. data/lib/bard/plugins/git.rb +0 -36
  43. data/lib/bard/plugins/github.rb +0 -152
  44. data/lib/bard/plugins/github_pages/strategy.rb +0 -163
  45. data/lib/bard/plugins/github_pages.rb +0 -30
  46. data/lib/bard/plugins/hurt.rb +0 -13
  47. data/lib/bard/plugins/install/.github/dependabot.yml +0 -18
  48. data/lib/bard/plugins/install/.github/workflows/cache-ci.yml +0 -15
  49. data/lib/bard/plugins/install/.github/workflows/ci.yml +0 -74
  50. data/lib/bard/plugins/install/apt_dependencies.rb +0 -33
  51. data/lib/bard/plugins/install/ci +0 -5
  52. data/lib/bard/plugins/install/setup +0 -13
  53. data/lib/bard/plugins/install/specified_bundler.rb +0 -15
  54. data/lib/bard/plugins/install/specified_ruby.rb +0 -59
  55. data/lib/bard/plugins/install.rb +0 -9
  56. data/lib/bard/plugins/open.rb +0 -20
  57. data/lib/bard/plugins/ping/check.rb +0 -66
  58. data/lib/bard/plugins/ping.rb +0 -10
  59. data/lib/bard/plugins/run.rb +0 -19
  60. data/lib/bard/plugins/setup.rb +0 -75
  61. data/lib/bard/plugins/ssh/copy.rb +0 -95
  62. data/lib/bard/plugins/ssh.rb +0 -10
  63. data/lib/bard/plugins/vim.rb +0 -6
  64. data/lib/bard/retryable.rb +0 -25
  65. data/lib/bard/secrets.rb +0 -10
  66. data/spec/acceptance/.gitignore +0 -4
  67. data/spec/acceptance/docker/Dockerfile +0 -36
  68. data/spec/acceptance/docker/test_key +0 -27
  69. data/spec/acceptance/docker/test_key.pub +0 -1
  70. data/spec/bard/ci/github_actions_spec.rb +0 -138
  71. data/spec/bard/ci/jenkins_spec.rb +0 -139
  72. data/spec/bard/ci/runner_spec.rb +0 -61
  73. data/spec/bard/ci_spec.rb +0 -10
  74. data/spec/bard/cli/ci_spec.rb +0 -170
  75. data/spec/bard/cli/data_spec.rb +0 -58
  76. data/spec/bard/cli/deploy_spec.rb +0 -243
  77. data/spec/bard/cli/hurt_spec.rb +0 -17
  78. data/spec/bard/cli/install_spec.rb +0 -19
  79. data/spec/bard/cli/master_key_spec.rb +0 -38
  80. data/spec/bard/cli/open_spec.rb +0 -51
  81. data/spec/bard/cli/ping_spec.rb +0 -32
  82. data/spec/bard/cli/run_spec.rb +0 -57
  83. data/spec/bard/cli/setup_spec.rb +0 -99
  84. data/spec/bard/cli/ssh_spec.rb +0 -40
  85. data/spec/bard/cli/stage_spec.rb +0 -127
  86. data/spec/bard/cli/vim_spec.rb +0 -28
  87. data/spec/bard/command_spec.rb +0 -30
  88. data/spec/bard/copy_spec.rb +0 -69
  89. data/spec/bard/deploy_strategy/ssh_spec.rb +0 -135
  90. data/spec/bard/deploy_strategy_spec.rb +0 -107
  91. data/spec/bard/dynamic_dsl_spec.rb +0 -46
  92. data/spec/bard/git_spec.rb +0 -65
  93. data/spec/bard/github_spec.rb +0 -45
  94. data/spec/bard/ping_spec.rb +0 -60
  95. data/spec/bard/ssh_copy_spec.rb +0 -44
@@ -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
@@ -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