bard 1.8.0 → 1.9.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/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/vim.rb +5 -10
- data/lib/bard/cli.rb +7 -12
- data/lib/bard/config.rb +1 -13
- 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/secrets.rb +10 -0
- 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/vim_spec.rb +5 -5
- data/spec/bard/github_spec.rb +1 -1
- data/spec/bard/plugin_spec.rb +79 -0
- data/spec/spec_helper.rb +6 -1
- metadata +27 -3
- data/README.rdoc +0 -15
data/spec/bard/cli/ci_spec.rb
CHANGED
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
|
2
2
|
require "bard/cli"
|
|
3
3
|
require "bard/cli/ci"
|
|
4
4
|
require "thor"
|
|
5
|
+
require "ostruct"
|
|
5
6
|
|
|
6
7
|
class TestCICLI < Thor
|
|
7
8
|
include Bard::CLI::CI
|
|
@@ -16,6 +17,10 @@ class TestCICLI < Thor
|
|
|
16
17
|
def project_name
|
|
17
18
|
"test_project"
|
|
18
19
|
end
|
|
20
|
+
|
|
21
|
+
def config
|
|
22
|
+
@config ||= OpenStruct.new(ci: nil)
|
|
23
|
+
end
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
describe Bard::CLI::CI do
|
|
@@ -101,12 +106,9 @@ describe Bard::CLI::CI do
|
|
|
101
106
|
it "shows error message and exits" do
|
|
102
107
|
allow(cli).to receive(:options).and_return({})
|
|
103
108
|
allow(ci_runner).to receive(:exists?).and_return(false)
|
|
109
|
+
allow(cli).to receive(:exit).with(1).and_raise(SystemExit)
|
|
104
110
|
|
|
105
|
-
expect
|
|
106
|
-
expect(cli).to receive(:puts) # "Re-run with --skip-ci to bypass CI..."
|
|
107
|
-
expect(cli).to receive(:exit).with(1)
|
|
108
|
-
|
|
109
|
-
cli.ci
|
|
111
|
+
expect { cli.ci }.to raise_error(SystemExit)
|
|
110
112
|
end
|
|
111
113
|
end
|
|
112
114
|
|
|
@@ -116,7 +118,7 @@ describe Bard::CLI::CI do
|
|
|
116
118
|
allow(ci_runner).to receive(:exists?).and_return(true)
|
|
117
119
|
allow(ci_runner).to receive(:run).and_return(true)
|
|
118
120
|
|
|
119
|
-
expect(Bard::CI).to receive(:new).with("test_project", "develop",
|
|
121
|
+
expect(Bard::CI).to receive(:new).with("test_project", "develop", runner_name: nil)
|
|
120
122
|
expect(cli).to receive(:puts).with("Continuous integration: starting build on develop...")
|
|
121
123
|
|
|
122
124
|
cli.ci("develop")
|
|
@@ -124,12 +126,36 @@ describe Bard::CLI::CI do
|
|
|
124
126
|
end
|
|
125
127
|
|
|
126
128
|
context "with local-ci option" do
|
|
127
|
-
it "passes local
|
|
129
|
+
it "passes local runner_name to CI" do
|
|
128
130
|
allow(cli).to receive(:options).and_return({ "local-ci" => true })
|
|
129
131
|
allow(ci_runner).to receive(:exists?).and_return(true)
|
|
130
132
|
allow(ci_runner).to receive(:run).and_return(true)
|
|
131
133
|
|
|
132
|
-
expect(Bard::CI).to receive(:new).with("test_project", "feature-branch",
|
|
134
|
+
expect(Bard::CI).to receive(:new).with("test_project", "feature-branch", runner_name: :local)
|
|
135
|
+
|
|
136
|
+
cli.ci
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
context "with ci option" do
|
|
141
|
+
it "passes specified runner_name to CI" do
|
|
142
|
+
allow(cli).to receive(:options).and_return({ "ci" => "jenkins" })
|
|
143
|
+
allow(ci_runner).to receive(:exists?).and_return(true)
|
|
144
|
+
allow(ci_runner).to receive(:run).and_return(true)
|
|
145
|
+
|
|
146
|
+
expect(Bard::CI).to receive(:new).with("test_project", "feature-branch", runner_name: :jenkins)
|
|
147
|
+
|
|
148
|
+
cli.ci
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
context "with both local-ci and ci options" do
|
|
153
|
+
it "local-ci takes precedence" do
|
|
154
|
+
allow(cli).to receive(:options).and_return({ "local-ci" => true, "ci" => "jenkins" })
|
|
155
|
+
allow(ci_runner).to receive(:exists?).and_return(true)
|
|
156
|
+
allow(ci_runner).to receive(:run).and_return(true)
|
|
157
|
+
|
|
158
|
+
expect(Bard::CI).to receive(:new).with("test_project", "feature-branch", runner_name: :local)
|
|
133
159
|
|
|
134
160
|
cli.ci
|
|
135
161
|
end
|
|
@@ -26,6 +26,7 @@ describe Bard::CLI::Deploy do
|
|
|
26
26
|
|
|
27
27
|
before do
|
|
28
28
|
allow(cli).to receive(:config).and_return(config)
|
|
29
|
+
allow(cli).to receive(:options).and_return({ target: "production" })
|
|
29
30
|
allow(cli).to receive(:puts)
|
|
30
31
|
allow(cli).to receive(:exit)
|
|
31
32
|
allow(cli).to receive(:run!)
|
|
@@ -48,7 +49,7 @@ describe Bard::CLI::Deploy do
|
|
|
48
49
|
context "when on master branch" do
|
|
49
50
|
before do
|
|
50
51
|
allow(Bard::Git).to receive(:current_branch).and_return("master")
|
|
51
|
-
allow(cli).to receive(:options).and_return({})
|
|
52
|
+
allow(cli).to receive(:options).and_return({ target: "production" })
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
context "when up to date with remote" do
|
|
@@ -79,7 +80,7 @@ describe Bard::CLI::Deploy do
|
|
|
79
80
|
|
|
80
81
|
context "with skip-ci option" do
|
|
81
82
|
it "skips CI step" do
|
|
82
|
-
allow(cli).to receive(:options).and_return({ "skip-ci" => true })
|
|
83
|
+
allow(cli).to receive(:options).and_return({ "skip-ci" => true, target: "production" })
|
|
83
84
|
|
|
84
85
|
expect(cli).not_to receive(:invoke).with(:ci, anything, anything)
|
|
85
86
|
expect(production_server).to receive(:run!).with("git pull origin master && bin/setup")
|
|
@@ -91,16 +92,16 @@ describe Bard::CLI::Deploy do
|
|
|
91
92
|
|
|
92
93
|
context "when on feature branch" do
|
|
93
94
|
before do
|
|
94
|
-
allow(cli).to receive(:options).and_return({})
|
|
95
|
+
allow(cli).to receive(:options).and_return({ target: "production" })
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
context "with fast-forward merge possible" do
|
|
98
99
|
it "fetches master, pushes branch, runs CI, merges to master, and deploys" do
|
|
99
|
-
expect(cli).to receive(:run!).with("git fetch origin
|
|
100
|
+
expect(cli).to receive(:run!).with("git fetch origin")
|
|
101
|
+
expect(cli).to receive(:run!).with("git fetch origin master:master").twice
|
|
100
102
|
expect(cli).to receive(:run!).with("git push -f origin feature-branch:feature-branch")
|
|
101
103
|
expect(cli).to receive(:invoke).with(:ci, ["feature-branch"], {})
|
|
102
104
|
expect(cli).to receive(:run!).with("git push origin feature-branch:master")
|
|
103
|
-
expect(cli).to receive(:run!).with("git fetch origin master:master")
|
|
104
105
|
expect(production_server).to receive(:run!).with("git pull origin master && bin/setup")
|
|
105
106
|
|
|
106
107
|
cli.deploy
|
|
@@ -141,7 +142,7 @@ describe Bard::CLI::Deploy do
|
|
|
141
142
|
|
|
142
143
|
context "with clone option" do
|
|
143
144
|
it "clones repository and sets up application" do
|
|
144
|
-
allow(cli).to receive(:options).and_return({ clone: true })
|
|
145
|
+
allow(cli).to receive(:options).and_return({ clone: true, target: "production" })
|
|
145
146
|
|
|
146
147
|
expect(production_server).to receive(:run!).with("git clone git@github.com:botandrosedesign/test_project /var/www/test_project", home: true)
|
|
147
148
|
expect(cli).to receive(:invoke).with(:master_key, [], from: "local", to: :production)
|
|
@@ -168,13 +169,14 @@ describe Bard::CLI::Deploy do
|
|
|
168
169
|
|
|
169
170
|
before do
|
|
170
171
|
allow(config).to receive(:[]).with(:staging).and_return(staging_server)
|
|
172
|
+
allow(cli).to receive(:options).and_return({ target: "staging" })
|
|
171
173
|
end
|
|
172
174
|
|
|
173
175
|
it "deploys to specified target" do
|
|
174
176
|
expect(staging_server).to receive(:run!).with("git pull origin master && bin/setup")
|
|
175
177
|
expect(cli).to receive(:ping).with(:staging)
|
|
176
178
|
|
|
177
|
-
cli.deploy
|
|
179
|
+
cli.deploy
|
|
178
180
|
end
|
|
179
181
|
end
|
|
180
182
|
|
|
@@ -191,12 +193,22 @@ describe Bard::CLI::Deploy do
|
|
|
191
193
|
|
|
192
194
|
context "with local-ci option" do
|
|
193
195
|
it "passes local-ci option to CI invocation" do
|
|
194
|
-
allow(cli).to receive(:options).and_return({ "local-ci" => true })
|
|
196
|
+
allow(cli).to receive(:options).and_return({ "local-ci" => true, target: "production" })
|
|
195
197
|
|
|
196
198
|
expect(cli).to receive(:invoke).with(:ci, ["feature-branch"], { "local-ci" => true })
|
|
197
199
|
|
|
198
200
|
cli.deploy
|
|
199
201
|
end
|
|
200
202
|
end
|
|
203
|
+
|
|
204
|
+
context "with ci option" do
|
|
205
|
+
it "passes ci option to CI invocation" do
|
|
206
|
+
allow(cli).to receive(:options).and_return({ "ci" => "jenkins", target: "production" })
|
|
207
|
+
|
|
208
|
+
expect(cli).to receive(:invoke).with(:ci, ["feature-branch"], { "ci" => "jenkins" })
|
|
209
|
+
|
|
210
|
+
cli.deploy
|
|
211
|
+
end
|
|
212
|
+
end
|
|
201
213
|
end
|
|
202
214
|
end
|
data/spec/bard/cli/hurt_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "bard/cli/hurt"
|
|
|
4
4
|
require "thor"
|
|
5
5
|
|
|
6
6
|
class TestHurtCLI < Thor
|
|
7
|
-
|
|
7
|
+
Bard::CLI::Hurt.setup(self)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe Bard::CLI::Hurt do
|
|
@@ -20,4 +20,4 @@ describe Bard::CLI::Hurt do
|
|
|
20
20
|
expect(cli).to respond_to(:hurt)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
-
end
|
|
23
|
+
end
|
|
@@ -4,7 +4,7 @@ require "bard/cli/install"
|
|
|
4
4
|
require "thor"
|
|
5
5
|
|
|
6
6
|
class TestInstallCLI < Thor
|
|
7
|
-
|
|
7
|
+
Bard::CLI::Install.setup(self)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe Bard::CLI::Install do
|
|
@@ -16,10 +16,10 @@ describe Bard::CLI::Install do
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it "should copy install files to bin directory" do
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
expect_any_instance_of(Bard::CLI::Install).to receive(:system).with(/cp -R .*install_files\/\* bin\//)
|
|
20
|
+
expect_any_instance_of(Bard::CLI::Install).to receive(:system).with(/cp -R .*install_files\/\.github \.\//)
|
|
21
21
|
|
|
22
22
|
cli.install
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
end
|
|
25
|
+
end
|
data/spec/bard/cli/open_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "bard/cli/open"
|
|
|
4
4
|
require "thor"
|
|
5
5
|
|
|
6
6
|
class TestOpenCLI < Thor
|
|
7
|
-
|
|
7
|
+
Bard::CLI::Open.setup(self)
|
|
8
8
|
|
|
9
9
|
attr_reader :config
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ describe Bard::CLI::Open do
|
|
|
25
25
|
|
|
26
26
|
before do
|
|
27
27
|
allow(cli).to receive(:config).and_return(config)
|
|
28
|
-
|
|
28
|
+
allow_any_instance_of(Bard::CLI::Open).to receive(:exec)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe "#open" do
|
|
@@ -34,7 +34,7 @@ describe Bard::CLI::Open do
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "should open production server URL by default" do
|
|
37
|
-
|
|
37
|
+
expect_any_instance_of(Bard::CLI::Open).to receive(:exec).with("xdg-open https://example.com")
|
|
38
38
|
|
|
39
39
|
cli.open
|
|
40
40
|
end
|
|
@@ -43,13 +43,13 @@ describe Bard::CLI::Open do
|
|
|
43
43
|
staging_server = double("staging", ping: ["https://staging.example.com"])
|
|
44
44
|
allow(config).to receive(:[]).with(:staging).and_return(staging_server)
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
expect_any_instance_of(Bard::CLI::Open).to receive(:exec).with("xdg-open https://staging.example.com")
|
|
47
47
|
|
|
48
48
|
cli.open(:staging)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it "should open CI URL when server is ci" do
|
|
52
|
-
|
|
52
|
+
expect_any_instance_of(Bard::CLI::Open).to receive(:exec).with("xdg-open https://github.com/botandrosedesign/test_project/actions/workflows/ci.yml")
|
|
53
53
|
|
|
54
54
|
cli.open(:ci)
|
|
55
55
|
end
|
|
@@ -57,11 +57,13 @@ describe Bard::CLI::Open do
|
|
|
57
57
|
|
|
58
58
|
describe "#open_url" do
|
|
59
59
|
it "returns CI URL for ci server" do
|
|
60
|
-
|
|
60
|
+
command = Bard::CLI::Open.new(cli)
|
|
61
|
+
expect(command.send(:open_url, :ci)).to eq("https://github.com/botandrosedesign/test_project/actions/workflows/ci.yml")
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
it "returns server ping URL for other servers" do
|
|
64
|
-
|
|
65
|
+
command = Bard::CLI::Open.new(cli)
|
|
66
|
+
expect(command.send(:open_url, :production)).to eq("https://example.com")
|
|
65
67
|
end
|
|
66
68
|
end
|
|
67
|
-
end
|
|
69
|
+
end
|
data/spec/bard/cli/ping_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "bard/cli/ping"
|
|
|
4
4
|
require "thor"
|
|
5
5
|
|
|
6
6
|
class TestPingCLI < Thor
|
|
7
|
-
|
|
7
|
+
Bard::CLI::Ping.setup(self)
|
|
8
8
|
|
|
9
9
|
attr_reader :config
|
|
10
10
|
|
|
@@ -21,8 +21,8 @@ describe Bard::CLI::Ping do
|
|
|
21
21
|
|
|
22
22
|
before do
|
|
23
23
|
allow(cli).to receive(:config).and_return(config)
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
allow_any_instance_of(Bard::CLI::Ping).to receive(:puts)
|
|
25
|
+
allow_any_instance_of(Bard::CLI::Ping).to receive(:exit)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
describe "#ping" do
|
|
@@ -39,9 +39,9 @@ describe Bard::CLI::Ping do
|
|
|
39
39
|
it "should print down URLs when they exist" do
|
|
40
40
|
down_urls = ["https://down.example.com"]
|
|
41
41
|
allow(Bard::Ping).to receive(:call).and_return(down_urls)
|
|
42
|
-
|
|
42
|
+
expect_any_instance_of(Bard::CLI::Ping).to receive(:puts).with("https://down.example.com is down!")
|
|
43
43
|
|
|
44
44
|
cli.ping
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
|
-
end
|
|
47
|
+
end
|
data/spec/bard/cli/run_spec.rb
CHANGED
|
@@ -25,6 +25,7 @@ describe Bard::CLI::Run do
|
|
|
25
25
|
allow(cli).to receive(:exit)
|
|
26
26
|
allow(cli).to receive(:red).and_return("")
|
|
27
27
|
allow(cli).to receive(:yellow).and_return("")
|
|
28
|
+
allow(cli).to receive(:options).and_return({ target: "production" })
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
describe "#run" do
|
|
@@ -33,7 +34,25 @@ describe Bard::CLI::Run do
|
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
it "should run command on production server" do
|
|
36
|
-
expect(server).to receive(:run!).with("ls -la", verbose: true)
|
|
37
|
+
expect(server).to receive(:run!).with("ls -la", verbose: true, home: nil)
|
|
38
|
+
|
|
39
|
+
cli.run("ls", "-la")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should run command on specified target" do
|
|
43
|
+
staging_server = double("staging_server")
|
|
44
|
+
allow(cli).to receive(:config).and_return(config.merge(staging: staging_server))
|
|
45
|
+
allow(cli).to receive(:options).and_return({ target: "staging" })
|
|
46
|
+
|
|
47
|
+
expect(staging_server).to receive(:run!).with("ls -la", verbose: true, home: nil)
|
|
48
|
+
|
|
49
|
+
cli.run("ls", "-la")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should pass home option to target" do
|
|
53
|
+
allow(cli).to receive(:options).and_return({ target: "production", home: true })
|
|
54
|
+
|
|
55
|
+
expect(server).to receive(:run!).with("ls -la", verbose: true, home: true)
|
|
37
56
|
|
|
38
57
|
cli.run("ls", "-la")
|
|
39
58
|
end
|
data/spec/bard/cli/vim_spec.rb
CHANGED
|
@@ -4,14 +4,14 @@ require "bard/cli/vim"
|
|
|
4
4
|
require "thor"
|
|
5
5
|
|
|
6
6
|
class TestVimCLI < Thor
|
|
7
|
-
|
|
7
|
+
Bard::CLI::Vim.setup(self)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe Bard::CLI::Vim do
|
|
11
11
|
let(:cli) { TestVimCLI.new }
|
|
12
12
|
|
|
13
13
|
before do
|
|
14
|
-
|
|
14
|
+
allow_any_instance_of(Bard::CLI::Vim).to receive(:exec)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
describe "#vim" do
|
|
@@ -20,15 +20,15 @@ describe Bard::CLI::Vim do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it "should exec vim with git diff files by default" do
|
|
23
|
-
|
|
23
|
+
expect_any_instance_of(Bard::CLI::Vim).to receive(:exec).with("vim -p `(git diff master --name-only; git ls-files --others --exclude-standard) | grep -v '^app/assets/images/' | grep -v '^app/assets/stylesheets/' | while read f; do [ -f \"$f\" ] && ! file -b \"$f\" | grep -q \"binary\" && echo \"$f\"; done | tac`")
|
|
24
24
|
|
|
25
25
|
cli.vim
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "should exec vim with specified branch" do
|
|
29
|
-
|
|
29
|
+
expect_any_instance_of(Bard::CLI::Vim).to receive(:exec).with("vim -p `(git diff develop --name-only; git ls-files --others --exclude-standard) | grep -v '^app/assets/images/' | grep -v '^app/assets/stylesheets/' | while read f; do [ -f \"$f\" ] && ! file -b \"$f\" | grep -q \"binary\" && echo \"$f\"; done | tac`")
|
|
30
30
|
|
|
31
31
|
cli.vim("develop")
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
|
-
end
|
|
34
|
+
end
|
data/spec/bard/github_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ describe Bard::Github do
|
|
|
5
5
|
let(:github) { Bard::Github.new("test-project") }
|
|
6
6
|
|
|
7
7
|
before do
|
|
8
|
-
allow(
|
|
8
|
+
allow(Bard::Secrets).to receive(:fetch).with("github-apikey").and_return("12345")
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
describe "#get" do
|
|
@@ -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
|
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.0
|
|
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-10 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
|
-
|