bard 1.8.0.beta4 → 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 315f02fbb865e24647f358979a3f135d6a9b5fa58d27d447cc92cc9462ba80b6
|
|
4
|
+
data.tar.gz: 3fd528b19bbfb0edfeb3b05aff689a4c4bc52ef9c2ac218566b1c0be8e071ade
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 464041788694b06f9ef754a01a5de77e198140ad738cc60a7596110f32044b0e8b73ebb405aa210b488ad269b64d3829d51b368cc297617b9c0c8bfc479126c6
|
|
7
|
+
data.tar.gz: c48d80a55fc37dd081cb6220919c9f3cef0f0356f75b8befcd8fd1dbf89e11619075f3db9b8ec7cdf387da9e80ee120b39a93b500c839ba816c627cea3dff6ae
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -34,10 +34,5 @@ jobs:
|
|
|
34
34
|
done
|
|
35
35
|
echo "DOCKER_HOST=tcp://127.0.0.1:8080" >> $GITHUB_ENV
|
|
36
36
|
|
|
37
|
-
- name: Build test container image
|
|
38
|
-
run: |
|
|
39
|
-
sudo podman pull ubuntu:22.04
|
|
40
|
-
sudo podman build -t bard-test-server -f spec/acceptance/docker/Dockerfile spec/acceptance/docker
|
|
41
|
-
|
|
42
37
|
- name: Run tests
|
|
43
38
|
run: bundle exec rake
|
data/MIGRATION_GUIDE.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
This guide will help you migrate your Bard configuration from v1.x to v2.0.
|
|
4
4
|
|
|
5
|
-
> **Note:** Bard v1.8.0 is a transitional release that supports both v1.x and v2.0 APIs. When using deprecated v1.x patterns, you'll see deprecation warnings indicating what to change. This gives you time to migrate at your own pace while keeping your deployments working.
|
|
6
|
-
|
|
7
5
|
## Overview of Changes
|
|
8
6
|
|
|
9
7
|
Bard v2.0 introduces a cleaner, more modular architecture:
|
|
@@ -479,35 +477,22 @@ mv bard.rb.backup bard.rb
|
|
|
479
477
|
- Check [CUSTOM_STRATEGIES.md](CUSTOM_STRATEGIES.md) for strategy creation
|
|
480
478
|
- Open an issue at https://github.com/botandrose/bard/issues
|
|
481
479
|
|
|
482
|
-
## Transitional Release (v1.
|
|
480
|
+
## Transitional Release (v1.9.x)
|
|
483
481
|
|
|
484
|
-
|
|
482
|
+
A transitional release (v1.9.x) will support both v1 and v2 APIs simultaneously with deprecation warnings. This allows gradual migration.
|
|
485
483
|
|
|
486
|
-
**Using v1.
|
|
484
|
+
**Using v1.9.x:**
|
|
487
485
|
```bash
|
|
488
486
|
# Gemfile
|
|
489
|
-
gem 'bard', '~> 1.
|
|
487
|
+
gem 'bard', '~> 1.9'
|
|
490
488
|
|
|
491
489
|
bundle update bard
|
|
492
490
|
```
|
|
493
491
|
|
|
494
|
-
v1.
|
|
495
|
-
- Accept both `server` and `target` (with deprecation warning
|
|
496
|
-
- Accept both old and new SSH configuration styles
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
- Support full v2.0 API
|
|
492
|
+
v1.9.x will:
|
|
493
|
+
- Accept both `server` and `target` (with deprecation warning)
|
|
494
|
+
- Accept both old and new SSH configuration styles
|
|
495
|
+
- Show deprecation warnings for old API usage
|
|
496
|
+
- Support full v2 API
|
|
500
497
|
|
|
501
498
|
This gives you time to migrate at your own pace while keeping your deployments working.
|
|
502
|
-
|
|
503
|
-
### Deprecation Warnings
|
|
504
|
-
|
|
505
|
-
When using deprecated patterns, you'll see warnings like:
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
[DEPRECATION] `server` is deprecated; use `target` instead (will be removed in v2.0) (called from bard.rb:3)
|
|
509
|
-
[DEPRECATION] Separate SSH options are deprecated; pass as keyword arguments to `ssh` instead (will be removed in v2.0) (called from bard.rb:5)
|
|
510
|
-
[DEPRECATION] `strategy` is deprecated; use the strategy method directly (will be removed in v2.0) (called from bard.rb:10)
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
These warnings help you identify what needs to change before upgrading to v2.0.
|
data/Rakefile
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Feature: Bard can check its environment for missing dependencies and potential problems
|
|
2
|
+
|
|
3
|
+
Scenario: Bard check returns its version
|
|
4
|
+
When I type "bard check -v"
|
|
5
|
+
Then I should see the current version of bard
|
|
6
|
+
And I should see the current version of git
|
|
7
|
+
And I should see the current version of rubygems
|
|
8
|
+
And I should see the current version of ruby
|
|
9
|
+
|
|
10
|
+
Scenario: Bard check examines a local project for problems
|
|
11
|
+
Given a shared rails project
|
|
12
|
+
When I type "bard check"
|
|
13
|
+
Then I should see "No problems"
|
|
14
|
+
|
|
15
|
+
Scenario: Bard check detects missing database
|
|
16
|
+
Given a shared rails project
|
|
17
|
+
And the database is missing
|
|
18
|
+
When I type "bard check"
|
|
19
|
+
Then I should see the fatal error "missing database"
|
|
20
|
+
|
|
21
|
+
Scenario: Bard check detects pending migrations
|
|
22
|
+
Given a shared rails project
|
|
23
|
+
And a commit with a new migration
|
|
24
|
+
When I type "bard check"
|
|
25
|
+
Then I should see the fatal error "pending migrations"
|
|
26
|
+
|
|
27
|
+
Scenario: Bard check detects missing config/database.yml
|
|
28
|
+
Given a shared rails project
|
|
29
|
+
And "config/database.yml" is missing
|
|
30
|
+
When I type "bard check"
|
|
31
|
+
Then I should see the fatal error "missing config/database.yml"
|
|
32
|
+
|
|
33
|
+
Scenario: Bard check detects missing submodules
|
|
34
|
+
Given a shared rails project
|
|
35
|
+
And a submodule
|
|
36
|
+
And the submodule is missing
|
|
37
|
+
When I type "bard check"
|
|
38
|
+
Then I should see the fatal error "missing submodule"
|
|
39
|
+
|
|
40
|
+
Scenario: Bard check detects submodules with detached heads
|
|
41
|
+
Given a shared rails project
|
|
42
|
+
And a submodule
|
|
43
|
+
And the submodule has a detached head
|
|
44
|
+
When I type "bard check"
|
|
45
|
+
Then I should see the fatal error "submodule has a detached head"
|
|
46
|
+
|
|
47
|
+
Scenario: Bard check detects missing gems
|
|
48
|
+
Given a shared rails project
|
|
49
|
+
And the test gem is not installed
|
|
50
|
+
And a commit that adds the test gem as a dependency
|
|
51
|
+
When I type "bard check"
|
|
52
|
+
Then I should see the fatal error "missing gems"
|
|
53
|
+
|
|
54
|
+
Scenario: Bard check detects master branch checked out
|
|
55
|
+
Given a shared rails project
|
|
56
|
+
And I am on the "master" branch
|
|
57
|
+
When I type "bard check"
|
|
58
|
+
Then I should see the fatal error "master branch"
|
|
59
|
+
|
|
60
|
+
Scenario: Bard check detects missing integration branch
|
|
61
|
+
Given a shared rails project
|
|
62
|
+
And there is no integration branch
|
|
63
|
+
When I type "bard check"
|
|
64
|
+
Then I should see the fatal error "missing integration branch"
|
|
65
|
+
|
|
66
|
+
Scenario: Bard check detects non-tracking integration branch
|
|
67
|
+
Given a shared rails project
|
|
68
|
+
And the integration branch isnt tracking origin/integration
|
|
69
|
+
When I type "bard check"
|
|
70
|
+
Then I should see the fatal error "tracking"
|
|
71
|
+
|
|
72
|
+
Scenario: Bard check detects gitignored Capfile
|
|
73
|
+
Given a shared rails project
|
|
74
|
+
And the ".gitignore" file includes "Capfile"
|
|
75
|
+
When I type "bard check"
|
|
76
|
+
Then I should see the fatal error "Capfile should not be gitignored"
|
|
77
|
+
|
|
78
|
+
Scenario: Bard check detects gitignored config/deploy.rb
|
|
79
|
+
Given a shared rails project
|
|
80
|
+
And the ".gitignore" file includes "config/deploy.rb"
|
|
81
|
+
When I type "bard check"
|
|
82
|
+
Then I should see the fatal error "config/deploy.rb should not be gitignored"
|
|
83
|
+
|
|
84
|
+
Scenario: Bard check detects missing bard rake tasks
|
|
85
|
+
Given a shared rails project
|
|
86
|
+
And the "Rakefile" file does not include "bard/rake"
|
|
87
|
+
When I type "bard check"
|
|
88
|
+
Then I should see the fatal error "missing bard rake tasks"
|
|
89
|
+
|
|
90
|
+
Scenario: Bard check detects missing bard cap tasks
|
|
91
|
+
Given a shared rails project
|
|
92
|
+
And the "Capfile" file does not include "bard/capistrano"
|
|
93
|
+
When I type "bard check"
|
|
94
|
+
Then I should see the fatal error "missing bard capistrano tasks"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: Bard deploy should fold the integration branch into master and perform a deploy
|
|
2
|
+
|
|
3
|
+
Scenario: Bard deploy detects non-fast-forward merge from integration to master
|
|
4
|
+
Given a shared rails project
|
|
5
|
+
And on development_b, a commit on the "master" branch
|
|
6
|
+
And on development_b, I type "git push origin master"
|
|
7
|
+
And a commit
|
|
8
|
+
When I type "bard deploy"
|
|
9
|
+
Then I should see the fatal error "Rebase"
|
|
10
|
+
|
|
11
|
+
Scenario: Bard deploy works
|
|
12
|
+
Given a shared rails project
|
|
13
|
+
And a commit
|
|
14
|
+
When I type "bard deploy"
|
|
15
|
+
Then the "master" branch should match the "integration" branch
|
|
16
|
+
And the "integration" branch should match the "origin/integration" branch
|
|
17
|
+
And the "origin/master" branch should match the "origin/integration" branch
|
|
18
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Feature: bard pull
|
|
2
|
+
Background:
|
|
3
|
+
Given a shared rails project
|
|
4
|
+
|
|
5
|
+
Scenario: Pulling down the latest changes from the remote integration branch
|
|
6
|
+
Given on development_b, a commit
|
|
7
|
+
And on development_b, I type "bard push"
|
|
8
|
+
When I type "bard pull"
|
|
9
|
+
Then the "integration" branch should match the "development_b:integration" branch
|
|
10
|
+
|
|
11
|
+
Scenario: Pulling down when the latest changes include a submodule addition
|
|
12
|
+
Given on development_b, a commit with a new submodule
|
|
13
|
+
And on development_b, I type "bard push"
|
|
14
|
+
When I type "bard pull"
|
|
15
|
+
Then the "integration" branch should match the "development_b:integration" branch
|
|
16
|
+
And there should be one new submodule
|
|
17
|
+
And the submodule branch should match the submodule origin branch
|
|
18
|
+
And the submodule working directory should be clean
|
|
19
|
+
|
|
20
|
+
Scenario: Pulling down when the latest changes include a submodule update
|
|
21
|
+
Given a submodule
|
|
22
|
+
And on development_b, a commit with a submodule update
|
|
23
|
+
And on development_b, I type "bard push"
|
|
24
|
+
When I type "bard pull"
|
|
25
|
+
Then the "integration" branch should match the "development_b:integration" branch
|
|
26
|
+
And the submodule branch should match the submodule origin branch
|
|
27
|
+
And the submodule working directory should be clean
|
|
28
|
+
|
|
29
|
+
Scenario: Pulling down when the latest changes include a submodule url change
|
|
30
|
+
Given a submodule
|
|
31
|
+
And on development_b, a commit with a submodule url change
|
|
32
|
+
And on development_b, I type "bard push"
|
|
33
|
+
When I type "bard pull"
|
|
34
|
+
Then the "integration" branch should match the "development_b:integration" branch
|
|
35
|
+
And the submodule url should be changed
|
|
36
|
+
And the submodule branch should match the submodule origin branch
|
|
37
|
+
And the submodule working directory should be clean
|
|
38
|
+
|
|
39
|
+
# TODO
|
|
40
|
+
#Scenario: Pulling down when the latest changes include a submodule deletion
|
|
41
|
+
# Given a submodule
|
|
42
|
+
# And on staging, a commit with a submodule deletion
|
|
43
|
+
# When I type "bard pull"
|
|
44
|
+
# Then the "integration" branch should match the "origin/integration" branch
|
|
45
|
+
# And the submodule should be deleted
|
|
46
|
+
|
|
47
|
+
Scenario: Pulling latest changes from the remote integration branch after committing locally
|
|
48
|
+
Given on development_b, a commit
|
|
49
|
+
And on development_b, I type "bard push"
|
|
50
|
+
And a commit
|
|
51
|
+
When I type "bard pull"
|
|
52
|
+
Then I should see the warning "Someone has pushed some changes"
|
|
53
|
+
And the "integration" branch should be a fast-forward from the "development_b:integration" branch
|
|
54
|
+
|
|
55
|
+
Scenario: Bard pull from a topic branch
|
|
56
|
+
Given on development_b, a commit on the "topic" branch
|
|
57
|
+
And on development_b, I am on the "topic" branch
|
|
58
|
+
And on development_b, I type "bard push"
|
|
59
|
+
And I am on the "topic" branch
|
|
60
|
+
When I type "bard pull"
|
|
61
|
+
Then the "topic" branch should match the "development_b:topic" branch
|
|
62
|
+
|
|
63
|
+
Scenario: Trying to bard pull when not in the project root
|
|
64
|
+
Given I am in a subdirectory
|
|
65
|
+
When I type "bard pull"
|
|
66
|
+
Then I should see the fatal error "root directory"
|
|
67
|
+
|
|
68
|
+
Scenario: Trying to bard pull with a dirty working directory
|
|
69
|
+
Given on development_b, a commit
|
|
70
|
+
And on development_b, I type "bard push"
|
|
71
|
+
And a dirty working directory
|
|
72
|
+
When I type "bard pull"
|
|
73
|
+
Then I should see the fatal error "You have uncommitted changes!"
|
|
74
|
+
And the "integration" branch should not match the "development_b:integration" branch
|
|
75
|
+
|
|
76
|
+
Scenario: Trying to bard pull when on the "master" branch
|
|
77
|
+
Given on development_b, a commit on the "master" branch
|
|
78
|
+
And on development_b, I am on the "master" branch
|
|
79
|
+
And on development_b, I type "git push origin master"
|
|
80
|
+
And I am on the "master" branch
|
|
81
|
+
When I type "bard pull"
|
|
82
|
+
Then I should see the fatal error "on the master branch"
|
|
83
|
+
And the "master" branch should not match the "development_b:master" branch
|
|
84
|
+
|
|
85
|
+
Scenario: Pulling in a change that includes a migration on a dev machine
|
|
86
|
+
Given on development_b, a commit with a new migration
|
|
87
|
+
And on development_b, I type "bard push"
|
|
88
|
+
And a development database
|
|
89
|
+
When I type "bard pull"
|
|
90
|
+
Then the development database should include that migration
|
|
91
|
+
|
|
92
|
+
Scenario: Pulling in a change that includes a migration on a dev and testing machine
|
|
93
|
+
Given on development_b, a commit with a new migration
|
|
94
|
+
And on development_b, I type "bard push"
|
|
95
|
+
And a development database
|
|
96
|
+
And a test database
|
|
97
|
+
When I type "bard pull"
|
|
98
|
+
Then the development database should include that migration
|
|
99
|
+
And the test database should include that migration
|
|
100
|
+
|
|
101
|
+
Scenario: Pulling in a change that includes a gem dependency change
|
|
102
|
+
Given the test gem is not installed
|
|
103
|
+
And on development_b, a commit that adds the test gem as a dependency
|
|
104
|
+
And on development_b, I type "bard push"
|
|
105
|
+
When I type "bard pull"
|
|
106
|
+
Then the test gem should be installed
|
|
107
|
+
|
|
108
|
+
Scenario: Pulling in a change should restart the rails server
|
|
109
|
+
Given on development_b, a commit
|
|
110
|
+
And on development_b, I type "bard push"
|
|
111
|
+
When I type "bard pull"
|
|
112
|
+
Then passenger should have been restarted
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Feature: bard push
|
|
2
|
+
Background:
|
|
3
|
+
Given a shared rails project
|
|
4
|
+
|
|
5
|
+
Scenario: Uploading local changes onto the remote integration branch
|
|
6
|
+
Given a commit
|
|
7
|
+
When I type "bard push"
|
|
8
|
+
And on staging, I type "bard stage"
|
|
9
|
+
Then the "integration" branch should match the "staging:integration" branch
|
|
10
|
+
|
|
11
|
+
Scenario: Uploading local changes onto a remote topic branch
|
|
12
|
+
Given a commit on the "topic" branch
|
|
13
|
+
And I am on the "topic" branch
|
|
14
|
+
When I type "bard push"
|
|
15
|
+
Then the "topic" branch should match the "origin/topic" branch
|
|
16
|
+
|
|
17
|
+
Scenario: Pushing a change that includes a migration
|
|
18
|
+
Given on staging, a staging database
|
|
19
|
+
And a commit with a new migration
|
|
20
|
+
When I type "bard push"
|
|
21
|
+
And on staging, I type "bard stage"
|
|
22
|
+
Then on staging, the staging database should include that migration
|
|
23
|
+
|
|
24
|
+
Scenario: Pushing a change that includes a gem dependency change
|
|
25
|
+
Given the test gem is not installed
|
|
26
|
+
And a commit that adds the test gem as a dependency
|
|
27
|
+
When I type "bard push"
|
|
28
|
+
And on staging, I type "bard stage"
|
|
29
|
+
Then on staging, the test gem should be installed
|
|
30
|
+
|
|
31
|
+
Scenario: Pushing a change should advance the staging HEAD and restart the staging rails server
|
|
32
|
+
Given a commit
|
|
33
|
+
When I type "bard push"
|
|
34
|
+
And on staging, I type "bard stage"
|
|
35
|
+
And the "integration" branch should match the "staging:integration" branch
|
|
36
|
+
Then on staging, passenger should have been restarted
|
|
37
|
+
|
|
38
|
+
Scenario: Pushing a change that includes a submodule addition
|
|
39
|
+
Given a commit with a new submodule
|
|
40
|
+
When I type "bard push"
|
|
41
|
+
And on staging, I type "bard stage"
|
|
42
|
+
Then on staging, there should be one new submodule
|
|
43
|
+
And the submodule branch should match the submodule origin branch
|
|
44
|
+
And on staging, the submodule working directory should be clean
|
|
45
|
+
|
|
46
|
+
Scenario: Pushing a change that includes a submodule update
|
|
47
|
+
Given a submodule
|
|
48
|
+
And a commit with a submodule update
|
|
49
|
+
When I type "bard push"
|
|
50
|
+
And on staging, I type "bard stage"
|
|
51
|
+
Then the submodule branch should match the submodule origin branch
|
|
52
|
+
Then on staging, the submodule working directory should be clean
|
|
53
|
+
|
|
54
|
+
Scenario: Pushing a change that includes a submodule url change
|
|
55
|
+
Given a submodule
|
|
56
|
+
And a commit with a submodule url change
|
|
57
|
+
When I type "bard push"
|
|
58
|
+
And on staging, I type "bard stage"
|
|
59
|
+
Then on staging, the submodule url should be changed
|
|
60
|
+
And the submodule branch should match the submodule origin branch
|
|
61
|
+
Then on staging, the submodule working directory should be clean
|
|
62
|
+
|
|
63
|
+
# TODO
|
|
64
|
+
#Scenario: Pushing a change that includes a submodule deletion
|
|
65
|
+
# Given a submodule
|
|
66
|
+
# Given I have committed a set of changes that includes a submodule deletion
|
|
67
|
+
# When I type "bard push"
|
|
68
|
+
# And on staging, I type "bard stage"
|
|
69
|
+
# Then the remote submodule should be deleted
|
|
70
|
+
|
|
71
|
+
Scenario: Trying to bard push when not in the project root
|
|
72
|
+
Given I am in a subdirectory
|
|
73
|
+
When I type "bard push"
|
|
74
|
+
Then I should see the fatal error "root directory"
|
|
75
|
+
|
|
76
|
+
Scenario: Trying to bard push when not on the integration branch
|
|
77
|
+
Given a commit on the "master" branch
|
|
78
|
+
And I am on the "master" branch
|
|
79
|
+
When I type "bard push"
|
|
80
|
+
Then I should see the fatal error "on the master branch"
|
|
81
|
+
And the "master" branch should not match the "origin/master" branch
|
|
82
|
+
|
|
83
|
+
Scenario: Trying to bard push with a dirty working directory
|
|
84
|
+
Given a commit
|
|
85
|
+
And a dirty working directory
|
|
86
|
+
When I type "bard push"
|
|
87
|
+
Then I should see the fatal error "You have uncommitted changes!"
|
|
88
|
+
And the "integration" branch should not match the "origin/integration" branch
|
|
89
|
+
|
|
90
|
+
Scenario: Trying to bard push with a non-fast-foward changeset
|
|
91
|
+
Given a commit
|
|
92
|
+
And on development_b, a commit
|
|
93
|
+
And on development_b, I type "bard push"
|
|
94
|
+
When I type "bard push"
|
|
95
|
+
Then I should see the fatal error "Someone has pushed some changes"
|
|
96
|
+
And the "integration" branch should not match the "origin/integration" branch
|
|
97
|
+
|
|
98
|
+
Scenario: Trying to bard push with an uncommitted change to a submodule
|
|
99
|
+
Given a submodule
|
|
100
|
+
And a commit
|
|
101
|
+
And the submodule working directory is dirty
|
|
102
|
+
When I type "bard push"
|
|
103
|
+
Then I should see the fatal error "Micah"
|
|
104
|
+
And the "integration" branch should not match the "origin/integration" branch
|
|
105
|
+
|
|
106
|
+
Scenario: Trying to bard push with a committed but unpushed change to a submodule
|
|
107
|
+
Given a submodule
|
|
108
|
+
And a commit to the submodule
|
|
109
|
+
And a commit
|
|
110
|
+
When I type "bard push"
|
|
111
|
+
Then I should see the fatal error "Micah"
|
|
112
|
+
And the "integration" branch should not match the "origin/integration" branch
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@podman
|
|
2
|
+
Feature: bard run against a podman TestContainers host
|
|
3
|
+
Background:
|
|
4
|
+
Given a podman testcontainer is ready for bard
|
|
5
|
+
|
|
6
|
+
Scenario: Running ls via bard run
|
|
7
|
+
Given a remote file "test-file.txt" exists in the test container
|
|
8
|
+
When I run bard "ls" against the test container
|
|
9
|
+
Then the bard command should succeed
|
|
10
|
+
And the bard output should include "test-file.txt"
|
|
11
|
+
|
|
12
|
+
Scenario: Running commands in isolated containers
|
|
13
|
+
Given a remote file "another-file.txt" containing "content" exists in the test container
|
|
14
|
+
When I run bard "cat another-file.txt" against the test container
|
|
15
|
+
Then the bard command should succeed
|
|
16
|
+
And the bard output should include "content"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Then /^I should see the current version of bard$/ do
|
|
2
|
+
version = File.read("#{ROOT}/VERSION").chomp
|
|
3
|
+
@stdout.should =~ /bard\s+\(#{Regexp.escape(version)}\)/
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Then /^I should see the current version of git$/ do
|
|
7
|
+
version = `git --version`[/[0-9]+\.[0-9]+\.[0-9]+/]
|
|
8
|
+
@stdout.should =~ /git\s+\(#{Regexp.escape(version)}/
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Then /^I should see the current version of rubygems$/ do
|
|
12
|
+
version = `gem --version`.chomp
|
|
13
|
+
@stdout.should =~ /rubygems\s+\(#{Regexp.escape(version)}\)/
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Then /^I should see the current version of ruby$/ do
|
|
17
|
+
version = `ruby --version`[/[0-9]+\.[0-9]+\.[0-9]+/]
|
|
18
|
+
@stdout.should =~ /ruby\s+\(#{Regexp.escape(version)}\)/
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Given /^"([^\"]*)" is missing$/ do |file|
|
|
22
|
+
type "rm #{file}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Given /^the database is missing$/ do
|
|
26
|
+
File.open "config/database.yml", "w" do |f|
|
|
27
|
+
f.puts <<-DB
|
|
28
|
+
development:
|
|
29
|
+
adapter: mysql
|
|
30
|
+
username: root
|
|
31
|
+
password:
|
|
32
|
+
database: bad_bad_bad
|
|
33
|
+
socket: /var/run/mysqld/mysqld.sock
|
|
34
|
+
DB
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Given /^the submodule is missing$/ do
|
|
39
|
+
type "rm -rf submodule"
|
|
40
|
+
type "mkdir submodule"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Given /^the submodule has a detached head$/ do
|
|
44
|
+
Dir.chdir "submodule" do
|
|
45
|
+
type "git checkout `git rev-parse HEAD`"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Given /^I am on the "([^\"]+)" branch$/ do |branch|
|
|
2
|
+
if `git branch` =~ / #{branch}$/
|
|
3
|
+
type "git checkout #{branch}"
|
|
4
|
+
else
|
|
5
|
+
type "git checkout -b #{branch}"
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^there is no integration branch$/ do
|
|
10
|
+
type "git checkout master"
|
|
11
|
+
type "git branch -d integration"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Given /^the integration branch isnt tracking origin\/integration$/ do
|
|
15
|
+
type "git checkout master"
|
|
16
|
+
type "git branch -d integration"
|
|
17
|
+
type "git checkout -b integration"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Given /^a dirty working directory$/ do
|
|
21
|
+
File.open("dirty_file", "w") { |f| f.puts "dirty dirty" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Given /^a commit$/ do
|
|
25
|
+
text = (rand * 100000000).round
|
|
26
|
+
type "echo '#{text}' > foobar_#{text}_file"
|
|
27
|
+
type "git add ."
|
|
28
|
+
type "git commit -am'test commit'"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Given /^a commit on the "([^\"]+)" branch$/ do |branch|
|
|
32
|
+
Given %(I am on the "#{branch}" branch)
|
|
33
|
+
text = (rand * 100000000).round
|
|
34
|
+
type "echo '#{text}' > #{branch}_#{text}_file"
|
|
35
|
+
type "git add ."
|
|
36
|
+
type "git commit -am 'testing #{branch} change'"
|
|
37
|
+
type "git checkout integration"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
Then /^the directory should not be dirty$/ do
|
|
41
|
+
type("git status").should include "working directory clean"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
Then /^I should be on the "([^\"]*)" branch$/ do |branch|
|
|
45
|
+
@repo.head.name.should == branch
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Then /^there should not be a "([^\"]*)" branch$/ do |branch_name|
|
|
49
|
+
@repo.branches.any? { |branch| branch.name == branch_name }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Then /^the "([^\"]*)" branch (should|should not) match the "([^\"]*)" branch$/ do |local_branch, which, remote_branch|
|
|
53
|
+
type "git fetch origin"
|
|
54
|
+
local_env, local_branch = local_branch.split(':') if local_branch.include? ':'
|
|
55
|
+
local_env ||= "development_a"
|
|
56
|
+
remote_env, remote_branch = remote_branch.split(':') if remote_branch.include? ':'
|
|
57
|
+
remote_env ||= "development_a"
|
|
58
|
+
local_sha = @repos[local_env].commits(local_branch).first.id
|
|
59
|
+
remote_sha = @repos[remote_env].commits(remote_branch).first.id
|
|
60
|
+
which = which.gsub(/ /, '_').to_sym
|
|
61
|
+
local_sha.send(which) == remote_sha
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Then /^the "([^\"]*)" branch should be a fast\-forward from the "([^\"]*)" branch$/ do |local_branch, remote_branch|
|
|
65
|
+
local_env, local_branch = local_branch.split(':') if local_branch.include? ':'
|
|
66
|
+
local_env ||= "development_a"
|
|
67
|
+
remote_env, remote_branch = remote_branch.split(':') if remote_branch.include? ':'
|
|
68
|
+
remote_env ||= "development_a"
|
|
69
|
+
local_sha = @repos[local_env].commits(local_branch).first.id
|
|
70
|
+
remote_sha = @repos[remote_env].commits(remote_branch).first.id
|
|
71
|
+
common_ancestor = @repos[local_env].find_common_ancestor local_sha, remote_sha
|
|
72
|
+
common_ancestor.should == remote_sha
|
|
73
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Given /^a shared rails project$/ do
|
|
2
|
+
# TEARDOWN
|
|
3
|
+
Dir.foreach "#{ROOT}/tmp" do |file|
|
|
4
|
+
FileUtils.rm_rf("#{ROOT}/tmp/#{file}") unless %w(fixtures . ..).include? file
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# SETUP
|
|
8
|
+
Dir.chdir ROOT
|
|
9
|
+
`cp -r tmp/fixtures/* tmp/`
|
|
10
|
+
|
|
11
|
+
Dir.chdir 'tmp'
|
|
12
|
+
@repos = {}
|
|
13
|
+
%w(development_a development_b staging production).each do |env|
|
|
14
|
+
@repos[env] = Grit::Repo.new env
|
|
15
|
+
end
|
|
16
|
+
Dir.chdir 'development_a'
|
|
17
|
+
@repo = @repos['development_a']
|
|
18
|
+
@env = { 'RAILS_ENV' => 'development', 'TESTING' => true }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Given /^I am in a subdirectory$/ do
|
|
22
|
+
FileUtils.mkdir "test_subdirectory"
|
|
23
|
+
Dir.chdir "test_subdirectory"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
When /^I type "([^\"]*)"$/ do |command|
|
|
27
|
+
type command.sub /\b(bard)\b/, "#{ROOT}/bin/bard"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
When /^on (\w+), (.*$)/ do |env, step|
|
|
31
|
+
old_env = @env['RAILS_ENV']
|
|
32
|
+
@env['RAILS_ENV'] = env if %w(staging production).include? env
|
|
33
|
+
Dir.chdir "#{ROOT}/tmp/#{env}" do
|
|
34
|
+
old_repo = @repo
|
|
35
|
+
@repo = @repos[env]
|
|
36
|
+
When step
|
|
37
|
+
@repo = old_repo
|
|
38
|
+
end
|
|
39
|
+
@env['RAILS_ENV'] = old_env
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Then /^I should see the fatal error "([^\"]*)"$/ do |error_message|
|
|
43
|
+
@stderr.should include(error_message)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
Then /^I should see the warning "([^\"]*)"$/ do |warning_message|
|
|
47
|
+
@stderr.should include(warning_message)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Then /^I should see "([^\"]*)"$/ do |message|
|
|
51
|
+
@stdout.should include(message)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Then /^debug$/ do
|
|
55
|
+
debugger
|
|
56
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Given /^a podman testcontainer is ready for bard$/ do
|
|
2
|
+
raise "Podman testcontainer failed to start" unless @podman_container && @podman_ssh_port
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given /^a remote file "([^\"]+)" exists in the test container$/ do |filename|
|
|
6
|
+
run_ssh("touch testproject/#{filename}").should be_true
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^a remote file "([^\"]+)" containing "([^\"]+)" exists in the test container$/ do |filename, content|
|
|
10
|
+
run_ssh("echo #{Shellwords.escape(content)} > testproject/#{filename}").should be_true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When /^I run bard "([^\"]+)" against the test container$/ do |command|
|
|
14
|
+
run_bard_against_container(command)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then /^the bard command should succeed$/ do
|
|
18
|
+
@status.success?.should be_true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then /^the bard output should include "([^\"]+)"$/ do |expected|
|
|
22
|
+
@stdout.should include(expected)
|
|
23
|
+
end
|