braid 1.1.4 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/braid +11 -0
- data/lib/braid/check_gem.rb +58 -0
- data/lib/braid/command.rb +13 -0
- data/lib/braid/commands/diff.rb +1 -1
- data/lib/braid/config.rb +28 -4
- data/{bin/braid → lib/braid/main.rb} +1 -16
- data/lib/braid/mirror.rb +110 -23
- data/lib/braid/operations.rb +9 -6
- data/lib/braid/operations_lite.rb +19 -1
- data/lib/braid/sorbet/fake_runtime.rb +68 -0
- data/lib/braid/sorbet/setup.rb +18 -0
- data/lib/braid/version.rb +1 -1
- data/lib/braid.rb +21 -0
- metadata +12 -75
- data/.gitignore +0 -16
- data/.travis.yml +0 -15
- data/CONTRIBUTING.md +0 -24
- data/Gemfile +0 -3
- data/README.md +0 -234
- data/Rakefile +0 -12
- data/_config.yml +0 -1
- data/braid.gemspec +0 -35
- data/braids-json.schema.json +0 -91
- data/config_versions.md +0 -58
- data/spec/config_spec.rb +0 -59
- data/spec/fixtures/shiny/README +0 -3
- data/spec/fixtures/shiny/other-skit/layout.liquid +0 -219
- data/spec/fixtures/shiny/skit-layout.liquid.test +0 -2
- data/spec/fixtures/shiny/skit1.test +0 -2
- data/spec/fixtures/shiny-conf-1.0.9-lock/.braids.json +0 -10
- data/spec/fixtures/shiny-conf-1.0.9-lock/expected.braids.json +0 -9
- data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-breaking-changes/.braids +0 -14
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/README.md +0 -9
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/index.html +0 -20
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/styles.css +0 -17
- data/spec/fixtures/shiny-conf-breaking-changes/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-breaking-changes/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-breaking-changes/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-future/.braids.json +0 -10
- data/spec/fixtures/shiny-conf-future/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-future/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-json-old-name/.braids +0 -9
- data/spec/fixtures/shiny-conf-json-old-name/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-json-old-name/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-json-old-name/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-yaml/.braids +0 -8
- data/spec/fixtures/shiny-conf-yaml/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-yaml/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-yaml/skit1/preview.png +0 -0
- data/spec/fixtures/shiny_skit1.2_merged/layouts/layout.liquid +0 -223
- data/spec/fixtures/shiny_skit1.2_merged/preview.png +0 -0
- data/spec/fixtures/shiny_skit1_conflicting/layouts/layout.liquid +0 -221
- data/spec/fixtures/shiny_skit1_conflicting/preview.png +0 -0
- data/spec/fixtures/shiny_skit1_mergeable/layouts/layout.liquid +0 -221
- data/spec/fixtures/shiny_skit1_mergeable/preview.png +0 -0
- data/spec/fixtures/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1/preview.png +0 -0
- data/spec/fixtures/skit1.1/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.1_with_filter/.gitattributes +0 -1
- data/spec/fixtures/skit1.1_with_filter/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.1_with_filter/preview.png +0 -0
- data/spec/fixtures/skit1.1x/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.2/layouts/layout.liquid +0 -221
- data/spec/fixtures/skit1.3/layouts/README.md +0 -1
- data/spec/fixtures/skit1.3/layouts/layout.liquid +0 -221
- data/spec/fixtures/skit1_with_filter/.gitattributes +0 -1
- data/spec/fixtures/skit1_with_filter/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1_with_filter/preview.png +0 -0
- data/spec/integration/adding_spec.rb +0 -230
- data/spec/integration/config_versioning_spec.rb +0 -222
- data/spec/integration/diff_spec.rb +0 -597
- data/spec/integration/integration_helper.rb +0 -126
- data/spec/integration/push_spec.rb +0 -402
- data/spec/integration/remove_spec.rb +0 -81
- data/spec/integration/status_spec.rb +0 -165
- data/spec/integration/updating_spec.rb +0 -487
- data/spec/mirror_spec.rb +0 -119
- data/spec/operations_spec.rb +0 -66
- data/spec/test_helper.rb +0 -19
@@ -1,230 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/integration_helper'
|
2
|
-
|
3
|
-
describe 'Adding a mirror in a clean repository' do
|
4
|
-
|
5
|
-
before do
|
6
|
-
FileUtils.rm_rf(TMP_PATH)
|
7
|
-
FileUtils.mkdir_p(TMP_PATH)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'from a git repository' do
|
11
|
-
before do
|
12
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
13
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
14
|
-
|
15
|
-
in_dir(@repository_dir) do
|
16
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should add the files and commit' do
|
21
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
22
|
-
|
23
|
-
in_dir(@repository_dir) do
|
24
|
-
assert_commit_subject(/Braid: Add mirror 'skit1' at '[0-9a-f]{7}'/)
|
25
|
-
assert_commit_author('Some body')
|
26
|
-
assert_commit_email('somebody@example.com')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should create .braids.json and add the mirror to it' do
|
31
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
32
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
33
|
-
mirror_obj = braids['mirrors']['skit1']
|
34
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
35
|
-
expect(mirror_obj['revision']).not_to be_nil
|
36
|
-
expect(mirror_obj['branch']).to eq('master')
|
37
|
-
expect(mirror_obj['tag']).to be_nil
|
38
|
-
expect(mirror_obj['path']).to be_nil
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'from a subdirectory in a git repository' do
|
43
|
-
before do
|
44
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
45
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
46
|
-
|
47
|
-
in_dir(@repository_dir) do
|
48
|
-
run_command("#{BRAID_BIN} add --path layouts #{@vendor_repository_dir} skit-layouts")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should add the files and commit' do
|
53
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit-layouts/layout.liquid")
|
54
|
-
|
55
|
-
in_dir(@repository_dir) do
|
56
|
-
assert_commit_subject(/Braid: Add mirror 'skit-layouts' at '[0-9a-f]{7}'/)
|
57
|
-
assert_commit_author('Some body')
|
58
|
-
assert_commit_email('somebody@example.com')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should create .braids.json and add the mirror to it' do
|
63
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
64
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
65
|
-
mirror_obj = braids['mirrors']['skit-layouts']
|
66
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
67
|
-
expect(mirror_obj['revision']).not_to be_nil
|
68
|
-
expect(mirror_obj['branch']).to eq('master')
|
69
|
-
expect(mirror_obj['tag']).to be_nil
|
70
|
-
expect(mirror_obj['path']).to eq('layouts')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'from a single file in a git repository' do
|
75
|
-
before do
|
76
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
77
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
78
|
-
|
79
|
-
in_dir(@repository_dir) do
|
80
|
-
run_command("#{BRAID_BIN} add --path layouts/layout.liquid #{@vendor_repository_dir} skit-layout.liquid")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should add the file and commit' do
|
85
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit-layout.liquid")
|
86
|
-
|
87
|
-
in_dir(@repository_dir) do
|
88
|
-
assert_commit_subject(/Braid: Add mirror 'skit-layout.liquid' at '[0-9a-f]{7}'/)
|
89
|
-
assert_commit_author('Some body')
|
90
|
-
assert_commit_email('somebody@example.com')
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'should create .braids.json and add the mirror to it' do
|
95
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
96
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
97
|
-
mirror_obj = braids['mirrors']['skit-layout.liquid']
|
98
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
99
|
-
expect(mirror_obj['revision']).not_to be_nil
|
100
|
-
expect(mirror_obj['branch']).to eq('master')
|
101
|
-
expect(mirror_obj['tag']).to be_nil
|
102
|
-
expect(mirror_obj['path']).to eq('layouts/layout.liquid')
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe 'from a tag in a git repository' do
|
107
|
-
before do
|
108
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
109
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
110
|
-
in_dir(@vendor_repository_dir) do
|
111
|
-
run_command('git tag v1')
|
112
|
-
end
|
113
|
-
|
114
|
-
in_dir(@repository_dir) do
|
115
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --tag v1")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'should add the files and commit' do
|
120
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
121
|
-
|
122
|
-
in_dir(@repository_dir) do
|
123
|
-
assert_commit_subject(/Braid: Add mirror 'skit1' at '[0-9a-f]{7}'/)
|
124
|
-
assert_commit_author('Some body')
|
125
|
-
assert_commit_email('somebody@example.com')
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'should create .braids.json and add the mirror to it' do
|
130
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
131
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
132
|
-
mirror_obj = braids['mirrors']['skit1']
|
133
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
134
|
-
expect(mirror_obj['revision']).not_to be_nil
|
135
|
-
expect(mirror_obj['branch']).to be_nil
|
136
|
-
expect(mirror_obj['tag']).to eq('v1')
|
137
|
-
expect(mirror_obj['path']).to be_nil
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe 'from an annotated tag in a git repository' do
|
142
|
-
before do
|
143
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
144
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
145
|
-
in_dir(@vendor_repository_dir) do
|
146
|
-
run_command('git tag -a -m "v1" v1')
|
147
|
-
end
|
148
|
-
|
149
|
-
in_dir(@repository_dir) do
|
150
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --tag v1")
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'should add the files and commit' do
|
155
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
156
|
-
|
157
|
-
in_dir(@repository_dir) do
|
158
|
-
assert_commit_subject(/Braid: Add mirror 'skit1' at '[0-9a-f]{7}'/)
|
159
|
-
assert_commit_author('Some body')
|
160
|
-
assert_commit_email('somebody@example.com')
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'should create .braids.json and add the mirror to it' do
|
165
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
166
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
167
|
-
mirror_obj = braids['mirrors']['skit1']
|
168
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
169
|
-
expect(mirror_obj['revision']).not_to be_nil
|
170
|
-
expect(mirror_obj['branch']).to be_nil
|
171
|
-
expect(mirror_obj['tag']).to eq('v1')
|
172
|
-
expect(mirror_obj['path']).to be_nil
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe 'from a revision in a git repository' do
|
177
|
-
before do
|
178
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
179
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
180
|
-
in_dir(@vendor_repository_dir) do
|
181
|
-
run_command('git tag v1')
|
182
|
-
@revision = run_command('git rev-parse HEAD').strip
|
183
|
-
end
|
184
|
-
|
185
|
-
in_dir(@repository_dir) do
|
186
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --revision #{@revision}")
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
it 'should add the files and commit' do
|
191
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/layouts/layout.liquid", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
192
|
-
|
193
|
-
in_dir(@repository_dir) do
|
194
|
-
assert_commit_subject(/Braid: Add mirror 'skit1' at '[0-9a-f]{7}'/)
|
195
|
-
assert_commit_author('Some body')
|
196
|
-
assert_commit_email('somebody@example.com')
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'should create .braids.json and add the mirror to it' do
|
201
|
-
braids = YAML::load_file("#{@repository_dir}/.braids.json")
|
202
|
-
expect(braids['config_version']).to be_kind_of(Numeric)
|
203
|
-
mirror_obj = braids['mirrors']['skit1']
|
204
|
-
expect(mirror_obj['url']).to eq(@vendor_repository_dir)
|
205
|
-
expect(mirror_obj['revision']).not_to be_nil
|
206
|
-
expect(mirror_obj['branch']).to be_nil
|
207
|
-
expect(mirror_obj['tag']).to be_nil
|
208
|
-
expect(mirror_obj['path']).to be_nil
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
describe 'with a git repository' do
|
213
|
-
before do
|
214
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
215
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
216
|
-
in_dir(@vendor_repository_dir) do
|
217
|
-
run_command('git tag v1')
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
it 'should generate an error if both tag and revision specified' do
|
222
|
-
output = nil
|
223
|
-
in_dir(@repository_dir) do
|
224
|
-
output = `#{BRAID_BIN} add #{@vendor_repository_dir} --revision X --tag v1`
|
225
|
-
end
|
226
|
-
|
227
|
-
expect(output).to match(/^Braid: Error: Can not add mirror specifying both a revision and a tag$/)
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
@@ -1,222 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/integration_helper'
|
2
|
-
|
3
|
-
describe 'Config versioning:' do
|
4
|
-
|
5
|
-
before do
|
6
|
-
FileUtils.rm_rf(TMP_PATH)
|
7
|
-
FileUtils.mkdir_p(TMP_PATH)
|
8
|
-
end
|
9
|
-
|
10
|
-
# Workaround for Braid writing .braids.json with LF line endings on Windows,
|
11
|
-
# while the .braids.json files in the fixtures get converted to CRLF under Git
|
12
|
-
# for Windows recommended settings.
|
13
|
-
# https://github.com/cristibalan/braid/issues/77
|
14
|
-
def assert_no_diff_in_braids(file1, file2)
|
15
|
-
# --ignore-trailing-space is not present in the platform diff command under osx so only use it when needed
|
16
|
-
assert_no_diff(file1, file2, Gem.win_platform? ? '--ignore-trailing-space' : '')
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'read-only command' do
|
20
|
-
|
21
|
-
it 'from future config version should fail' do
|
22
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-future')
|
23
|
-
|
24
|
-
in_dir(@repository_dir) do
|
25
|
-
output = run_command_expect_failure("#{BRAID_BIN} diff skit1")
|
26
|
-
expect(output).to match(/is too old to understand/)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'from old config version with no breaking changes should work' do
|
31
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-yaml')
|
32
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
33
|
-
|
34
|
-
vendor_revision = nil
|
35
|
-
in_dir(@vendor_repository_dir) do
|
36
|
-
vendor_revision = run_command('git rev-parse HEAD')
|
37
|
-
end
|
38
|
-
|
39
|
-
in_dir(@repository_dir) do
|
40
|
-
# For a real command to work, we have to substitute the URL and revision
|
41
|
-
# of the real vendor repository we created on this run of the test. The
|
42
|
-
# below looks marginally easier than using the real YAML parser.
|
43
|
-
braids_content = nil
|
44
|
-
File.open('.braids', 'rb') do |f|
|
45
|
-
braids_content = f.read
|
46
|
-
end
|
47
|
-
braids_content = braids_content.sub(/revision:.*$/, "revision: #{vendor_revision}")
|
48
|
-
braids_content = braids_content.sub(/url:.*$/, "url: file://#{@vendor_repository_dir}")
|
49
|
-
File.open('.braids', 'wb') do |f|
|
50
|
-
f.write braids_content
|
51
|
-
end
|
52
|
-
|
53
|
-
output = run_command("#{BRAID_BIN} diff skit1")
|
54
|
-
expect(output).to eq('') # no diff
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'from old config version with breaking changes should fail' do
|
59
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-breaking-changes')
|
60
|
-
|
61
|
-
in_dir(@repository_dir) do
|
62
|
-
output = run_command_expect_failure("#{BRAID_BIN} diff skit1")
|
63
|
-
expect(output).to match(/no longer supports a feature/)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
describe 'write command' do
|
70
|
-
|
71
|
-
it 'from future config version should fail' do
|
72
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-future')
|
73
|
-
|
74
|
-
in_dir(@repository_dir) do
|
75
|
-
output = run_command_expect_failure("#{BRAID_BIN} update skit1")
|
76
|
-
expect(output).to match(/is too old to understand/)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'from old config version with no breaking changes should fail' do
|
81
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-yaml')
|
82
|
-
|
83
|
-
in_dir(@repository_dir) do
|
84
|
-
output = run_command_expect_failure("#{BRAID_BIN} update skit1")
|
85
|
-
expect(output).to match(/force other developers on your project to upgrade Braid/)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'from old config version with breaking changes should fail' do
|
90
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-breaking-changes')
|
91
|
-
|
92
|
-
in_dir(@repository_dir) do
|
93
|
-
output = run_command_expect_failure("#{BRAID_BIN} update skit1")
|
94
|
-
expect(output).to match(/no longer supports a feature/)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '"braid upgrade-config"' do
|
101
|
-
|
102
|
-
it 'from Braid 0.7.1 (.braids YAML) should produce the expected configuration' do
|
103
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-yaml')
|
104
|
-
|
105
|
-
in_dir(@repository_dir) do
|
106
|
-
output = run_command("#{BRAID_BIN} upgrade-config")
|
107
|
-
# Check this on one of the test cases.
|
108
|
-
expect(output).to match(/Configuration upgrade complete\./)
|
109
|
-
expect(File.exists?('.braids')).to eq(false)
|
110
|
-
assert_no_diff_in_braids('.braids.json', 'expected.braids.json')
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'from Braid 1.0.0 (.braids JSON) should produce the expected configuration' do
|
115
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-json-old-name')
|
116
|
-
|
117
|
-
in_dir(@repository_dir) do
|
118
|
-
run_command("#{BRAID_BIN} upgrade-config")
|
119
|
-
expect(File.exists?('.braids')).to eq(false)
|
120
|
-
assert_no_diff_in_braids('.braids.json', 'expected.braids.json')
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'from Braid 1.0.9 (.braids.json) with old-style lock should produce the expected configuration' do
|
125
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-1.0.9-lock')
|
126
|
-
|
127
|
-
in_dir(@repository_dir) do
|
128
|
-
run_command("#{BRAID_BIN} upgrade-config")
|
129
|
-
assert_no_diff_in_braids('.braids.json', 'expected.braids.json')
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'from Braid 1.0.9 (.braids.json) with old-style lock with --dry-run should print info without performing the upgrade' do
|
134
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-1.0.9-lock')
|
135
|
-
|
136
|
-
in_dir(@repository_dir) do
|
137
|
-
output = run_command("#{BRAID_BIN} upgrade-config --dry-run")
|
138
|
-
expect(output).to match(/Your configuration file will be upgraded from configuration version 0 to 1\./)
|
139
|
-
expect(output).not_to match(/The following breaking changes/)
|
140
|
-
# Instructions should not include --allow-breaking-changes if it isn't necessary.
|
141
|
-
expect(output).to match(/Run 'braid upgrade-config'/)
|
142
|
-
assert_no_diff_in_braids('.braids.json', "#{FIXTURE_PATH}/shiny-conf-1.0.9-lock/.braids.json")
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'with breaking changes and --dry-run should print info without performing the upgrade' do
|
147
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-breaking-changes')
|
148
|
-
|
149
|
-
in_dir(@repository_dir) do
|
150
|
-
output = run_command("#{BRAID_BIN} upgrade-config --dry-run")
|
151
|
-
expect(output).to match(/The following breaking changes/)
|
152
|
-
expect(output).to match(/Spoon-Knife.*Subversion/)
|
153
|
-
expect(output).to match(/skit1.*full-history/)
|
154
|
-
expect(output).to match(/Run 'braid upgrade-config --allow-breaking-changes'/)
|
155
|
-
assert_no_diff('.braids', "#{FIXTURE_PATH}/shiny-conf-breaking-changes/.braids")
|
156
|
-
expect(File.exists?('.braids.json')).to eq(false)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'with breaking changes should fail' do
|
161
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-breaking-changes')
|
162
|
-
|
163
|
-
in_dir(@repository_dir) do
|
164
|
-
output = run_command_expect_failure("#{BRAID_BIN} upgrade-config")
|
165
|
-
expect(output).to match(/The following breaking changes/)
|
166
|
-
expect(output).to match(/Spoon-Knife.*Subversion/)
|
167
|
-
expect(output).to match(/skit1.*full-history/)
|
168
|
-
expect(output).to match(/You must pass --allow-breaking-changes/)
|
169
|
-
# `braid upgrade-config` should not have changed any files.
|
170
|
-
assert_no_diff('.braids', "#{FIXTURE_PATH}/shiny-conf-breaking-changes/.braids")
|
171
|
-
expect(File.exists?('.braids.json')).to eq(false)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'with breaking changes and --allow-breaking-changes should produce the expected configuration' do
|
176
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-breaking-changes')
|
177
|
-
|
178
|
-
in_dir(@repository_dir) do
|
179
|
-
output = run_command("#{BRAID_BIN} upgrade-config --allow-breaking-changes")
|
180
|
-
expect(output).to match(/The following breaking changes/)
|
181
|
-
expect(output).to match(/Spoon-Knife.*Subversion/)
|
182
|
-
expect(output).to match(/skit1.*full-history/)
|
183
|
-
expect(output).to match(/Configuration upgrade complete\./)
|
184
|
-
expect(File.exists?('.braids')).to eq(false)
|
185
|
-
assert_no_diff_in_braids('.braids.json', 'expected.braids.json')
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
it 'from future config version should fail' do
|
190
|
-
@repository_dir = create_git_repo_from_fixture('shiny-conf-future')
|
191
|
-
|
192
|
-
in_dir(@repository_dir) do
|
193
|
-
output = run_command_expect_failure("#{BRAID_BIN} upgrade-config")
|
194
|
-
expect(output).to match(/is too old to understand/)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
it 'from current config version should do nothing and print expected message' do
|
199
|
-
# Generate a current-version configuration by adding a mirror.
|
200
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
201
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
202
|
-
|
203
|
-
in_dir(@repository_dir) do
|
204
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir}")
|
205
|
-
output = run_command("#{BRAID_BIN} upgrade-config")
|
206
|
-
expect(output).to match(/already at the current configuration version/)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'with no Braid configuration should do nothing and print expected message' do
|
211
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
212
|
-
|
213
|
-
in_dir(@repository_dir) do
|
214
|
-
output = run_command("#{BRAID_BIN} upgrade-config")
|
215
|
-
expect(output).to match(/has no Braid configuration file/)
|
216
|
-
expect(File.exists?('.braids.json')).to eq(false)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
end
|